[SeaBIOS] [PATCH 1/4] Don't clobber %ax on ENTRY_INTO32 macro

Kevin O'Connor kevin at koconnor.net
Tue Oct 21 20:53:42 CEST 2014


There's no need to clobber %ax in ENTRY_INTO32.  Now that %eax isn't
clobbered, use ENTRY_INTO32 in entry_csm.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/entryfuncs.S |  5 ++---
 src/romlayout.S  | 10 ++--------
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/entryfuncs.S b/src/entryfuncs.S
index 679b1fc..8438604 100644
--- a/src/entryfuncs.S
+++ b/src/entryfuncs.S
@@ -135,10 +135,9 @@
         .endm
 
         // Reset stack, transition to 32bit mode, and call a C function.
-        // Clobbers %ax
         .macro ENTRY_INTO32 cfunc
-        xorw %ax, %ax
-        movw %ax, %ss
+        xorw %dx, %dx
+        movw %dx, %ss
         movl $ BUILD_STACK_ADDR , %esp
         movl $ \cfunc , %edx
         jmp transition32
diff --git a/src/romlayout.S b/src/romlayout.S
index cca4e43..4ebbdee 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -431,14 +431,8 @@ entry_csm:
         shll $4, %eax
         addl %esp, %eax
 
-        // Change to BUILD_STACK_ADDR stack
-        xorl %ebx, %ebx
-        movw %bx, %ss
-        movl $BUILD_STACK_ADDR, %esp
-
-        // Jump to 32bit mode and call handle_csm(bregs)
-        movl $_cfunc32flat_handle_csm, %edx
-        jmp transition32
+        // Change to BUILD_STACK_ADDR stack and call handle_csm(bregs)
+        ENTRY_INTO32 _cfunc32flat_handle_csm
 
         DECLFUNC __csm_return
         .code32
-- 
1.9.3




More information about the SeaBIOS mailing list