diff options
author | Bodo Stroesser <bstroesser@fujitsu-siemens.com> | 2005-05-07 00:30:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-07 01:09:29 -0400 |
commit | 82c1c11bdd92d94f8fd620a3ea6c894eba37d4ed (patch) | |
tree | bc2ac7e025e250678261695a19e171f2991746c6 /arch/um/sys-x86_64 | |
parent | 16c11163019879c0e1e69d3ec7d4574a80e9c77e (diff) |
[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>
Diffstat (limited to 'arch/um/sys-x86_64')
-rw-r--r-- | arch/um/sys-x86_64/ptrace.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c index 8c146b2a1e00..b593bb256f2c 100644 --- a/arch/um/sys-x86_64/ptrace.c +++ b/arch/um/sys-x86_64/ptrace.c | |||
@@ -62,6 +62,27 @@ int putreg(struct task_struct *child, int regno, unsigned long value) | |||
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | int poke_user(struct task_struct *child, long addr, long data) | ||
66 | { | ||
67 | if ((addr & 3) || addr < 0) | ||
68 | return -EIO; | ||
69 | |||
70 | if (addr < MAX_REG_OFFSET) | ||
71 | return putreg(child, addr, data); | ||
72 | |||
73 | #if 0 /* Need x86_64 debugregs handling */ | ||
74 | else if((addr >= offsetof(struct user, u_debugreg[0])) && | ||
75 | (addr <= offsetof(struct user, u_debugreg[7]))){ | ||
76 | addr -= offsetof(struct user, u_debugreg[0]); | ||
77 | addr = addr >> 2; | ||
78 | if((addr == 4) || (addr == 5)) return -EIO; | ||
79 | child->thread.arch.debugregs[addr] = data; | ||
80 | return 0; | ||
81 | } | ||
82 | #endif | ||
83 | return -EIO; | ||
84 | } | ||
85 | |||
65 | unsigned long getreg(struct task_struct *child, int regno) | 86 | unsigned long getreg(struct task_struct *child, int regno) |
66 | { | 87 | { |
67 | unsigned long retval = ~0UL; | 88 | unsigned long retval = ~0UL; |
@@ -84,6 +105,29 @@ unsigned long getreg(struct task_struct *child, int regno) | |||
84 | return retval; | 105 | return retval; |
85 | } | 106 | } |
86 | 107 | ||
108 | int peek_user(struct task_struct *child, long addr, long data) | ||
109 | { | ||
110 | /* read the word at location addr in the USER area. */ | ||
111 | unsigned long tmp; | ||
112 | |||
113 | if ((addr & 3) || addr < 0) | ||
114 | return -EIO; | ||
115 | |||
116 | tmp = 0; /* Default return condition */ | ||
117 | if(addr < MAX_REG_OFFSET){ | ||
118 | tmp = getreg(child, addr); | ||
119 | } | ||
120 | #if 0 /* Need x86_64 debugregs handling */ | ||
121 | else if((addr >= offsetof(struct user, u_debugreg[0])) && | ||
122 | (addr <= offsetof(struct user, u_debugreg[7]))){ | ||
123 | addr -= offsetof(struct user, u_debugreg[0]); | ||
124 | addr = addr >> 2; | ||
125 | tmp = child->thread.arch.debugregs[addr]; | ||
126 | } | ||
127 | #endif | ||
128 | return put_user(tmp, (unsigned long *) data); | ||
129 | } | ||
130 | |||
87 | void arch_switch(void) | 131 | void arch_switch(void) |
88 | { | 132 | { |
89 | /* XXX | 133 | /* XXX |