Cleanup implementation of call16().

This commit is contained in:
Kevin O'Connor 2008-03-01 14:46:37 -05:00
parent e20ed9f362
commit 3a47a310ed
3 changed files with 18 additions and 16 deletions

2
TODO
View File

@ -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.

View File

@ -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)

View File

@ -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