[SeaBIOS] [PATCH] pmm: Fix entry point to support non-zero %ss

Kevin O'Connor kevin at koconnor.net
Tue Sep 30 15:42:17 CEST 2014


If the pmm entry point was called with a non-zero stack segment, the
pointer to the arguments on the stack would not be valid once the
code transitioned to 32bit mode.  Fix by adding the stack segment
offset into the args pointer.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/romlayout.S | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/romlayout.S b/src/romlayout.S
index a3ba965..028d1e8 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -321,10 +321,11 @@ entry_pmm:
         pushl %edx
         pushw %es
         pushw %ds
-        movw %ss, %cx           // Move %ss to %ds
+        movl %ss, %ecx          // Move %ss to %ds
         movw %cx, %ds
+        shll $4, %ecx
         movl $_cfunc32flat_handle_pmm, %eax // Setup: call32(handle_pmm, args, -1)
-        leal 28(%esp), %edx     // %edx points to start of args
+        leal 28(%esp, %ecx), %edx       // %edx points to start of args
         movl $-1, %ecx
         calll call32
         movw %ax, 12(%esp)      // Modify %ax:%dx to return %eax
-- 
1.9.3




More information about the SeaBIOS mailing list