|
34 | 34 | #include <sys/prctl.h> |
35 | 35 |
|
36 | 36 | #include "validate.h" |
37 | | -#include "ppc-linux-mcontext.h" |
38 | 37 |
|
39 | 38 | int arch_os_thread_init(struct thread *thread) { |
40 | 39 | /* For some reason, PPC Linux appears to default to not generating |
@@ -62,74 +61,37 @@ int arch_os_thread_cleanup(struct thread *thread) { |
62 | 61 | os_context_register_t * |
63 | 62 | os_context_register_addr(os_context_t *context, int offset) |
64 | 63 | { |
65 | | -#if defined(GLIBC231_STYLE_UCONTEXT) |
66 | | - return &((context->uc_mcontext.regs)->gpr[offset]); |
67 | | -#elif defined(GLIBC232_STYLE_UCONTEXT) |
68 | | - return &((context->uc_mcontext.uc_regs->gregs)[offset]); |
69 | | -#endif |
| 64 | + return &context->uc_mcontext.regs->gpr[offset]; |
70 | 65 | } |
71 | 66 |
|
72 | 67 | os_context_register_t * |
73 | 68 | os_context_lr_addr(os_context_t *context) |
74 | 69 | { |
75 | | -#if defined(GLIBC231_STYLE_UCONTEXT) |
76 | | - return &((context->uc_mcontext.regs)->link); |
77 | | -#elif defined(GLIBC232_STYLE_UCONTEXT) |
78 | | - return &((context->uc_mcontext.uc_regs->gregs)[PT_LNK]); |
79 | | -#endif |
| 70 | + return &context->uc_mcontext.regs->link; |
80 | 71 | } |
81 | 72 |
|
82 | 73 | os_context_register_t * |
83 | 74 | os_context_ctr_addr(os_context_t *context) |
84 | 75 | { |
85 | | - /* Like os_context_fp_control() and os_context_lr_addr(), this |
86 | | - * uses an index beyond the declared end of the array in order to |
87 | | - * find the correct register value in the context. */ |
88 | | -#if defined(GLIBC231_STYLE_UCONTEXT) |
89 | | - /* FIXME: This probably should be ->ctr instead of ->gpr[PT_CTR]. */ |
90 | | - return &((context->uc_mcontext.regs)->gpr[PT_CTR]); |
91 | | -#elif defined(GLIBC232_STYLE_UCONTEXT) |
92 | | - return &((context->uc_mcontext.uc_regs)->gregs[PT_CTR]); |
93 | | -#endif |
| 76 | + return &context->uc_mcontext.regs->ctr; |
94 | 77 | } |
95 | 78 |
|
96 | 79 | os_context_register_t * |
97 | 80 | os_context_cr_addr(os_context_t *context) |
98 | 81 | { |
99 | | - /* Like os_context_fp_control() and os_context_lr_addr(), this |
100 | | - * uses an index beyond the declared end of the array in order to |
101 | | - * find the correct register value in the context. */ |
102 | | -#if defined(GLIBC231_STYLE_UCONTEXT) |
103 | | - /* FIXME: This probably should be ->ccr instead of ->gpr[PT_CCR]. */ |
104 | | - return &((context->uc_mcontext.regs)->gpr[PT_CCR]); |
105 | | -#elif defined(GLIBC232_STYLE_UCONTEXT) |
106 | | - return &((context->uc_mcontext.uc_regs)->gregs[PT_CCR]); |
107 | | -#endif |
| 82 | + return &context->uc_mcontext.regs->ccr; |
108 | 83 | } |
109 | 84 |
|
110 | 85 | sigset_t * |
111 | 86 | os_context_sigmask_addr(os_context_t *context) |
112 | 87 | { |
113 | | -#if defined(GLIBC231_STYLE_UCONTEXT) |
114 | 88 | return &context->uc_sigmask; |
115 | | -#elif defined(GLIBC232_STYLE_UCONTEXT) |
116 | | - return &context->uc_sigmask; |
117 | | -#endif |
118 | 89 | } |
119 | 90 |
|
120 | 91 | unsigned long |
121 | 92 | os_context_fp_control(os_context_t *context) |
122 | 93 | { |
123 | | - /* So this may look like nice, well behaved code. However, closer |
124 | | - inspection reveals that gpr is simply the general purpose |
125 | | - registers, and PT_FPSCR is an offset that is larger than 32 |
126 | | - (the number of ppc registers), but that happens to get the |
127 | | - right answer. -- CSR, 2002-07-11 */ |
128 | | -#if defined(GLIBC231_STYLE_UCONTEXT) |
129 | | - return context->uc_mcontext.regs->gpr[PT_FPSCR]; |
130 | | -#elif defined(GLIBC232_STYLE_UCONTEXT) |
131 | | - return context->uc_mcontext.uc_regs->gregs[PT_FPSCR]; |
132 | | -#endif |
| 94 | + return ((unsigned long*)context->uc_mcontext.regs)[PT_FPSCR]; |
133 | 95 | } |
134 | 96 |
|
135 | 97 | void |
|
0 commit comments