]> xenbits.xensource.com Git - seabios.git/commitdiff
Clear irqs in transition32 instead of callers.
authorKevin O'Connor <kevin@koconnor.net>
Mon, 13 Apr 2009 23:30:27 +0000 (19:30 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 13 Apr 2009 23:30:27 +0000 (19:30 -0400)
This moves the irq clear into transition32.
Also, disable nmi before loading gdt - this prevents a race with an nmi.

src/romlayout.S
src/util.c

index 7ca0c432ec904652abc0a4f14ad50571002b528f..75769c2f83103c88db2ed25c99de717274aaf7b4 100644 (file)
 
 // Place CPU into 32bit mode from 16bit mode.
 // Clobbers: flags, segment registers, cr0, idt/gdt
-// Require: interrupts must be disabled
         DECLFUNC transition32
 transition32:
         pushl %eax
 
+        // Disable irqs (and clear direction flag)
+        cli
+        cld
+
+        // Disable nmi
+        movl $CMOS_RESET_CODE|NMI_DISABLE_BIT, %eax
+        outb %al, $PORT_CMOS_INDEX
+        inb $PORT_CMOS_DATA, %al
+
         // enable a20
         inb $PORT_A20, %al
         orb $A20_ENABLE_BIT, %al
@@ -143,11 +151,6 @@ transition32:
         lidtw %cs:pmode_IDT_info
         lgdtw %cs:rombios32_gdt_48
 
-        // Disable nmi
-        movl $CMOS_RESET_CODE|NMI_DISABLE_BIT, %eax
-        outb %al, $PORT_CMOS_INDEX
-        inb $PORT_CMOS_DATA, %al
-
         // Enable protected mode
         movl %cr0, %eax
         orl $CR0_PE, %eax
@@ -288,9 +291,6 @@ __call16:
         popl %eax
         popl %ebp
 
-        cli
-        cld
-
         retl
 
 // IRQ trampolines
@@ -480,14 +480,10 @@ post32:
         // int 18/19 are special - they reset stack and call into 32bit mode.
         DECLFUNC entry_19
 entry_19:
-        cli
-        cld
         ENTRY_INTO32 _code32_handle_19
 
         DECLFUNC entry_18
 entry_18:
-        cli
-        cld
         ENTRY_INTO32 _code32_handle_18
 
 
index df0e9939b3ebb15b590bc7d79b750ffe31f8f154..ceceed828c35f44a67e47ab0e05206d77974dab1 100644 (file)
@@ -17,6 +17,8 @@ call16(struct bregs *callregs)
     asm volatile(
 #if MODE16 == 1
         "calll __call16\n"
+        "cli\n"
+        "cld\n"
 #else
         "calll __call16_from32\n"
 #endif