1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 4 * Copyright (C) 2015 Thomas Meyer (thomas@m3y3r.de) 5 * Copyright (C) 2005 Jeff Dike (jdike@karaya.com) 6 */ 7 8 #ifndef __STUB_DATA_H 9 #define __STUB_DATA_H 10 11 #include <linux/compiler_types.h> 12 #include <as-layout.h> 13 #include <sysdep/tls.h> 14 15 struct stub_init_data { 16 unsigned long stub_start; 17 18 int stub_code_fd; 19 unsigned long stub_code_offset; 20 int stub_data_fd; 21 unsigned long stub_data_offset; 22 23 unsigned long segv_handler; 24 }; 25 26 #define STUB_NEXT_SYSCALL(s) \ 27 ((struct stub_syscall *) (((unsigned long) s) + (s)->cmd_len)) 28 29 enum stub_syscall_type { 30 STUB_SYSCALL_UNSET = 0, 31 STUB_SYSCALL_MMAP, 32 STUB_SYSCALL_MUNMAP, 33 STUB_SYSCALL_MPROTECT, 34 }; 35 36 struct stub_syscall { 37 struct { 38 unsigned long addr; 39 unsigned long length; 40 unsigned long offset; 41 int fd; 42 int prot; 43 } mem; 44 45 enum stub_syscall_type syscall; 46 }; 47 48 struct stub_data { 49 unsigned long offset; 50 long err, child_err; 51 52 int syscall_data_len; 53 /* 128 leaves enough room for additional fields in the struct */ 54 struct stub_syscall syscall_data[(UM_KERN_PAGE_SIZE - 128) / sizeof(struct stub_syscall)] __aligned(16); 55 56 /* Stack for our signal handlers and for calling into . */ 57 unsigned char sigstack[UM_KERN_PAGE_SIZE] __aligned(UM_KERN_PAGE_SIZE); 58 }; 59 60 #endif 61