Merge tag 'pinctrl-v5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[platform/kernel/linux-starfive.git] / arch / x86 / um / user-offsets.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <stdio.h>
3 #include <stddef.h>
4 #include <signal.h>
5 #include <poll.h>
6 #include <sys/mman.h>
7 #include <sys/user.h>
8 #define __FRAME_OFFSETS
9 #include <linux/ptrace.h>
10 #include <asm/types.h>
11 #include <linux/kbuild.h>
12
13 #define DEFINE_LONGS(sym, val)  \
14         COMMENT(#val " / sizeof(unsigned long)");       \
15         DEFINE(sym, val / sizeof(unsigned long))
16
17 void foo(void)
18 {
19 #ifdef __i386__
20         DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_fpregs_struct));
21         DEFINE_LONGS(HOST_FPX_SIZE, sizeof(struct user_fpxregs_struct));
22
23         DEFINE(HOST_IP, EIP);
24         DEFINE(HOST_SP, UESP);
25         DEFINE(HOST_EFLAGS, EFL);
26         DEFINE(HOST_AX, EAX);
27         DEFINE(HOST_BX, EBX);
28         DEFINE(HOST_CX, ECX);
29         DEFINE(HOST_DX, EDX);
30         DEFINE(HOST_SI, ESI);
31         DEFINE(HOST_DI, EDI);
32         DEFINE(HOST_BP, EBP);
33         DEFINE(HOST_CS, CS);
34         DEFINE(HOST_SS, SS);
35         DEFINE(HOST_DS, DS);
36         DEFINE(HOST_FS, FS);
37         DEFINE(HOST_ES, ES);
38         DEFINE(HOST_GS, GS);
39         DEFINE(HOST_ORIG_AX, ORIG_EAX);
40 #else
41 #ifdef FP_XSTATE_MAGIC1
42         DEFINE_LONGS(HOST_FP_SIZE, 2696);
43 #else
44         DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
45 #endif
46         DEFINE_LONGS(HOST_BX, RBX);
47         DEFINE_LONGS(HOST_CX, RCX);
48         DEFINE_LONGS(HOST_DI, RDI);
49         DEFINE_LONGS(HOST_SI, RSI);
50         DEFINE_LONGS(HOST_DX, RDX);
51         DEFINE_LONGS(HOST_BP, RBP);
52         DEFINE_LONGS(HOST_AX, RAX);
53         DEFINE_LONGS(HOST_R8, R8);
54         DEFINE_LONGS(HOST_R9, R9);
55         DEFINE_LONGS(HOST_R10, R10);
56         DEFINE_LONGS(HOST_R11, R11);
57         DEFINE_LONGS(HOST_R12, R12);
58         DEFINE_LONGS(HOST_R13, R13);
59         DEFINE_LONGS(HOST_R14, R14);
60         DEFINE_LONGS(HOST_R15, R15);
61         DEFINE_LONGS(HOST_ORIG_AX, ORIG_RAX);
62         DEFINE_LONGS(HOST_CS, CS);
63         DEFINE_LONGS(HOST_SS, SS);
64         DEFINE_LONGS(HOST_EFLAGS, EFLAGS);
65 #if 0
66         DEFINE_LONGS(HOST_FS, FS);
67         DEFINE_LONGS(HOST_GS, GS);
68         DEFINE_LONGS(HOST_DS, DS);
69         DEFINE_LONGS(HOST_ES, ES);
70 #endif
71
72         DEFINE_LONGS(HOST_IP, RIP);
73         DEFINE_LONGS(HOST_SP, RSP);
74 #endif
75
76         DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
77         DEFINE(UM_POLLIN, POLLIN);
78         DEFINE(UM_POLLPRI, POLLPRI);
79         DEFINE(UM_POLLOUT, POLLOUT);
80
81         DEFINE(UM_PROT_READ, PROT_READ);
82         DEFINE(UM_PROT_WRITE, PROT_WRITE);
83         DEFINE(UM_PROT_EXEC, PROT_EXEC);
84 }