]> xenbits.xensource.com Git - seabios.git/commitdiff
vgabios: Simplify set_cursor_pos()
authorKevin O'Connor <kevin@koconnor.net>
Mon, 4 Jul 2016 16:31:50 +0000 (12:31 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 4 Jul 2016 16:31:50 +0000 (12:31 -0400)
Rework set_cursor_pos() to be slightly simpler.

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

index 2593e037a2a8aa01b800fccff8846dcb405ddc26..cfb6ba25e243957509a91b6c3d88ade9f4884545 100644 (file)
@@ -83,27 +83,19 @@ set_cursor_shape(u16 cursor_type)
 static void
 set_cursor_pos(struct cursorpos cp)
 {
-    u8 page = cp.page, x = cp.x, y = cp.y;
-
-    // Should not happen...
-    if (page > 7)
+    if (cp.page > 7)
+        // Should not happen...
         return;
 
-    vgafb_set_swcursor(0);
-
-    // Bios cursor pos
-    SET_BDA(cursor_pos[page], (y << 8) | x);
-
-    if (!CONFIG_VGA_STDVGA_PORTS)
-        return;
-
-    // Set the hardware cursor
-    u8 current = GET_BDA(video_page);
-    if (cp.page != current)
-        return;
+    if (cp.page == GET_BDA(video_page)) {
+        // Update cursor in hardware
+        vgafb_set_swcursor(0);
+        if (CONFIG_VGA_STDVGA_PORTS)
+            stdvga_set_cursor_pos((int)text_address(cp));
+    }
 
-    // Calculate the memory address
-    stdvga_set_cursor_pos((int)text_address(cp));
+    // Update BIOS cursor pos
+    SET_BDA(cursor_pos[cp.page], (cp.y << 8) | cp.x);
 }
 
 struct cursorpos