]> xenbits.xensource.com Git - seabios.git/commitdiff
vgabios: PMM scan was incorrectly depending on a zero %ds segment.
authorKevin O'Connor <kevin@koconnor.net>
Sun, 6 Apr 2014 22:48:39 +0000 (18:48 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 11 Apr 2014 15:26:23 +0000 (11:26 -0400)
Make sure the PMM scanning code uses the GET_FARVAR macro.  (The
existing code only worked because SeaBIOS happens to call the vgabios
in bigreal mode with %ds == %ss = 0.)  Also, the scan doesn't require
bigreal mode - use accesses relative to the SEG_BIOS segment so that
the scan can work in regular real mode.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
vgasrc/vgainit.c

index 33b8eb9bf0aef5565c9f7f12a8b663cd377bc005..6d9a224db1fa7a019d662ca9b2d47455ef5f5607 100644 (file)
@@ -60,14 +60,14 @@ allocate_extra_stack(void)
 {
     if (!CONFIG_VGA_ALLOCATE_EXTRA_STACK)
         return;
-    void *pmmscan = (void*)BUILD_BIOS_ADDR;
-    for (; pmmscan < (void*)BUILD_BIOS_ADDR+BUILD_BIOS_SIZE; pmmscan+=16) {
-        struct pmmheader *pmm = pmmscan;
-        if (pmm->signature != PMM_SIGNATURE)
+    u32 pmmscan;
+    for (pmmscan=0; pmmscan < BUILD_BIOS_SIZE; pmmscan+=16) {
+        struct pmmheader *pmm = (void*)pmmscan;
+        if (GET_FARVAR(SEG_BIOS, pmm->signature) != PMM_SIGNATURE)
             continue;
-        if (checksum_far(0, pmm, pmm->length))
+        if (checksum_far(SEG_BIOS, pmm, GET_FARVAR(SEG_BIOS, pmm->length)))
             continue;
-        struct segoff_s entry = pmm->entry;
+        struct segoff_s entry = GET_FARVAR(SEG_BIOS, pmm->entry);
         dprintf(1, "Attempting to allocate VGA stack via pmm call to %04x:%04x\n"
                 , entry.seg, entry.offset);
         u16 res1, res2;