aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-03-01 14:46:37 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-03-01 14:46:37 -0500
commit3a47a310edd92bef0136ff3a97672d6fb45922fe (patch)
treee9065b809765938ef4b6b1f769af0f122a4d3d34
parente20ed9f362a0d81d718c82780208f8361f3d2f51 (diff)
downloadseabios-hppa-3a47a310edd92bef0136ff3a97672d6fb45922fe.zip
seabios-hppa-3a47a310edd92bef0136ff3a97672d6fb45922fe.tar.gz
seabios-hppa-3a47a310edd92bef0136ff3a97672d6fb45922fe.tar.bz2
Cleanup implementation of call16().
-rw-r--r--TODO2
-rw-r--r--src/rombios32.lds.S2
-rw-r--r--src/util.h30
3 files changed, 18 insertions, 16 deletions
diff --git a/TODO b/TODO
index d8d0128..08aaf91 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
Find out why ubuntu compiles are failing. Find work around.
-Fixup __call16 usage from util.h / rombios32.lds.S
-
See if it is better to tell gcc that call16 clobbers all registers
instead of having the code call pushal/popal.
diff --git a/src/rombios32.lds.S b/src/rombios32.lds.S
index 5d7e772..78546cf 100644
--- a/src/rombios32.lds.S
+++ b/src/rombios32.lds.S
@@ -23,7 +23,7 @@ SECTIONS
__bss_start = . ;
.bss : { *(.bss) *(COMMON) }
_end = . ;
- __call16 = (0xf0000 | OFFSET___call16_from32) ;
+ __call16_from32 = (0xf0000 | OFFSET___call16_from32) ;
/DISCARD/ : { *(.stab)
*(.stabstr)
*(.comment)
diff --git a/src/util.h b/src/util.h
index cdb8b1b..7de577b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -67,29 +67,33 @@ void call16(struct bregs *callregs)
asm volatile(
"pushfl\n" // Save flags
"pushal\n" // Save registers
+#ifdef MODE16
"calll __call16\n"
+#else
+ "calll __call16_from32\n"
+#endif
"popal\n"
"popfl\n"
: : "a" (callregs), "m" (*callregs));
}
-// XXX - this is ugly.
+static inline
+void __call16_int(struct bregs *callregs, u16 offset)
+{
+ callregs->cs = 0xf000;
+ callregs->ip = offset;
+ call16(callregs);
+}
+
#ifdef MODE16
-#define call16_int(nr, callregs) do { \
- struct bregs *__br = (callregs); \
- extern void irq_trampoline_ ##nr (); \
- __br->cs = 0xf000; \
- __br->ip = (u16)&irq_trampoline_ ##nr; \
- call16(__br); \
+#define call16_int(nr, callregs) do { \
+ extern void irq_trampoline_ ##nr (); \
+ __call16_int((callregs), (u16)&irq_trampoline_ ##nr ); \
} while (0)
#else
#include "../out/rom16.offset.auto.h"
-#define call16_int(nr, callregs) do { \
- struct bregs *__br = (callregs); \
- __br->cs = 0xf000; \
- __br->ip = OFFSET_irq_trampoline_ ##nr; \
- call16(__br); \
- } while (0)
+#define call16_int(nr, callregs) \
+ __call16_int((callregs), OFFSET_irq_trampoline_ ##nr )
#endif
// output.c