xref: /linux/arch/um/include/shared/skas/stub-data.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
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 };
34 
35 struct stub_syscall {
36 	struct {
37 		unsigned long addr;
38 		unsigned long length;
39 		unsigned long offset;
40 		int fd;
41 		int prot;
42 	} mem;
43 
44 	enum stub_syscall_type syscall;
45 };
46 
47 struct stub_data {
48 	unsigned long offset;
49 	long err, child_err;
50 
51 	int syscall_data_len;
52 	/* 128 leaves enough room for additional fields in the struct */
53 	struct stub_syscall syscall_data[(UM_KERN_PAGE_SIZE - 128) / sizeof(struct stub_syscall)] __aligned(16);
54 
55 	/* Stack for our signal handlers and for calling into . */
56 	unsigned char sigstack[UM_KERN_PAGE_SIZE] __aligned(UM_KERN_PAGE_SIZE);
57 };
58 
59 #endif
60