On 07/25/2016 06:21 AM, Benjamin Herrenschmidt wrote:
On Mon, 2016-07-25 at 10:46 +1000, Benjamin Herrenschmidt wrote:
On Mon, 2016-07-25 at 06:06 +0530, Richard Henderson wrote:
These functions would have to be always_inline for this to work.
Otherwise you
could get the helper's PC, not the TCG caller's PC.
But let's try to fix this the other way.
I could use some help there as I don't really understand the PC fixup
adjustment mechanism in qemu...
One thing I can do, but I don't know whether that's worthwhile (you
tell me), is change all translation helpers in powerpc to do like
x86, which is to pass the RA along and never use the non_ra() variants.
But that's quite a bit of churn, so let me know if your plan is better.
It is worthwhile, because that allows you to drop some state saving within the
translation. With the assumption being, of course, that the exceptional case
is rare and so we save on the state saving most of the time.
Or, as appears to be the case for e.g. LVEBX, there currently is no such state
save, and so any exceptions raised by this insn will point to the wrong insn,
and so the conversion fixes a bug.
Are those functions always meant to be called within translation
helpers ? IE, the fault can safely longjmp out and it's just a matter
of finding the proper instruction PC to report ?
Correct.
Or can they also be called outside of that context ?
No, not without a valid return address.
E.g. it's not valid to have one helper call another, and for the second helper
use GETPC. For this, typically, one must factor out a common function which
accepts a "retaddr" argument, which the callers must fill in with GETPC.
r~