mirror of https://gitee.com/openkylin/qemu.git
linux-user/host/sparc: Populate host_signal.h
Split host_signal_pc and host_signal_write out of user-exec.c. Drop the *BSD code, to be re-created under bsd-user/ later. Drop the Solaris code as completely unused. Reviewed-by: Warner Losh <imp@bsdimp.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
44c8f2cd90
commit
8b5bd46193
|
@ -253,67 +253,7 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size,
|
|||
return size ? g2h(env_cpu(env), addr) : NULL;
|
||||
}
|
||||
|
||||
#if defined(__sparc__)
|
||||
|
||||
int cpu_signal_handler(int host_signum, void *pinfo,
|
||||
void *puc)
|
||||
{
|
||||
siginfo_t *info = pinfo;
|
||||
int is_write;
|
||||
uint32_t insn;
|
||||
#if !defined(__arch64__) || defined(CONFIG_SOLARIS)
|
||||
uint32_t *regs = (uint32_t *)(info + 1);
|
||||
void *sigmask = (regs + 20);
|
||||
/* XXX: is there a standard glibc define ? */
|
||||
unsigned long pc = regs[1];
|
||||
#else
|
||||
#ifdef __linux__
|
||||
struct sigcontext *sc = puc;
|
||||
unsigned long pc = sc->sigc_regs.tpc;
|
||||
void *sigmask = (void *)sc->sigc_mask;
|
||||
#elif defined(__OpenBSD__)
|
||||
struct sigcontext *uc = puc;
|
||||
unsigned long pc = uc->sc_pc;
|
||||
void *sigmask = (void *)(long)uc->sc_mask;
|
||||
#elif defined(__NetBSD__)
|
||||
ucontext_t *uc = puc;
|
||||
unsigned long pc = _UC_MACHINE_PC(uc);
|
||||
void *sigmask = (void *)&uc->uc_sigmask;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* XXX: need kernel patch to get write flag faster */
|
||||
is_write = 0;
|
||||
insn = *(uint32_t *)pc;
|
||||
if ((insn >> 30) == 3) {
|
||||
switch ((insn >> 19) & 0x3f) {
|
||||
case 0x05: /* stb */
|
||||
case 0x15: /* stba */
|
||||
case 0x06: /* sth */
|
||||
case 0x16: /* stha */
|
||||
case 0x04: /* st */
|
||||
case 0x14: /* sta */
|
||||
case 0x07: /* std */
|
||||
case 0x17: /* stda */
|
||||
case 0x0e: /* stx */
|
||||
case 0x1e: /* stxa */
|
||||
case 0x24: /* stf */
|
||||
case 0x34: /* stfa */
|
||||
case 0x27: /* stdf */
|
||||
case 0x37: /* stdfa */
|
||||
case 0x26: /* stqf */
|
||||
case 0x36: /* stqfa */
|
||||
case 0x25: /* stfsr */
|
||||
case 0x3c: /* casa */
|
||||
case 0x3e: /* casxa */
|
||||
is_write = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return handle_cpu_signal(pc, info, is_write, sigmask);
|
||||
}
|
||||
|
||||
#elif defined(__arm__)
|
||||
#if defined(__arm__)
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include <ucontext.h>
|
||||
|
|
|
@ -1 +1,54 @@
|
|||
#define HOST_SIGNAL_PLACEHOLDER
|
||||
/*
|
||||
* host-signal.h: signal info dependent on the host architecture
|
||||
*
|
||||
* Copyright (c) 2003-2005 Fabrice Bellard
|
||||
* Copyright (c) 2021 Linaro Limited
|
||||
*
|
||||
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
|
||||
* See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#ifndef SPARC_HOST_SIGNAL_H
|
||||
#define SPARC_HOST_SIGNAL_H
|
||||
|
||||
static inline uintptr_t host_signal_pc(ucontext_t *uc)
|
||||
{
|
||||
#ifdef __arch64__
|
||||
return uc->uc_mcontext.mc_gregs[MC_PC];
|
||||
#else
|
||||
return uc->uc_mcontext.gregs[REG_PC];
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
|
||||
{
|
||||
uint32_t insn = *(uint32_t *)host_signal_pc(uc);
|
||||
|
||||
if ((insn >> 30) == 3) {
|
||||
switch ((insn >> 19) & 0x3f) {
|
||||
case 0x05: /* stb */
|
||||
case 0x15: /* stba */
|
||||
case 0x06: /* sth */
|
||||
case 0x16: /* stha */
|
||||
case 0x04: /* st */
|
||||
case 0x14: /* sta */
|
||||
case 0x07: /* std */
|
||||
case 0x17: /* stda */
|
||||
case 0x0e: /* stx */
|
||||
case 0x1e: /* stxa */
|
||||
case 0x24: /* stf */
|
||||
case 0x34: /* stfa */
|
||||
case 0x27: /* stdf */
|
||||
case 0x37: /* stdfa */
|
||||
case 0x26: /* stqf */
|
||||
case 0x36: /* stqfa */
|
||||
case 0x25: /* stfsr */
|
||||
case 0x3c: /* casa */
|
||||
case 0x3e: /* casxa */
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define HOST_SIGNAL_PLACEHOLDER
|
||||
#include "../sparc/host-signal.h"
|
||||
|
|
Loading…
Reference in New Issue