aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-01-05 08:05:50 -0500
committerRaghuram Subramani <raghus2247@gmail.com>2025-01-05 08:05:50 -0500
commit75609c32bc1eabefd878563df7a2e088c8c2976c (patch)
tree0b4f67c08e625933f36a6282ed0ef41cfe0f3042
parentda67bfc9723f8c70b0840ff14c77bbf4444bdaa5 (diff)
kernel: gdt: Use macro for packed attribute
-rw-r--r--kernel/include/boot/gdt.h6
-rw-r--r--kernel/include/common.h1
2 files changed, 5 insertions, 2 deletions
diff --git a/kernel/include/boot/gdt.h b/kernel/include/boot/gdt.h
index 316c359..a32bce6 100644
--- a/kernel/include/boot/gdt.h
+++ b/kernel/include/boot/gdt.h
@@ -21,6 +21,8 @@
#include <stdint.h>
+#include <common.h>
+
/* Access Flags:
* 7 PRESENT
* 6 PRIVILEGE
@@ -93,12 +95,12 @@ typedef struct {
uint8_t access_flags;
uint8_t flags_limit_high;
uint8_t base_high;
-} __attribute__((packed)) GDT_entry;
+} PACKED GDT_entry;
typedef struct {
uint16_t limit; /* sizeof(GDT) - 1 */
GDT_entry *ptr; /* Address of GDT */
-} __attribute__((packed)) GDT_descriptor;
+} PACKED GDT_descriptor;
extern void _GDT_flush(GDT_descriptor *);
void GDT_load(void);
diff --git a/kernel/include/common.h b/kernel/include/common.h
index cd60fdf..c0f34b5 100644
--- a/kernel/include/common.h
+++ b/kernel/include/common.h
@@ -20,6 +20,7 @@
#define __common_h
#define ALWAYS_INLINE __attribute__((always_inline)) inline
+#define PACKED __attribute__((packed))
#define KiB 1024
#define MiB (KiB * KiB)