]> xenbits.xensource.com Git - seabios.git/commitdiff
If an int 1587 call is made from an option rom, stay in bigreal mode.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 19 Apr 2014 16:22:22 +0000 (12:22 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Tue, 6 May 2014 16:10:36 +0000 (12:10 -0400)
Modify the int 1587 handler to check if the POST phase is still
running.  If it is, use bigreal mode segment limits so that the caller
remains in bigreal mode when the 1587 handler completes.  This helps
with SeaVGABIOS' use of "direct" framebuffer accesses (an option rom
may attempt to display text during its option rom execution which can
cause SeaVGABIOS to make the int 1587 calls).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/misc.c
src/post.c
src/resume.c
src/system.c
src/util.h

index 191e7070569c38191c15e78457c81278292c00e8..67123557b0f89e5a9fb48d3a6102943126413cbe 100644 (file)
 
 #define PORT_MATH_CLEAR        0x00f0
 
+// Indicator if POST phase has been started (and if it has completed).
+int HaveRunPost VARFSEG;
+
+int
+in_post(void)
+{
+    return GET_GLOBAL(HaveRunPost) == 1;
+}
+
 
 /****************************************************************
  * Misc 16bit ISRs
index 5fc196806bbe5167b18af50506d1d42c2320dea8..0d9e66f6055b6ad84054dd3bff74547c97159400 100644 (file)
@@ -185,6 +185,8 @@ prepareboot(void)
     malloc_prepboot();
     memmap_prepboot();
 
+    HaveRunPost = 2;
+
     // Setup bios checksum.
     BiosChecksum -= checksum((u8*)BUILD_BIOS_ADDR, BUILD_BIOS_SIZE);
 }
index e2ceef14741ff582ec399ec13a60bd0e743101f7..19031747c28aed1a4e7635bb71eabe79effbc512 100644 (file)
@@ -17,9 +17,6 @@
 #include "string.h" // memset
 #include "util.h" // dma_setup
 
-// Indicator if POST phase has been run.
-int HaveRunPost VARFSEG;
-
 // Handler for post calls that look like a resume.
 void VISIBLE16
 handle_resume(void)
index 5d10cc8e8e867e48dd1f2d66a55f4ca3ca3355a0..3cb2228f520d572551a203fa8d101a44484aa0d0 100644 (file)
@@ -115,12 +115,13 @@ handle_1587(struct bregs *regs)
     SET_FARVAR(gdt_seg, gdt_far[1], GDT_DATA | GDT_LIMIT((6*sizeof(u64))-1)
                | GDT_BASE(loc));
     // Initialize CS descriptor
-    SET_FARVAR(gdt_seg, gdt_far[4], GDT_CODE | GDT_LIMIT(BUILD_BIOS_SIZE-1)
-               | GDT_BASE(BUILD_BIOS_ADDR));
+    u64 lim = GDT_LIMIT(0x0ffff);
+    if (in_post())
+        lim = GDT_GRANLIMIT(0xffffffff);
+    SET_FARVAR(gdt_seg, gdt_far[4], GDT_CODE | lim | GDT_BASE(BUILD_BIOS_ADDR));
     // Initialize SS descriptor
     loc = (u32)MAKE_FLATPTR(GET_SEG(SS), 0);
-    SET_FARVAR(gdt_seg, gdt_far[5], GDT_DATA | GDT_LIMIT(0x0ffff)
-               | GDT_BASE(loc));
+    SET_FARVAR(gdt_seg, gdt_far[5], GDT_DATA | lim | GDT_BASE(loc));
 
     u16 count = regs->cx;
     asm volatile(
index 9557581b159d4ffa9b044d554f4c55f501ff13df..0cbea485857cd179dcf9534a0f3a1622e5872346 100644 (file)
@@ -178,6 +178,7 @@ void process_key(u8 key);
 // misc.c
 extern struct bios_config_table_s BIOS_CONFIG_TABLE __aligned(1);
 extern u8 BiosChecksum;
+int in_post(void);
 void mathcp_setup(void);
 
 // mouse.c