diff options
Diffstat (limited to 'vgasrc/vgainit.c')
-rw-r--r-- | vgasrc/vgainit.c | 34 |
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 |