19 #ifndef _COBALT_X86_ASM_SYSCALL32_H 20 #define _COBALT_X86_ASM_SYSCALL32_H 22 #include <asm/unistd.h> 26 #define __COBALT_X32_BASE 128 28 #define __COBALT_SYSNR32x(__reg) \ 31 if (__nr & __X32_SYSCALL_BIT) { \ 32 __nr &= ~__X32_SYSCALL_BIT; \ 33 __nr += __COBALT_X32_BASE; \ 38 #define __COBALT_COMPAT32x(__reg) \ 39 (((__reg) & __X32_SYSCALL_BIT) ? __COBALT_COMPATX_BIT : 0) 41 #if __NR_COBALT_SYSCALLS > __COBALT_X32_BASE 42 #error "__NR_COBALT_SYSCALLS > __COBALT_X32_BASE" 45 #define __syshand32x__(__name) ((cobalt_syshand)(CoBaLt32x_ ## __name)) 47 #define __COBALT_CALL32x_INITHAND(__handler) \ 48 [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __handler, 50 #define __COBALT_CALL32x_INITMODE(__mode) \ 51 [__COBALT_X32_BASE ... __COBALT_X32_BASE + __NR_COBALT_SYSCALLS-1] = __mode, 54 #define __COBALT_CALL32x_ENTRY(__name, __handler) \ 55 [sc_cobalt_ ## __name + __COBALT_X32_BASE] = __handler, 58 #define __COBALT_CALL32x_pure_THUNK(__name) \ 59 __COBALT_CALL32x_ENTRY(__name, __syshand32x__(__name)) 61 #define __COBALT_CALL32x_THUNK(__name) \ 62 __COBALT_CALL32x_ENTRY(__name, __syshand32emu__(__name)) 65 #define COBALT_SYSCALL32x(__name, __mode, __args) \ 66 long CoBaLt32x_ ## __name __args 69 #define COBALT_SYSCALL32x_DECL(__name, __args) \ 70 long CoBaLt32x_ ## __name __args 76 #define __COBALT_SYSNR32x(__reg) (__reg) 78 #define __COBALT_COMPAT32x(__reg) 0 80 #define __COBALT_CALL32x_INITHAND(__handler) 82 #define __COBALT_CALL32x_INITMODE(__mode) 84 #define __COBALT_CALL32x_ENTRY(__name, __handler) 86 #define __COBALT_CALL32x_pure_THUNK(__name) 88 #define __COBALT_CALL32x_THUNK(__name) 90 #define COBALT_SYSCALL32x_DECL(__name, __args) 94 #ifdef CONFIG_IA32_EMULATION 96 #define __COBALT_IA32_BASE 256 98 #define __COBALT_SYSNR32emu(__reg) \ 101 if (in_ia32_syscall()) \ 102 __nr += __COBALT_IA32_BASE; \ 106 #define __COBALT_COMPAT32emu(__reg) \ 107 (in_ia32_syscall() ? __COBALT_COMPAT_BIT : 0) 109 #if __NR_COBALT_SYSCALLS > __COBALT_IA32_BASE 110 #error "__NR_COBALT_SYSCALLS > __COBALT_IA32_BASE" 113 #define __syshand32emu__(__name) ((cobalt_syshand)(CoBaLt32emu_ ## __name)) 115 #define __COBALT_CALL32emu_INITHAND(__handler) \ 116 [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __handler, 118 #define __COBALT_CALL32emu_INITMODE(__mode) \ 119 [__COBALT_IA32_BASE ... __COBALT_IA32_BASE + __NR_COBALT_SYSCALLS-1] = __mode, 122 #define __COBALT_CALL32emu_ENTRY(__name, __handler) \ 123 [sc_cobalt_ ## __name + __COBALT_IA32_BASE] = __handler, 126 #define __COBALT_CALL32emu_THUNK(__name) \ 127 __COBALT_CALL32emu_ENTRY(__name, __syshand32emu__(__name)) 130 #define COBALT_SYSCALL32emu(__name, __mode, __args) \ 131 long CoBaLt32emu_ ## __name __args 134 #define COBALT_SYSCALL32emu_DECL(__name, __args) \ 135 long CoBaLt32emu_ ## __name __args 141 #define __COBALT_SYSNR32emu(__reg) (__reg) 143 #define __COBALT_COMPAT32emu(__reg) 0 145 #define __COBALT_CALL32emu_INITHAND(__handler) 147 #define __COBALT_CALL32emu_INITMODE(__mode) 149 #define __COBALT_CALL32emu_ENTRY(__name, __handler) 151 #define __COBALT_CALL32emu_THUNK(__name) 153 #define COBALT_SYSCALL32emu_DECL(__name, __args) 157 #define __COBALT_CALL32_ENTRY(__name, __handler) \ 158 __COBALT_CALL32x_ENTRY(__name, __handler) \ 159 __COBALT_CALL32emu_ENTRY(__name, __handler) 161 #define __COBALT_CALL32_INITHAND(__handler) \ 162 __COBALT_CALL32x_INITHAND(__handler) \ 163 __COBALT_CALL32emu_INITHAND(__handler) 165 #define __COBALT_CALL32_INITMODE(__mode) \ 166 __COBALT_CALL32x_INITMODE(__mode) \ 167 __COBALT_CALL32emu_INITMODE(__mode) 170 #define __COBALT_CALL32_SYSNR(__reg) \ 173 __nr = __COBALT_SYSNR32x(__reg); \ 174 if (__nr == (__reg)) \ 175 __nr = __COBALT_SYSNR32emu(__reg); \ 179 #define __COBALT_CALL_COMPAT(__reg) \ 181 int __ret = __COBALT_COMPAT32x(__reg); \ 183 __ret = __COBALT_COMPAT32emu(__reg); \