[OpenBIOS] [PATCH 2/4] ppc: add new context handler
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Tue May 3 23:12:09 CEST 2016
On 03/05/16 22:06, Segher Boessenkool wrote:
> On Tue, May 03, 2016 at 09:03:48PM +0100, Mark Cave-Ayland wrote:
>>>> So the optimiser has decided to remove the storage to/from the lr stack
>>>> variable which of course means that the lr value isn't being preserved.
>>>> Do I somehow need to mark the "r" (lr) as clobbered or something else?
>>>
>>> Oh, yeah, that's another problem: a call can clobber all volatile
>>> (caller-save) registers. The best solution is to write this whole
>>> thing in actual assembler, instead of fighting the compiler to get
>>> just the assembler you want ;-)
>>
>> Heh actually the bug was a missing volatile qualifier from the __context
>> pointer which is interesting since this code is used almost boilerplate
>> for other architectures - I'll spin up a patch to update the other archs
>> once this has gone in. The v2 version of the patchset contains this
>> correction though.
>
> That is just a workaround. It might well work, and it can also break
> at any time.
Can you explain further? The v2 patch uses a single register marked as
clobber for mflr/mtlr and the volatile modifier for __context ensures
that the old value being written to the stack doesn't get optimised away
by the compiler. What else am I missing?
ATB,
Mark.
More information about the OpenBIOS
mailing list