Add a stack canary, setup on boot

This commit is contained in:
Toby Jaffey 2025-12-10 01:00:36 +00:00
parent 9596838a4b
commit 9baedb42e8
21 changed files with 61 additions and 16 deletions

View file

@ -1,19 +1,24 @@
#include "uvm32_sys.h"
.equ uvm32_syscall_halt, 0x1000000
.equ uvm32_syscall_yield, 0x1000001
.equ uvm32_syscall_stackprotect, 0x1000002
.section .initial_jump , "ax", %progbits
.global _start
.align 4
_start:
la a0, _estack
li a7, uvm32_syscall_stackprotect
ecall
# sp is already setup by vm
sw ra,12(sp)
jal ra, main
#if 1
// rust will interpret the "#if 1" and "#include" as comments and ignore
// C, asm, zig will include the file below, which references a constant from uvm32_sys.h
#include "non-rust-crt0-hack.S"
#else
// only rust will see this
li a7, {UVM32_SYSCALL_HALT}
#endif
li a7, uvm32_syscall_halt
ecall
.section .data