From 99ee9de277063ced53fc7c4a396aeaf8ceab16bd Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Tue, 19 Sep 2006 00:25:04 +0000 Subject: 2006-09-19 Samuel Thibault Fix against gcc 4.1's optimizations. * i386/i386/seg.h (struct pseudo_descriptor): Pack structure and move the padding field to the end. (lgdt): Pass the whole structure to the lgdt assembly command. (lidt): Likewise. --- i386/i386/seg.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'i386') diff --git a/i386/i386/seg.h b/i386/i386/seg.h index a71611d..d95bff9 100644 --- a/i386/i386/seg.h +++ b/i386/i386/seg.h @@ -121,20 +121,20 @@ struct real_gate { /* Format of a "pseudo-descriptor", used for loading the IDT and GDT. */ struct pseudo_descriptor { - short pad; unsigned short limit; unsigned long linear_base; -}; + short pad; +} __attribute__((packed)); /* Load the processor's IDT, GDT, or LDT pointers. */ MACH_INLINE void lgdt(struct pseudo_descriptor *pdesc) { - __asm volatile("lgdt %0" : : "m" (pdesc->limit)); + __asm volatile("lgdt %0" : : "m" (*pdesc)); } MACH_INLINE void lidt(struct pseudo_descriptor *pdesc) { - __asm volatile("lidt %0" : : "m" (pdesc->limit)); + __asm volatile("lidt %0" : : "m" (*pdesc)); } MACH_INLINE void lldt(unsigned short ldt_selector) { -- cgit v1.2.3