aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-07-04 12:31:50 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-07-04 12:31:50 -0400
commit13213a252286372efa5f72b4119faafd5dff5db1 (patch)
treec138c6de855a834ee9bad360e006643b5276c08f
parentb303687deb4b56a9c187d74ec1869326683da464 (diff)
downloadseabios-13213a252286372efa5f72b4119faafd5dff5db1.tar.gz
seabios-13213a252286372efa5f72b4119faafd5dff5db1.tar.xz
seabios-13213a252286372efa5f72b4119faafd5dff5db1.zip
vgabios: Simplify set_cursor_pos()
Rework set_cursor_pos() to be slightly simpler. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--vgasrc/vgabios.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index 2593e03..cfb6ba2 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -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