arch/risc/mcall.h: Make the stack pointer global

Clang complains about the stack pointer register variable being
uninitialized. This can remediated by making the variable global. Change
the variable name to be more unambiguous.

Change-Id: I24602372833aa9d413bf396853b223263fd873ed
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74570
Reviewed-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-by: Daniel Maslowski <info@orangecms.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans 2023-04-19 21:27:25 +02:00 committed by Felix Singer
parent 09b573ff75
commit 5c2a2e1bb3
1 changed files with 3 additions and 3 deletions

View File

@ -54,10 +54,10 @@ _Static_assert(
sizeof(hls_t) == HLS_SIZE, sizeof(hls_t) == HLS_SIZE,
"HLS_SIZE must equal to sizeof(hls_t)"); "HLS_SIZE must equal to sizeof(hls_t)");
register uintptr_t current_stack_pointer asm("sp");
#define MACHINE_STACK_TOP() ({ \ #define MACHINE_STACK_TOP() ({ \
/* coverity[uninit_use] : FALSE */ \ (void *)((current_stack_pointer + RISCV_PGSIZE) & -RISCV_PGSIZE); })
register uintptr_t sp asm ("sp"); \
(void*)((sp + RISCV_PGSIZE) & -RISCV_PGSIZE); })
// hart-local storage, at top of stack // hart-local storage, at top of stack
#define HLS() ((hls_t*)(MACHINE_STACK_TOP() - HLS_SIZE)) #define HLS() ((hls_t*)(MACHINE_STACK_TOP() - HLS_SIZE))