From 927b9ef243e7325d266a92a81d97b4762d282437 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Sun, 15 Apr 2012 20:39:36 +0200 Subject: [PATCH] kernel: align gdt and idt base addresses patch my fdmanana: As recommended by the Intel 64 and IA-32 Architectures Developer's Manual Volume 3A, the GDT and IDT base addresses should be aligned on an 8 byte boundary to yield better processor performance. --- kernel/arch/i386/protect.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/arch/i386/protect.c b/kernel/arch/i386/protect.c index c6056a9ce..4c5949d0a 100644 --- a/kernel/arch/i386/protect.c +++ b/kernel/arch/i386/protect.c @@ -25,7 +25,9 @@ struct gatedesc_s { u16_t offset_high; }; -struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */ + +/* used in klib.s and mpx.s */ +struct segdesc_s gdt[GDT_SIZE] __aligned(DESC_SIZE) = { {0}, {0,0,0,0}, /* GDT descriptor */ {0,0,0,0}, /* IDT descriptor */ @@ -35,7 +37,9 @@ struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */ {0xffff,0,0,0x9b,0xcf,0}, /* kernel CS */ {0xffff,0,0,0x9b,0xcf,0}, /* temp for BIOS (386: monitor CS at startup) */ }; -static struct gatedesc_s idt[IDT_SIZE]; /* zero-init so none present */ + +/* zero-init so none present */ +static struct gatedesc_s idt[IDT_SIZE] __aligned(DESC_SIZE); struct tss_s tss[CONFIG_MAX_CPUS]; /* zero init */ static void sdesc(struct segdesc_s *segdp, phys_bytes base, vir_bytes -- 2.44.0