Commit 5674124f authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-syscall-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

* 'x86-syscall-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86: Move <asm/asm-offsets.h> from trace_syscalls.c to asm/syscall.h
  x86, um: Fix typo in 32-bit system call modifications
  um: Use $(srctree) not $(KBUILD_SRC)
  x86, um: Mark system call tables readonly
  x86, um: Use the same style generated syscall tables as native
  um: Generate headers before generating user-offsets.s
  um: Run host archheaders, allow use of host generated headers
  kbuild, headers.sh: Don't make archheaders explicitly
  x86, syscall: Allow syscall offset to be symbolic
  x86, syscall: Re-fix typo in comment
  x86: Simplify syscallhdr.sh
  x86: Generate system call tables and unistd_*.h from tables
  checksyscalls: Use arch/x86/syscalls/syscall_32.tbl as source
  x86: Machine-readable syscall tables and scripts to process them
  trace: Include <asm/asm-offsets.h> in trace_syscalls.c
  x86-64, ia32: Move compat_ni_syscall into C and its own file
  x86-64, syscall: Adjust comment spacing and remove typo
  kbuild: Add support for an "archheaders" target
  kbuild: Add support for installing generated asm headers
parents 5d48421b 72142fd4
......@@ -33,14 +33,15 @@ This document describes the Linux kernel Makefiles.
=== 6 Architecture Makefiles
--- 6.1 Set variables to tweak the build to the architecture
--- 6.2 Add prerequisites to archprepare:
--- 6.3 List directories to visit when descending
--- 6.4 Architecture-specific boot images
--- 6.5 Building non-kbuild targets
--- 6.6 Commands useful for building a boot image
--- 6.7 Custom kbuild commands
--- 6.8 Preprocessing linker scripts
--- 6.9 Generic header files
--- 6.2 Add prerequisites to archheaders:
--- 6.3 Add prerequisites to archprepare:
--- 6.4 List directories to visit when descending
--- 6.5 Architecture-specific boot images
--- 6.6 Building non-kbuild targets
--- 6.7 Commands useful for building a boot image
--- 6.8 Custom kbuild commands
--- 6.9 Preprocessing linker scripts
--- 6.10 Generic header files
=== 7 Kbuild syntax for exported headers
--- 7.1 header-y
......@@ -252,7 +253,7 @@ more details, with real examples.
This will create a library lib.a based on delay.o. For kbuild to
actually recognize that there is a lib.a being built, the directory
shall be listed in libs-y.
See also "6.3 List directories to visit when descending".
See also "6.4 List directories to visit when descending".
Use of lib-y is normally restricted to lib/ and arch/*/lib.
......@@ -974,7 +975,20 @@ When kbuild executes, the following steps are followed (roughly):
$(KBUILD_ARFLAGS) set by the top level Makefile to "D" (deterministic
mode) if this option is supported by $(AR).
--- 6.2 Add prerequisites to archprepare:
--- 6.2 Add prerequisites to archheaders:
The archheaders: rule is used to generate header files that
may be installed into user space by "make header_install" or
"make headers_install_all". In order to support
"make headers_install_all", this target has to be able to run
on an unconfigured tree, or a tree configured for another
architecture.
It is run before "make archprepare" when run on the
architecture itself.
--- 6.3 Add prerequisites to archprepare:
The archprepare: rule is used to list prerequisites that need to be
built before starting to descend down in the subdirectories.
......@@ -990,7 +1004,7 @@ When kbuild executes, the following steps are followed (roughly):
generating offset header files.
--- 6.3 List directories to visit when descending
--- 6.4 List directories to visit when descending
An arch Makefile cooperates with the top Makefile to define variables
which specify how to build the vmlinux file. Note that there is no
......@@ -1019,7 +1033,7 @@ When kbuild executes, the following steps are followed (roughly):
drivers-$(CONFIG_OPROFILE) += arch/sparc64/oprofile/
--- 6.4 Architecture-specific boot images
--- 6.5 Architecture-specific boot images
An arch Makefile specifies goals that take the vmlinux file, compress
it, wrap it in bootstrapping code, and copy the resulting files
......@@ -1070,7 +1084,7 @@ When kbuild executes, the following steps are followed (roughly):
When "make" is executed without arguments, bzImage will be built.
--- 6.5 Building non-kbuild targets
--- 6.6 Building non-kbuild targets
extra-y
......@@ -1090,7 +1104,7 @@ When kbuild executes, the following steps are followed (roughly):
shall be built, but shall not be linked as part of built-in.o.
--- 6.6 Commands useful for building a boot image
--- 6.7 Commands useful for building a boot image
Kbuild provides a few macros that are useful when building a
boot image.
......@@ -1112,7 +1126,7 @@ When kbuild executes, the following steps are followed (roughly):
always be built.
Assignments to $(targets) are without $(obj)/ prefix.
if_changed may be used in conjunction with custom commands as
defined in 6.7 "Custom kbuild commands".
defined in 6.8 "Custom kbuild commands".
Note: It is a typical mistake to forget the FORCE prerequisite.
Another common pitfall is that whitespace is sometimes
......@@ -1171,7 +1185,7 @@ When kbuild executes, the following steps are followed (roughly):
$(obj)/%.dtb: $(src)/%.dts
$(call cmd,dtc)
--- 6.7 Custom kbuild commands
--- 6.8 Custom kbuild commands
When kbuild is executing with KBUILD_VERBOSE=0, then only a shorthand
of a command is normally displayed.
......@@ -1198,7 +1212,7 @@ When kbuild executes, the following steps are followed (roughly):
will be displayed with "make KBUILD_VERBOSE=0".
--- 6.8 Preprocessing linker scripts
--- 6.9 Preprocessing linker scripts
When the vmlinux image is built, the linker script
arch/$(ARCH)/kernel/vmlinux.lds is used.
......@@ -1228,7 +1242,7 @@ When kbuild executes, the following steps are followed (roughly):
The kbuild infrastructure for *lds file are used in several
architecture-specific files.
--- 6.9 Generic header files
--- 6.10 Generic header files
The directory include/asm-generic contains the header files
that may be shared between individual architectures.
......
......@@ -442,7 +442,7 @@ asm-generic:
no-dot-config-targets := clean mrproper distclean \
cscope gtags TAGS tags help %docs check% coccicheck \
include/linux/version.h headers_% \
include/linux/version.h headers_% archheaders \
kernelversion %src-pkg
config-targets := 0
......@@ -979,7 +979,7 @@ prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
include/config/auto.conf
$(cmd_crmodverdir)
archprepare: prepare1 scripts_basic
archprepare: archheaders prepare1 scripts_basic
prepare0: archprepare FORCE
$(Q)$(MAKE) $(build)=.
......@@ -1046,8 +1046,11 @@ hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
# If we do an all arch process set dst to asm-$(hdr-arch)
hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
PHONY += archheaders
archheaders:
PHONY += __headers
__headers: include/linux/version.h scripts_basic asm-generic FORCE
__headers: include/linux/version.h scripts_basic asm-generic archheaders FORCE
$(Q)$(MAKE) $(build)=scripts build_unifdef
PHONY += headers_install_all
......
......@@ -64,7 +64,8 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
#This will adjust *FLAGS accordingly to the platform.
include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include
KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \
-I$(HOST_DIR)/include/generated
# -Derrno=kernel_errno - This turns all kernel references to errno into
# kernel_errno to separate them from the libc errno. This allows -fno-common
......@@ -96,6 +97,10 @@ endef
KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig
archheaders:
$(Q)$(MAKE) -C '$(srctree)' KBUILD_SRC= \
ARCH=$(SUBARCH) O='$(objtree)' archheaders
archprepare: include/generated/user_constants.h
LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
......@@ -135,7 +140,7 @@ archclean:
# Generated files
$(HOST_DIR)/um/user-offsets.s: FORCE
$(HOST_DIR)/um/user-offsets.s: __headers FORCE
$(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@
define filechk_gen-asm-offsets
......
......@@ -117,6 +117,12 @@ KBUILD_CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
KBUILD_CFLAGS += $(mflags-y)
KBUILD_AFLAGS += $(mflags-y)
###
# Syscall table generation
archheaders:
$(Q)$(MAKE) $(build)=arch/x86/syscalls all
###
# Kernel objects
......
......@@ -3,6 +3,7 @@
#
obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o
obj-$(CONFIG_IA32_EMULATION) += nosyscall.o syscall_ia32.o
sysv-$(CONFIG_SYSVIPC) := ipc32.o
obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
......
This diff is collapsed.
#include <linux/kernel.h>
#include <linux/errno.h>
long compat_ni_syscall(void)
{
return -ENOSYS;
}
/* System call table for ia32 emulation. */
#include <linux/linkage.h>
#include <linux/sys.h>
#include <linux/cache.h>
#include <asm/asm-offsets.h>
#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void compat(void) ;
#include <asm/syscalls_32.h>
#undef __SYSCALL_I386
#define __SYSCALL_I386(nr, sym, compat) [nr] = compat,
typedef void (*sys_call_ptr_t)(void);
extern void compat_ni_syscall(void);
const sys_call_ptr_t ia32_sys_call_table[__NR_ia32_syscall_max+1] = {
/*
* Smells like a compiler bug -- it doesn't work
* when the & below is removed.
*/
[0 ... __NR_ia32_syscall_max] = &compat_ni_syscall,
#include <asm/syscalls_32.h>
};
......@@ -19,7 +19,8 @@ header-y += processor-flags.h
header-y += ptrace-abi.h
header-y += sigcontext32.h
header-y += ucontext.h
header-y += unistd_32.h
header-y += unistd_64.h
header-y += vm86.h
header-y += vsyscall.h
genhdr-y += unistd_32.h
genhdr-y += unistd_64.h
......@@ -2,17 +2,10 @@
#define _ASM_X86_IA32_UNISTD_H
/*
* This file contains the system call numbers of the ia32 port,
* This file contains the system call numbers of the ia32 compat ABI,
* this is for the kernel only.
* Only add syscalls here where some part of the kernel needs to know
* the number. This should be otherwise in sync with asm-x86/unistd_32.h. -AK
*/
#define __NR_ia32_restart_syscall 0
#define __NR_ia32_exit 1
#define __NR_ia32_read 3
#define __NR_ia32_write 4
#define __NR_ia32_sigreturn 119
#define __NR_ia32_rt_sigreturn 173
#define __SYSCALL_ia32_NR(x) (x)
#include <asm/unistd_32_ia32.h>
#endif /* _ASM_X86_IA32_UNISTD_H */
......@@ -15,6 +15,7 @@
#include <linux/sched.h>
#include <linux/err.h>
#include <asm/asm-offsets.h> /* For NR_syscalls */
extern const unsigned long sys_call_table[];
......
#ifndef _ASM_X86_UNISTD_H
#define _ASM_X86_UNISTD_H 1
#ifdef __KERNEL__
# ifdef CONFIG_X86_32
# include "unistd_32.h"
# include <asm/unistd_32.h>
# define __ARCH_WANT_IPC_PARSE_VERSION
# define __ARCH_WANT_STAT64
# define __ARCH_WANT_SYS_OLD_MMAP
# define __ARCH_WANT_SYS_OLD_SELECT
# else
# include "unistd_64.h"
# include <asm/unistd_64.h>
# define __ARCH_WANT_COMPAT_SYS_TIME
# endif
# define __ARCH_WANT_OLD_READDIR
# define __ARCH_WANT_OLD_STAT
# define __ARCH_WANT_SYS_ALARM
# define __ARCH_WANT_SYS_FADVISE64
# define __ARCH_WANT_SYS_GETHOSTNAME
# define __ARCH_WANT_SYS_GETPGRP
# define __ARCH_WANT_SYS_LLSEEK
# define __ARCH_WANT_SYS_NICE
# define __ARCH_WANT_SYS_OLDUMOUNT
# define __ARCH_WANT_SYS_OLD_GETRLIMIT
# define __ARCH_WANT_SYS_OLD_UNAME
# define __ARCH_WANT_SYS_PAUSE
# define __ARCH_WANT_SYS_RT_SIGACTION
# define __ARCH_WANT_SYS_RT_SIGSUSPEND
# define __ARCH_WANT_SYS_SGETMASK
# define __ARCH_WANT_SYS_SIGNAL
# define __ARCH_WANT_SYS_SIGPENDING
# define __ARCH_WANT_SYS_SIGPROCMASK
# define __ARCH_WANT_SYS_SOCKETCALL
# define __ARCH_WANT_SYS_TIME
# define __ARCH_WANT_SYS_UTIME
# define __ARCH_WANT_SYS_WAITPID
/*
* "Conditional" syscalls
*
* What we want is __attribute__((weak,alias("sys_ni_syscall"))),
* but it doesn't work on all toolchains, so we just do it by hand
*/
# define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
#else
# ifdef __i386__
# include "unistd_32.h"
# include <asm/unistd_32.h>
# else
# include "unistd_64.h"
# include <asm/unistd_64.h>
# endif
#endif
#endif /* _ASM_X86_UNISTD_H */
This diff is collapsed.
This diff is collapsed.
......@@ -25,7 +25,8 @@ obj-$(CONFIG_IRQ_WORK) += irq_work.o
obj-y += probe_roms.o
obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o
obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o
obj-$(CONFIG_X86_64) += syscall_64.o vsyscall_64.o
obj-y += syscall_$(BITS).o
obj-$(CONFIG_X86_64) += vsyscall_64.o
obj-$(CONFIG_X86_64) += vsyscall_emu_64.o
obj-y += bootflag.o e820.o
obj-y += pci-dma.o quirks.o topology.o kdebugfs.o
......
......@@ -3,6 +3,11 @@
#include <linux/lguest.h>
#include "../../../drivers/lguest/lg.h"
#define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
static char syscalls[] = {
#include <asm/syscalls_32.h>
};
/* workaround for a warning with -Wmissing-prototypes */
void foo(void);
......@@ -76,4 +81,7 @@ void foo(void)
OFFSET(LGUEST_PAGES_regs_errcode, lguest_pages, regs.errcode);
OFFSET(LGUEST_PAGES_regs, lguest_pages, regs);
#endif
BLANK();
DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
DEFINE(NR_syscalls, sizeof(syscalls));
}
#include <asm/ia32.h>
#define __NO_STUBS 1
#undef __SYSCALL
#undef _ASM_X86_UNISTD_64_H
#define __SYSCALL(nr, sym) [nr] = 1,
static char syscalls[] = {
#include <asm/unistd.h>
#define __SYSCALL_64(nr, sym, compat) [nr] = 1,
static char syscalls_64[] = {
#include <asm/syscalls_64.h>
};
#define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
static char syscalls_ia32[] = {
#include <asm/syscalls_32.h>
};
int main(void)
......@@ -72,7 +73,11 @@ int main(void)
OFFSET(TSS_ist, tss_struct, x86_tss.ist);
BLANK();
DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
DEFINE(__NR_syscall_max, sizeof(syscalls_64) - 1);
DEFINE(NR_syscalls, sizeof(syscalls_64));
DEFINE(__NR_ia32_syscall_max, sizeof(syscalls_ia32) - 1);
DEFINE(IA32_NR_syscalls, sizeof(syscalls_ia32));
return 0;
}
......@@ -81,8 +81,6 @@
* enough to patch inline, increasing performance.
*/
#define nr_syscalls ((syscall_table_size)/4)
#ifdef CONFIG_PREEMPT
#define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF
#else
......@@ -423,7 +421,7 @@ sysenter_past_esp:
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
jnz sysenter_audit
sysenter_do_call:
cmpl $(nr_syscalls), %eax
cmpl $(NR_syscalls), %eax
jae syscall_badsys
call *sys_call_table(,%eax,4)
movl %eax,PT_EAX(%esp)
......@@ -504,7 +502,7 @@ ENTRY(system_call)
# system call tracing in operation / emulation
testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
jnz syscall_trace_entry
cmpl $(nr_syscalls), %eax
cmpl $(NR_syscalls), %eax
jae syscall_badsys
syscall_call:
call *sys_call_table(,%eax,4)
......@@ -654,7 +652,7 @@ syscall_trace_entry:
movl %esp, %eax
call syscall_trace_enter
/* What it returned is what we'll actually use. */
cmpl $(nr_syscalls), %eax
cmpl $(NR_syscalls), %eax
jnae syscall_call
jmp syscall_exit
END(syscall_trace_entry)
......@@ -694,29 +692,28 @@ END(syscall_badsys)
* System calls that need a pt_regs pointer.
*/
#define PTREGSCALL0(name) \
ALIGN; \
ptregs_##name: \
ENTRY(ptregs_##name) ; \
leal 4(%esp),%eax; \
jmp sys_##name;
jmp sys_##name; \
ENDPROC(ptregs_##name)
#define PTREGSCALL1(name) \
ALIGN; \
ptregs_##name: \
ENTRY(ptregs_##name) ; \
leal 4(%esp),%edx; \
movl (PT_EBX+4)(%esp),%eax; \
jmp sys_##name;
jmp sys_##name; \
ENDPROC(ptregs_##name)
#define PTREGSCALL2(name) \
ALIGN; \
ptregs_##name: \
ENTRY(ptregs_##name) ; \
leal 4(%esp),%ecx; \
movl (PT_ECX+4)(%esp),%edx; \
movl (PT_EBX+4)(%esp),%eax; \
jmp sys_##name;
jmp sys_##name; \
ENDPROC(ptregs_##name)
#define PTREGSCALL3(name) \
ALIGN; \
ptregs_##name: \
ENTRY(ptregs_##name) ; \
CFI_STARTPROC; \
leal 4(%esp),%eax; \
pushl_cfi %eax; \
......@@ -741,8 +738,7 @@ PTREGSCALL2(vm86)
PTREGSCALL1(vm86old)
/* Clone is an oddball. The 4th arg is in %edi */
ALIGN;
ptregs_clone:
ENTRY(ptregs_clone)
CFI_STARTPROC
leal 4(%esp),%eax
pushl_cfi %eax
......@@ -1213,11 +1209,6 @@ return_to_handler:
jmp *%ecx
#endif
.section .rodata,"a"
#include "syscall_table_32.S"
syscall_table_size=(.-sys_call_table)
/*
* Some functions should be protected against kprobes
*/
......
/* System call table for i386. */
#include <linux/linkage.h>
#include <linux/sys.h>
#include <linux/cache.h>
#include <asm/asm-offsets.h>
#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void sym(void) ;
#include <asm/syscalls_32.h>
#undef __SYSCALL_I386
#define __SYSCALL_I386(nr, sym, compat) [nr] = sym,
typedef asmlinkage void (*sys_call_ptr_t)(void);
extern asmlinkage void sys_ni_syscall(void);
const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
/*
* Smells like a compiler bug -- it doesn't work
* when the & below is removed.
*/
[0 ... __NR_syscall_max] = &sys_ni_syscall,
#include <asm/syscalls_32.h>
};
......@@ -5,15 +5,11 @@
#include <linux/cache.h>
#include <asm/asm-offsets.h>
#define __NO_STUBS
#define __SYSCALL_64(nr, sym, compat) extern asmlinkage void sym(void) ;
#include <asm/syscalls_64.h>
#undef __SYSCALL_64
#define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ;
#undef _ASM_X86_UNISTD_64_H
#include <asm/unistd_64.h>
#undef __SYSCALL
#define __SYSCALL(nr, sym) [nr] = sym,
#undef _ASM_X86_UNISTD_64_H
#define __SYSCALL_64(nr, sym, compat) [nr] = sym,
typedef void (*sys_call_ptr_t)(void);
......@@ -21,9 +17,9 @@ extern void sys_ni_syscall(void);
const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
/*
*Smells like a like a compiler bug -- it doesn't work
*when the & below is removed.
* Smells like a compiler bug -- it doesn't work
* when the & below is removed.
*/
[0 ... __NR_syscall_max] = &sys_ni_syscall,
#include <asm/unistd_64.h>
#include <asm/syscalls_64.h>
};
ENTRY(sys_call_table)
.long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
.long sys_exit
.long ptregs_fork
.long sys_read
.long sys_write
.long sys_open /* 5 */
.long sys_close
.long sys_waitpid
.long sys_creat
.long sys_link
.long sys_unlink /* 10 */
.long ptregs_execve
.long sys_chdir
.long sys_time
.long sys_mknod
.long sys_chmod /* 15 */
.long sys_lchown16
.long sys_ni_syscall /* old break syscall holder */
.long sys_stat
.long sys_lseek
.long sys_getpid /* 20 */
.long sys_mount
.long sys_oldumount
.long sys_setuid16
.long sys_getuid16
.long sys_stime /* 25 */
.long sys_ptrace
.long sys_alarm
.long sys_fstat
.long sys_pause
.long sys_utime /* 30 */
.long sys_ni_syscall /* old stty syscall holder */
.long sys_ni_syscall /* old gtty syscall holder */
.long sys_access
.long sys_nice
.long sys_ni_syscall /* 35 - old ftime syscall holder */
.long sys_sync
.long sys_kill
.long sys_rename
.long sys_mkdir
.long sys_rmdir /* 40 */
.long sys_dup
.long sys_pipe
.long sys_times
.long sys_ni_syscall /* old prof syscall holder */
.long sys_brk /* 45 */
.long sys_setgid16
.long sys_getgid16
.long sys_signal
.long sys_geteuid16
.long sys_getegid16 /* 50 */
.long sys_acct
.long sys_umount /* recycled never used phys() */
.long sys_ni_syscall /* old lock syscall holder */
.long sys_ioctl
.long sys_fcntl /* 55 */
.long sys_ni_syscall /* old mpx syscall holder */
.long sys_setpgid
.long sys_ni_syscall /* old ulimit syscall holder */
.long sys_olduname
.long sys_umask /* 60 */
.long sys_chroot
.long sys_ustat
.long sys_dup2
.long sys_getppid
.long sys_getpgrp /* 65 */
.long sys_setsid
.long sys_sigaction
.long sys_sgetmask
.long sys_ssetmask
.long sys_setreuid16 /* 70 */
.long sys_setregid16
.long sys_sigsuspend
.long sys_sigpending
.long sys_sethostname
.long sys_setrlimit /* 75 */
.long sys_old_getrlimit
.long sys_getrusage
.long sys_gettimeofday
.long sys_settimeofday
.long sys_getgroups16 /* 80 */
.long sys_setgroups16
.long sys_old_select
.long sys_symlink
.long sys_lstat
.long sys_readlink /* 85 */
.long sys_uselib
.long sys_swapon
.long sys_reboot
.long sys_old_readdir
.long sys_old_mmap /* 90 */
.long sys_munmap
.long sys_truncate
.long sys_ftruncate
.long sys_fchmod
.long sys_fchown16 /* 95 */
.long sys_getpriority
.long sys_setpriority
.long sys_ni_syscall /* old profil syscall holder */
.long sys_statfs
.long sys_fstatfs /* 100 */
.long sys_ioperm
.long sys_socketcall
.long sys_syslog
.long sys_setitimer
.long sys_getitimer /* 105 */
.long sys_newstat
.long sys_newlstat
.long sys_newfstat
.long sys_uname
.long ptregs_iopl /* 110 */
.long sys_vhangup
.long sys_ni_syscall /* old "idle" system call */
.long ptregs_vm86old
.long sys_wait4
.long sys_swapoff /* 115 */
.long sys_sysinfo
.long sys_ipc
.long sys_fsync
.long ptregs_sigreturn
.long ptregs_clone /* 120 */
.long sys_setdomainname
.long sys_newuname
.long sys_modify_ldt
.long sys_adjtimex
.long sys_mprotect /* 125 */
.long sys_sigprocmask
.long sys_ni_syscall /* old "create_module" */
.long sys_init_module
.long sys_delete_module
.long sys_ni_syscall /* 130: old "get_kernel_syms" */
.long sys_quotactl
.long sys_getpgid
.long sys_fchdir
.long sys_bdflush
.long sys_sysfs /* 135 */
.long sys_personality
.long sys_ni_syscall /* reserved for afs_syscall */
.long sys_setfsuid16
.long sys_setfsgid16
.long sys_llseek /* 140 */
.long sys_getdents
.long sys_select
.long sys_flock
.long sys_msync
.long sys_readv /* 145 */
.long sys_writev
.long sys_getsid
.long sys_fdatasync
.long sys_sysctl
.long sys_mlock /* 150 */
.long sys_munlock
.long sys_mlockall
.long sys_munlockall
.long sys_sched_setparam
.long sys_sched_getparam /* 155 */
.long sys_sched_setscheduler
.long sys_sched_getscheduler
.long sys_sched_yield
.long sys_sched_get_priority_max
.long sys_sched_get_priority_min /* 160 */
.long sys_sched_rr_get_interval
.long sys_nanosleep
.long sys_mremap
.long sys_setresuid16
.long sys_getresuid16 /* 165 */
.long ptregs_vm86
.long sys_ni_syscall /* Old sys_query_module */
.long sys_poll
.long sys_ni_syscall /* Old nfsservctl */
.long sys_setresgid16 /* 170 */
.long sys_getresgid16
.long sys_prctl
.long ptregs_rt_sigreturn
.long sys_rt_sigaction
.long sys_rt_sigprocmask /* 175 */
.long sys_rt_sigpending
.long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend
.long sys_pread64 /* 180 */
.long sys_pwrite64
.long sys_chown16
.long sys_getcwd
.long sys_capget
.long sys_capset /* 185 */
.long ptregs_sigaltstack
.long sys_sendfile
.long sys_ni_syscall /* reserved for streams1 */
.long sys_ni_syscall /* reserved for streams2 */
.long ptregs_vfork /* 190 */
.long sys_getrlimit
.long sys_mmap_pgoff
.long sys_truncate64
.long sys_ftruncate64
.long sys_stat64 /* 195 */
.long sys_lstat64
.long sys_fstat64
.long sys_lchown
.long sys_getuid
.long sys_getgid /* 200 */
.long sys_geteuid
.long sys_getegid
.long sys_setreuid
.long sys_setregid
.long sys_getgroups /* 205 */
.long sys_setgroups
.long sys_fchown
.long sys_setresuid
.long sys_getresuid
.long sys_setresgid /* 210 */
.long sys_getresgid
.long sys_chown
.long sys_setuid
.long sys_setgid
.long sys_setfsuid /* 215 */
.long sys_setfsgid
.long sys_pivot_root
.long sys_mincore
.long sys_madvise
.long sys_getdents64 /* 220 */
.long sys_fcntl64
.long sys_ni_syscall /* reserved for TUX */
.long sys_ni_syscall
.long sys_gettid
.long sys_readahead /* 225 */
.long sys_setxattr
.long sys_lsetxattr
.long sys_fsetxattr
.long sys_getxattr
.long sys_lgetxattr /* 230 */
.long sys_fgetxattr
.long sys_listxattr
.long sys_llistxattr
.long sys_flistxattr
.long sys_removexattr /* 235 */
.long sys_lremovexattr
.long sys_fremovexattr
.long sys_tkill
.long sys_sendfile64
.long sys_futex /* 240 */
.long sys_sched_setaffinity
.long sys_sched_getaffinity
.long sys_set_thread_area
.long sys_get_thread_area
.long sys_io_setup /* 245 */
.long sys_io_destroy
.long sys_io_getevents
.long sys_io_submit
.long sys_io_cancel
.long sys_fadvise64 /* 250 */
.long sys_ni_syscall
.long sys_exit_group
.long sys_lookup_dcookie
.long sys_epoll_create
.long sys_epoll_ctl /* 255 */
.long sys_epoll_wait
.long sys_remap_file_pages
.long sys_set_tid_address
.long sys_timer_create
.long sys_timer_settime /* 260 */
.long sys_timer_gettime
.long sys_timer_getoverrun
.long sys_timer_delete
.long sys_clock_settime
.long sys_clock_gettime /* 265 */
.long sys_clock_getres
.long sys_clock_nanosleep
.long sys_statfs64
.long sys_fstatfs64
.long sys_tgkill /* 270 */
.long sys_utimes
.long sys_fadvise64_64
.long sys_ni_syscall /* sys_vserver */
.long sys_mbind
.long sys_get_mempolicy
.long sys_set_mempolicy
.long sys_mq_open
.long sys_mq_unlink
.long sys_mq_timedsend
.long sys_mq_timedreceive /* 280 */
.long sys_mq_notify
.long sys_mq_getsetattr
.long sys_kexec_load
.long sys_waitid
.long sys_ni_syscall /* 285 */ /* available */
.long sys_add_key
.long sys_request_key
.long sys_keyctl
.long sys_ioprio_set
.long sys_ioprio_get /* 290 */
.long sys_inotify_init
.long sys_inotify_add_watch
.long sys_inotify_rm_watch
.long sys_migrate_pages
.long sys_openat /* 295 */
.long sys_mkdirat
.long sys_mknodat
.long sys_fchownat
.long sys_futimesat
.long sys_fstatat64 /* 300 */
.long sys_unlinkat
.long sys_renameat
.long sys_linkat
.long sys_symlinkat
.long sys_readlinkat /* 305 */
.long sys_fchmodat
.long sys_faccessat
.long sys_pselect6
.long sys_ppoll
.long sys_unshare /* 310 */
.long sys_set_robust_list
.long sys_get_robust_list
.long sys_splice
.long sys_sync_file_range
.long sys_tee /* 315 */
.long sys_vmsplice
.long sys_move_pages
.long sys_getcpu
.long sys_epoll_pwait
.long sys_utimensat /* 320 */
.long sys_signalfd
.long sys_timerfd_create
.long sys_eventfd
.long sys_fallocate
.long sys_timerfd_settime /* 325 */
.long sys_timerfd_gettime
.long sys_signalfd4
.long sys_eventfd2
.long sys_epoll_create1
.long sys_dup3 /* 330 */
.long sys_pipe2
.long sys_inotify_init1
.long sys_preadv
.long sys_pwritev
.long sys_rt_tgsigqueueinfo /* 335 */
.long sys_perf_event_open
.long sys_recvmmsg
.long sys_fanotify_init
.long sys_fanotify_mark
.long sys_prlimit64 /* 340 */
.long sys_name_to_handle_at
.long sys_open_by_handle_at
.long sys_clock_adjtime
.long sys_syncfs
.long sys_sendmmsg /* 345 */
.long sys_setns
.long sys_process_vm_readv
.long sys_process_vm_writev
out := $(obj)/../include/generated/asm
# Create output directory if not already present
_dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)')
syscall32 := $(srctree)/$(src)/syscall_32.tbl
syscall64 := $(srctree)/$(src)/syscall_64.tbl
syshdr := $(srctree)/$(src)/syscallhdr.sh
systbl := $(srctree)/$(src)/syscalltbl.sh
quiet_cmd_syshdr = SYSHDR $@
cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' $< $@ \
$(syshdr_abi_$(basetarget)) $(syshdr_pfx_$(basetarget))
quiet_cmd_systbl = SYSTBL $@
cmd_systbl = $(CONFIG_SHELL) '$(systbl)' $< $@
syshdr_abi_unistd_32 := i386
$(out)/unistd_32.h: $(syscall32) $(syshdr)
$(call if_changed,syshdr)
syshdr_abi_unistd_32_ia32 := i386
syshdr_pfx_unistd_32_ia32 := ia32_
$(out)/unistd_32_ia32.h: $(syscall32) $(syshdr)
$(call if_changed,syshdr)
syshdr_abi_unistd_64 := 64
$(out)/unistd_64.h: $(syscall64) $(syshdr)
$(call if_changed,syshdr)
$(out)/syscalls_32.h: $(syscall32) $(systbl)
$(call if_changed,systbl)
$(out)/syscalls_64.h: $(syscall64) $(systbl)
$(call if_changed,systbl)
syshdr-y += unistd_32.h unistd_64.h
syshdr-y += syscalls_32.h
syshdr-$(CONFIG_X86_64) += unistd_32_ia32.h
syshdr-$(CONFIG_X86_64) += syscalls_64.h
targets += $(syshdr-y)
all: $(addprefix $(out)/,$(targets))
This diff is collapsed.
#
# 64-bit system call numbers and entry vectors
#
# The format is:
# <number> <abi> <name> <entry point>
#
# The abi is always "64" for this file (for now.)
#
0 64 read sys_read
1 64 write sys_write
2 64 open sys_open
3 64 close sys_close
4 64 stat sys_newstat
5 64 fstat sys_newfstat
6 64 lstat sys_newlstat
7 64 poll sys_poll
8 64 lseek sys_lseek
9 64 mmap sys_mmap
10 64 mprotect sys_mprotect
11 64 munmap sys_munmap
12 64 brk sys_brk
13 64 rt_sigaction sys_rt_sigaction
14 64 rt_sigprocmask sys_rt_sigprocmask
15 64 rt_sigreturn stub_rt_sigreturn
16 64 ioctl sys_ioctl
17 64 pread64 sys_pread64
18 64 pwrite64 sys_pwrite64
19 64 readv sys_readv
20 64 writev sys_writev
21 64 access sys_access
22 64 pipe sys_pipe
23 64 select sys_select
24 64 sched_yield sys_sched_yield
25 64 mremap sys_mremap
26 64 msync sys_msync
27 64 mincore sys_mincore
28 64 madvise sys_madvise
29 64 shmget sys_shmget
30 64 shmat sys_shmat
31 64 shmctl sys_shmctl
32 64 dup sys_dup
33 64 dup2 sys_dup2
34 64 pause sys_pause
35 64 nanosleep sys_nanosleep
36 64 getitimer sys_getitimer
37 64 alarm sys_alarm
38 64 setitimer sys_setitimer
39 64 getpid sys_getpid
40 64 sendfile sys_sendfile64
41 64 socket sys_socket
42 64 connect sys_connect
43 64 accept sys_accept
44 64 sendto sys_sendto
45 64 recvfrom sys_recvfrom
46 64 sendmsg sys_sendmsg
47 64 recvmsg sys_recvmsg
48 64 shutdown sys_shutdown
49 64 bind sys_bind
50 64 listen sys_listen
51 64 getsockname sys_getsockname
52 64 getpeername sys_getpeername
53 64 socketpair sys_socketpair
54 64 setsockopt sys_setsockopt
55 64 getsockopt sys_getsockopt
56 64 clone stub_clone
57 64 fork stub_fork
58 64 vfork stub_vfork
59 64 execve stub_execve
60 64 exit sys_exit
61 64 wait4 sys_wait4
62 64 kill sys_kill
63 64 uname sys_newuname
64 64 semget sys_semget
65 64 semop sys_semop
66 64 semctl sys_semctl
67 64 shmdt sys_shmdt
68 64 msgget sys_msgget
69 64 msgsnd sys_msgsnd
70 64 msgrcv sys_msgrcv
71 64 msgctl sys_msgctl
72 64 fcntl sys_fcntl
73 64 flock sys_flock
74 64 fsync sys_fsync
75 64 fdatasync sys_fdatasync
76 64 truncate sys_truncate
77 64 ftruncate sys_ftruncate
78 64 getdents sys_getdents
79 64 getcwd sys_getcwd
80 64 chdir sys_chdir
81 64 fchdir sys_fchdir
82 64 rename sys_rename
83 64 mkdir sys_mkdir
84 64 rmdir sys_rmdir
85 64 creat sys_creat
86 64 link sys_link
87 64 unlink sys_unlink
88 64 symlink sys_symlink
89 64 readlink sys_readlink
90 64 chmod sys_chmod
91 64 fchmod sys_fchmod
92 64 chown sys_chown
93 64 fchown sys_fchown
94 64 lchown sys_lchown
95 64 umask sys_umask
96 64 gettimeofday sys_gettimeofday
97 64 getrlimit sys_getrlimit
98 64 getrusage sys_getrusage
99 64 sysinfo sys_sysinfo
100 64 times sys_times
101 64 ptrace sys_ptrace
102 64 getuid sys_getuid
103 64 syslog sys_syslog
104 64 getgid sys_getgid
105 64 setuid sys_setuid
106 64 setgid sys_setgid
107 64 geteuid sys_geteuid
108 64 getegid sys_getegid
109 64 setpgid sys_setpgid
110 64 getppid sys_getppid
111 64 getpgrp sys_getpgrp
112 64 setsid sys_setsid
113 64 setreuid sys_setreuid
114 64 setregid sys_setregid
115 64 getgroups sys_getgroups
116 64 setgroups sys_setgroups
117 64 setresuid sys_setresuid
118 64 getresuid sys_getresuid
119 64 setresgid sys_setresgid
120 64 getresgid sys_getresgid
121 64 getpgid sys_getpgid
122 64 setfsuid sys_setfsuid
123 64 setfsgid sys_setfsgid
124 64 getsid sys_getsid
125 64 capget sys_capget
126 64 capset sys_capset
127 64 rt_sigpending sys_rt_sigpending
128 64 rt_sigtimedwait sys_rt_sigtimedwait
129 64 rt_sigqueueinfo sys_rt_sigqueueinfo
130 64 rt_sigsuspend sys_rt_sigsuspend
131 64 sigaltstack stub_sigaltstack
132 64 utime sys_utime
133 64 mknod sys_mknod
134 64 uselib
135 64 personality sys_personality
136 64 ustat sys_ustat
137 64 statfs sys_statfs
138 64 fstatfs sys_fstatfs
139 64 sysfs sys_sysfs
140 64 getpriority sys_getpriority
141 64 setpriority sys_setpriority
142 64 sched_setparam sys_sched_setparam
143 64 sched_getparam sys_sched_getparam
144 64 sched_setscheduler sys_sched_setscheduler
145 64 sched_getscheduler sys_sched_getscheduler
146 64 sched_get_priority_max sys_sched_get_priority_max
147 64 sched_get_priority_min sys_sched_get_priority_min
148 64 sched_rr_get_interval sys_sched_rr_get_interval
149 64 mlock sys_mlock
150 64 munlock sys_munlock
151 64 mlockall sys_mlockall
152 64 munlockall sys_munlockall
153 64 vhangup sys_vhangup
154 64 modify_ldt sys_modify_ldt
155 64 pivot_root sys_pivot_root
156 64 _sysctl sys_sysctl
157 64 prctl sys_prctl
158 64 arch_prctl sys_arch_prctl
159 64 adjtimex sys_adjtimex
160 64 setrlimit sys_setrlimit
161 64 chroot sys_chroot
162 64 sync sys_sync
163 64 acct sys_acct
164 64 settimeofday sys_settimeofday
165 64 mount sys_mount
166 64 umount2 sys_umount
167 64 swapon sys_swapon
168 64 swapoff sys_swapoff
169 64 reboot sys_reboot
170 64 sethostname sys_sethostname
171 64 setdomainname sys_setdomainname
172 64 iopl stub_iopl
173 64 ioperm sys_ioperm
174 64 create_module
175 64 init_module sys_init_module
176 64 delete_module sys_delete_module
177 64 get_kernel_syms
178 64 query_module
179 64 quotactl sys_quotactl
180 64 nfsservctl
181 64 getpmsg
182 64 putpmsg
183 64 afs_syscall
184 64 tuxcall
185 64 security
186 64 gettid sys_gettid
187 64 readahead sys_readahead
188 64 setxattr sys_setxattr
189 64 lsetxattr sys_lsetxattr
190 64 fsetxattr sys_fsetxattr
191 64 getxattr sys_getxattr
192 64 lgetxattr sys_lgetxattr
193 64 fgetxattr sys_fgetxattr
194 64 listxattr sys_listxattr
195 64 llistxattr sys_llistxattr
196 64 flistxattr sys_flistxattr
197 64 removexattr sys_removexattr
198 64 lremovexattr sys_lremovexattr
199 64 fremovexattr sys_fremovexattr
200 64 tkill sys_tkill
201 64 time sys_time
202 64 futex sys_futex
203 64 sched_setaffinity sys_sched_setaffinity
204 64 sched_getaffinity sys_sched_getaffinity
205 64 set_thread_area
206 64 io_setup sys_io_setup
207 64 io_destroy sys_io_destroy
208 64 io_getevents sys_io_getevents
209 64 io_submit sys_io_submit
210 64 io_cancel sys_io_cancel
211 64 get_thread_area
212 64 lookup_dcookie sys_lookup_dcookie
213 64 epoll_create sys_epoll_create
214 64 epoll_ctl_old
215 64 epoll_wait_old
216 64 remap_file_pages sys_remap_file_pages
217 64 getdents64 sys_getdents64
218 64 set_tid_address sys_set_tid_address
219 64 restart_syscall sys_restart_syscall
220 64 semtimedop sys_semtimedop
221 64 fadvise64 sys_fadvise64
222 64 timer_create sys_timer_create
223 64 timer_settime sys_timer_settime
224 64 timer_gettime sys_timer_gettime
225 64 timer_getoverrun sys_timer_getoverrun
226 64 timer_delete sys_timer_delete
227 64 clock_settime sys_clock_settime
228 64 clock_gettime sys_clock_gettime
229 64 clock_getres sys_clock_getres
230 64 clock_nanosleep sys_clock_nanosleep
231 64 exit_group sys_exit_group
232 64 epoll_wait sys_epoll_wait
233 64 epoll_ctl sys_epoll_ctl
234 64 tgkill sys_tgkill
235 64 utimes sys_utimes
236 64 vserver
237 64 mbind sys_mbind
238 64 set_mempolicy sys_set_mempolicy
239 64 get_mempolicy sys_get_mempolicy
240 64 mq_open sys_mq_open
241 64 mq_unlink sys_mq_unlink
242 64 mq_timedsend sys_mq_timedsend
243 64 mq_timedreceive sys_mq_timedreceive
244 64 mq_notify sys_mq_notify
245 64 mq_getsetattr sys_mq_getsetattr
246 64 kexec_load sys_kexec_load
247 64 waitid sys_waitid
248 64 add_key sys_add_key
249 64 request_key sys_request_key
250 64 keyctl sys_keyctl
251 64 ioprio_set sys_ioprio_set
252 64 ioprio_get sys_ioprio_get
253 64 inotify_init sys_inotify_init
254 64 inotify_add_watch sys_inotify_add_watch
255 64 inotify_rm_watch sys_inotify_rm_watch
256 64 migrate_pages sys_migrate_pages
257 64 openat sys_openat
258 64 mkdirat sys_mkdirat
259 64 mknodat sys_mknodat
260 64 fchownat sys_fchownat
261 64 futimesat sys_futimesat
262 64 newfstatat sys_newfstatat
263 64 unlinkat sys_unlinkat
264 64 renameat sys_renameat
265 64 linkat sys_linkat
266 64 symlinkat sys_symlinkat
267 64 readlinkat sys_readlinkat
268 64 fchmodat sys_fchmodat
269 64 faccessat sys_faccessat
270 64 pselect6 sys_pselect6
271 64 ppoll sys_ppoll
272 64 unshare sys_unshare
273 64 set_robust_list sys_set_robust_list
274 64 get_robust_list sys_get_robust_list
275 64 splice sys_splice
276 64 tee sys_tee
277 64 sync_file_range sys_sync_file_range
278 64 vmsplice sys_vmsplice
279 64 move_pages sys_move_pages
280 64 utimensat sys_utimensat
281 64 epoll_pwait sys_epoll_pwait
282 64 signalfd sys_signalfd
283 64 timerfd_create sys_timerfd_create
284 64 eventfd sys_eventfd
285 64 fallocate sys_fallocate
286 64 timerfd_settime sys_timerfd_settime
287 64 timerfd_gettime sys_timerfd_gettime
288 64 accept4 sys_accept4
289 64 signalfd4 sys_signalfd4
290 64 eventfd2 sys_eventfd2
291 64 epoll_create1 sys_epoll_create1
292 64 dup3 sys_dup3
293 64 pipe2 sys_pipe2
294 64 inotify_init1 sys_inotify_init1
295 64 preadv sys_preadv
296 64 pwritev sys_pwritev
297 64 rt_tgsigqueueinfo sys_rt_tgsigqueueinfo
298 64 perf_event_open sys_perf_event_open
299 64 recvmmsg sys_recvmmsg
300 64 fanotify_init sys_fanotify_init
301 64 fanotify_mark sys_fanotify_mark
302 64 prlimit64 sys_prlimit64
303 64 name_to_handle_at sys_name_to_handle_at
304 64 open_by_handle_at sys_open_by_handle_at
305 64 clock_adjtime sys_clock_adjtime
306 64 syncfs sys_syncfs
307 64 sendmmsg sys_sendmmsg
308 64 setns sys_setns
309 64 getcpu sys_getcpu
310 64 process_vm_readv sys_process_vm_readv
311 64 process_vm_writev sys_process_vm_writev
#!/bin/sh
in="$1"
out="$2"
my_abis=`echo "($3)" | tr ',' '|'`
prefix="$4"
offset="$5"
fileguard=_ASM_X86_`basename "$out" | sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
echo "#ifndef ${fileguard}"
echo "#define ${fileguard} 1"
echo ""
while read nr abi name entry ; do
if [ -z "$offset" ]; then
echo "#define __NR_${prefix}${name} $nr"
else
echo "#define __NR_${prefix}${name} ($offset + $nr)"
fi
done
echo ""
echo "#endif /* ${fileguard} */"
) > "$out"
#!/bin/sh
in="$1"
out="$2"
grep '^[0-9]' "$in" | sort -n | (
while read nr abi name entry compat; do
abi=`echo "$abi" | tr '[a-z]' '[A-Z]'`
if [ -n "$compat" ]; then
echo "__SYSCALL_${abi}($nr, $entry, $compat)"
elif [ -n "$entry" ]; then
echo "__SYSCALL_${abi}($nr, $entry, $entry)"
fi
done
) > "$out"
......@@ -37,7 +37,8 @@ subarch-$(CONFIG_MODULES) += ../kernel/module.o
USER_OBJS := bugs_$(BITS).o ptrace_user.o fault.o
extra-y += user-offsets.s
$(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS)
$(obj)/user-offsets.s: c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) \
-Iarch/x86/include/generated
UNPROFILE_OBJS := stub_segv.o
CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
......
/*
* System call table for UML/i386, copied from arch/x86/kernel/syscall_*.c
* with some changes for UML.
*/
#include <linux/linkage.h>
/* Steal i386 syscall table for our purposes, but with some slight changes.*/
#include <linux/sys.h>
#include <linux/cache.h>
#include <generated/user_constants.h>
#define __NO_STUBS
/*
* Below you can see, in terms of #define's, the differences between the x86-64
* and the UML syscall table.
*/
/* Not going to be implemented by UML, since we have no hardware. */
#define sys_iopl sys_ni_syscall
#define sys_ioperm sys_ni_syscall
......@@ -18,9 +33,23 @@
#define ptregs_sigaltstack sys_sigaltstack
#define ptregs_vfork sys_vfork
.section .rodata,"a"
#define __SYSCALL_I386(nr, sym, compat) extern asmlinkage void sym(void) ;
#include <asm/syscalls_32.h>
#undef __SYSCALL_I386
#define __SYSCALL_I386(nr, sym, compat) [ nr ] = sym,
typedef void (*sys_call_ptr_t)(void);
extern void sys_ni_syscall(void);
#include "../kernel/syscall_table_32.S"
const sys_call_ptr_t sys_call_table[] __cacheline_aligned = {
/*
* Smells like a compiler bug -- it doesn't work
* when the & below is removed.
*/
[0 ... __NR_syscall_max] = &sys_ni_syscall,
#include <asm/syscalls_32.h>
};
ENTRY(syscall_table_size)
.long .-sys_call_table
int syscall_table_size = sizeof(sys_call_table);
/*
* System call table for UML/x86-64, copied from arch/x86_64/kernel/syscall.c
* System call table for UML/x86-64, copied from arch/x86/kernel/syscall_*.c
* with some changes for UML.
*/
#include <linux/linkage.h>
#include <linux/sys.h>
#include <linux/cache.h>
#include <generated/user_constants.h>
#define __NO_STUBS
......@@ -34,31 +35,23 @@
#define stub_sigaltstack sys_sigaltstack
#define stub_rt_sigreturn sys_rt_sigreturn
#define __SYSCALL(nr, sym) extern asmlinkage void sym(void) ;
#undef _ASM_X86_UNISTD_64_H
#include "../../x86/include/asm/unistd_64.h"
#define __SYSCALL_64(nr, sym, compat) extern asmlinkage void sym(void) ;
#include <asm/syscalls_64.h>
#undef __SYSCALL
#define __SYSCALL(nr, sym) [ nr ] = sym,
#undef _ASM_X86_UNISTD_64_H
#undef __SYSCALL_64
#define __SYSCALL_64(nr, sym, compat) [ nr ] = sym,
typedef void (*sys_call_ptr_t)(void);
extern void sys_ni_syscall(void);
/*
* We used to have a trick here which made sure that holes in the
* x86_64 table were filled in with sys_ni_syscall, but a comment in
* unistd_64.h says that holes aren't allowed, so the trick was
* removed.
* The trick looked like this
* [0 ... UM_NR_syscall_max] = &sys_ni_syscall
* before including unistd_64.h - the later initializations overwrote
* the sys_ni_syscall filler.
const sys_call_ptr_t sys_call_table[] __cacheline_aligned = {
/*
* Smells like a compiler bug -- it doesn't work
* when the & below is removed.
*/
sys_call_ptr_t sys_call_table[] __cacheline_aligned = {
#include <asm/unistd_64.h>
[0 ... __NR_syscall_max] = &sys_ni_syscall,
#include <asm/syscalls_64.h>
};
int syscall_table_size = sizeof(sys_call_table);
......@@ -8,6 +8,18 @@
#include <asm/ptrace.h>
#include <asm/types.h>
#ifdef __i386__
#define __SYSCALL_I386(nr, sym, compat) [nr] = 1,
static char syscalls[] = {
#include <asm/syscalls_32.h>
};
#else
#define __SYSCALL_64(nr, sym, compat) [nr] = 1,
static char syscalls[] = {
#include <asm/syscalls_64.h>
};
#endif
#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
......@@ -77,4 +89,7 @@ void foo(void)
DEFINE(UM_PROT_READ, PROT_READ);
DEFINE(UM_PROT_WRITE, PROT_WRITE);
DEFINE(UM_PROT_EXEC, PROT_EXEC);
DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
DEFINE(NR_syscalls, sizeof(syscalls));
}
......@@ -4,12 +4,16 @@
# header-y - list files to be installed. They are preprocessed
# to remove __KERNEL__ section of the file
# objhdr-y - Same as header-y but for generated files
# genhdr-y - Same as objhdr-y but in a generated/ directory
#
# ==========================================================================
# called may set destination dir (when installing to asm/)
_dst := $(if $(dst),$(dst),$(obj))
# generated header directory
gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
kbuild-file := $(srctree)/$(obj)/Kbuild
include $(kbuild-file)
......@@ -33,9 +37,10 @@ wrapper-files := $(filter $(header-y), $(generic-y))
# all headers files for this dir
header-y := $(filter-out $(generic-y), $(header-y))
all-files := $(header-y) $(objhdr-y) $(wrapper-files)
all-files := $(header-y) $(objhdr-y) $(genhdr-y) $(wrapper-files)
input-files := $(addprefix $(srctree)/$(obj)/,$(header-y)) \
$(addprefix $(objtree)/$(obj)/,$(objhdr-y))
$(addprefix $(objtree)/$(obj)/,$(objhdr-y)) \
$(addprefix $(objtree)/$(gen)/,$(genhdr-y))
output-files := $(addprefix $(install)/, $(all-files))
# Work out what needs to be removed
......@@ -52,6 +57,7 @@ quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
cmd_install = \
$(PERL) $< $(srctree)/$(obj) $(install) $(SRCARCH) $(header-y); \
$(PERL) $< $(objtree)/$(obj) $(install) $(SRCARCH) $(objhdr-y); \
$(PERL) $< $(objtree)/$(gen) $(install) $(SRCARCH) $(genhdr-y); \
for F in $(wrapper-files); do \
echo "\#include <asm-generic/$$F>" > $(install)/$$F; \
done; \
......
......@@ -198,11 +198,16 @@ EOF
}
syscall_list() {
sed -n -e '/^\#define/ s/[^_]*__NR_\([^[:space:]]*\).*/\
\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\
\#warning syscall \1 not implemented\
\#endif/p' $1
grep '^[0-9]' "$1" | sort -n | (
while read nr abi name entry ; do
echo <<EOF
#if !defined(__NR_${name}) && !defined(__IGNORE_${name})
#warning syscall ${name} not implemented
#endif
EOF
done
)
}
(ignore_list && syscall_list $(dirname $0)/../arch/x86/include/asm/unistd_32.h) | \
(ignore_list && syscall_list $(dirname $0)/../arch/x86/syscalls/syscall_32.tbl) | \
$* -E -x c - > /dev/null
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment