Cleanup syscall numbers

This commit is contained in:
Toby Jaffey 2025-12-08 12:53:33 +00:00
parent 61fe0e8647
commit 9d6e6790e1
19 changed files with 32 additions and 32 deletions

View file

@ -10,3 +10,5 @@ clean:
(cd host-parallel && make clean) (cd host-parallel && make clean)
(cd apps && make clean) (cd apps && make clean)
world:
make && (cd apps && make) && cp apps/*/*.bin precompiled/

View file

@ -1,11 +1,11 @@
// Definitions needed by both host and target // Definitions needed by both host and target
// syscalls for exposed host functions // syscalls for exposed host functions, start at 0
#define UVM32_SYSCALL_PRINT 0x13A #define UVM32_SYSCALL_PRINTC 0x00000000
#define UVM32_SYSCALL_PRINTLN 0x13B #define UVM32_SYSCALL_GETC 0x00000001
#define UVM32_SYSCALL_PRINTD 0x13C #define UVM32_SYSCALL_PRINT 0x00000002
#define UVM32_SYSCALL_PRINTX 0x13D #define UVM32_SYSCALL_PRINTLN 0x00000003
#define UVM32_SYSCALL_MILLIS 0x13F #define UVM32_SYSCALL_PRINTD 0x00000004
#define UVM32_SYSCALL_PRINTC 0x140 #define UVM32_SYSCALL_PRINTX 0x00000005
#define UVM32_SYSCALL_GETC 0x141 #define UVM32_SYSCALL_MILLIS 0x00000006

View file

@ -1,5 +1,5 @@
// System provided UVM32_SYSCALLs // System provided UVM32_SYSCALLs, start at 0x10000000
#define UVM32_SYSCALL_HALT 0x138 #define UVM32_SYSCALL_HALT 0x1000000
#define UVM32_SYSCALL_YIELD 0x139 #define UVM32_SYSCALL_YIELD 0x1000001
#include "uvm32_common_custom.h" #include "uvm32_common_custom.h"

View file

@ -1,10 +1,11 @@
// Definitions needed by both host and target // Definitions needed by both host and target
// CSRs for exposed host functions // syscalls for exposed host functions, start at 0
#define UVM32_SYSCALL_PRINT 0x13A #define UVM32_SYSCALL_PRINTC 0x00000000
#define UVM32_SYSCALL_PRINTLN 0x13B #define UVM32_SYSCALL_GETC 0x00000001
#define UVM32_SYSCALL_PRINTD 0x13C #define UVM32_SYSCALL_PRINT 0x00000002
#define UVM32_SYSCALL_PRINTX 0x13D #define UVM32_SYSCALL_PRINTLN 0x00000003
#define UVM32_SYSCALL_MILLIS 0x13F #define UVM32_SYSCALL_PRINTD 0x00000004
#define UVM32_SYSCALL_PRINTC 0x140 #define UVM32_SYSCALL_PRINTX 0x00000005
#define UVM32_SYSCALL_MILLIS 0x00000006

View file

@ -1,5 +1,5 @@
// System provided UVM32_SYSCALLs // System provided UVM32_SYSCALLs, start at 0x10000000
#define UVM32_SYSCALL_HALT 0x138 #define UVM32_SYSCALL_HALT 0x1000000
#define UVM32_SYSCALL_YIELD 0x139 #define UVM32_SYSCALL_YIELD 0x1000001
#include "uvm32_common_custom.h" #include "uvm32_common_custom.h"

View file

@ -154,6 +154,7 @@ uint32_t uvm32_run(uvm32_state_t *vmst, uvm32_evt_t *evt, uint32_t instr_meter)
get_safeptr_terminated(vmst, value, 0x00, &vmst->ioevt.data.syscall.val.buf); get_safeptr_terminated(vmst, value, 0x00, &vmst->ioevt.data.syscall.val.buf);
break; break;
case UVM32_SYSCALL_TYP_U32_RD: case UVM32_SYSCALL_TYP_U32_RD:
// pass link to r1 for user function to update
vmst->ioevt.data.syscall.val.u32p = &vmst->core->regs[11]; vmst->ioevt.data.syscall.val.u32p = &vmst->core->regs[11];
break; break;
} }
@ -167,6 +168,7 @@ uint32_t uvm32_run(uvm32_state_t *vmst, uvm32_evt_t *evt, uint32_t instr_meter)
} }
// no mapping found // no mapping found
if (!syscall_valid) { if (!syscall_valid) {
printf("BADSYS %08x halt=%08x YIELD=%08x\n", syscall, UVM32_SYSCALL_HALT, UVM32_SYSCALL_YIELD);
setStatusErr(vmst, UVM32_ERR_BAD_SYSCALL); setStatusErr(vmst, UVM32_ERR_BAD_SYSCALL);
} }
break; break;

View file

@ -3,10 +3,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "common/uvm32_sys.h"
// "well-known" system UVM32_SYSCALL functions
#define UVM32_SYSCALL_HALT 0x138
#define UVM32_SYSCALL_YIELD 0x139
#define LIST_OF_UVM32_ERRS \ #define LIST_OF_UVM32_ERRS \
X(UVM32_ERR_NONE) \ X(UVM32_ERR_NONE) \

View file

@ -1,5 +1,5 @@
all: all:
gcc -Wall -DUVM32_MEMORY_SIZE=512 -I../uvm32 -o host-mini ../uvm32/uvm32.c host-mini.c gcc -Wall -DUVM32_MEMORY_SIZE=512 -I../uvm32 -I../common -o host-mini ../uvm32/uvm32.c host-mini.c
clean: clean:
rm -f host-mini rm -f host-mini

View file

@ -1,5 +1,5 @@
all: all:
gcc -Wall -DUVM32_MEMORY_SIZE=512 -I../uvm32 -o host-parallel ../uvm32/uvm32.c host-parallel.c gcc -Wall -DUVM32_MEMORY_SIZE=512 -I../uvm32 -I../common -o host-parallel ../uvm32/uvm32.c host-parallel.c
clean: clean:
rm -f host-parallel rm -f host-parallel

View file

@ -1,5 +1,5 @@
all: all:
gcc -Wall -Werror -pedantic -std=c99 -O2 -DUVM32_MEMORY_SIZE=32768 -I../uvm32 -o host ../uvm32/uvm32.c host.c gcc -Wall -Werror -pedantic -std=c99 -O2 -DUVM32_MEMORY_SIZE=32768 -I../uvm32 -I../common -o host ../uvm32/uvm32.c host.c
clean: clean:
rm -f host rm -f host

Binary file not shown.

BIN
precompiled/hello-asm.bin Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
precompiled/rust-hello.bin Executable file

Binary file not shown.

BIN
precompiled/sketch.bin Executable file

Binary file not shown.

Binary file not shown.

View file

@ -167,6 +167,7 @@ uint32_t uvm32_run(uvm32_state_t *vmst, uvm32_evt_t *evt, uint32_t instr_meter)
} }
// no mapping found // no mapping found
if (!syscall_valid) { if (!syscall_valid) {
printf("BADSYS %08x halt=%08x YIELD=%08x\n", syscall, UVM32_SYSCALL_HALT, UVM32_SYSCALL_YIELD);
setStatusErr(vmst, UVM32_ERR_BAD_SYSCALL); setStatusErr(vmst, UVM32_ERR_BAD_SYSCALL);
} }
break; break;

View file

@ -3,10 +3,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "uvm32_sys.h"
// "well-known" system UVM32_SYSCALL functions
#define UVM32_SYSCALL_HALT 0x138
#define UVM32_SYSCALL_YIELD 0x139
#define LIST_OF_UVM32_ERRS \ #define LIST_OF_UVM32_ERRS \
X(UVM32_ERR_NONE) \ X(UVM32_ERR_NONE) \