[coreboot] [v3] r1172 - coreboot-v3/util/x86emu

svn at coreboot.org svn at coreboot.org
Tue Jun 9 13:14:27 CEST 2009


Author: rminnich
Date: 2009-06-09 13:14:26 +0200 (Tue, 09 Jun 2009)
New Revision: 1172

Modified:
   coreboot-v3/util/x86emu/x86_asm.S
Log:
There are some problems with the way these interrrupts were 
managed. First, the CLI erases any knowledge of whether interrupts 
were enabled or disabled. Second, the STI works badly on qemu; we 
get an immediate INT #0 as soon as the STI happens.

This spurious interrupt doesn't happen on real hardware (YET!)but, 
that said, I don't think this code should be doing cli and sti. I 
can't see a reason to enable interrupts at this point in coreboot.

This change fixes the observed qemu failures.

Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
Acked-by: Stefan Reinauer <stepan at coresystems.de>



Modified: coreboot-v3/util/x86emu/x86_asm.S
===================================================================
--- coreboot-v3/util/x86emu/x86_asm.S	2009-06-07 17:36:43 UTC (rev 1171)
+++ coreboot-v3/util/x86emu/x86_asm.S	2009-06-09 11:14:26 UTC (rev 1172)
@@ -71,11 +71,6 @@
 	// FIXME: Should this function be called with regparm=0?
 	movl    8(%ebp), %ecx
 
-	/* Clear interrupts before making a
-	 * transition to Real Mode
-	 */
-	cli
-
 	/* Activate the right segment descriptor real mode. */
 	ljmp	$0x28, $RELOCATED(1f)
 1:
@@ -111,14 +106,11 @@
 	movl	$0x1000, %eax
 	movl	%eax, %esp
 
-	/* Load our 16 it idt */
+	/* Load our 16 bit idt */
 	xor	%ax, %ax
 	mov	%ax, %ds
 	lidt	__realmode_idt
 
-	/* All critical work is done, allow interrupts again */
-	sti
-
 	/* Set all segments to 0x0000, ds to 0x0040 */
 	mov	%ax, %es       
 	mov	%ax, %fs       
@@ -133,11 +125,6 @@
 	lcall	$0xc000, $0x0003
 	/* ************************************ */
 
-	/* Clear interrupts before making a 
-	 * transition to Protected Mode
-	 */
-	cli
-
 	/* If we got here, just about done.
 	 * Need to get back to protected mode
 	 */
@@ -161,9 +148,6 @@
 	/* restore proper idt */
 	lidt	idtarg
 
-	/* All critical work is done, allow interrupts again */
-	sti
-
 	/* and exit */
 	mov	__stack, %esp
 	popal
@@ -179,11 +163,6 @@
 	mov	%esp, __stack
 
 
-	/* Clear interrupts before making a 
-	 * transition to Real Mode
-	 */
-	cli
-
 	/*  This configures CS properly for real mode. */
 	ljmp 	$0x28, $RELOCATED(1f)
 1:
@@ -228,9 +207,6 @@
 	mov	%ax, %ds
 	lidt	__realmode_idt
 
-	/* All critical work is done, allow interrupts again */
-	sti
-
 	/* Set all segments to 0x0000 */
 	mov	%ax, %ds
 	mov	%ax, %es
@@ -250,11 +226,6 @@
 	movw	$0, %di
 	int	$0x10
 
-	/* Clear interrupts before making a 
-	 * transition to Protected Mode
-	 */
-	cli
-
 	/* Ok, the job is done, now go back to protected mode coreboot */
 	movl	%cr0, %eax
 	orl	$PE, %eax
@@ -274,9 +245,6 @@
 	/* restore coreboot's 32-bit IDT */
 	lidt	idtarg
 
-	/* All critical work is done, allow interrupts again */
-	sti
-
 	/* Exit */
 	mov	__stack, %esp
 	popal
@@ -299,11 +267,6 @@
 	andl	$0xff, %eax
 	pushl	%eax		/* ... and make it the first parameter */
 
-	/* Clear interrupts before making a 
-	 * transition to Protected Mode
-	 */
-	cli
-
 	/* Switch to protected mode */
 	movl    %cr0, %eax
 	orl	$PE, %eax
@@ -322,9 +285,6 @@
 
 	lidt	idtarg
 
-	/* All critical work is done, allow interrupts again */
-	sti
-
 	/* Call the C interrupt handler */
 	movl	$interrupt_handler, %eax
 	call	*%eax
@@ -344,11 +304,6 @@
 	mov	%ax, %gs
 	mov	%ax, %ss
 
-	/* Clear interrupts before making a 
-	 * transition to Real Mode
-	 */
-	cli
-
 	/* Disable Protected Mode */
 	movl	%cr0, %eax
 	andl	$~PE, %eax
@@ -366,9 +321,6 @@
 	mov	%ax, %ds
 	lidt	__realmode_idt
 
-	/* All critical work is done, allow interrupts again */
-	sti
-
 	/* Set up our segment registers to segment 0x0000 */
 	mov	%ax, %es
 	mov	%ax, %fs





More information about the coreboot mailing list