16 #include <ptrace_user.h>
17 #include <registers.h>
19 #include <sysdep/ptrace.h>
26 static inline unsigned long *check_init_stack(
struct mm_id * mm_idp,
30 stack = (
unsigned long *) mm_idp->
stack + 2;
38 static int __init init_syscall_regs(
void)
42 ((
unsigned long) &batch_syscall_stub -
51 static inline long do_syscall_stub(
struct mm_id * mm_idp,
void **
addr)
68 panic(
"do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
74 panic(
"Failed to continue stub, pid = %d, errno = %d\n", pid,
85 ret = *((
unsigned long *) mm_idp->
stack);
86 offset = *((
unsigned long *) mm_idp->
stack + 1);
90 "data = %p\n", ret, offset, data);
91 syscall = (
unsigned long *)((
unsigned long)data + data[0]);
93 "return value = 0x%lx, expected return value = 0x%lx\n",
94 syscall[0], ret, syscall[7]);
96 "0x%lx 0x%lx 0x%lx 0x%lx 0x%lx 0x%lx\n",
97 syscall[1], syscall[2], syscall[3],
98 syscall[4], syscall[5], syscall[6]);
99 for (n = 1; n < data[0]/
sizeof(
long); n++) {
105 printk(
" 0x%lx", data[n]);
112 *addr = check_init_stack(mm_idp,
NULL);
118 unsigned long *args,
long expected,
void **addr,
121 unsigned long *stack = check_init_stack(mm_idp, *addr);
123 *stack +=
sizeof(
long);
124 stack += *stack /
sizeof(
long);
136 if (!done && ((((
unsigned long) stack) & ~UM_KERN_PAGE_MASK) <
137 UM_KERN_PAGE_SIZE - 10 *
sizeof(
long))) {
142 return do_syscall_stub(mm_idp, addr);
147 void **addr,
void **stub_addr)
149 unsigned long *
stack;
156 if ((((
unsigned long) *addr) & ~UM_KERN_PAGE_MASK) >=
157 UM_KERN_PAGE_SIZE - (10 + data_count) *
sizeof(
long)) {
158 ret = do_syscall_stub(mm_idp, addr);
164 stack = check_init_stack(mm_idp, *addr);
167 *stack = data_count *
sizeof(
long);
169 memcpy(stack + 1, data, data_count *
sizeof(
long));
171 *stub_addr = (
void *)(((
unsigned long)(stack + 1) &
177 int map(
struct mm_id * mm_idp,
unsigned long virt,
unsigned long len,
int prot,
178 int phys_fd,
unsigned long long offset,
int done,
void **data)
198 if (ret !=
sizeof(map)) {
206 unsigned long args[] = { virt, len, prot,
217 int unmap(
struct mm_id * mm_idp,
unsigned long addr,
unsigned long len,
218 int done,
void **data)
230 (
unsigned long) addr,
233 if (ret !=
sizeof(unmap)) {
241 unsigned long args[] = { (
unsigned long) addr, len, 0, 0, 0,
251 int protect(
struct mm_id * mm_idp,
unsigned long addr,
unsigned long len,
252 unsigned int prot,
int done,
void **data)
264 (
unsigned long) addr,
266 .prot = prot } } } );
269 if (ret !=
sizeof(protect)) {
276 unsigned long args[] = {
addr, len, prot, 0, 0, 0 };