arch: riscv: stacktrace: fix cpuid type and optimize branch with compiler
Change the type of `cpu_id` to `uint8_t` since that is the type of `arch_curr_cpu()->id`. Instead of using precompiler switch (`#ifdef CONFIG_SMP`), use if-else shorthand instead (`IS_ENABLED(CONFIG_SMP)`). Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
parent
25138ff99c
commit
602c993799
1 changed files with 1 additions and 7 deletions
|
@ -49,13 +49,7 @@ static bool in_stack_bound(uintptr_t addr)
|
||||||
|
|
||||||
if (_current == NULL || arch_is_in_isr()) {
|
if (_current == NULL || arch_is_in_isr()) {
|
||||||
/* We were servicing an interrupt */
|
/* We were servicing an interrupt */
|
||||||
int cpu_id;
|
uint8_t cpu_id = IS_ENABLED(CONFIG_SMP) ? arch_curr_cpu()->id : 0U;
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
|
||||||
cpu_id = arch_curr_cpu()->id;
|
|
||||||
#else
|
|
||||||
cpu_id = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
start = (uintptr_t)K_KERNEL_STACK_BUFFER(z_interrupt_stacks[cpu_id]);
|
start = (uintptr_t)K_KERNEL_STACK_BUFFER(z_interrupt_stacks[cpu_id]);
|
||||||
end = start + CONFIG_ISR_STACK_SIZE;
|
end = start + CONFIG_ISR_STACK_SIZE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue