mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-24 10:32:02 -06:00
accel/tcg: Adjust cpu_signal_handler for NetBSD/arm
Fix building on NetBSD/arm by extracting the FSR value from the correct siginfo_t field. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Nick Hudson <skrll@netbsd.org> Message-Id: <20200516154147.24842-1-skrll@netbsd.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
61f15c487f
commit
853d9a4be8
1 changed files with 13 additions and 3 deletions
|
@ -517,6 +517,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
|
#include <sys/siginfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int cpu_signal_handler(int host_signum, void *pinfo,
|
int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
|
@ -525,10 +526,12 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
siginfo_t *info = pinfo;
|
siginfo_t *info = pinfo;
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
ucontext_t *uc = puc;
|
ucontext_t *uc = puc;
|
||||||
|
siginfo_t *si = pinfo;
|
||||||
#else
|
#else
|
||||||
ucontext_t *uc = puc;
|
ucontext_t *uc = puc;
|
||||||
#endif
|
#endif
|
||||||
unsigned long pc;
|
unsigned long pc;
|
||||||
|
uint32_t fsr;
|
||||||
int is_write;
|
int is_write;
|
||||||
|
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
|
@ -539,10 +542,17 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
pc = uc->uc_mcontext.arm_pc;
|
pc = uc->uc_mcontext.arm_pc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* error_code is the FSR value, in which bit 11 is WnR (assuming a v6 or
|
#ifdef __NetBSD__
|
||||||
* later processor; on v5 we will always report this as a read).
|
fsr = si->si_trap;
|
||||||
|
#else
|
||||||
|
fsr = uc->uc_mcontext.error_code;
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* In the FSR, bit 11 is WnR, assuming a v6 or
|
||||||
|
* later processor. On v5 we will always report
|
||||||
|
* this as a read, which will fail later.
|
||||||
*/
|
*/
|
||||||
is_write = extract32(uc->uc_mcontext.error_code, 11, 1);
|
is_write = extract32(fsr, 11, 1);
|
||||||
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue