summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown2006-06-06 17:30:28 +0200
committerMichael Brown2006-06-06 17:30:28 +0200
commite7eca7b7cbd3354916145c36ca88e9e754ef8812 (patch)
treeccb17d4271862fb936983634df73cdebee592be8 /src/arch
parentCalculate _rom_size for the ROM prefix (diff)
downloadipxe-e7eca7b7cbd3354916145c36ca88e9e754ef8812.tar.gz
ipxe-e7eca7b7cbd3354916145c36ca88e9e754ef8812.tar.xz
ipxe-e7eca7b7cbd3354916145c36ca88e9e754ef8812.zip
Code segment may not be writable; create the temporary pointer to the GDT
on the stack.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/prefix/libprefix.S9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/arch/i386/prefix/libprefix.S b/src/arch/i386/prefix/libprefix.S
index 10227818c..f0f7682b5 100644
--- a/src/arch/i386/prefix/libprefix.S
+++ b/src/arch/i386/prefix/libprefix.S
@@ -254,6 +254,7 @@ flatten_real_mode:
/* Preserve real-mode segment values and temporary registers */
pushw %es
pushw %ds
+ pushw %bp
pushl %eax
/* Set GDT base and load GDT */
@@ -261,8 +262,11 @@ flatten_real_mode:
movw %cs, %ax
shll $4, %eax
addl $gdt, %eax
- movl %eax, %cs:gdt_base
- lgdt %cs:gdt
+ pushl %eax
+ pushw %cs:gdt_limit
+ movw %sp, %bp
+ lgdt (%bp)
+ addw $6, %sp
/* Switch to protected mode */
movl %cr0, %eax
@@ -281,6 +285,7 @@ flatten_real_mode:
/* Restore real-mode segment values and temporary registers */
popl %eax
+ popw %bp
popw %ds
popw %es
ret