Add stub function vgafb_set_swcursor(), and add calls to it any place that may read/write the framebuffer or may modify the cursor shape/position.
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- vgasrc/vgabios.c | 38 +++++++++++++++++++++++++++++++++----- vgasrc/vgabios.h | 1 + vgasrc/vgafb.c | 5 +++++ 3 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index 8ec6aa6..85a060e 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -56,9 +56,13 @@ set_cursor_shape(u8 start, u8 end) start &= 0x3f; end &= 0x1f;
+ vgafb_set_swcursor(0); + u16 curs = (start << 8) + end; SET_BDA(cursor_type, curs);
+ vgafb_set_swcursor(1); + if (!CONFIG_VGA_STDVGA_PORTS) return;
@@ -134,6 +138,8 @@ set_active_page(u8 page) if (!vmode_g) return;
+ vgafb_set_swcursor(0); + // Calculate memory address of start of page struct cursorpos cp = {0, 0, page}; int address = (int)text_address(cp); @@ -147,6 +153,8 @@ set_active_page(u8 page)
// Display the cursor, now the page is active set_cursor_pos(get_cursor_pos(page)); + + vgafb_set_swcursor(1); }
static void @@ -287,9 +295,13 @@ vga_set_mode(int mode, int flags) if (!vmode_g) return VBE_RETURN_STATUS_FAILED;
+ vgafb_set_swcursor(0); + int ret = vgahw_set_mode(vmode_g, flags); - if (ret) + if (ret) { + vgafb_set_swcursor(1); return ret; + }
// Set the BIOS mem int width = GET_GLOBAL(vmode_g->width); @@ -348,6 +360,7 @@ vga_set_mode(int mode, int flags) break; }
+ vgafb_set_swcursor(1); return 0; }
@@ -386,7 +399,9 @@ static void handle_1002(struct bregs *regs) { struct cursorpos cp = {regs->dl, regs->dh, regs->bh}; + vgafb_set_swcursor(0); set_cursor_pos(cp); + vgafb_set_swcursor(1); }
static void @@ -426,6 +441,7 @@ verify_scroll(struct bregs *regs, int dir) if (wincols <= 0 || winrows <= 0) return;
+ vgafb_set_swcursor(0); u8 page = GET_BDA(video_page); int clearlines = regs->al, movelines = winrows - clearlines; if (!clearlines || movelines <= 0) { @@ -434,10 +450,7 @@ verify_scroll(struct bregs *regs, int dir) struct carattr attr = {' ', regs->bh, 1}; struct cursorpos clrsize = {wincols, winrows}; vgafb_clear_chars(clr, attr, clrsize); - return; - } - - if (dir > 0) { + } else if (dir > 0) { // Normal scroll struct cursorpos dest = {ulx, uly, page}; struct cursorpos src = {ulx, uly + clearlines, page}; @@ -460,6 +473,7 @@ verify_scroll(struct bregs *regs, int dir) struct cursorpos clrsize = {wincols, clearlines}; vgafb_clear_chars(clr, attr, clrsize); } + vgafb_set_swcursor(1); }
static void @@ -477,9 +491,11 @@ handle_1007(struct bregs *regs) static void handle_1008(struct bregs *regs) { + vgafb_set_swcursor(0); struct carattr ca = vgafb_read_char(get_cursor_pos(regs->bh)); regs->al = ca.car; regs->ah = ca.attr; + vgafb_set_swcursor(1); }
static void noinline @@ -487,9 +503,11 @@ handle_1009(struct bregs *regs) { struct carattr ca = {regs->al, regs->bl, 1}; struct cursorpos cp = get_cursor_pos(regs->bh); + vgafb_set_swcursor(0); int count = regs->cx; while (count--) write_char(&cp, ca); + vgafb_set_swcursor(1); }
static void noinline @@ -497,9 +515,11 @@ handle_100a(struct bregs *regs) { struct carattr ca = {regs->al, regs->bl, 0}; struct cursorpos cp = get_cursor_pos(regs->bh); + vgafb_set_swcursor(0); int count = regs->cx; while (count--) write_char(&cp, ca); + vgafb_set_swcursor(1); }
@@ -540,14 +560,18 @@ static void handle_100c(struct bregs *regs) { // XXX - page (regs->bh) is unused + vgafb_set_swcursor(0); vgafb_write_pixel(regs->al, regs->cx, regs->dx); + vgafb_set_swcursor(1); }
static void handle_100d(struct bregs *regs) { // XXX - page (regs->bh) is unused + vgafb_set_swcursor(0); regs->al = vgafb_read_pixel(regs->cx, regs->dx); + vgafb_set_swcursor(1); }
static void noinline @@ -557,8 +581,10 @@ handle_100e(struct bregs *regs) // We do output only on the current page ! struct carattr ca = {regs->al, regs->bl, 0}; struct cursorpos cp = get_cursor_pos(0xff); + vgafb_set_swcursor(0); write_teletype(&cp, ca); set_cursor_pos(cp); + vgafb_set_swcursor(1); }
static void @@ -1040,6 +1066,7 @@ handle_1013(struct bregs *regs) else cp = (struct cursorpos) {regs->dl, regs->dh, regs->bh};
+ vgafb_set_swcursor(0); u16 count = regs->cx; u8 *offset_far = (void*)(regs->bp + 0); u8 attr = regs->bl; @@ -1057,6 +1084,7 @@ handle_1013(struct bregs *regs)
if (regs->al & 1) set_cursor_pos(cp); + vgafb_set_swcursor(1); }
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h index fc8d45a..e07309a 100644 --- a/vgasrc/vgabios.h +++ b/vgasrc/vgabios.h @@ -131,6 +131,7 @@ void vgafb_write_char(struct cursorpos cp, struct carattr ca); struct carattr vgafb_read_char(struct cursorpos cp); void vgafb_write_pixel(u8 color, u16 x, u16 y); u8 vgafb_read_pixel(u16 x, u16 y); +void vgafb_set_swcursor(int enable);
// vbe.c extern u32 VBE_total_memory; diff --git a/vgasrc/vgafb.c b/vgasrc/vgafb.c index 9652683..f179584 100644 --- a/vgasrc/vgafb.c +++ b/vgasrc/vgafb.c @@ -595,3 +595,8 @@ fail: ; struct carattr ca2 = {0, 0, 0}; return ca2; } + +void +vgafb_set_swcursor(int enable) +{ +}