On 19/09/2018 16:33, Peter Maydell wrote:

> On 19 September 2018 at 07:47, Roman Kapl <roman.k...@sysgo.com> wrote:
>> It seems that the `dcbz` instruction is not emulated correctly (which may
>> lead to some garbage in inittab?). However, if I manualy inline the
>> `helper_dcbz_common` code into `helper dcbz`, it starts to work.
> 
> This is because helper_dcbz_common() uses GETPC() to get the
> return address inside generated code which will be used when
> an exception occurs. This only works from a function called
> directly from generated code. If you want to abstract out
> into a second function, then you need:
>  * the second function to take a retaddr argument, which it
>    can then pass to cpu_stq_data_ra()
>  * the top level helpers called from TCG to pass GETPC() as
>    that retaddr parameter
> 
> Incidentally, calling your secondary helper function
> "helper_dcbz_common" is not ideal -- the "helper_" prefix
> is generally used to indicate functions which are directly
> called from TCG generated code as helper functions (which
> does matter for some purposes, like this one).

Brilliant! I had no idea about the restrictions on GETPC(). Thanks so much for
helping here, Peter.


ATB,

Mark.

Reply via email to