Support passing a parameter to the 32bit function, as well as
returning the result of the function back to the 16bit code.
Also, make call32 available outside of stacks.c.
}
// Call a 32bit SeaBIOS function from a 16bit SeaBIOS function.
}
// Call a 32bit SeaBIOS function from a 16bit SeaBIOS function.
-static inline int
-call32(void *func)
+u32
+call32(void *func, u32 eax, u32 errret)
{
ASSERT16();
u32 cr0 = getcr0();
if (cr0 & CR0_PE)
// Called in 16bit protected mode?!
{
ASSERT16();
u32 cr0 = getcr0();
if (cr0 & CR0_PE)
// Called in 16bit protected mode?!
// Backup cmos index register and disable nmi
u8 cmosindex = inb(PORT_CMOS_INDEX);
// Backup cmos index register and disable nmi
u8 cmosindex = inb(PORT_CMOS_INDEX);
" movl %%esp, %1\n"
" shll $4, %0\n"
" addl %0, %%esp\n"
" movl %%esp, %1\n"
" shll $4, %0\n"
" addl %0, %%esp\n"
// Transition to 32bit mode, call func, return to 16bit
" movl $(" __stringify(BUILD_BIOS_ADDR) " + 1f), %%edx\n"
" jmp transition32\n"
" .code32\n"
// Transition to 32bit mode, call func, return to 16bit
" movl $(" __stringify(BUILD_BIOS_ADDR) " + 1f), %%edx\n"
" jmp transition32\n"
" .code32\n"
" movl $2f, %%edx\n"
" jmp transition16big\n"
" movl $2f, %%edx\n"
" jmp transition16big\n"
"2:movl %0, %%ds\n"
" movl %0, %%ss\n"
" movl %1, %%esp\n"
"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)
- : "eax", "ecx", "edx", "cc", "memory");
+ : "ecx", "edx", "cc", "memory");
// Restore gdt and fs/gs
lgdt(&gdt);
// Restore gdt and fs/gs
lgdt(&gdt);
// Restore cmos index register
outb(cmosindex, PORT_CMOS_INDEX);
inb(PORT_CMOS_DATA);
// Restore cmos index register
outb(cmosindex, PORT_CMOS_INDEX);
inb(PORT_CMOS_DATA);
}
// 16bit trampoline for enabling irqs from 32bit mode.
}
// 16bit trampoline for enabling irqs from 32bit mode.
|| GET_FLATPTR(MainThread.next) == &MainThread)
return;
|| GET_FLATPTR(MainThread.next) == &MainThread)
return;
+ call32(yield_preempt, 0, 0);
int get_keystroke(int msec);
// stacks.c
int get_keystroke(int msec);
// stacks.c
+u32 call32(void *func, u32 eax, u32 errret);
inline u32 stack_hop(u32 eax, u32 edx, void *func);
extern struct thread_info MainThread;
struct thread_info *getCurThread(void);
inline u32 stack_hop(u32 eax, u32 edx, void *func);
extern struct thread_info MainThread;
struct thread_info *getCurThread(void);