summaryrefslogtreecommitdiff
path: root/src/kbd.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-12-29 20:42:40 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-12-29 20:42:40 -0500
commit92f95b0fecca029a0c4dd81203e6b42f60c4a382 (patch)
tree63a9bb2ff504decebbfd73d3a41d22d7c7aaf4be /src/kbd.c
parentc659fdedadce1566308675d0c44537ade0eb12a2 (diff)
downloadqemu-seabios-92f95b0fecca029a0c4dd81203e6b42f60c4a382.tar.gz
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.
Diffstat (limited to 'src/kbd.c')
-rw-r--r--src/kbd.c20
1 files changed, 10 insertions, 10 deletions
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! */