From: Kevin O'Connor Date: Tue, 31 Dec 2013 03:04:28 +0000 (-0500) Subject: Add call32_params() helper function. X-Git-Tag: rel-1.7.5-rc1~55 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7f54bf7e8870366bdbee4db8e6e85c06596c88d6;p=seabios.git Add call32_params() helper function. Add helper function for calling 32bit functions with more than just one parameter. Signed-off-by: Kevin O'Connor --- diff --git a/src/stacks.c b/src/stacks.c index 9c528f5..de71c1d 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -501,3 +501,30 @@ check_preempt(void) if (CONFIG_THREAD_OPTIONROMS && GET_GLOBAL(CanPreempt) && have_threads()) call32(_cfunc32flat_yield_preempt, 0, 0); } + + +/**************************************************************** + * call32 helper + ****************************************************************/ + +struct call32_params_s { + void *func; + u32 eax, edx, ecx; +}; + +u32 VISIBLE32FLAT +call32_params_helper(struct call32_params_s *params) +{ + return ((u32 (*)(u32, u32, u32))params->func)( + params->eax, params->edx, params->ecx); +} + +u32 +call32_params(void *func, u32 eax, u32 edx, u32 ecx, u32 errret) +{ + ASSERT16(); + struct call32_params_s params = {func, eax, edx, ecx}; + extern void _cfunc32flat_call32_params_helper(void); + return call32(_cfunc32flat_call32_params_helper + , (u32)MAKE_FLATPTR(GET_SEG(SS), ¶ms), errret); +} diff --git a/src/stacks.h b/src/stacks.h index 5ee4adc..9fe8761 100644 --- a/src/stacks.h +++ b/src/stacks.h @@ -30,5 +30,6 @@ void start_preempt(void); void finish_preempt(void); int wait_preempt(void); void check_preempt(void); +u32 call32_params(void *func, u32 eax, u32 edx, u32 ecx, u32 errret); #endif // stacks.h