mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-10-15 15:32:51 +00:00
bsd-user/host/x86_64/host-signal.h: Implement host_signal_*
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>
This commit is contained in:
parent
220f8606c8
commit
b375158801
37
bsd-user/host/x86_64/host-signal.h
Normal file
37
bsd-user/host/x86_64/host-signal.h
Normal file
|
@ -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
|
Loading…
Reference in a new issue