aboutsummaryrefslogtreecommitdiff
path: root/src/mouse.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2012-05-28 14:25:15 -0400
committerKevin O'Connor <kevin@koconnor.net>2012-05-30 21:04:52 -0400
commitecdc655a867480b938652d52a0880853595e2976 (patch)
treebb05ef9488ce19343b805ef246ca95636a6f5fb2 /src/mouse.c
parentbeeabd63df5ad76c74360626549b0be2f6bbad91 (diff)
downloadseabios-hppa-ecdc655a867480b938652d52a0880853595e2976.zip
seabios-hppa-ecdc655a867480b938652d52a0880853595e2976.tar.gz
seabios-hppa-ecdc655a867480b938652d52a0880853595e2976.tar.bz2
Run all hardware irq handlers on the extra stack.
Jump into the extra stack for all hardware irq handlers. This reduces the overall stack requirements of SeaBIOS. Replace all users of call16_simpint with call16_int. Only the hardware irq handlers used the old call, and they need to use the new call to ensure the extra stack is properly re-entrant. Also, pass in a 'struct bregs' to the hardware irq handlers now. It was not done previously to save stack space. Now that the extra stack is used, that is no longer an issue. Note that should an old OS invoke a hardware irq in 16bit protected mode, then this patch could break that OS. However, the chances of this causing a regression seem small as several existing hardware irq handlers already do not work in 16bit protected mode. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/mouse.c')
-rw-r--r--src/mouse.c57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/mouse.c b/src/mouse.c
index 237c8ff..93e4ed2 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -6,8 +6,7 @@
// This file may be distributed under the terms of the GNU LGPLv3 license.
#include "biosvar.h" // GET_EBDA
-#include "util.h" // debug_isr
-#include "pic.h" // eoi_pic2
+#include "util.h" // dprintf
#include "bregs.h" // struct bregs
#include "ps2port.h" // ps2_mouse_command
#include "usb-hid.h" // usb_mouse_command
@@ -273,34 +272,12 @@ handle_15c2(struct bregs *regs)
}
}
-void noinline
-process_mouse(u8 data)
+static void
+invoke_mouse_handler(u16 ebda_seg)
{
- if (!CONFIG_MOUSE)
- return;
-
- u16 ebda_seg = get_ebda_seg();
- u8 mouse_flags_1 = GET_EBDA(ebda_seg, mouse_flag1);
- u8 mouse_flags_2 = GET_EBDA(ebda_seg, mouse_flag2);
-
- if (! (mouse_flags_2 & 0x80))
- // far call handler not installed
- return;
-
- u8 package_count = mouse_flags_2 & 0x07;
- u8 index = mouse_flags_1 & 0x07;
- SET_EBDA(ebda_seg, mouse_data[index], data);
-
- if ((index+1) < package_count) {
- mouse_flags_1++;
- SET_EBDA(ebda_seg, mouse_flag1, mouse_flags_1);
- return;
- }
-
u16 status = GET_EBDA(ebda_seg, mouse_data[0]);
u16 X = GET_EBDA(ebda_seg, mouse_data[1]);
u16 Y = GET_EBDA(ebda_seg, mouse_data[2]);
- SET_EBDA(ebda_seg, mouse_flag1, 0);
struct segoff_s func = GET_EBDA(ebda_seg, far_call_pointer);
dprintf(16, "mouse farcall s=%04x x=%04x y=%04x func=%04x:%04x\n"
@@ -325,3 +302,31 @@ process_mouse(u8 data)
:
: "edi", "esi", "cc", "memory");
}
+
+void noinline
+process_mouse(u8 data)
+{
+ if (!CONFIG_MOUSE)
+ return;
+
+ u16 ebda_seg = get_ebda_seg();
+ u8 mouse_flags_1 = GET_EBDA(ebda_seg, mouse_flag1);
+ u8 mouse_flags_2 = GET_EBDA(ebda_seg, mouse_flag2);
+
+ if (! (mouse_flags_2 & 0x80))
+ // far call handler not installed
+ return;
+
+ u8 package_count = mouse_flags_2 & 0x07;
+ u8 index = mouse_flags_1 & 0x07;
+ SET_EBDA(ebda_seg, mouse_data[index], data);
+
+ if ((index+1) < package_count) {
+ mouse_flags_1++;
+ SET_EBDA(ebda_seg, mouse_flag1, mouse_flags_1);
+ return;
+ }
+
+ SET_EBDA(ebda_seg, mouse_flag1, 0);
+ stack_hop_back(ebda_seg, 0, invoke_mouse_handler);
+}