[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 23/36] bsd-user/arm/target_arch_sigtramp.h: Signal Trampoline
From: |
Warner Losh |
Subject: |
[PATCH v4 23/36] bsd-user/arm/target_arch_sigtramp.h: Signal Trampoline for arm |
Date: |
Thu, 4 Nov 2021 21:19:04 -0600 |
Copy of the signal trampoline code for arm, as well as setup_sigtramp to
write it to the stack.
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
bsd-user/arm/target_arch_sigtramp.h | 49 +++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 bsd-user/arm/target_arch_sigtramp.h
diff --git a/bsd-user/arm/target_arch_sigtramp.h
b/bsd-user/arm/target_arch_sigtramp.h
new file mode 100644
index 0000000000..5d434a9e7e
--- /dev/null
+++ b/bsd-user/arm/target_arch_sigtramp.h
@@ -0,0 +1,49 @@
+/*
+ * arm sysarch() system call emulation
+ *
+ * Copyright (c) 2013 Stacey D. Son
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _TARGET_ARCH_SIGTRAMP_H_
+#define _TARGET_ARCH_SIGTRAMP_H_
+
+/* Compare to arm/arm/locore.S ENTRY_NP(sigcode) */
+static inline abi_long setup_sigtramp(abi_ulong offset, unsigned sigf_uc,
+ unsigned sys_sigreturn)
+{
+ int i;
+ uint32_t sys_exit = TARGET_FREEBSD_NR_exit;
+ uint32_t sigtramp_code[] = {
+ /* 1 */ 0xE1A0000D, /* mov r0, sp */
+ /* 2 */ 0xE2800000 + sigf_uc, /* add r0, r0, #SIGF_UC */
+ /* 3 */ 0xE59F700C, /* ldr r7, [pc, #12] */
+ /* 4 */ 0xEF000000 + sys_sigreturn, /* swi (SYS_sigreturn) */
+ /* 5 */ 0xE59F7008, /* ldr r7, [pc, #8] */
+ /* 6 */ 0xEF000000 + sys_exit, /* swi (SYS_exit)*/
+ /* 7 */ 0xEAFFFFFA, /* b . -16 */
+ /* 8 */ sys_sigreturn,
+ /* 9 */ sys_exit
+ };
+
+ G_STATIC_ASSERT(sizeof(sigtramp_code) == TARGET_SZSIGCODE);
+
+ for (i = 0; i < 9; i++) {
+ tswap32s(&sigtramp_code[i]);
+ }
+
+ return memcpy_to_target(offset, sigtramp_code, TARGET_SZSIGCODE);
+}
+#endif /* _TARGET_ARCH_SIGTRAMP_H_ */
--
2.33.0
- [PATCH v4 29/36] bsd-user/arm/target_arch_signal.h: arm machine context and trapframe for signals, (continued)
- [PATCH v4 29/36] bsd-user/arm/target_arch_signal.h: arm machine context and trapframe for signals, Warner Losh, 2021/11/04
- [PATCH v4 28/36] bsd-user/arm/target_arch_signal.h: arm specific signal registers and stack, Warner Losh, 2021/11/04
- [PATCH v4 31/36] bsd-user/arm/target_arch_signal.c: arm set_sigtramp_args, Warner Losh, 2021/11/04
- [PATCH v4 20/36] bsd-user/arm/target_arch_cpu.h: Implement system call dispatch, Warner Losh, 2021/11/04
- [PATCH v4 30/36] bsd-user/arm/target_arch_signal.h: Define size of *context_t, Warner Losh, 2021/11/04
- [PATCH v4 35/36] bsd-user/freebsd/target_os_ucontext.h: Require TARGET_*CONTEXT_SIZE, Warner Losh, 2021/11/04
- [PATCH v4 36/36] bsd-user: add arm target build, Warner Losh, 2021/11/04
- [PATCH v4 23/36] bsd-user/arm/target_arch_sigtramp.h: Signal Trampoline for arm,
Warner Losh <=
- [PATCH v4 25/36] bsd-user/arm/target_arch_elf.h: arm defines for ELF, Warner Losh, 2021/11/04
- [PATCH v4 26/36] bsd-user/arm/target_arch_elf.h: arm get hwcap, Warner Losh, 2021/11/04
- [PATCH v4 22/36] bsd-user/arm/target_arch_vmparam.h: Parameters for arm address space, Warner Losh, 2021/11/04
- [PATCH v4 32/36] bsd-user/arm/target_arch_signal.c: arm get_mcontext, Warner Losh, 2021/11/04
- [PATCH v4 33/36] bsd-user/arm/target_arch_signal.c: arm set_mcontext, Warner Losh, 2021/11/04
- [PATCH v4 34/36] bsd-user/arm/target_arch_signal.c: arm get_ucontext_sigreturn, Warner Losh, 2021/11/04