aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2010-03-13 22:29:55 -0500
committerKevin O'Connor <kevin@koconnor.net>2010-03-13 22:29:55 -0500
commit4ed378a3c000dd3c4226e60a468cc1ea2210254e (patch)
tree3aba5ee2fadd93d9bb63cc996670a4527623011d
parent68c51390e3c78ed4a5b012d9097007f7cb0b8bbe (diff)
downloadseabios-hppa-4ed378a3c000dd3c4226e60a468cc1ea2210254e.zip
seabios-hppa-4ed378a3c000dd3c4226e60a468cc1ea2210254e.tar.gz
seabios-hppa-4ed378a3c000dd3c4226e60a468cc1ea2210254e.tar.bz2
Backup and restore registers when calling out to user funcs.
Make sure to fully backup and restore register state when calling out to other interrupts and functions. Some old DOS programs don't fully restore state. Also, make sure to enable irqs in call16_simpint().
-rw-r--r--src/mouse.c10
-rw-r--r--src/util.h9
2 files changed, 12 insertions, 7 deletions
diff --git a/src/mouse.c b/src/mouse.c
index 8389d2a..aba12ad 100644
--- a/src/mouse.c
+++ b/src/mouse.c
@@ -305,15 +305,17 @@ process_mouse(u8 data)
return;
}
- //BX_DEBUG_INT74("int74_function: make_farcall=1\n");
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);
struct segoff_s func = GET_EBDA2(ebda_seg, far_call_pointer);
+ dprintf(16, "mouse farcall s=%04x x=%04x y=%04x func=%04x:%04x\n"
+ , status, X, Y, func.seg, func.offset);
asm volatile(
+ "pushl %%ebp\n"
"sti\n"
"pushl %0\n"
@@ -326,8 +328,8 @@ process_mouse(u8 data)
"cli\n"
"cld\n"
+ "popl %%ebp"
+ : "+a"(func.segoff), "+c"(status), "+d"(X), "+b"(Y)
:
- : "r"(func.segoff), "r"(status), "r"(X), "r"(Y)
- : "cc"
- );
+ : "edi", "esi", "cc", "memory");
}
diff --git a/src/util.h b/src/util.h
index 9b4fd3a..7c7c698 100644
--- a/src/util.h
+++ b/src/util.h
@@ -144,15 +144,18 @@ static inline u8 readb(const void *addr) {
#define call16_simpint(nr, peax, pflags) do { \
ASSERT16(); \
asm volatile( \
+ "pushl %%ebp\n" \
+ "sti\n" \
"stc\n" \
"int %2\n" \
"pushfl\n" \
"popl %1\n" \
"cli\n" \
- "cld" \
- : "+a"(*peax), "=r"(*pflags) \
+ "cld\n" \
+ "popl %%ebp" \
+ : "+a"(*peax), "=c"(*pflags) \
: "i"(nr) \
- : "cc", "memory"); \
+ : "ebx", "edx", "esi", "edi", "cc", "memory"); \
} while (0)
// GDT bit manipulation