18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * System call table for UML/x86-64, copied from arch/x86/kernel/syscall_*.c 48c2ecf20Sopenharmony_ci * with some changes for UML. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/linkage.h> 88c2ecf20Sopenharmony_ci#include <linux/sys.h> 98c2ecf20Sopenharmony_ci#include <linux/cache.h> 108c2ecf20Sopenharmony_ci#include <asm/unistd.h> 118c2ecf20Sopenharmony_ci#include <asm/syscall.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define __NO_STUBS 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* 168c2ecf20Sopenharmony_ci * Below you can see, in terms of #define's, the differences between the x86-64 178c2ecf20Sopenharmony_ci * and the UML syscall table. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* Not going to be implemented by UML, since we have no hardware. */ 218c2ecf20Sopenharmony_ci#define sys_iopl sys_ni_syscall 228c2ecf20Sopenharmony_ci#define sys_ioperm sys_ni_syscall 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* 258c2ecf20Sopenharmony_ci * The UML TLS problem. Note that x86_64 does not implement this, so the below 268c2ecf20Sopenharmony_ci * is needed only for the ia32 compatibility. 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* On UML we call it this way ("old" means it's not mmap2) */ 308c2ecf20Sopenharmony_ci#define sys_mmap old_mmap 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci#define stub_clone sys_clone 338c2ecf20Sopenharmony_ci#define stub_fork sys_fork 348c2ecf20Sopenharmony_ci#define stub_vfork sys_vfork 358c2ecf20Sopenharmony_ci#define stub_execve sys_execve 368c2ecf20Sopenharmony_ci#define stub_execveat sys_execveat 378c2ecf20Sopenharmony_ci#define stub_rt_sigreturn sys_rt_sigreturn 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define __SYSCALL_X32(nr, sym) 408c2ecf20Sopenharmony_ci#define __SYSCALL_COMMON(nr, sym) __SYSCALL_64(nr, sym) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define __SYSCALL_64(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; 438c2ecf20Sopenharmony_ci#include <asm/syscalls_64.h> 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#undef __SYSCALL_64 468c2ecf20Sopenharmony_ci#define __SYSCALL_64(nr, sym) [ nr ] = sym, 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ciextern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciconst sys_call_ptr_t sys_call_table[] ____cacheline_aligned = { 518c2ecf20Sopenharmony_ci /* 528c2ecf20Sopenharmony_ci * Smells like a compiler bug -- it doesn't work 538c2ecf20Sopenharmony_ci * when the & below is removed. 548c2ecf20Sopenharmony_ci */ 558c2ecf20Sopenharmony_ci [0 ... __NR_syscall_max] = &sys_ni_syscall, 568c2ecf20Sopenharmony_ci#include <asm/syscalls_64.h> 578c2ecf20Sopenharmony_ci}; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciint syscall_table_size = sizeof(sys_call_table); 60