Skip to contentSkip to conversation

Fix 32bit gateway and TCG extensions and some cleanup

PATCH New Stefan Berger 1 participant 1 message Mar 14, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix 32bit gateway and TCG extensions and some cleanup

This patch does the following:

- Add a missing break into the switch statement
- Simplify the code that switches from protected mode into real mode by letting it spill eax; this also fixes the case where the stack is above 0xffff.
- reformat the source for 80 columns
- remove some comments that were relevant when the TCG extensions were direct part of the real-mode Bochs BIOS

xen-unstable.hg/tools/firmware/rombios/tcgbios.c +4 -0
Index: root/xen-unstable.hg/tools/firmware/rombios/tcgbios.c
===================================================================
@@ -228,6 +228,8 @@ int1a_function32(regs, ES, DS, FLAGS)
 {
 	Bit16u rc;
 
+	BX_DEBUG_INT1A("int1a_32: AX=%04x\n", regs.u.r16.ax);
+
 	switch (regs.u.r8.ah) {
 	case 0xbb:
 		/*
@@ -256,8 +258,10 @@ int1a_function32(regs, ES, DS, FLAGS)
 		default:
 			SET_CF();
 		}
+		break;
 	default:
 		SET_CF();
 		break;
 	}
+	BX_DEBUG_INT1A("int1a_32: FLAGS=%04x\n", FLAGS);
 }
xen-unstable.hg/tools/firmware/rombios/32bitgateway.c +9 -20
Index: root/xen-unstable.hg/tools/firmware/rombios/32bitgateway.c
===================================================================
@@ -153,26 +153,17 @@ realmode_gdtdesc:				;to be used in real
 
 switch_to_realmode:
     ; Implementation of switching from protected mode to real mode
-    ; restores all registers and prepares cs, es, ds, ss to be used
-    ; in real mode
+    ; prepares cs, es, ds, ss to be used in real mode
+    ; spills   eax
     START_PM_CODE
 
     ; need to fix up the stack to return in 16 bit mode
     ; currently the 32 bit return address is on the stack
-    push bp					;pop@A1
-    mov bp, sp
-    push eax					;pop@X
-
-    mov eax, [bp]				; return address low 16bits
-                  				; and 'bp' are being moved
-    mov 2[bp], eax
-
-    pop eax					;@X
-    add sp, #2					; adjust stack for 'lost' bytes
-
-    push eax					;pop@1
-    push bx					;pop@2
-    push si					;pop@3
+    pop eax
+    push ax
+
+    push bx					;pop@1
+    push si					;pop@2
 
     call _ebda_ss_offset32			; get the offset of the ss
     mov bx, ax					; entry within the ebda.
@@ -229,10 +220,8 @@ switch_to_realmode_goon_2:
 
     sti						; allow interrupts
 
-    pop si					;@3
-    pop bx					;@2
-    pop eax					;@1
-    pop bp					;@A1
+    pop si					;@2
+    pop bx					;@1
 
     ret
 
xen-unstable.hg/tools/firmware/rombios/32bit/tcgbios/tcgbios.c +24 -40

166 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel