treewide: Make carray arrays const and NULL-terminated

This allows the compiler to generate significantly better code, because
it does not have to maintain either the loop counter or loop limit. Plus
there are half as many symbols to relocate. This also simplifies passing
carray arrays to helper functions.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2024-11-11 14:02:45 -08:00
committed by Anup Patel
parent 23ef9c5f00
commit df1c100001
12 changed files with 26 additions and 38 deletions

View File

@@ -13,8 +13,7 @@
#include <sbi/sbi_error.h>
#include <sbi/sbi_trap.h>
extern struct sbi_ecall_extension *sbi_ecall_exts[];
extern unsigned long sbi_ecall_exts_size;
extern struct sbi_ecall_extension *const sbi_ecall_exts[];
u16 sbi_ecall_version_major(void)
{
@@ -148,7 +147,7 @@ int sbi_ecall_init(void)
struct sbi_ecall_extension *ext;
unsigned long i;
for (i = 0; i < sbi_ecall_exts_size; i++) {
for (i = 0; sbi_ecall_exts[i]; i++) {
ext = sbi_ecall_exts[i];
ret = SBI_ENODEV;