1 #include "linux/sched.h"
2 #include "asm/ptrace.h"
4 int putreg(struct task_struct
*child
, unsigned long regno
,
7 child
->thread
.process_regs
.regs
[regno
>> 2] = value
;
11 int poke_user(struct task_struct
*child
, long addr
, long data
)
13 if ((addr
& 3) || addr
< 0)
16 if (addr
< MAX_REG_OFFSET
)
17 return putreg(child
, addr
, data
);
19 else if((addr
>= offsetof(struct user
, u_debugreg
[0])) &&
20 (addr
<= offsetof(struct user
, u_debugreg
[7]))){
21 addr
-= offsetof(struct user
, u_debugreg
[0]);
23 if((addr
== 4) || (addr
== 5)) return -EIO
;
24 child
->thread
.arch
.debugregs
[addr
] = data
;
30 unsigned long getreg(struct task_struct
*child
, unsigned long regno
)
32 unsigned long retval
= ~0UL;
34 retval
&= child
->thread
.process_regs
.regs
[regno
>> 2];
38 int peek_user(struct task_struct
*child
, long addr
, long data
)
40 /* read the word at location addr in the USER area. */
43 if ((addr
& 3) || addr
< 0)
46 tmp
= 0; /* Default return condition */
47 if(addr
< MAX_REG_OFFSET
){
48 tmp
= getreg(child
, addr
);
50 else if((addr
>= offsetof(struct user
, u_debugreg
[0])) &&
51 (addr
<= offsetof(struct user
, u_debugreg
[7]))){
52 addr
-= offsetof(struct user
, u_debugreg
[0]);
54 tmp
= child
->thread
.arch
.debugregs
[addr
];
56 return put_user(tmp
, (unsigned long *) data
);
60 * Overrides for Emacs so that we follow Linus's tabbing style.
61 * Emacs will notice this stuff at the end of the file and automatically
62 * adjust the settings for this buffer only. This must remain at the end
64 * ---------------------------------------------------------------------------
66 * c-file-style: "linux"