[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 21/40] bsd-user/host/x86_64/host-signal.h: Implement host_sign
From: |
Warner Losh |
Subject: |
[PATCH v3 21/40] bsd-user/host/x86_64/host-signal.h: Implement host_signal_* |
Date: |
Fri, 28 Jan 2022 16:27:46 -0700 |
Implement host_signal_pc, host_signal_set_pc and host_signal_write for
x86_64.
Signed-off-by: Kyle Evans <kevans@freebsd.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
bsd-user/host/x86_64/host-signal.h | 37 ++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 bsd-user/host/x86_64/host-signal.h
diff --git a/bsd-user/host/x86_64/host-signal.h
b/bsd-user/host/x86_64/host-signal.h
new file mode 100644
index 00000000000..47ca19f8814
--- /dev/null
+++ b/bsd-user/host/x86_64/host-signal.h
@@ -0,0 +1,37 @@
+/*
+ * host-signal.h: signal info dependent on the host architecture
+ *
+ * Copyright (c) 2021 Warner Losh
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef X86_64_HOST_SIGNAL_H
+#define X86_64_HOST_SIGNAL_H
+
+#include <sys/ucontext.h>
+#include <machine/trap.h>
+#include <vm/pmap.h>
+#include <machine/pmap.h>
+
+static inline uintptr_t host_signal_pc(ucontext_t *uc)
+{
+ return uc->uc_mcontext.mc_rip;
+}
+
+static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc)
+{
+ uc->uc_mcontext.mc_rip = pc;
+}
+
+static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
+{
+ /*
+ * Look in sys/amd64/amd64/trap.c. NOTE: mc_err == tr_err due to type
+ * punning between a trapframe and mcontext on FreeBSD/amd64.
+ */
+ return uc->uc_mcontext.mc_trapno == T_PAGEFLT &&
+ uc->uc_mcontext.mc_err & PGEX_W;
+}
+
+#endif
--
2.33.1
- [PATCH v3 06/40] bsd-user: Bring in docs from linux-user for signal_pending, (continued)
- [PATCH v3 06/40] bsd-user: Bring in docs from linux-user for signal_pending, Warner Losh, 2022/01/28
- [PATCH v3 08/40] bsd-user/signal.c: implement force_sig_fault, Warner Losh, 2022/01/28
- [PATCH v3 09/40] bsd-user/signal-common.h: Move signal functions prototypes to here, Warner Losh, 2022/01/28
- [PATCH v3 10/40] bsd-user/signal.c: Implement cpu_loop_exit_sigsegv, Warner Losh, 2022/01/28
- [PATCH v3 12/40] bsd-user/arm/arget_arch_cpu.h: Move EXCP_DEBUG and EXCP_BKPT together, Warner Losh, 2022/01/28
- [PATCH v3 13/40] bsd-user/arm/target_arch_cpu.h: Correct code pointer, Warner Losh, 2022/01/28
- [PATCH v3 11/40] bsd-user/signal.c: implement cpu_loop_exit_sigbus, Warner Losh, 2022/01/28
- [PATCH v3 15/40] bsd-user/arm/target_arch_cpu.h: Implement data faults, Warner Losh, 2022/01/28
- [PATCH v3 16/40] bsd-user/signal.c: implement abstract target / host signal translation, Warner Losh, 2022/01/28
- [PATCH v3 14/40] bsd-user/arm/target_arch_cpu.h: Use force_sig_fault for EXCP_UDEF, Warner Losh, 2022/01/28
- [PATCH v3 21/40] bsd-user/host/x86_64/host-signal.h: Implement host_signal_*,
Warner Losh <=
- [PATCH v3 20/40] bsd-user/host/i386/host-signal.h: Implement host_signal_*, Warner Losh, 2022/01/28
- [PATCH v3 18/40] bsd-user/signal.c: Add si_type argument to queue_signal, Warner Losh, 2022/01/28
- [PATCH v3 35/40] bsd-user/signal.c: implement do_sigreturn, Warner Losh, 2022/01/28
- [PATCH v3 36/40] bsd-user/signal.c: implement do_sigaction, Warner Losh, 2022/01/28
- [PATCH v3 26/40] bsd-user/signal.c: Implement host_signal_handler, Warner Losh, 2022/01/28
- [PATCH v3 24/40] bsd-user/signal.c: host_to_target_siginfo_noswap, Warner Losh, 2022/01/28
- [PATCH v3 25/40] bsd-user/signal.c: Implement rewind_if_in_safe_syscall, Warner Losh, 2022/01/28