From: Ben Gras Date: Sun, 15 Apr 2012 18:39:36 +0000 (+0200) Subject: kernel: align gdt and idt base addresses X-Git-Tag: v3.2.1~587 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.host.html?a=commitdiff_plain;h=927b9ef243e7325d266a92a81d97b4762d282437;p=minix.git 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. --- 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