diff options
author | Warner Losh <imp@bsdimp.com> | 2022-01-08 17:15:19 -0700 |
---|---|---|
committer | Warner Losh <imp@bsdimp.com> | 2022-01-28 15:52:39 -0700 |
commit | 220f8606c8d48e5d6d4145abccebb0fa8518c507 (patch) | |
tree | ea5388e5d11beba061c44acb350ba0b0d49a6d21 /bsd-user/host | |
parent | 6e0bc06e210cbd25006c3a39e9a8325784d0be78 (diff) | |
download | qemu-220f8606c8d48e5d6d4145abccebb0fa8518c507.zip qemu-220f8606c8d48e5d6d4145abccebb0fa8518c507.tar.gz qemu-220f8606c8d48e5d6d4145abccebb0fa8518c507.tar.bz2 |
bsd-user/host/i386/host-signal.h: Implement host_signal_*
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>
Diffstat (limited to 'bsd-user/host')
-rw-r--r-- | bsd-user/host/i386/host-signal.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bsd-user/host/i386/host-signal.h b/bsd-user/host/i386/host-signal.h new file mode 100644 index 0000000..169e61b --- /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 |