aboutsummaryrefslogtreecommitdiff
path: root/src/pcibios.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-01-21 19:14:49 -0500
committerKevin O'Connor <kevin@koconnor.net>2009-01-21 19:14:49 -0500
commitd99908e5114d428a6b142d1f222a8d0a3fd9cfe9 (patch)
tree47dca4bd9d465da44a5665cf2a2eab069a188b5c /src/pcibios.c
parent885e2dd9bcc666a549a6d4b3731834a1f2340058 (diff)
downloadseabios-hppa-d99908e5114d428a6b142d1f222a8d0a3fd9cfe9.zip
seabios-hppa-d99908e5114d428a6b142d1f222a8d0a3fd9cfe9.tar.gz
seabios-hppa-d99908e5114d428a6b142d1f222a8d0a3fd9cfe9.tar.bz2
Minor - use a struct when working with pcibios 1ab10e param.
Diffstat (limited to 'src/pcibios.c')
-rw-r--r--src/pcibios.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/pcibios.c b/src/pcibios.c
index cfcb25e..5da079a 100644
--- a/src/pcibios.c
+++ b/src/pcibios.c
@@ -133,22 +133,27 @@ handle_1ab10e(struct bregs *regs)
return;
}
+ struct param_s {
+ u16 size;
+ u16 buf_off;
+ u16 buf_seg;
+ } *param_far = (void*)(regs->di+0);
+
// Validate and update size.
- u16 size = GET_FARVAR(regs->es, *(u16*)(regs->di+0));
- u16 pirsize = (GET_GLOBAL(pirtable_g->size)
- - sizeof(struct pir_header));
- SET_FARVAR(regs->es, *(u16*)(regs->di+0), pirsize);
- if (size < pirsize) {
+ u16 bufsize = GET_FARVAR(regs->es, param_far->size);
+ u16 pirsize = GET_GLOBAL(pirtable_g->size) - sizeof(struct pir_header);
+ SET_FARVAR(regs->es, param_far->size, pirsize);
+ if (bufsize < pirsize) {
set_code_fail(regs, RET_BUFFER_TOO_SMALL);
return;
}
// Get dest buffer.
- void *d_far = (void*)(GET_FARVAR(regs->es, *(u16*)(regs->di+2)) + 0);
- u16 d_seg = GET_FARVAR(regs->es, *(u16*)(regs->di+4));
+ void *buf_far = (void*)(GET_FARVAR(regs->es, param_far->buf_off)+0);
+ u16 buf_seg = GET_FARVAR(regs->es, param_far->buf_seg);
// Memcpy pir table slots to dest buffer.
- memcpy_far(d_seg, d_far
+ memcpy_far(buf_seg, buf_far
, get_global_seg(), pirtable_g->slots
, pirsize);