26 #include <linux/elf.h>
27 #include <linux/kernel.h>
29 #include <linux/ptrace.h>
32 #include <asm/uaccess.h>
39 unsigned int pos,
unsigned int count,
40 void *kbuf,
void __user *ubuf)
46 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
50 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
56 ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
67 unsigned int pos,
unsigned int count,
68 const void *kbuf,
const void __user *ubuf)
74 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
78 ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
84 ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
97 static const struct user_regset score7_regsets[] = {
101 .size =
sizeof(
long),
102 .
align =
sizeof(
long),
111 .regsets = score7_regsets,
117 return &user_score_native_view;
120 static int is_16bitinsn(
unsigned long insn)
130 unsigned long addr,
unsigned long *
res)
136 return copied !=
sizeof(*res) ? -
EIO : 0;
141 unsigned long addr,
unsigned short *
res)
147 return copied !=
sizeof(*res) ? -
EIO : 0;
152 unsigned long addr,
unsigned short val)
158 return copied !=
sizeof(
val) ? -
EIO : 0;
163 unsigned long addr,
unsigned long val)
169 return copied !=
sizeof(
val) ? -
EIO : 0;
175 unsigned int epc, far_epc = 0;
176 unsigned long epc_insn, far_epc_insn;
178 unsigned int tmp, tmp2;
180 child->
thread.single_step = 1;
181 child->
thread.ss_nextcnt = 1;
186 if (is_16bitinsn(epc_insn)) {
187 if ((epc_insn &
J16M) ==
J16) {
188 tmp = epc_insn & 0xFFE;
189 epc = (epc & 0xFFFFF000) | tmp;
190 }
else if ((epc_insn &
B16M) ==
B16) {
191 child->
thread.ss_nextcnt = 2;
192 tmp = (epc_insn & 0xFF) << 1;
194 tmp = (
unsigned int)((
int) tmp >> 23);
198 child->
thread.ss_nextcnt = 2;
199 tmp = (epc_insn >> 4) & 0xF;
205 if ((epc_insn &
J32M) ==
J32) {
206 tmp = epc_insn & 0x03FFFFFE;
208 tmp = (((tmp >> 16) & 0x3FF) << 15) | tmp2;
209 epc = (epc & 0xFFC00000) | tmp;
210 }
else if ((epc_insn &
B32M) ==
B32) {
211 child->
thread.ss_nextcnt = 2;
212 tmp = epc_insn & 0x03FFFFFE;
214 tmp = (((tmp >> 16) & 0x3FF) << 10) | tmp2;
216 tmp = (
unsigned int)((
int) tmp >> 12);
220 child->
thread.ss_nextcnt = 2;
221 tmp = (epc_insn >> 16) & 0x1F;
228 if (child->
thread.ss_nextcnt == 1) {
231 if (is_16bitinsn(epc_insn)) {
239 if (ninsn_type == 0) {
240 child->
thread.insn1_type = 0;
245 child->
thread.insn1_type = 1;
247 child->
thread.insn1 = epc_insn;
253 if (is_16bitinsn(epc_insn)) {
261 if (ninsn_type == 0) {
262 child->
thread.insn1_type = 0;
267 child->
thread.insn1_type = 1;
269 child->
thread.insn1 = epc_insn;
272 if (is_16bitinsn(far_epc_insn)) {
280 if (ninsn_type == 0) {
281 child->
thread.insn2_type = 0;
282 child->
thread.addr2 = far_epc;
286 child->
thread.insn2_type = 1;
287 child->
thread.addr2 = far_epc;
288 child->
thread.insn2 = far_epc_insn;
295 if (child->
thread.insn1_type == 0)
296 write_tsk_short(child, child->
thread.addr1,
299 if (child->
thread.insn1_type == 1)
300 write_tsk_long(child, child->
thread.addr1,
303 if (child->
thread.ss_nextcnt == 2) {
304 if (child->
thread.insn1_type == 0)
305 write_tsk_short(child, child->
thread.addr1,
307 if (child->
thread.insn1_type == 1)
308 write_tsk_long(child, child->
thread.addr1,
310 if (child->
thread.insn2_type == 0)
311 write_tsk_short(child, child->
thread.addr2,
313 if (child->
thread.insn2_type == 1)
314 write_tsk_long(child, child->
thread.addr2,
318 child->
thread.single_step = 0;
319 child->
thread.ss_nextcnt = 0;
329 unsigned long addr,
unsigned long data)
336 ret = copy_regset_to_user(child, &user_score_native_view,
343 ret = copy_regset_from_user(child, &user_score_native_view,