Le 01/02/2017 à 23:30, David Gibson a écrit : > On Wed, Feb 01, 2017 at 03:25:05PM +0000, Peter Maydell wrote: >> On 30 January 2017 at 23:52, Sam Bobroff <[email protected]> wrote: >>>> On 01/16/2017 03:56 PM, Aníbal Limón wrote: >>>>> I'm trying to upgrade qemu to 2.8.0 in Openembedded-core and segfaults >>>>> in qemu-ppc when is executing: >> >>> I've recently encountered a similar problem and I've posted a fix. If >>> you'd like to try it, it's here: >>> >>> https://lists.gnu.org/archive/html/qemu-ppc/2017-01/msg00413.html >> >> Hmm, I missed that patch (it doesn't seem to have made it >> to the qemu-devel list), but it isn't correct, I'm afraid. >> In the patch for handling TARGET_USER_ESIGRETURN you must >> not change the nip register, because we will have just >> set it from the signal context that the guest provided >> to the sigreturn syscall. (The patch as it stands will >> cause us to reexecute an instruction after return from >> a signal handler, which isn't going to go very well).
I think commit bd6fefe has already made the change in
target-ppc/excp_helper.c:
case POWERPC_EXCP_SYSCALL: /* System call exception
*/
dump_syscall(env);
lev = env->error_code;
+ /* We need to correct the NIP which in this case is supposed
+ * to point to the next instruction
+ */
+ env->nip += 4;
+
/* "PAPR mode" built-in hypercall emulation */
if ((lev == 1) && cpu_ppc_hypercall) {
cpu_ppc_hypercall(cpu);
And target/ppc/translate.c:
#if defined(CONFIG_USER_ONLY)
#define POWERPC_SYSCALL POWERPC_EXCP_SYSCALL_USER
#else
#define POWERPC_SYSCALL POWERPC_EXCP_SYSCALL
#endif
So I guess the fix should be only to revert the
POWERPC_EXCP_SYSCALL_USER change of bd6fefe with:
@@ -2001,9 +2001,9 @@ void cpu_loop(CPUPPCState *env)
env->gpr[5], env->gpr[6], env->gpr[7],
env->gpr[8], 0, 0);
if (ret == -TARGET_ERESTARTSYS) {
+ env->nip -= 4;
break;
}
- env->nip += 4;
if (ret == (target_ulong)(-TARGET_QEMU_ESIGRETURN)) {
/* Returning from a successful sigreturn syscall.
Avoid corrupting register state. */
Not sure anyway...
Laurent
signature.asc
Description: OpenPGP digital signature
