aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-09-30 00:11:38 -0400
committerKevin O'Connor <kevin@koconnor.net>2014-10-11 13:41:53 -0400
commit79c3ab3d6ceab52e73d1d5700e6dcb89d209f987 (patch)
treefe5ffe181caf507c4238bd62fe1ec17bb197e1e1
parentdcacfa08b2a26e9aac17c52d4015100935bbcb9a (diff)
downloadseabios-79c3ab3d6ceab52e73d1d5700e6dcb89d209f987.zip
seabios-79c3ab3d6ceab52e73d1d5700e6dcb89d209f987.tar.gz
seabios-79c3ab3d6ceab52e73d1d5700e6dcb89d209f987.tar.bz2
Simplify farcall16 code
With this change, farcall16() is only used for external API calls and is only invoked from a 32bit mode entered directly via transition32. farcall16big() is also only used for external API calls and is only invoked from a 32bit mode entered directly via transition32. call16_int() now calls _farcall16() directly, and it will use normal 16bit mode or big real mode as required. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/stacks.c26
-rw-r--r--src/stacks.h6
2 files changed, 15 insertions, 17 deletions
diff --git a/src/stacks.c b/src/stacks.c
index b91b216..2a4b867 100644
--- a/src/stacks.c
+++ b/src/stacks.c
@@ -238,34 +238,32 @@ _farcall16(struct bregs *callregs, u16 callregseg)
: "ebx", "ecx", "esi", "edi", "cc", "memory");
}
-inline void
+void
farcall16(struct bregs *callregs)
{
- if (MODE16) {
- _farcall16(callregs, GET_SEG(SS));
- return;
- }
extern void _cfunc16__farcall16(void);
- call16((u32)callregs - StackSeg * 16, StackSeg, _cfunc16__farcall16);
+ call16((u32)callregs, 0, _cfunc16__farcall16);
}
-inline void
+void
farcall16big(struct bregs *callregs)
{
extern void _cfunc16__farcall16(void);
- call16big((u32)callregs - StackSeg * 16, StackSeg, _cfunc16__farcall16);
+ call16big((u32)callregs, 0, _cfunc16__farcall16);
}
// Invoke a 16bit software interrupt.
-inline void
+void
__call16_int(struct bregs *callregs, u16 offset)
{
- if (MODESEGMENT)
- callregs->code.seg = GET_SEG(CS);
- else
- callregs->code.seg = SEG_BIOS;
callregs->code.offset = offset;
- farcall16(callregs);
+ if (!MODESEGMENT) {
+ callregs->code.seg = SEG_BIOS;
+ _farcall16((void*)callregs - StackSeg * 16, StackSeg);
+ return;
+ }
+ callregs->code.seg = GET_SEG(CS);
+ _farcall16(callregs, GET_SEG(SS));
}
// Reset the machine
diff --git a/src/stacks.h b/src/stacks.h
index cbc5f4f..c3ddc17 100644
--- a/src/stacks.h
+++ b/src/stacks.h
@@ -11,9 +11,9 @@ u32 stack_hop(u32 eax, u32 edx, void *func);
u32 stack_hop_back(u32 eax, u32 edx, void *func);
int on_extra_stack(void);
struct bregs;
-inline void farcall16(struct bregs *callregs);
-inline void farcall16big(struct bregs *callregs);
-inline void __call16_int(struct bregs *callregs, u16 offset);
+void farcall16(struct bregs *callregs);
+void farcall16big(struct bregs *callregs);
+void __call16_int(struct bregs *callregs, u16 offset);
#define call16_int(nr, callregs) do { \
extern void irq_trampoline_ ##nr (); \
__call16_int((callregs), (u32)&irq_trampoline_ ##nr ); \