]> gitweb.factorcode.org Git - factor.git/blob - vm/os-linux-ppc.32.hpp
32 and 64 bit Linux PPC support
[factor.git] / vm / os-linux-ppc.32.hpp
1 #include <ucontext.h>
2
3 namespace factor
4 {
5
6 #define FRAME_RETURN_ADDRESS(frame,vm) *((void **)(vm->frame_successor(frame) + 1) + 1)
7 #define UAP_STACK_POINTER(ucontext) ((ucontext_t *)ucontext)->uc_mcontext.uc_regs->gregs[1]
8 #define UAP_PROGRAM_COUNTER(ucontext) (((ucontext_t *)ucontext)->uc_mcontext.uc_regs->gregs[32])
9 #define UAP_SET_TOC_POINTER(uap, ptr) (void)0
10
11 #define CODE_TO_FUNCTION_POINTER(code) (void)0
12 #define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
13 #define FUNCTION_CODE_POINTER(ptr) ptr
14 #define FUNCTION_TOC_POINTER(ptr) ptr
15
16 #define UAP_STACK_POINTER_TYPE unsigned long
17
18 inline static unsigned int uap_fpu_status(void *uap)
19 {
20         union {
21                 double       as_double;
22                 unsigned int as_uint[2];
23         } tmp;
24         tmp.as_double  = ((ucontext_t*) uap)->uc_mcontext.uc_regs->fpregs.fpscr;
25         return tmp.as_uint[1];
26 }
27
28 inline static void uap_clear_fpu_status(void *uap)
29 {
30         union {
31                 double       as_double;
32                 unsigned int as_uint[2];
33         } tmp;
34         tmp.as_double  = ((ucontext_t*) uap)->uc_mcontext.uc_regs->fpregs.fpscr;
35         tmp.as_uint[1] &= 0x0007f8ff;
36         ((ucontext_t*) uap)->uc_mcontext.uc_regs->fpregs.fpscr = tmp.as_double;
37 }
38
39 }