diff mbox

[RFC,v3,0/3] Add segment limit checks to emulator

Message ID 20100724161630.GA15361@morn.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Kevin O'Connor July 24, 2010, 4:16 p.m. UTC
None
diff mbox

Patch

diff --git a/src/misc.c b/src/misc.c
index 354df87..108c332 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -156,8 +156,8 @@  u64 rombios32_gdt[] VAR16VISIBLE __aligned(8) = {
     GDT_LIMIT(BUILD_BIOS_SIZE-1) | GDT_CODE | GDT_BASE(BUILD_BIOS_ADDR),
     // 16 bit data segment base=0x0 limit=0xffff (SEG32_MODE16_DS)
     GDT_LIMIT(0x0ffff) | GDT_DATA,
-    // 16 bit code segment base=0 limit=0xffffffff (SEG32_MODE16BIG_CS)
-    GDT_LIMIT(0xfffff) | GDT_CODE | GDT_G,
+    // 16 bit code segment base=0xf0000 limit=0xffffffff (SEG32_MODE16BIG_CS)
+    GDT_LIMIT(0xfffff) | GDT_CODE | GDT_G | GDT_BASE(BUILD_BIOS_ADDR),
     // 16 bit data segment base=0 limit=0xffffffff (SEG32_MODE16BIG_DS)
     GDT_LIMIT(0xfffff) | GDT_DATA | GDT_G,
 };
diff --git a/src/romlayout.S b/src/romlayout.S
index 54e5a4d..a469596 100644
--- a/src/romlayout.S
+++ b/src/romlayout.S
@@ -105,7 +105,7 @@  transition16big:
         movw %ax, %fs
         movw %ax, %gs
 
-        ljmpl $SEG32_MODE16BIG_CS, $(BUILD_BIOS_ADDR + 1f)
+        ljmpw $SEG32_MODE16BIG_CS, $1f
 
         .code16gcc
 1: