aboutsummaryrefslogtreecommitdiff
path: root/src/serial.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-03-09 12:19:23 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-03-09 12:19:23 -0400
commit6c78122091367f87ea2338e38b175d586cee1389 (patch)
tree02104c9163bc41def70a9fde10b2d52f1ca9a851 /src/serial.c
parent5a869f02df8f150e6b0525b728fba25d913f96b9 (diff)
downloadseabios-hppa-6c78122091367f87ea2338e38b175d586cee1389.zip
seabios-hppa-6c78122091367f87ea2338e38b175d586cee1389.tar.gz
seabios-hppa-6c78122091367f87ea2338e38b175d586cee1389.tar.bz2
Replace debug_exit calls with debug info while setting a failure.
Calling debug_exit at the end of a call doesn't help much - several of the registers are already clobbered at this point. It also increases stack usage because it prevents call tail optimization in many places.
Diffstat (limited to 'src/serial.c')
-rw-r--r--src/serial.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/serial.c b/src/serial.c
index e6cb052..c620a0f 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -17,12 +17,12 @@ static u16
getComAddr(struct bregs *regs)
{
if (regs->dx >= 4) {
- set_cf(regs, 1);
+ set_fail(regs);
return 0;
}
u16 addr = GET_BDA(port_com[regs->dx]);
if (! addr)
- set_cf(regs, 1);
+ set_fail(regs);
return addr;
}
@@ -44,7 +44,7 @@ handle_1400(struct bregs *regs)
outb(regs->al & 0x1F, addr+3);
regs->ah = inb(addr+5);
regs->al = inb(addr+6);
- set_cf(regs, 0);
+ set_success(regs);
}
static void
@@ -67,7 +67,7 @@ handle_1401(struct bregs *regs)
regs->ah = inb(addr+5);
if (!timeout)
regs->ah |= 0x80;
- set_cf(regs, 0);
+ set_success(regs);
}
static void
@@ -91,7 +91,7 @@ handle_1402(struct bregs *regs)
} else {
regs->ah = inb(addr+5);
}
- set_cf(regs, 0);
+ set_success(regs);
}
static void
@@ -102,14 +102,14 @@ handle_1403(struct bregs *regs)
return;
regs->ah = inb(addr+5);
regs->al = inb(addr+6);
- set_cf(regs, 0);
+ set_success(regs);
}
static void
handle_14XX(struct bregs *regs)
{
// Unsupported
- set_cf(regs, 1);
+ set_fail(regs);
}
// INT 14h Serial Communications Service Entry Point
@@ -127,7 +127,6 @@ handle_14(struct bregs *regs)
case 0x03: handle_1403(regs); break;
default: handle_14XX(regs); break;
}
- debug_exit(regs);
}
@@ -139,12 +138,12 @@ static u16
getLptAddr(struct bregs *regs)
{
if (regs->dx >= 3) {
- set_cf(regs, 1);
+ set_fail(regs);
return 0;
}
u16 addr = GET_BDA(port_lpt[regs->dx]);
if (! addr)
- set_cf(regs, 1);
+ set_fail(regs);
return addr;
}
@@ -155,7 +154,7 @@ lpt_ret(struct bregs *regs, u16 addr, u16 timeout)
regs->ah = (val8 ^ 0x48);
if (!timeout)
regs->ah |= 0x01;
- set_cf(regs, 0);
+ set_success(regs);
}
// INT 17 - PRINTER - WRITE CHARACTER
@@ -211,7 +210,7 @@ static void
handle_17XX(struct bregs *regs)
{
// Unsupported
- set_cf(regs, 1);
+ set_fail(regs);
}
// INT17h : Printer Service Entry Point
@@ -228,5 +227,4 @@ handle_17(struct bregs *regs)
case 0x02: handle_1702(regs); break;
default: handle_17XX(regs); break;
}
- debug_exit(regs);
}