aboutsummaryrefslogtreecommitdiffstats
path: root/src/stacks.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2013-09-29 19:58:09 -0400
committerKevin O'Connor <kevin@koconnor.net>2013-10-14 21:37:56 -0400
commit9e75b08bd476aaa6abbd0bfdd7c5cf5a682148e5 (patch)
treef5d0135a647823fb3a3a679c8c0b330c3baf81af /src/stacks.c
parent38aadba0ceb6bf03c782be5fd8e77427913d2db9 (diff)
downloadseabios-9e75b08bd476aaa6abbd0bfdd7c5cf5a682148e5.tar.gz
Make __call16 use C calling convention and support two passed parameters.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stacks.c')
-rw-r--r--src/stacks.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/stacks.c b/src/stacks.c
index 6e6a7b35..ad615d2c 100644
--- a/src/stacks.c
+++ b/src/stacks.c
@@ -166,31 +166,23 @@ call32(void *func, u32 eax, u32 errret)
// Call a 16bit SeaBIOS function from a 32bit SeaBIOS function.
static inline u32
-call16(u32 eax, void *func)
+call16(u32 eax, u32 edx, void *func)
{
ASSERT32FLAT();
if (getesp() > BUILD_STACK_ADDR)
panic("call16 with invalid stack\n");
- asm volatile(
- "calll __call16"
- : "+a" (eax)
- : "b" ((u32)func - BUILD_BIOS_ADDR)
- : "ecx", "edx", "cc", "memory");
- return eax;
+ extern u32 __call16(u32 eax, u32 edx, void *func);
+ return __call16(eax, edx, func - BUILD_BIOS_ADDR);
}
static inline u32
-call16big(u32 eax, void *func)
+call16big(u32 eax, u32 edx, void *func)
{
ASSERT32FLAT();
if (getesp() > BUILD_STACK_ADDR)
panic("call16big with invalid stack\n");
- asm volatile(
- "calll __call16big"
- : "+a" (eax)
- : "b" ((u32)func - BUILD_BIOS_ADDR)
- : "ecx", "edx", "cc", "memory");
- return eax;
+ extern u32 __call16big(u32 eax, u32 edx, void *func);
+ return __call16big(eax, edx, func - BUILD_BIOS_ADDR);
}
@@ -223,14 +215,14 @@ farcall16(struct bregs *callregs)
return;
}
extern void _cfunc16__farcall16(void);
- call16((u32)callregs, _cfunc16__farcall16);
+ call16((u32)callregs, 0, _cfunc16__farcall16);
}
inline void
farcall16big(struct bregs *callregs)
{
extern void _cfunc16__farcall16(void);
- call16big((u32)callregs, _cfunc16__farcall16);
+ call16big((u32)callregs, 0, _cfunc16__farcall16);
}
// Invoke a 16bit software interrupt.
@@ -380,13 +372,13 @@ yield(void)
}
extern void _cfunc16_check_irqs(void);
if (!CONFIG_THREADS) {
- call16big(0, _cfunc16_check_irqs);
+ call16big(0, 0, _cfunc16_check_irqs);
return;
}
struct thread_info *cur = getCurThread();
if (cur == &MainThread)
// Permit irqs to fire
- call16big(0, _cfunc16_check_irqs);
+ call16big(0, 0, _cfunc16_check_irqs);
// Switch to the next thread
switch_next(cur);
@@ -416,7 +408,7 @@ yield_toirq(void)
return;
}
extern void _cfunc16_wait_irq(void);
- call16big(0, _cfunc16_wait_irq);
+ call16big(0, 0, _cfunc16_wait_irq);
}
// Wait for all threads (other than the main thread) to complete.