]> xenbits.xensource.com Git - seabios.git/commitdiff
Simplify farcall16 code
authorKevin O'Connor <kevin@koconnor.net>
Tue, 30 Sep 2014 04:11:38 +0000 (00:11 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 11 Oct 2014 17:41:53 +0000 (13:41 -0400)
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>
src/stacks.c
src/stacks.h

index b91b2160181417ebbd244514769bb7b109476c83..2a4b8675ae7f1ca4fa440d8ec8115ee6d70bc027 100644 (file)
@@ -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
index cbc5f4fc2fe1d6cf5a453599b7e93ba0433355c6..c3ddc173c682ac53c66928ef5c4f89adaeaa284b 100644 (file)
@@ -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 );  \