diff options
author | Dmitry Chagin <dchagin@FreeBSD.org> | 2022-05-15 18:03:01 +0000 |
---|---|---|
committer | Dmitry Chagin <dchagin@FreeBSD.org> | 2022-05-15 18:03:01 +0000 |
commit | 21f246174184742ba8952aeb1dadbf58d48d54b4 (patch) | |
tree | 696a47a0a326e0e6c44a55a55a635d8cd3535b3c /sys/amd64 | |
parent | ba279bcd6d75aa236bcb9ccf11aeb6f51a2f8514 (diff) | |
download | src-21f246174184742ba8952aeb1dadbf58d48d54b4.tar.gz src-21f246174184742ba8952aeb1dadbf58d48d54b4.zip |
linux(4): Move sigframe definitions to separate headers
The signal trampoine-related definitions are used only in the MD part
of code, wherefore moved from everywhere used linux.h to separate MD
headers.
MFC after: 2 weeks
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/linux/linux.h | 65 | ||||
-rw-r--r-- | sys/amd64/linux/linux_genassym.c | 2 | ||||
-rw-r--r-- | sys/amd64/linux/linux_sysvec.c | 2 | ||||
-rw-r--r-- | sys/amd64/linux32/linux.h | 90 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_genassym.c | 2 | ||||
-rw-r--r-- | sys/amd64/linux32/linux32_sysvec.c | 2 |
6 files changed, 8 insertions, 155 deletions
diff --git a/sys/amd64/linux/linux.h b/sys/amd64/linux/linux.h index 08cf3d4b6bbd..51a2906f45cf 100644 --- a/sys/amd64/linux/linux.h +++ b/sys/amd64/linux/linux.h @@ -182,59 +182,6 @@ typedef struct { l_size_t ss_size; } l_stack_t; -struct l_fpstate { - u_int16_t cwd; - u_int16_t swd; - u_int16_t twd; - u_int16_t fop; - u_int64_t rip; - u_int64_t rdp; - u_int32_t mxcsr; - u_int32_t mxcsr_mask; - u_int32_t st_space[32]; - u_int32_t xmm_space[64]; - u_int32_t reserved2[24]; -}; - -struct l_sigcontext { - l_ulong sc_r8; - l_ulong sc_r9; - l_ulong sc_r10; - l_ulong sc_r11; - l_ulong sc_r12; - l_ulong sc_r13; - l_ulong sc_r14; - l_ulong sc_r15; - l_ulong sc_rdi; - l_ulong sc_rsi; - l_ulong sc_rbp; - l_ulong sc_rbx; - l_ulong sc_rdx; - l_ulong sc_rax; - l_ulong sc_rcx; - l_ulong sc_rsp; - l_ulong sc_rip; - l_ulong sc_rflags; - l_ushort sc_cs; - l_ushort sc_gs; - l_ushort sc_fs; - l_ushort sc___pad0; - l_ulong sc_err; - l_ulong sc_trapno; - l_sigset_t sc_mask; - l_ulong sc_cr2; - struct l_fpstate *sc_fpstate; - l_ulong sc_reserved1[8]; -}; - -struct l_ucontext { - l_ulong uc_flags; - l_uintptr_t uc_link; - l_stack_t uc_stack; - struct l_sigcontext uc_mcontext; - l_sigset_t uc_sigmask; -}; - #define LINUX_SI_PREAMBLE_SIZE (4 * sizeof(int)) #define LINUX_SI_MAX_SIZE 128 #define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE - \ @@ -305,18 +252,6 @@ typedef struct l_siginfo { #define lsi_fd _sifields._sigpoll._fd /* - * We make the stack look like Linux expects it when calling a signal - * handler, but use the BSD way of calling the handler and sigreturn(). - * This means that we need to pass the pointer to the handler too. - * It is appended to the frame to not interfere with the rest of it. - */ - -struct l_rt_sigframe { - struct l_ucontext sf_sc; - struct l_siginfo sf_si; -}; - -/* * mount flags */ #define LINUX_MS_RDONLY 0x0001 diff --git a/sys/amd64/linux/linux_genassym.c b/sys/amd64/linux/linux_genassym.c index 73febbe6ef40..a468520431dc 100644 --- a/sys/amd64/linux/linux_genassym.c +++ b/sys/amd64/linux/linux_genassym.c @@ -8,6 +8,8 @@ __FBSDID("$FreeBSD$"); #include <amd64/linux/linux.h> #include <compat/linux/linux_mib.h> +#include <x86/linux/linux_x86_sigframe.h> + ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc)); ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext)); ASSYM(LINUX_VERSION_CODE, LINUX_VERSION_CODE); diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index ea91dcae5d49..58ab443cd8b1 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$"); #include <compat/linux/linux_util.h> #include <compat/linux/linux_vdso.h> +#include <x86/linux/linux_x86_sigframe.h> + MODULE_VERSION(linux64, 1); #define LINUX_VDSOPAGE_SIZE PAGE_SIZE * 2 diff --git a/sys/amd64/linux32/linux.h b/sys/amd64/linux32/linux.h index ba7aeac517e1..1987ff515275 100644 --- a/sys/amd64/linux32/linux.h +++ b/sys/amd64/linux32/linux.h @@ -287,40 +287,6 @@ typedef struct { l_size_t ss_size; } l_stack_t; -/* The Linux sigcontext, pretty much a standard 386 trapframe. */ -struct l_sigcontext { - l_uint sc_gs; - l_uint sc_fs; - l_uint sc_es; - l_uint sc_ds; - l_uint sc_edi; - l_uint sc_esi; - l_uint sc_ebp; - l_uint sc_esp; - l_uint sc_ebx; - l_uint sc_edx; - l_uint sc_ecx; - l_uint sc_eax; - l_uint sc_trapno; - l_uint sc_err; - l_uint sc_eip; - l_uint sc_cs; - l_uint sc_eflags; - l_uint sc_esp_at_signal; - l_uint sc_ss; - l_uint sc_387; - l_uint sc_mask; - l_uint sc_cr2; -}; - -struct l_ucontext { - l_ulong uc_flags; - l_uintptr_t uc_link; - l_stack_t uc_stack; - struct l_sigcontext uc_mcontext; - l_sigset_t uc_sigmask; -} __packed; - #define LINUX_SI_MAX_SIZE 128 #define LINUX_SI_PAD_SIZE ((LINUX_SI_MAX_SIZE/sizeof(l_int)) - 3) @@ -389,62 +355,6 @@ typedef struct l_siginfo { #define lsi_band _sifields._sigpoll._band #define lsi_fd _sifields._sigpoll._fd -struct l_fpreg { - u_int16_t significand[4]; - u_int16_t exponent; -}; - -struct l_fpxreg { - u_int16_t significand[4]; - u_int16_t exponent; - u_int16_t padding[3]; -}; - -struct l_xmmreg { - u_int32_t element[4]; -}; - -struct l_fpstate { - /* Regular FPU environment */ - u_int32_t cw; - u_int32_t sw; - u_int32_t tag; - u_int32_t ipoff; - u_int32_t cssel; - u_int32_t dataoff; - u_int32_t datasel; - struct l_fpreg _st[8]; - u_int16_t status; - u_int16_t magic; /* 0xffff = regular FPU data */ - - /* FXSR FPU environment */ - u_int32_t _fxsr_env[6]; /* env is ignored. */ - u_int32_t mxcsr; - u_int32_t reserved; - struct l_fpxreg _fxsr_st[8]; /* reg data is ignored. */ - struct l_xmmreg _xmm[8]; - u_int32_t padding[56]; -}; - -/* - * We make the stack look like Linux expects it when calling a signal - * handler, but use the BSD way of calling the handler and sigreturn(). - */ -struct l_sigframe { - l_int sf_sig; - struct l_sigcontext sf_sc; - struct l_fpstate sf_fpstate; - l_uint sf_extramask[1]; -}; - -struct l_rt_sigframe { - l_int sf_sig; - l_uintptr_t sf_siginfo; - l_uintptr_t sf_ucontext; - l_siginfo_t sf_si; - struct l_ucontext sf_sc; -} __packed; - /* * arch specific open/fcntl flags */ diff --git a/sys/amd64/linux32/linux32_genassym.c b/sys/amd64/linux32/linux32_genassym.c index ca618c01ffab..2bc2586ebe4a 100644 --- a/sys/amd64/linux32/linux32_genassym.c +++ b/sys/amd64/linux32/linux32_genassym.c @@ -9,6 +9,8 @@ __FBSDID("$FreeBSD$"); #include <amd64/linux32/linux.h> #include <compat/linux/linux_mib.h> +#include <x86/linux/linux_x86_sigframe.h> + ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc)); ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc)); ASSYM(LINUX_RT_SIGF_SC, offsetof(struct l_ucontext, uc_mcontext)); diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index b2d0f2401bf9..c40cc6a2d269 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -91,6 +91,8 @@ __FBSDID("$FreeBSD$"); #include <compat/linux/linux_util.h> #include <compat/linux/linux_vdso.h> +#include <x86/linux/linux_x86_sigframe.h> + MODULE_VERSION(linux, 1); #define LINUX32_MAXUSER ((1ul << 32) - PAGE_SIZE) |