- while(1){
- if(ptrace(PTRACE_SYSCALL, pid, 0, 0) < 0)
- panic("check_ptrace : ptrace failed, errno = %d",
- errno);
- n = waitpid(pid, &status, WUNTRACED);
- if(n < 0)
- panic("check_ptrace : wait failed, errno = %d", errno);
- if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
- panic("check_ptrace : expected SIGTRAP, "
- "got status = %d", status);
-
- syscall = ptrace(PTRACE_PEEKUSER, pid, PT_SYSCALL_NR_OFFSET,
- 0);
- if(syscall == __NR_getpid){
- n = ptrace(PTRACE_POKEUSER, pid, PT_SYSCALL_NR_OFFSET,
- __NR_getppid);
- if(n < 0)
- panic("check_ptrace : failed to modify system "
- "call, errno = %d", errno);
- break;
- }
- }
- stop_ptraced_child(pid, stack, 0);
- printk("OK\n");
-
- printk("Checking syscall emulation patch for ptrace...");
- set_using_sysemu(0);
- pid = start_ptraced_child(&stack);
- if(ptrace(PTRACE_SYSEMU, pid, 0, 0) >= 0) {
- struct user_regs_struct regs;
-
- if (waitpid(pid, &status, WUNTRACED) < 0)
- panic("check_ptrace : wait failed, errno = %d", errno);
- if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGTRAP))
- panic("check_ptrace : expected SIGTRAP, "
- "got status = %d", status);
-
- if (ptrace(PTRACE_GETREGS, pid, 0, ®s) < 0)
- panic("check_ptrace : failed to read child "
- "registers, errno = %d", errno);
- regs.orig_eax = pid;
- if (ptrace(PTRACE_SETREGS, pid, 0, ®s) < 0)
- panic("check_ptrace : failed to modify child "
- "registers, errno = %d", errno);
-
- stop_ptraced_child(pid, stack, 0);
-
- if (!force_sysemu_disabled) {
- printk("found\n");
- set_using_sysemu(1);
- } else {
- printk("found but disabled\n");
- }
- }
- else
- {
- printk("missing\n");
- stop_ptraced_child(pid, stack, 1);
- }
+void *um_kmalloc(int size)
+{
+ return kmalloc(size, GFP_KERNEL);
+}
+
+void *um_kmalloc_atomic(int size)
+{
+ return kmalloc(size, GFP_ATOMIC);
+}
+
+void *um_vmalloc(int size)
+{
+ return vmalloc(size);
+}
+
+void *um_vmalloc_atomic(int size)
+{
+ return __vmalloc(size, GFP_ATOMIC | __GFP_HIGHMEM, PAGE_KERNEL);
+}
+
+int __cant_sleep(void) {
+ return in_atomic() || irqs_disabled() || in_interrupt();
+ /* Is in_interrupt() really needed? */
+}
+
+unsigned long get_fault_addr(void)
+{
+ return((unsigned long) current->thread.fault_addr);
+}
+
+EXPORT_SYMBOL(get_fault_addr);
+
+void not_implemented(void)
+{
+ printk(KERN_DEBUG "Something isn't implemented in here\n");
+}
+
+EXPORT_SYMBOL(not_implemented);
+
+int user_context(unsigned long sp)
+{
+ unsigned long stack;
+
+ stack = sp & (PAGE_MASK << CONFIG_KERNEL_STACK_ORDER);
+ return(stack != (unsigned long) current_thread);
+}
+
+extern exitcall_t __uml_exitcall_begin, __uml_exitcall_end;
+
+void do_uml_exitcalls(void)
+{
+ exitcall_t *call;
+
+ call = &__uml_exitcall_end;
+ while (--call >= &__uml_exitcall_begin)
+ (*call)();
+}
+
+char *uml_strdup(char *string)
+{
+ return kstrdup(string, GFP_KERNEL);
+}
+
+int copy_to_user_proc(void __user *to, void *from, int size)
+{
+ return(copy_to_user(to, from, size));
+}
+
+int copy_from_user_proc(void *to, void __user *from, int size)
+{
+ return(copy_from_user(to, from, size));
+}