aboutsummaryrefslogtreecommitdiff
path: root/src/mouse.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-12-29 21:16:31 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-12-29 21:16:31 -0500
commit08815370c94d88b37bc651d6707b6f1d68dc519b (patch)
tree7ccfd69fe17ec47c91d1c5b833fa7d966cdf4084 /src/mouse.c
parent92f95b0fecca029a0c4dd81203e6b42f60c4a382 (diff)
downloadseabios-hppa-08815370c94d88b37bc651d6707b6f1d68dc519b.zip
seabios-hppa-08815370c94d88b37bc651d6707b6f1d68dc519b.tar.gz
seabios-hppa-08815370c94d88b37bc651d6707b6f1d68dc519b.tar.bz2
Introduce GET/SET_EBDA2() macros - they take a cached ebda seg.
For those places that repeatedly read/write to the ebda, caching the ebda segment improves code generation.
Diffstat (limited to 'src/mouse.c')
-rw-r--r--src/mouse.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/src/mouse.c b/src/mouse.c
index daac505..6c74fc1 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -30,12 +30,12 @@ mouse_setup()
#define RET_ENOHANDLER 0x05
static int
-disable_mouse()
+disable_mouse(u16 ebda_seg)
{
- u8 ps2ctr = GET_EBDA(ps2ctr);
+ u8 ps2ctr = GET_EBDA2(ebda_seg, ps2ctr);
ps2ctr |= I8042_CTR_AUXDIS;
ps2ctr &= ~I8042_CTR_AUXINT;
- SET_EBDA(ps2ctr, ps2ctr);
+ SET_EBDA2(ebda_seg, ps2ctr, ps2ctr);
return aux_command(PSMOUSE_CMD_DISABLE, NULL);
}
@@ -44,7 +44,8 @@ disable_mouse()
static void
mouse_15c20000(struct bregs *regs)
{
- int ret = disable_mouse();
+ u16 ebda_seg = get_ebda_seg();
+ int ret = disable_mouse(ebda_seg);
if (ret)
set_code_fail(regs, RET_ENEEDRESEND);
else
@@ -55,16 +56,17 @@ mouse_15c20000(struct bregs *regs)
static void
mouse_15c20001(struct bregs *regs)
{
- u8 mouse_flags_2 = GET_EBDA(mouse_flag2);
+ u16 ebda_seg = get_ebda_seg();
+ u8 mouse_flags_2 = GET_EBDA2(ebda_seg, mouse_flag2);
if ((mouse_flags_2 & 0x80) == 0) {
set_code_fail(regs, RET_ENOHANDLER);
return;
}
- u8 ps2ctr = GET_EBDA(ps2ctr);
+ u8 ps2ctr = GET_EBDA2(ebda_seg, ps2ctr);
ps2ctr &= ~I8042_CTR_AUXDIS;
ps2ctr |= I8042_CTR_AUXINT;
- SET_EBDA(ps2ctr, ps2ctr);
+ SET_EBDA2(ebda_seg, ps2ctr, ps2ctr);
int ret = aux_command(PSMOUSE_CMD_ENABLE, NULL);
if (ret)
@@ -165,8 +167,9 @@ mouse_15c205(struct bregs *regs)
set_code_fail(regs, RET_EINTERFACE);
return;
}
- SET_EBDA(mouse_flag1, 0x00);
- SET_EBDA(mouse_flag2, regs->bh);
+ u16 ebda_seg = get_ebda_seg();
+ SET_EBDA2(ebda_seg, mouse_flag1, 0x00);
+ SET_EBDA2(ebda_seg, mouse_flag2, regs->bh);
// Reset Mouse
mouse_15c201(regs);
@@ -233,19 +236,20 @@ static void
mouse_15c207(struct bregs *regs)
{
u32 farptr = (regs->es << 16) | regs->bx;
- u8 mouse_flags_2 = GET_EBDA(mouse_flag2);
+ u16 ebda_seg = get_ebda_seg();
+ u8 mouse_flags_2 = GET_EBDA2(ebda_seg, mouse_flag2);
if (! farptr) {
/* remove handler */
if ((mouse_flags_2 & 0x80) != 0) {
mouse_flags_2 &= ~0x80;
- disable_mouse();
+ disable_mouse(ebda_seg);
}
} else {
/* install handler */
mouse_flags_2 |= 0x80;
}
- SET_EBDA(mouse_flag2, mouse_flags_2);
- SET_EBDA(far_call_pointer, farptr);
+ SET_EBDA2(ebda_seg, mouse_flag2, mouse_flags_2);
+ SET_EBDA2(ebda_seg, far_call_pointer, farptr);
set_code_success(regs);
}
@@ -290,8 +294,9 @@ int74_function()
}
v = inb(PORT_PS2_DATA);
- u8 mouse_flags_1 = GET_EBDA(mouse_flag1);
- u8 mouse_flags_2 = GET_EBDA(mouse_flag2);
+ u16 ebda_seg = get_ebda_seg();
+ u8 mouse_flags_1 = GET_EBDA2(ebda_seg, mouse_flag1);
+ u8 mouse_flags_2 = GET_EBDA2(ebda_seg, mouse_flag2);
if (! (mouse_flags_2 & 0x80))
// far call handler not installed
@@ -299,21 +304,21 @@ int74_function()
u8 package_count = mouse_flags_2 & 0x07;
u8 index = mouse_flags_1 & 0x07;
- SET_EBDA(mouse_data[index], v);
+ SET_EBDA2(ebda_seg, mouse_data[index], v);
if ((index+1) < package_count) {
mouse_flags_1++;
- SET_EBDA(mouse_flag1, mouse_flags_1);
+ SET_EBDA2(ebda_seg, mouse_flag1, mouse_flags_1);
return;
}
//BX_DEBUG_INT74("int74_function: make_farcall=1\n");
- u16 status = GET_EBDA(mouse_data[0]);
- u16 X = GET_EBDA(mouse_data[1]);
- u16 Y = GET_EBDA(mouse_data[2]);
- SET_EBDA(mouse_flag1, 0);
+ u16 status = GET_EBDA2(ebda_seg, mouse_data[0]);
+ u16 X = GET_EBDA2(ebda_seg, mouse_data[1]);
+ u16 Y = GET_EBDA2(ebda_seg, mouse_data[2]);
+ SET_EBDA2(ebda_seg, mouse_flag1, 0);
- u32 func = GET_EBDA(far_call_pointer);
+ u32 func = GET_EBDA2(ebda_seg, far_call_pointer);
asm volatile(
"pushl %0\n"
"pushw %w1\n" // status