[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 20/40] bsd-user/host/i386/host-signal.h: Implement host_signal
From: |
Warner Losh |
Subject: |
[PATCH v2 20/40] bsd-user/host/i386/host-signal.h: Implement host_signal_* |
Date: |
Mon, 24 Jan 2022 18:29:27 -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
- Re: [PATCH v2 29/40] bsd-user/signal.c: Fill in queue_signal, (continued)
- [PATCH v2 30/40] bsd-user/signal.c: sigset manipulation routines., Warner Losh, 2022/01/24
- [PATCH v2 35/40] bsd-user/signal.c: implement do_sigreturn, Warner Losh, 2022/01/24
- [PATCH v2 33/40] bsd-user/signal.c: tswap_siginfo, Warner Losh, 2022/01/24
- [PATCH v2 40/40] bsd-user/freebsd/target_os_ucontext.h: Prefer env as arg name for CPUArchState args, Warner Losh, 2022/01/24
- [PATCH v2 24/40] bsd-user/signal.c: host_to_target_siginfo_noswap, Warner Losh, 2022/01/24
- [PATCH v2 20/40] bsd-user/host/i386/host-signal.h: Implement host_signal_*,
Warner Losh <=
- [PATCH v2 25/40] bsd-user/signal.c: Implement rewind_if_in_safe_syscall, Warner Losh, 2022/01/24
- [PATCH v2 31/40] bsd-user/signal.c: setup_frame, Warner Losh, 2022/01/24
- [PATCH v2 32/40] bsd-user/signal.c: handle_pending_signal, Warner Losh, 2022/01/24
- [PATCH v2 34/40] bsd-user/signal.c: process_pending_signals, Warner Losh, 2022/01/24
- [PATCH v2 37/40] bsd-user/signal.c: do_sigaltstack, Warner Losh, 2022/01/24