]> gitweb.factorcode.org Git - factor.git/blob - vm/os-linux-ppc.64.hpp
Put brackets around ipv6 addresses in `inet6 present`
[factor.git] / vm / os-linux-ppc.64.hpp
1 #include <ucontext.h>
2
3 namespace factor {
4
5 #define UAP_STACK_POINTER(ucontext) \
6   ((ucontext_t*)ucontext)->uc_mcontext.gp_regs[1]
7 #define UAP_PROGRAM_COUNTER(ucontext) \
8   (((ucontext_t*)ucontext)->uc_mcontext.gp_regs[32])
9
10 #define FACTOR_PPC_TOC 1
11
12 #define CODE_TO_FUNCTION_POINTER(code) \
13   void* desc[3];                       \
14   code = fill_function_descriptor(desc, code)
15
16 #define CODE_TO_FUNCTION_POINTER_CALLBACK(vm, code)     \
17   code = fill_function_descriptor(new void* [3], code); \
18   vm->function_descriptors.push_back((void**)code)
19
20 #define FUNCTION_CODE_POINTER(ptr) (function_descriptor_field((void*)ptr, 0))
21
22 #define FUNCTION_TOC_POINTER(ptr) (function_descriptor_field((void*)ptr, 1))
23
24 inline static unsigned int uap_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.fp_regs[32];
30   return tmp.as_uint[1];
31 }
32
33 inline static void uap_clear_fpu_status(void* uap) {
34   union {
35     double as_double;
36     unsigned int as_uint[2];
37   } tmp;
38   tmp.as_double = ((ucontext_t*)uap)->uc_mcontext.fp_regs[32];
39   tmp.as_uint[1] &= 0x0007f8ff;
40   ((ucontext_t*)uap)->uc_mcontext.fp_regs[32] = tmp.as_double;
41 }
42
43 }