aboutsummaryrefslogtreecommitdiff
path: root/src/system.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-11-16 09:17:02 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-11-16 09:17:02 -0500
commitd9a8b2dfef3eeed05a6f4e958bd327ac9a593b38 (patch)
treefe2d6c446ef22c1d0d51b6828d20dd6f9ea12b9f /src/system.c
parent8820a10e732c08e5c8224a2f1456a629b9bc5d98 (diff)
downloadseabios-hppa-d9a8b2dfef3eeed05a6f4e958bd327ac9a593b38.zip
seabios-hppa-d9a8b2dfef3eeed05a6f4e958bd327ac9a593b38.tar.gz
seabios-hppa-d9a8b2dfef3eeed05a6f4e958bd327ac9a593b38.tar.bz2
Cleanup a20 code.
Fix two apparent bugs - set_a20() returned new status instead of old status and handle_152402() checked wrong bit. Add bit definition for the a20 enable bit: A20_ENABLE_BIT Allow ioport.h #defines to be used in romlayout.S.
Diffstat (limited to 'src/system.c')
-rw-r--r--src/system.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/system.c b/src/system.c
index f4e4263..11b1cc8 100644
--- a/src/system.c
+++ b/src/system.c
@@ -19,12 +19,12 @@ set_a20(u8 cond)
// get current setting first
u8 newval, oldval = inb(PORT_A20);
if (cond)
- newval = oldval | 0x02;
+ newval = oldval | A20_ENABLE_BIT;
else
- newval = oldval & ~0x02;
+ newval = oldval & ~A20_ENABLE_BIT;
outb(newval, PORT_A20);
- return (newval & 0x02) != 0;
+ return (oldval & A20_ENABLE_BIT) != 0;
}
static void
@@ -44,7 +44,7 @@ handle_152401(struct bregs *regs)
static void
handle_152402(struct bregs *regs)
{
- regs->al = !!(inb(PORT_A20) & 0x20);
+ regs->al = (inb(PORT_A20) & A20_ENABLE_BIT) != 0;
set_code_success(regs);
}