2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
6 #include "linux/config.h"
7 #include "linux/slab.h"
8 #include "asm/uaccess.h"
9 #include "asm/ptrace.h"
10 #include "choose-mode.h"
14 extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
16 int sys_modify_ldt_tt(int func, void *ptr, unsigned long bytecount)
18 if(verify_area(VERIFY_READ, ptr, bytecount)) return(-EFAULT);
19 return(modify_ldt(func, ptr, bytecount));
23 #ifdef CONFIG_MODE_SKAS
24 extern int userspace_pid;
26 int sys_modify_ldt_skas(int func, void *ptr, unsigned long bytecount)
28 struct ptrace_ldt ldt;
32 buf = kmalloc(bytecount, GFP_KERNEL);
41 res = copy_from_user(buf, ptr, bytecount);
50 ldt = ((struct ptrace_ldt) { .func = func,
52 .bytecount = bytecount });
53 res = ptrace(PTRACE_LDT, userspace_pid, 0, (unsigned long) &ldt);
61 res = copy_to_user(ptr, buf, n);
75 int sys_modify_ldt(int func, void *ptr, unsigned long bytecount)
77 return(CHOOSE_MODE_PROC(sys_modify_ldt_tt, sys_modify_ldt_skas, func,
84 * Overrides for Emacs so that we follow Linus's tabbing style.
85 * Emacs will notice this stuff at the end of the file and automatically
86 * adjust the settings for this buffer only. This must remain at the end
88 * ---------------------------------------------------------------------------
90 * c-file-style: "linux"