From 92f95b0fecca029a0c4dd81203e6b42f60c4a382 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Mon, 29 Dec 2008 20:42:40 -0500 Subject: Add more linker protections around variables accessed from 16bit mode. Rename VAR16 to VAR16_32 -- that macro supports accesses from both 16bit and 32bit mode. Introduce a new macro VAR16 that must be present on all global variables accessed from 16bit mode. --- src/kbd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/kbd.c') diff --git a/src/kbd.c b/src/kbd.c index 702a032..9c59005 100644 --- a/src/kbd.c +++ b/src/kbd.c @@ -148,17 +148,17 @@ dequeue_key(struct bregs *regs, int incr, int extended) ascii_code = 0; regs->ax = (scan_code << 8) | ascii_code; - if (incr) { - u16 buffer_start = GET_BDA(kbd_buf_start_offset); - u16 buffer_end = GET_BDA(kbd_buf_end_offset); - - buffer_head += 2; - if (buffer_head >= buffer_end) - buffer_head = buffer_start; - SET_BDA(kbd_buf_head, buffer_head); - } else { + if (!incr) { regs->flags &= ~F_ZF; + return; } + u16 buffer_start = GET_BDA(kbd_buf_start_offset); + u16 buffer_end = GET_BDA(kbd_buf_end_offset); + + buffer_head += 2; + if (buffer_head >= buffer_end) + buffer_head = buffer_start; + SET_BDA(kbd_buf_head, buffer_head); } // read keyboard input @@ -326,7 +326,7 @@ static struct scaninfo { u16 control; u16 alt; u8 lock_flags; -} scan_to_scanascii[MAX_SCAN_CODE + 1] = { +} scan_to_scanascii[MAX_SCAN_CODE + 1] VAR16 = { { none, none, none, none, none }, { 0x011b, 0x011b, 0x011b, 0x0100, none }, /* escape */ { 0x0231, 0x0221, none, 0x7800, none }, /* 1! */ -- cgit v1.2.1