[Skiboot] [PATCH 03/13] cpu.h: implement this_cpu for clang

Joel Stanley joel at jms.id.au
Thu May 3 17:41:10 AEST 2018


On 3 May 2018 at 12:43, Joel Stanley <joel at jms.id.au> wrote:
> On 3 May 2018 at 07:19, Balbir Singh <bsingharora at gmail.com> wrote:
>> On Wed, 2018-05-02 at 18:07 +0930, Joel Stanley wrote:
>>> Clang can't use the global register variable, so instead load struct
>>> cpu_thread from r13 and return it.
>>>
>>
>> How do we know clang is not using r13 for anything else? Does -ffixed-reg
>> work with r13?
>
> That is a really good question. I was really surprised (excited!) that
> it booted once I had fixed all of the issues I knew about, I forgot to
> go back and ensure clang was reserving r13.
>

Here's the answer:

https://github.com/llvm-mirror/llvm/blob/ff51e42075425aa13ef7d6f5adbe408ace59b8d6/lib/Target/PowerPC/PPCRegisterInfo.cpp#L282

// On PPC64, r13 is the thread pointer. Never allocate this register.
if (TM.isPPC64())
    markSuperRegs(Reserved, PPC::R13);

So there we go. I will add this information to the commit message.

Cheers,

Joel


More information about the Skiboot mailing list