]> gitweb.factorcode.org Git - factor.git/blob - vm/os-linux-ppc.32.hpp
webapps.wiki: adding search bar
[factor.git] / vm / os-linux-ppc.32.hpp
1 #include <ucontext.h>
2
3 namespace factor {
4
5 #define UAP_STACK_POINTER(ucontext) \
6   ((ucontext_t*)ucontext)->uc_mcontext.uc_regs->gregs[1]
7 #define UAP_PROGRAM_COUNTER(ucontext) \
8   (((ucontext_t*)ucontext)->uc_mcontext.uc_regs->gregs[32])
9
10 #define CODE_TO_FUNCTION_POINTER(code) (void)0
11 #define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code) (void)0
12 #define FUNCTION_CODE_POINTER(ptr) ptr
13 #define FUNCTION_TOC_POINTER(ptr) ptr
14
15 inline static unsigned int uap_fpu_status(void* uap) {
16   union {
17     double as_double;
18     unsigned int as_uint[2];
19   } tmp;
20   tmp.as_double = ((ucontext_t*)uap)->uc_mcontext.uc_regs->fpregs.fpscr;
21   return tmp.as_uint[1];
22 }
23
24 inline static void uap_clear_fpu_status(void* uap) {
25   union {
26     double as_double;
27     unsigned int as_uint[2];
28   } tmp;
29   tmp.as_double = ((ucontext_t*)uap)->uc_mcontext.uc_regs->fpregs.fpscr;
30   tmp.as_uint[1] &= 0x0007f8ff;
31   ((ucontext_t*)uap)->uc_mcontext.uc_regs->fpregs.fpscr = tmp.as_double;
32 }
33
34 }