diff options
author | Michael Neuling <mikey@neuling.org> | 2008-06-26 03:07:48 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-30 21:28:43 -0400 |
commit | 9c75a31c3525a127f70b919856e32be3d8b03755 (patch) | |
tree | 3beee76d3dd4a55af868b5edfbef80c911819fed /arch/powerpc/kernel/ptrace32.c | |
parent | 9e7511861c4f8d35852a3721c5bcd92661cb4c9f (diff) |
powerpc: Add macros to access floating point registers in thread_struct.
We are going to change where the floating point registers are stored
in the thread_struct, so in preparation add some macros to access the
floating point registers. Update all code to use these new macros.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/ptrace32.c')
-rw-r--r-- | arch/powerpc/kernel/ptrace32.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c index 4c1de6af4c09..67bf1a1e7e14 100644 --- a/arch/powerpc/kernel/ptrace32.c +++ b/arch/powerpc/kernel/ptrace32.c | |||
@@ -64,6 +64,11 @@ static long compat_ptrace_old(struct task_struct *child, long request, | |||
64 | return -EPERM; | 64 | return -EPERM; |
65 | } | 65 | } |
66 | 66 | ||
67 | /* Macros to workout the correct index for the FPR in the thread struct */ | ||
68 | #define FPRNUMBER(i) (((i) - PT_FPR0) >> 1) | ||
69 | #define FPRHALF(i) (((i) - PT_FPR0) & 1) | ||
70 | #define FPRINDEX(i) TS_FPRWIDTH * FPRNUMBER(i) + FPRHALF(i) | ||
71 | |||
67 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | 72 | long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
68 | compat_ulong_t caddr, compat_ulong_t cdata) | 73 | compat_ulong_t caddr, compat_ulong_t cdata) |
69 | { | 74 | { |
@@ -122,7 +127,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
122 | * to be an array of unsigned int (32 bits) - the | 127 | * to be an array of unsigned int (32 bits) - the |
123 | * index passed in is based on this assumption. | 128 | * index passed in is based on this assumption. |
124 | */ | 129 | */ |
125 | tmp = ((unsigned int *)child->thread.fpr)[index - PT_FPR0]; | 130 | tmp = ((unsigned int *)child->thread.fpr) |
131 | [FPRINDEX(index)]; | ||
126 | } | 132 | } |
127 | ret = put_user((unsigned int)tmp, (u32 __user *)data); | 133 | ret = put_user((unsigned int)tmp, (u32 __user *)data); |
128 | break; | 134 | break; |
@@ -162,7 +168,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
162 | CHECK_FULL_REGS(child->thread.regs); | 168 | CHECK_FULL_REGS(child->thread.regs); |
163 | if (numReg >= PT_FPR0) { | 169 | if (numReg >= PT_FPR0) { |
164 | flush_fp_to_thread(child); | 170 | flush_fp_to_thread(child); |
165 | tmp = ((unsigned long int *)child->thread.fpr)[numReg - PT_FPR0]; | 171 | tmp = ((unsigned long int *)child->thread.fpr) |
172 | [FPRINDEX(numReg)]; | ||
166 | } else { /* register within PT_REGS struct */ | 173 | } else { /* register within PT_REGS struct */ |
167 | tmp = ptrace_get_reg(child, numReg); | 174 | tmp = ptrace_get_reg(child, numReg); |
168 | } | 175 | } |
@@ -217,7 +224,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
217 | * to be an array of unsigned int (32 bits) - the | 224 | * to be an array of unsigned int (32 bits) - the |
218 | * index passed in is based on this assumption. | 225 | * index passed in is based on this assumption. |
219 | */ | 226 | */ |
220 | ((unsigned int *)child->thread.fpr)[index - PT_FPR0] = data; | 227 | ((unsigned int *)child->thread.fpr) |
228 | [FPRINDEX(index)] = data; | ||
221 | ret = 0; | 229 | ret = 0; |
222 | } | 230 | } |
223 | break; | 231 | break; |