On Mon, Nov 22, 2010 at 07:40:36PM -0500, Kevin O'Connor wrote:
It should be possible to extend call32() to do what you need -
FYI - here's what call32 extended to pass a parameter looks like:
--- a/src/stacks.c +++ b/src/stacks.c @@ -37,14 +37,14 @@ static inline void lgdt(struct descloc_s *desc) { }
// Call a 32bit SeaBIOS function from a 16bit SeaBIOS function. -static inline int -call32(void *func) +static inline u32 +call32(void *func, u32 eax, u32 errret) { ASSERT16(); u32 cr0 = getcr0(); if (cr0 & CR0_PE) // Called in 16bit protected mode?! - return -1; + return errret;
// Backup cmos index register and disable nmi u8 cmosindex = inb(PORT_CMOS_INDEX); @@ -69,7 +69,7 @@ call32(void *func) " pushl $(" __stringify(BUILD_BIOS_ADDR) " + 1f)\n" " jmp transition32\n" " .code32\n" - "1:calll *%2\n" + "1:calll *%3\n" " pushl $2f\n" " jmp transition16big\n"
@@ -78,9 +78,9 @@ call32(void *func) "2:movl %0, %%ds\n" " movl %0, %%ss\n" " movl %1, %%esp\n" - : "=&r" (bkup_ss), "=&r" (bkup_esp) + : "=&r" (bkup_ss), "=&r" (bkup_esp), "+a" (eax) : "r" (func) - : "eax", "ecx", "edx", "cc", "memory"); + : "ecx", "edx", "cc", "memory");
// Restore gdt and fs/gs lgdt(&gdt); @@ -90,7 +90,7 @@ call32(void *func) // Restore cmos index register outb(cmosindex, PORT_CMOS_INDEX); inb(PORT_CMOS_DATA); - return 0; + return eax; }
// 16bit trampoline for enabling irqs from 32bit mode. @@ -393,5 +393,5 @@ check_preempt(void) || GET_FLATPTR(MainThread.next) == &MainThread) return;
- call32(yield_preempt); + call32(yield_preempt, 0, 0); }
-Kevin