mirror of https://github.com/xqemu/xqemu.git
linux-user: Propagate siginfo_t through to handle_cpu_signal()
Currently all the architecture/OS specific cpu_signal_handler() functions call handle_cpu_signal() without passing it the siginfo_t. We're going to want that so we can look at the si_code to determine whether this is a SEGV_ACCERR access violation or some other kind of fault, so change the functions to pass through the pointer to the siginfo_t rather than just the si_addr value. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <1511879725-9576-2-git-send-email-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
bfdec7f80e
commit
a78b1299f1
|
@ -57,12 +57,13 @@ static void cpu_exit_tb_from_sighandler(CPUState *cpu, sigset_t *old_set)
|
||||||
the effective address of the memory exception. 'is_write' is 1 if a
|
the effective address of the memory exception. 'is_write' is 1 if a
|
||||||
write caused the exception and otherwise 0'. 'old_set' is the
|
write caused the exception and otherwise 0'. 'old_set' is the
|
||||||
signal set which should be restored */
|
signal set which should be restored */
|
||||||
static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
|
static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info,
|
||||||
int is_write, sigset_t *old_set)
|
int is_write, sigset_t *old_set)
|
||||||
{
|
{
|
||||||
CPUState *cpu = current_cpu;
|
CPUState *cpu = current_cpu;
|
||||||
CPUClass *cc;
|
CPUClass *cc;
|
||||||
int ret;
|
int ret;
|
||||||
|
unsigned long address = (unsigned long)info->si_addr;
|
||||||
|
|
||||||
/* We must handle PC addresses from two different sources:
|
/* We must handle PC addresses from two different sources:
|
||||||
* a call return address and a signal frame address.
|
* a call return address and a signal frame address.
|
||||||
|
@ -215,9 +216,8 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
#endif
|
#endif
|
||||||
pc = EIP_sig(uc);
|
pc = EIP_sig(uc);
|
||||||
trapno = TRAP_sig(uc);
|
trapno = TRAP_sig(uc);
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, info,
|
||||||
trapno == 0xe ?
|
trapno == 0xe ? (ERROR_sig(uc) >> 1) & 1 : 0,
|
||||||
(ERROR_sig(uc) >> 1) & 1 : 0,
|
|
||||||
&MASK_sig(uc));
|
&MASK_sig(uc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,9 +261,8 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pc = PC_sig(uc);
|
pc = PC_sig(uc);
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, info,
|
||||||
TRAP_sig(uc) == 0xe ?
|
TRAP_sig(uc) == 0xe ? (ERROR_sig(uc) >> 1) & 1 : 0,
|
||||||
(ERROR_sig(uc) >> 1) & 1 : 0,
|
|
||||||
&MASK_sig(uc));
|
&MASK_sig(uc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,8 +340,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
is_write = 1;
|
is_write = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
||||||
is_write, &uc->uc_sigmask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__alpha__)
|
#elif defined(__alpha__)
|
||||||
|
@ -372,8 +370,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
is_write = 1;
|
is_write = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
||||||
is_write, &uc->uc_sigmask);
|
|
||||||
}
|
}
|
||||||
#elif defined(__sparc__)
|
#elif defined(__sparc__)
|
||||||
|
|
||||||
|
@ -432,8 +429,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, info, is_write, sigmask);
|
||||||
is_write, sigmask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__arm__)
|
#elif defined(__arm__)
|
||||||
|
@ -466,9 +462,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
* later processor; on v5 we will always report this as a read).
|
* later processor; on v5 we will always report this as a read).
|
||||||
*/
|
*/
|
||||||
is_write = extract32(uc->uc_mcontext.error_code, 11, 1);
|
is_write = extract32(uc->uc_mcontext.error_code, 11, 1);
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
||||||
is_write,
|
|
||||||
&uc->uc_sigmask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
|
@ -495,8 +489,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
|
||||||
/* Ignore bits 23 & 24, controlling indexing. */
|
/* Ignore bits 23 & 24, controlling indexing. */
|
||||||
|| (insn & 0x3a400000) == 0x28000000); /* C3.3.7,14-16 */
|
|| (insn & 0x3a400000) == 0x28000000); /* C3.3.7,14-16 */
|
||||||
|
|
||||||
return handle_cpu_signal(pc, (uintptr_t)info->si_addr,
|
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
||||||
is_write, &uc->uc_sigmask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__ia64)
|
#elif defined(__ia64)
|
||||||
|
@ -529,9 +522,7 @@ int cpu_signal_handler(int host_signum, void *pinfo, void *puc)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return handle_cpu_signal(ip, (unsigned long)info->si_addr,
|
return handle_cpu_signal(ip, info, is_write, (sigset_t *)&uc->uc_sigmask);
|
||||||
is_write,
|
|
||||||
(sigset_t *)&uc->uc_sigmask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__s390__)
|
#elif defined(__s390__)
|
||||||
|
@ -583,8 +574,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
||||||
is_write, &uc->uc_sigmask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(__mips__)
|
#elif defined(__mips__)
|
||||||
|
@ -599,8 +589,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
|
||||||
|
|
||||||
/* XXX: compute is_write */
|
/* XXX: compute is_write */
|
||||||
is_write = 0;
|
is_write = 0;
|
||||||
return handle_cpu_signal(pc, (unsigned long)info->si_addr,
|
return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask);
|
||||||
is_write, &uc->uc_sigmask);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue