2012-10-08 02:27:32 +00:00
|
|
|
#include <linux/sched.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include "asm/ptrace.h"
|
|
|
|
|
|
|
|
int putreg(struct task_struct *child, unsigned long regno,
|
|
|
|
unsigned long value)
|
|
|
|
{
|
|
|
|
child->thread.process_regs.regs[regno >> 2] = value;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
[PATCH] uml: S390 preparation, peekusr/pokeusr defined by subarch
s390 needs to change some parts of arch/um/kernel/ptrace.c. Thus, the code
regarding PEEKUSER and POKEUSER are shifted to arch/um/sys-<subarch>/ptrace.c.
Also s390 debug registers need to be updated, when singlestepping is switched
on / off. Thus, setting/resetting of singlestepping is centralized in the new
function set_singlestep(), which also inserts the macro
SUBARCH_SET_SINGLESTEP(mode), if defined.
Finally, s390 has the "ieee_instruction_pointer" in its
registers, which also is allowed to be read via
ptrace( PTRACE_PEEKUSER, getpid(), PT_IEEE_IP, 0);
To implement this feature, sys_ptrace inserts the macro
SUBARCH_PTRACE_SPECIAL, if defined.
Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-07 04:30:46 +00:00
|
|
|
int poke_user(struct task_struct *child, long addr, long data)
|
|
|
|
{
|
|
|
|
if ((addr & 3) || addr < 0)
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
if (addr < MAX_REG_OFFSET)
|
|
|
|
return putreg(child, addr, data);
|
|
|
|
|
|
|
|
else if((addr >= offsetof(struct user, u_debugreg[0])) &&
|
|
|
|
(addr <= offsetof(struct user, u_debugreg[7]))){
|
|
|
|
addr -= offsetof(struct user, u_debugreg[0]);
|
|
|
|
addr = addr >> 2;
|
|
|
|
if((addr == 4) || (addr == 5)) return -EIO;
|
|
|
|
child->thread.arch.debugregs[addr] = data;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
unsigned long getreg(struct task_struct *child, unsigned long regno)
|
|
|
|
{
|
|
|
|
unsigned long retval = ~0UL;
|
|
|
|
|
|
|
|
retval &= child->thread.process_regs.regs[regno >> 2];
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[PATCH] uml: S390 preparation, peekusr/pokeusr defined by subarch
s390 needs to change some parts of arch/um/kernel/ptrace.c. Thus, the code
regarding PEEKUSER and POKEUSER are shifted to arch/um/sys-<subarch>/ptrace.c.
Also s390 debug registers need to be updated, when singlestepping is switched
on / off. Thus, setting/resetting of singlestepping is centralized in the new
function set_singlestep(), which also inserts the macro
SUBARCH_SET_SINGLESTEP(mode), if defined.
Finally, s390 has the "ieee_instruction_pointer" in its
registers, which also is allowed to be read via
ptrace( PTRACE_PEEKUSER, getpid(), PT_IEEE_IP, 0);
To implement this feature, sys_ptrace inserts the macro
SUBARCH_PTRACE_SPECIAL, if defined.
Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-07 04:30:46 +00:00
|
|
|
int peek_user(struct task_struct *child, long addr, long data)
|
|
|
|
{
|
|
|
|
/* read the word at location addr in the USER area. */
|
|
|
|
unsigned long tmp;
|
|
|
|
|
|
|
|
if ((addr & 3) || addr < 0)
|
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
tmp = 0; /* Default return condition */
|
|
|
|
if(addr < MAX_REG_OFFSET){
|
|
|
|
tmp = getreg(child, addr);
|
|
|
|
}
|
|
|
|
else if((addr >= offsetof(struct user, u_debugreg[0])) &&
|
|
|
|
(addr <= offsetof(struct user, u_debugreg[7]))){
|
|
|
|
addr -= offsetof(struct user, u_debugreg[0]);
|
|
|
|
addr = addr >> 2;
|
|
|
|
tmp = child->thread.arch.debugregs[addr];
|
|
|
|
}
|
|
|
|
return put_user(tmp, (unsigned long *) data);
|
|
|
|
}
|
|
|
|
|