arch/riscv/include: Cast 'id' to int in OTHER_HLS()

The 'id' in OTHER_HSL macro is non-typed, downflow would occur when
‘id’ is unsigned and less greater than hart_id. Cast it to int.

Change-Id: I777337b7e374024aff6fb36de603b799b1a65371
Signed-off-by: Ziang Wang <wangziang.ok@bytedance.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89338
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
This commit is contained in:
Ziang Wang 2025-09-25 16:03:54 +08:00 committed by Matt DeVillier
commit c1e0384367

View file

@ -62,7 +62,8 @@ register uintptr_t current_stack_pointer asm("sp");
// hart-local storage, at top of stack
#define HLS() ((struct hls *)(MACHINE_STACK_TOP() - HLS_SIZE))
#define OTHER_HLS(id) ((struct hls *)((void *)HLS() + RISCV_PGSIZE * ((id) - HLS()->hart_id)))
#define OTHER_HLS(id) \
((struct hls *)((void *)HLS() + RISCV_PGSIZE * (((int)id) - HLS()->hart_id)))
#define MACHINE_STACK_SIZE RISCV_PGSIZE