Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 59 lines (54 sloc) 2.346 kb
d51bfc2 @nelhage Add the license to the files in arch/, too.
authored
1 /*
2 * Copyright (C) 2011 by Nelson Elhage
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
14f8754 @nelhage Change how arch/ works in preparation for 32-on-64 support.
authored
22 static struct ptrace_personality arch_personality[1] = {
23 {
24 offsetof(struct user, regs.uregs[0]),
25 offsetof(struct user, regs.uregs[0]),
26 offsetof(struct user, regs.uregs[1]),
27 offsetof(struct user, regs.uregs[2]),
28 offsetof(struct user, regs.uregs[3]),
29 offsetof(struct user, regs.uregs[4]),
30 offsetof(struct user, regs.uregs[5]),
31 offsetof(struct user, regs.ARM_pc),
32 }
33 };
6e4d75a @nelhage Initial ARM support.
authored
34
14f8754 @nelhage Change how arch/ works in preparation for 32-on-64 support.
authored
35 static inline void arch_fixup_regs(struct ptrace_child *child) {
36 child->user.regs.ARM_pc -= 4;
6e4d75a @nelhage Initial ARM support.
authored
37 }
38
39 static inline int arch_set_syscall(struct ptrace_child *child,
40 unsigned long sysno) {
41 return ptrace_command(child, PTRACE_SET_SYSCALL, 0, sysno);
42 }
43
44 static inline int arch_save_syscall(struct ptrace_child *child) {
45 unsigned long swi;
14f8754 @nelhage Change how arch/ works in preparation for 32-on-64 support.
authored
46 swi = ptrace_command(child, PTRACE_PEEKTEXT, child->user.regs.ARM_pc);
6e4d75a @nelhage Initial ARM support.
authored
47 if (child->error)
48 return -1;
49 if (swi == 0xef000000)
50 child->saved_syscall = child->user.regs.uregs[7];
51 else
52 child->saved_syscall = (swi & 0x000fffff);
53 return 0;
54 }
55
56 static inline int arch_restore_syscall(struct ptrace_child *child) {
57 return arch_set_syscall(child, child->saved_syscall);
58 }
Something went wrong with that request. Please try again.