mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
linux-user/host/ppc: 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. Reviewed-by: Warner Losh <imp@bsdimp.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
85442fce49
commit
8cc7b85d56
@ -253,84 +253,7 @@ void *probe_access(CPUArchState *env, target_ulong addr, int size,
|
||||
return size ? g2h(env_cpu(env), addr) : NULL;
|
||||
}
|
||||
|
||||
#if defined(_ARCH_PPC)
|
||||
|
||||
/***********************************************************************
|
||||
* signal context platform-specific definitions
|
||||
* From Wine
|
||||
*/
|
||||
#ifdef linux
|
||||
/* All Registers access - only for local access */
|
||||
#define REG_sig(reg_name, context) \
|
||||
((context)->uc_mcontext.regs->reg_name)
|
||||
/* Gpr Registers access */
|
||||
#define GPR_sig(reg_num, context) REG_sig(gpr[reg_num], context)
|
||||
/* Program counter */
|
||||
#define IAR_sig(context) REG_sig(nip, context)
|
||||
/* Machine State Register (Supervisor) */
|
||||
#define MSR_sig(context) REG_sig(msr, context)
|
||||
/* Count register */
|
||||
#define CTR_sig(context) REG_sig(ctr, context)
|
||||
/* User's integer exception register */
|
||||
#define XER_sig(context) REG_sig(xer, context)
|
||||
/* Link register */
|
||||
#define LR_sig(context) REG_sig(link, context)
|
||||
/* Condition register */
|
||||
#define CR_sig(context) REG_sig(ccr, context)
|
||||
|
||||
/* Float Registers access */
|
||||
#define FLOAT_sig(reg_num, context) \
|
||||
(((double *)((char *)((context)->uc_mcontext.regs + 48 * 4)))[reg_num])
|
||||
#define FPSCR_sig(context) \
|
||||
(*(int *)((char *)((context)->uc_mcontext.regs + (48 + 32 * 2) * 4)))
|
||||
/* Exception Registers access */
|
||||
#define DAR_sig(context) REG_sig(dar, context)
|
||||
#define DSISR_sig(context) REG_sig(dsisr, context)
|
||||
#define TRAP_sig(context) REG_sig(trap, context)
|
||||
#endif /* linux */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#include <ucontext.h>
|
||||
#define IAR_sig(context) ((context)->uc_mcontext.mc_srr0)
|
||||
#define MSR_sig(context) ((context)->uc_mcontext.mc_srr1)
|
||||
#define CTR_sig(context) ((context)->uc_mcontext.mc_ctr)
|
||||
#define XER_sig(context) ((context)->uc_mcontext.mc_xer)
|
||||
#define LR_sig(context) ((context)->uc_mcontext.mc_lr)
|
||||
#define CR_sig(context) ((context)->uc_mcontext.mc_cr)
|
||||
/* Exception Registers access */
|
||||
#define DAR_sig(context) ((context)->uc_mcontext.mc_dar)
|
||||
#define DSISR_sig(context) ((context)->uc_mcontext.mc_dsisr)
|
||||
#define TRAP_sig(context) ((context)->uc_mcontext.mc_exc)
|
||||
#endif /* __FreeBSD__|| __FreeBSD_kernel__ */
|
||||
|
||||
int cpu_signal_handler(int host_signum, void *pinfo,
|
||||
void *puc)
|
||||
{
|
||||
siginfo_t *info = pinfo;
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
ucontext_t *uc = puc;
|
||||
#else
|
||||
ucontext_t *uc = puc;
|
||||
#endif
|
||||
unsigned long pc;
|
||||
int is_write;
|
||||
|
||||
pc = IAR_sig(uc);
|
||||
is_write = 0;
|
||||
#if 0
|
||||
/* ppc 4xx case */
|
||||
if (DSISR_sig(uc) & 0x00800000) {
|
||||
is_write = 1;
|
||||
}
|
||||
#else
|
||||
if (TRAP_sig(uc) != 0x400 && (DSISR_sig(uc) & 0x02000000)) {
|
||||
is_write = 1;
|
||||
}
|
||||
#endif
|
||||
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
||||
}
|
||||
|
||||
#elif defined(__alpha__)
|
||||
#if defined(__alpha__)
|
||||
|
||||
int cpu_signal_handler(int host_signum, void *pinfo,
|
||||
void *puc)
|
||||
|
@ -1 +1,25 @@
|
||||
#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 PPC_HOST_SIGNAL_H
|
||||
#define PPC_HOST_SIGNAL_H
|
||||
|
||||
static inline uintptr_t host_signal_pc(ucontext_t *uc)
|
||||
{
|
||||
return uc->uc_mcontext.regs->nip;
|
||||
}
|
||||
|
||||
static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
|
||||
{
|
||||
return uc->uc_mcontext.regs->trap != 0x400
|
||||
&& (uc->uc_mcontext.regs->dsisr & 0x02000000);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1 +1 @@
|
||||
#define HOST_SIGNAL_PLACEHOLDER
|
||||
#include "../ppc/host-signal.h"
|
||||
|
Loading…
Reference in New Issue
Block a user