Jeff Dike | 95906b2 | 2008-02-04 22:31:20 -0800 | [diff] [blame] | 1 | /* |
H. Peter Anvin | 45db1c6 | 2011-12-05 16:08:49 -0800 | [diff] [blame] | 2 | * System call table for UML/x86-64, copied from arch/x86/kernel/syscall_*.c |
Jeff Dike | 95906b2 | 2008-02-04 22:31:20 -0800 | [diff] [blame] | 3 | * with some changes for UML. |
| 4 | */ |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 5 | |
| 6 | #include <linux/linkage.h> |
| 7 | #include <linux/sys.h> |
| 8 | #include <linux/cache.h> |
H. Peter Anvin | 45db1c6 | 2011-12-05 16:08:49 -0800 | [diff] [blame] | 9 | #include <generated/user_constants.h> |
Andy Lutomirski | 034042c | 2015-10-05 17:48:06 -0700 | [diff] [blame] | 10 | #include <asm/syscall.h> |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 11 | |
| 12 | #define __NO_STUBS |
| 13 | |
Jeff Dike | 95906b2 | 2008-02-04 22:31:20 -0800 | [diff] [blame] | 14 | /* |
| 15 | * Below you can see, in terms of #define's, the differences between the x86-64 |
| 16 | * and the UML syscall table. |
| 17 | */ |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 18 | |
| 19 | /* Not going to be implemented by UML, since we have no hardware. */ |
Denys Vlasenko | 616ab24 | 2015-03-10 11:45:06 +0100 | [diff] [blame] | 20 | #define sys_iopl sys_ni_syscall |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 21 | #define sys_ioperm sys_ni_syscall |
| 22 | |
Jeff Dike | 95906b2 | 2008-02-04 22:31:20 -0800 | [diff] [blame] | 23 | /* |
| 24 | * The UML TLS problem. Note that x86_64 does not implement this, so the below |
| 25 | * is needed only for the ia32 compatibility. |
| 26 | */ |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 27 | |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 28 | /* On UML we call it this way ("old" means it's not mmap2) */ |
| 29 | #define sys_mmap old_mmap |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 30 | |
| 31 | #define stub_clone sys_clone |
| 32 | #define stub_fork sys_fork |
| 33 | #define stub_vfork sys_vfork |
| 34 | #define stub_execve sys_execve |
David Drysdale | 27d6ec7 | 2014-12-12 16:57:33 -0800 | [diff] [blame] | 35 | #define stub_execveat sys_execveat |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 36 | #define stub_rt_sigreturn sys_rt_sigreturn |
| 37 | |
H. Peter Anvin | 6630f11 | 2012-02-14 14:18:50 -0800 | [diff] [blame] | 38 | #define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat) |
| 39 | #define __SYSCALL_X32(nr, sym, compat) /* Not supported */ |
| 40 | |
Andy Lutomirski | eb974c6 | 2015-10-05 17:48:07 -0700 | [diff] [blame] | 41 | #define __SYSCALL_64(nr, sym, compat) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; |
H. Peter Anvin | 45db1c6 | 2011-12-05 16:08:49 -0800 | [diff] [blame] | 42 | #include <asm/syscalls_64.h> |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 43 | |
H. Peter Anvin | 45db1c6 | 2011-12-05 16:08:49 -0800 | [diff] [blame] | 44 | #undef __SYSCALL_64 |
| 45 | #define __SYSCALL_64(nr, sym, compat) [ nr ] = sym, |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 46 | |
Andy Lutomirski | eb974c6 | 2015-10-05 17:48:07 -0700 | [diff] [blame] | 47 | extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 48 | |
Daniel Borkmann | b485342 | 2015-01-03 13:11:10 +0100 | [diff] [blame] | 49 | const sys_call_ptr_t sys_call_table[] ____cacheline_aligned = { |
H. Peter Anvin | 45db1c6 | 2011-12-05 16:08:49 -0800 | [diff] [blame] | 50 | /* |
| 51 | * Smells like a compiler bug -- it doesn't work |
| 52 | * when the & below is removed. |
| 53 | */ |
| 54 | [0 ... __NR_syscall_max] = &sys_ni_syscall, |
| 55 | #include <asm/syscalls_64.h> |
Paolo 'Blaisorblade' Giarrusso | 80f9507 | 2005-05-01 08:58:55 -0700 | [diff] [blame] | 56 | }; |
Jeff Dike | f87ea91 | 2008-02-04 22:31:29 -0800 | [diff] [blame] | 57 | |
| 58 | int syscall_table_size = sizeof(sys_call_table); |