]> xenbits.xensource.com Git - seabios.git/commitdiff
Add call32_params() helper function.
authorKevin O'Connor <kevin@koconnor.net>
Tue, 31 Dec 2013 03:04:28 +0000 (22:04 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 29 Jan 2014 17:57:01 +0000 (12:57 -0500)
Add helper function for calling 32bit functions with more than just
one parameter.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/stacks.c
src/stacks.h

index 9c528f551877786803dafdf39de4f05f128110ee..de71c1dd178fecaac1f72e28d6bda95e32ad36fc 100644 (file)
@@ -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), &params), errret);
+}
index 5ee4adc381e780c50c6dff428c37d63c915be088..9fe876127e18ed5f42a5b8903ee4e675ffd0b369 100644 (file)
@@ -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