summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorBo Gan <[email protected]>2025-12-15 21:25:28 -0800
committerAnup Patel <[email protected]>2025-12-27 11:21:27 +0530
commit4c1c77e085599f6f95df4b94714e1d7829ebefbf (patch)
tree26d4b8196d334bb2373b92177ec646a281d3be5a /firmware
parentf7b81034aa4c19199afac6be4e033270f3755bf5 (diff)
include: riscv_asm: Optimize csr_xyz() macros to reduce stack usage
When using debug builds, aka., DEBUG=1, csr_write_num() function can trigger stack overflow. This is caused by the large amount of macro expansion of csr_write(...), which, under debug builds, will generate massive amount of stack variables (tested with GCC 13.2.0). The issue is masked previously as we didn't have too many csr_write()'s before commit 55296fd27c0c, but now, it does overflow the default 4KB stack. The csr_read(relaxed) macros already use the "register" modifier to optimize stack usage (perhaps unknowingly?), so this patch just follows suit. Fixes: 55296fd27c0c ("lib: Allow custom CSRs in csr_read_num() and csr_write_num()") Signed-off-by: Bo Gan <[email protected]> Reviewed-by: Anup Patel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'firmware')
0 files changed, 0 insertions, 0 deletions