[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system calls for Microblaze targets |
Date: |
Thu, 3 Mar 2016 20:15:13 +0000 |
Hi Edgar -- I'm just looking back at these signal handling
race condition fix patches, and with this one I have a confusion
about the Microblaze Linux syscall code that I hope you can
clear up for me.
Looking at the kernel entry.S code it looks to me like
the way syscalls work on microblaze is:
* syscall insn is brki r14
* the insn itself saves the PC of the brki into r14
* on entry the kernel advances r14 by 4 to skip the brki
* then SAVE_REGS saves r14 into the 'PC' slot in the pt_regs
struct
* for syscall restart handle_restart() may wind the PC
value in the pt_regs back by 4
* in any case, on syscall exit we pull the PC value out of
pt_regs into r14, and do a return with rtbd r14, 0
I think what this implies is that:
* r14 is a "used by the kernel, may be corrupted at any
time, not to be touched by userspace" register
* on exit from a syscall PC and r14 are always the same
* this includes do_sigreturn, ie "taking a signal" is one
of the things that can corrupt r14
Is that right?
(For context, the original patch is this one:
http://patchwork.ozlabs.org/patch/514879/
and I now suspect my review comments at the time to be wrong.)
thanks
-- PMM
- Re: [Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system calls for Microblaze targets,
Peter Maydell <=