[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/40] bsd-user/host/i386/host-signal.h: Implement host_signal_*
|
From: |
Warner Losh |
|
Subject: |
[PULL 20/40] bsd-user/host/i386/host-signal.h: Implement host_signal_* |
|
Date: |
Mon, 31 Jan 2022 12:56:16 -0700 |
Implement host_signal_pc, host_signal_set_pc and host_signal_write for
i386.
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/i386/host-signal.h | 37 ++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
create mode 100644 bsd-user/host/i386/host-signal.h
diff --git a/bsd-user/host/i386/host-signal.h b/bsd-user/host/i386/host-signal.h
new file mode 100644
index 00000000000..169e61b154c
--- /dev/null
+++ b/bsd-user/host/i386/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 I386_HOST_SIGNAL_H
+#define I386_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_eip;
+}
+
+static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc)
+{
+ uc->uc_mcontext.mc_eip = pc;
+}
+
+static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
+{
+ /*
+ * Look in sys/i386/i386/trap.c. NOTE: mc_err == tr_err due to type punning
+ * between a trapframe and mcontext on FreeBSD/i386.
+ */
+ return uc->uc_mcontext.mc_trapno == T_PAGEFLT &&
+ uc->uc_mcontext.mc_err & PGEX_W;
+}
+
+#endif
--
2.33.1
- [PULL 05/40] bsd-user: Remove vestiges of signal queueing code, (continued)
- [PULL 05/40] bsd-user: Remove vestiges of signal queueing code, Warner Losh, 2022/01/31
- [PULL 12/40] bsd-user/arm/arget_arch_cpu.h: Move EXCP_DEBUG and EXCP_BKPT together, Warner Losh, 2022/01/31
- [PULL 14/40] bsd-user/arm/target_arch_cpu.h: Use force_sig_fault for EXCP_UDEF, Warner Losh, 2022/01/31
- [PULL 21/40] bsd-user/host/x86_64/host-signal.h: Implement host_signal_*, Warner Losh, 2022/01/31
- [PULL 30/40] bsd-user/signal.c: sigset manipulation routines., Warner Losh, 2022/01/31
- [PULL 39/40] bsd-user: Rename arg name for target_cpu_reset to env, Warner Losh, 2022/01/31
- [PULL 26/40] bsd-user/signal.c: Implement host_signal_handler, Warner Losh, 2022/01/31
- [PULL 23/40] bsd-user: Add trace events for bsd-user, Warner Losh, 2022/01/31
- [PULL 31/40] bsd-user/signal.c: setup_frame, Warner Losh, 2022/01/31
- [PULL 17/40] bsd-user/signal.c: Implement signal_init(), Warner Losh, 2022/01/31
- [PULL 20/40] bsd-user/host/i386/host-signal.h: Implement host_signal_*,
Warner Losh <=
- [PULL 02/40] bsd-user: Create setup_sigframe_arch to setup sigframe context, Warner Losh, 2022/01/31
- [PULL 15/40] bsd-user/arm/target_arch_cpu.h: Implement data faults, Warner Losh, 2022/01/31
- [PULL 27/40] bsd-user/strace.c: print_taken_signal, Warner Losh, 2022/01/31
- [PULL 28/40] bsd-user/signal.c: Implement dump_core_and_abort, Warner Losh, 2022/01/31
- [PULL 34/40] bsd-user/signal.c: process_pending_signals, Warner Losh, 2022/01/31
- [PULL 16/40] bsd-user/signal.c: implement abstract target / host signal translation, Warner Losh, 2022/01/31
- [PULL 13/40] bsd-user/arm/target_arch_cpu.h: Correct code pointer, Warner Losh, 2022/01/31
- [PULL 32/40] bsd-user/signal.c: handle_pending_signal, Warner Losh, 2022/01/31
- [PULL 33/40] bsd-user/signal.c: tswap_siginfo, Warner Losh, 2022/01/31
- [PULL 08/40] bsd-user/signal.c: implement force_sig_fault, Warner Losh, 2022/01/31