:: commit c89644b3d142c44494e4d2b6651235b9b87e136d

mintsuki <mintsuki@protonmail.com> — 2021-03-20 12:07

parents: 2dc49ee73b

edid: Properly get segment:offset from flat address

diff --git a/stage23/drivers/edid.c b/stage23/drivers/edid.c
index 62fd23c8..27b29617 100644
--- a/stage23/drivers/edid.c
+++ b/stage23/drivers/edid.c
@@ -17,7 +17,9 @@ struct edid_info_struct *get_edid_info(void) {
 
     r.eax = 0x4f15;
     r.ebx = 0x0001;
-    r.edi = (uint32_t)buf;
+    r.edi = (uint32_t)rm_off(buf);
+    r.ds  = (uint32_t)rm_seg(buf);
+    r.es  = r.ds;
     rm_int(0x10, &r, &r);
 
     if ((r.eax & 0x00ff) != 0x4f)
diff --git a/stage23/drivers/gop.c b/stage23/drivers/gop.c
index 6ed3a53d..2f574f91 100644
--- a/stage23/drivers/gop.c
+++ b/stage23/drivers/gop.c
@@ -164,10 +164,10 @@ bool init_gop(struct fb_info *ret,
                 target_bpp    = 32;
                 print("gop: EDID detected screen resolution of %ux%u\n",
                       target_width, target_height);
+                goto retry;
             }
-        } else {
-            goto fallback;
         }
+        goto fallback;
     } else {
         print("gop: Requested resolution of %ux%ux%u\n",
               target_width, target_height, target_bpp);
diff --git a/stage23/drivers/vbe.c b/stage23/drivers/vbe.c
index a6707128..6876c652 100644
--- a/stage23/drivers/vbe.c
+++ b/stage23/drivers/vbe.c
@@ -152,10 +152,10 @@ bool init_vbe(struct fb_info *ret,
                 target_bpp    = 32;
                 print("vbe: EDID detected screen resolution of %ux%u\n",
                       target_width, target_height);
+                goto retry;
             }
-        } else {
-            goto fallback;
         }
+        goto fallback;
     } else {
         print("vbe: Requested resolution of %ux%ux%u\n",
               target_width, target_height, target_bpp);
tab: 248 wrap: offon