aboutsummaryrefslogtreecommitdiffstats
path: root/vgasrc/vgainit.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-10-17 22:15:42 -0400
committerKevin O'Connor <kevin@koconnor.net>2014-11-12 12:17:57 -0500
commitb4eb6fc5cc051e18d07f9483c093c9c32cece2f7 (patch)
tree0eb793ef2481b9b2dcaa8e501078708858146ec1 /vgasrc/vgainit.c
parent6fed307251e2590e9a999af64cf29ff739b034f9 (diff)
downloadseabios-b4eb6fc5cc051e18d07f9483c093c9c32cece2f7.tar.gz
vgabios: Add software cursor capability
Add mechanism for drawing a cursor to the framebuffer to implement a cursor in software. The timer interrupt is "hooked" so that the cursor can blink. This can be useful for "coreboot native vga". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc/vgainit.c')
-rw-r--r--vgasrc/vgainit.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/vgasrc/vgainit.c b/vgasrc/vgainit.c
index 6ef19e1d..8d122618 100644
--- a/vgasrc/vgainit.c
+++ b/vgasrc/vgainit.c
@@ -88,6 +88,38 @@ allocate_extra_stack(void)
/****************************************************************
+ * Timer hook
+ ****************************************************************/
+
+struct segoff_s Timer_Hook_Resume VAR16 VISIBLE16;
+
+void VISIBLE16
+handle_timer_hook(void)
+{
+ if (!vga_emulate_text())
+ return;
+ vgafb_set_swcursor(GET_BDA(timer_counter) % 18 < 9);
+}
+
+static void
+hook_timer_irq(void)
+{
+ if (!CONFIG_VGA_EMULATE_TEXT)
+ return;
+ extern void entry_timer_hook(void);
+ extern void entry_timer_hook_extrastack(void);
+ struct segoff_s oldirq = GET_IVT(0x08);
+ struct segoff_s newirq = SEGOFF(get_global_seg(), (u32)entry_timer_hook);
+ if (CONFIG_VGA_ALLOCATE_EXTRA_STACK && GET_GLOBAL(ExtraStackSeg))
+ newirq = SEGOFF(get_global_seg(), (u32)entry_timer_hook_extrastack);
+ dprintf(1, "Hooking hardware timer irq (old=%x new=%x)\n"
+ , oldirq.segoff, newirq.segoff);
+ SET_VGA(Timer_Hook_Resume, oldirq);
+ SET_IVT(0x08, newirq);
+}
+
+
+/****************************************************************
* VGA post
****************************************************************/
@@ -150,6 +182,8 @@ vga_post(struct bregs *regs)
allocate_extra_stack();
+ hook_timer_irq();
+
SET_VGA(HaveRunInit, 1);
// Fixup checksum