RISC-V SMP: Fix Compile Error

Partially revert commit 70d1a5f792.

Can't include arch/machine.h because that will cause
a circular include dependency.

Signed-off-by: Indan Zupancic <indan@nul.nu>
This commit is contained in:
Indan Zupancic 2024-03-13 14:10:25 +00:00 committed by Gerwin Klein
parent 70d1a5f792
commit 3ccbfc083a

View file

@ -51,7 +51,8 @@ static inline bool_t try_arch_atomic_exchange_rlx(void *ptr, void *new_val, void
static inline CONST cpu_id_t getCurrentCPUIndex(void)
{
word_t sp = read_sscratch();
word_t sp;
asm volatile("csrr %0, sscratch" : "=r"(sp));
sp -= (word_t)kernel_stack_alloc;
sp -= 8;
return (sp >> CONFIG_KERNEL_STACK_BITS);