lkml.org 
[lkml]   [2020]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] powerpc/irq: don't use current_stack_pointer() in check_stack_overflow()
From
Date


On 01/24/2020 06:19 AM, Christophe Leroy wrote:
>
>
> Le 24/01/2020 à 06:46, Michael Ellerman a écrit :
>>
>> If I do this it seems to work, but feels a little dicey:
>>
>>     asm ("" : "=r" (r1));
>>     sp = r1 & (THREAD_SIZE - 1);
>
>
> Or we could do add in asm/reg.h what we have in boot/reg.h:
>
> register void *__stack_pointer asm("r1");
> #define get_sp()    (__stack_pointer)
>
> And use get_sp()
>

It works, and I guess doing it this way is acceptable as it's exactly
what's done for current in asm/current.h with register r2.

Now I (still) get:

sp = get_sp() & (THREAD_SIZE - 1);
b9c: 54 24 04 fe clrlwi r4,r1,19
if (unlikely(sp < 2048)) {
ba4: 2f 84 07 ff cmpwi cr7,r4,2047





Allthough GCC 8.1 what doing exactly the same with the form CLANG don't
like:

register unsigned long r1 asm("r1");
long sp = r1 & (THREAD_SIZE - 1);
b84: 54 24 04 fe clrlwi r4,r1,19
if (unlikely(sp < 2048)) {
b8c: 2f 84 07 ff cmpwi cr7,r4,2047


Christophe

\
 
 \ /
  Last update: 2020-01-24 08:04    [W:0.039 / U:3.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site