mirror of
https://github.com/ringtailsoftware/uvm32.git
synced 2026-06-05 22:43:39 +00:00
Add a stack canary, setup on boot
This commit is contained in:
parent
9596838a4b
commit
9baedb42e8
21 changed files with 61 additions and 16 deletions
21
apps/crt0.S
21
apps/crt0.S
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue