summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown2012-07-10 23:07:34 +0200
committerMichael Brown2015-04-20 22:30:12 +0200
commitdd0fe7a86278813fbf3c637aaf4ccf8d4ce678df (patch)
tree1de823e5bc2c04fadefb317aa830209de4ff6514
parent[setup] Make setup.S position-independent code (diff)
downloadmemtest86-dd0fe7a86278813fbf3c637aaf4ccf8d4ce678df.tar.gz
memtest86-dd0fe7a86278813fbf3c637aaf4ccf8d4ce678df.tar.xz
memtest86-dd0fe7a86278813fbf3c637aaf4ccf8d4ce678df.zip
[setup] Preserve real-mode stack during mode transition
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--setup.S4
1 files changed, 4 insertions, 0 deletions
diff --git a/setup.S b/setup.S
index 9ae578f..2fe3d2d 100644
--- a/setup.S
+++ b/setup.S
@@ -73,6 +73,9 @@ alt_a20_done:
* Note that the short jump isn't strictly needed, althought there are
* reasons why it might be a good idea. It won't hurt in any case.
*/
+ xorl %ebx, %ebx
+ movw %ss, %bx
+ shll $4, %ebx
movw $0x0001, %ax # protected mode (PE) bit
lmsw %ax # This is it#
jmp flush_instr
@@ -81,6 +84,7 @@ flush_instr:
movw %ax, %ds
movw %ax, %es
movw %ax, %ss
+ addl %ebx, %esp
movw %ax, %fs
movw %ax, %gs