xref: /openbmc/linux/arch/x86/entry/syscall_32.c (revision 86aa961bb4619a68077ebeba21c52e9ba0eab43d)
1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
200398a00SIngo Molnar /* System call table for i386. */
300398a00SIngo Molnar 
400398a00SIngo Molnar #include <linux/linkage.h>
500398a00SIngo Molnar #include <linux/sys.h>
600398a00SIngo Molnar #include <linux/cache.h>
725c619e5SBrian Gerst #include <linux/syscalls.h>
8034042ccSAndy Lutomirski #include <asm/syscall.h>
900398a00SIngo Molnar 
106218d0f6SMasahiro Yamada #ifdef CONFIG_IA32_EMULATION
116218d0f6SMasahiro Yamada #define __SYSCALL_WITH_COMPAT(nr, native, compat)	__SYSCALL(nr, compat)
126218d0f6SMasahiro Yamada #else
136218d0f6SMasahiro Yamada #define __SYSCALL_WITH_COMPAT(nr, native, compat)	__SYSCALL(nr, native)
146218d0f6SMasahiro Yamada #endif
156218d0f6SMasahiro Yamada 
166218d0f6SMasahiro Yamada #define __SYSCALL(nr, sym) extern long __ia32_##sym(const struct pt_regs *);
17ebeb8c82SDominik Brodowski 
1800398a00SIngo Molnar #include <asm/syscalls_32.h>
196218d0f6SMasahiro Yamada #undef __SYSCALL
2000398a00SIngo Molnar 
21*eb0f175bSLinus Torvalds /*
22*eb0f175bSLinus Torvalds  * The sys_call_table[] is no longer used for system calls, but
23*eb0f175bSLinus Torvalds  * kernel/trace/trace_syscalls.c still wants to know the system
24*eb0f175bSLinus Torvalds  * call address.
25*eb0f175bSLinus Torvalds  */
26*eb0f175bSLinus Torvalds #ifdef CONFIG_X86_32
2744fe4895SMasahiro Yamada #define __SYSCALL(nr, sym) __ia32_##sym,
28*eb0f175bSLinus Torvalds const sys_call_ptr_t sys_call_table[] = {
2900398a00SIngo Molnar #include <asm/syscalls_32.h>
3000398a00SIngo Molnar };
31*eb0f175bSLinus Torvalds #undef __SYSCALL
32*eb0f175bSLinus Torvalds #endif
33*eb0f175bSLinus Torvalds 
34*eb0f175bSLinus Torvalds #define __SYSCALL(nr, sym) case nr: return __ia32_##sym(regs);
35*eb0f175bSLinus Torvalds 
ia32_sys_call(const struct pt_regs * regs,unsigned int nr)36*eb0f175bSLinus Torvalds long ia32_sys_call(const struct pt_regs *regs, unsigned int nr)
37*eb0f175bSLinus Torvalds {
38*eb0f175bSLinus Torvalds 	switch (nr) {
39*eb0f175bSLinus Torvalds 	#include <asm/syscalls_32.h>
40*eb0f175bSLinus Torvalds 	default: return __ia32_sys_ni_syscall(regs);
41*eb0f175bSLinus Torvalds 	}
42*eb0f175bSLinus Torvalds };
43