1 #ifndef __LUNAIX_I386ABI_H
2 #define __LUNAIX_I386ABI_H
4 #include "sys/x86_isa.h"
6 #define stack_alignment 0xfffffff0
9 #define align_stack(ptr) ((ptr) & stack_alignment)
10 #define store_retval(retval) current_thread->hstate->registers.eax = (retval)
12 #define store_retval_to(th, retval) (th)->hstate->registers.eax = (retval)
14 static inline void must_inline
15 j_usr(ptr_t sp, ptr_t pc)
17 asm volatile("movw %0, %%ax\n"
26 "retf" ::"i"(UDATA_SEG),
34 static inline void must_inline noret
36 asm volatile("jmp do_switch\n");
40 #define push_arg1(stack_ptr, arg) *((typeof((arg))*)(stack_ptr)--) = arg
41 #define push_arg2(stack_ptr, arg1, arg2) \
43 *((typeof((arg1))*)(stack_ptr)--) = arg1; \
44 *((typeof((arg2))*)(stack_ptr)--) = arg2; \
46 #define push_arg3(stack_ptr, arg1, arg2, arg3) \
48 *((typeof((arg1))*)(stack_ptr)--) = arg1; \
49 *((typeof((arg2))*)(stack_ptr)--) = arg2; \
50 *((typeof((arg3))*)(stack_ptr)--) = arg3; \
52 #define push_arg4(stack_ptr, arg1, arg2, arg3, arg4) \
54 *((typeof((arg1))*)(stack_ptr)--) = arg1; \
55 *((typeof((arg2))*)(stack_ptr)--) = arg2; \
56 *((typeof((arg3))*)(stack_ptr)--) = arg3; \
57 *((typeof((arg4))*)(stack_ptr)--) = arg4; \
61 static inline ptr_t must_inline
65 asm("movl %%ebp, %0" : "=r"(val)::);
72 return *((ptr_t*)abi_get_callframe() + 1);
76 abi_get_retaddrat(ptr_t fp)
78 return *((ptr_t*)fp + 1);
81 #endif /* __LUNAIX_ABI_H */