2 * Copyright 2003 PathScale, Inc.
4 * Licensed under the GPL
7 #include "linux/linkage.h"
8 #include "linux/slab.h"
10 #include "linux/utsname.h"
11 #include "linux/personality.h"
12 #include "asm/uaccess.h"
13 #define __FRAME_OFFSETS
14 #include "asm/ptrace.h"
15 #include "asm/unistd.h"
16 #include "asm/prctl.h" /* XXX This should get the constants from libc */
17 #include "choose-mode.h"
20 asmlinkage
long sys_uname64(struct new_utsname __user
* name
)
24 err
= copy_to_user(name
, &system_utsname
, sizeof (*name
));
26 if (personality(current
->personality
) == PER_LINUX32
)
27 err
|= copy_to_user(&name
->machine
, "i686", 5);
28 return err
? -EFAULT
: 0;
32 extern long arch_prctl(int code
, unsigned long addr
);
34 static long arch_prctl_tt(int code
, unsigned long addr
)
42 ret
= arch_prctl(code
, addr
);
46 ret
= arch_prctl(code
, (unsigned long) &tmp
);
48 ret
= put_user(tmp
, &addr
);
59 #ifdef CONFIG_MODE_SKAS
61 /* XXX: Must also call arch_prctl in the host, beside saving the segment bases! */
62 static long arch_prctl_skas(int code
, unsigned long addr
)
68 current
->thread
.regs
.regs
.skas
.regs
[FS_BASE
/ sizeof(unsigned long)] = addr
;
71 current
->thread
.regs
.regs
.skas
.regs
[GS_BASE
/ sizeof(unsigned long)] = addr
;
74 ret
= put_user(current
->thread
.regs
.regs
.skas
.
75 regs
[FS_BASE
/ sizeof(unsigned long)],
76 (unsigned long __user
*)addr
);
79 ret
= put_user(current
->thread
.regs
.regs
.skas
.
80 regs
[GS_BASE
/ sizeof(unsigned long)],
81 (unsigned long __user
*)addr
);
92 long sys_arch_prctl(int code
, unsigned long addr
)
94 return(CHOOSE_MODE_PROC(arch_prctl_tt
, arch_prctl_skas
, code
, addr
));
97 long sys_clone(unsigned long clone_flags
, unsigned long newsp
,
98 void __user
*parent_tid
, void __user
*child_tid
)
103 newsp
= UPT_SP(¤t
->thread
.regs
.regs
);
104 current
->thread
.forking
= 1;
105 ret
= do_fork(clone_flags
, newsp
, ¤t
->thread
.regs
, 0, parent_tid
,
107 current
->thread
.forking
= 0;