mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
cleanup area for statics used by the loader
This commit is contained in:
parent
6c655e9358
commit
452ba4adff
1 changed files with 13 additions and 3 deletions
|
|
@ -15,9 +15,14 @@ pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
|
||||||
unsafe {
|
unsafe {
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
asm! (
|
asm! (
|
||||||
"li t0, 0xffffffff",
|
"mv t0, {ram_base}",
|
||||||
"csrw mideleg, t0",
|
"li t1, 0x10000",
|
||||||
"csrw medeleg, t0",
|
"add t2, t0, t1",
|
||||||
|
|
||||||
|
"900:", // clear 64k base data for statics
|
||||||
|
"sw x0, 0(t0)",
|
||||||
|
"addi t0, t0, 4",
|
||||||
|
"bltu t0, t2, 900b",
|
||||||
|
|
||||||
// decorate our stack area with a canary pattern
|
// decorate our stack area with a canary pattern
|
||||||
"li t1, 0xACE0BACE",
|
"li t1, 0xACE0BACE",
|
||||||
|
|
@ -33,6 +38,10 @@ pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
|
||||||
// subtract four from sp to make room for a DMA "gutter"
|
// subtract four from sp to make room for a DMA "gutter"
|
||||||
"addi sp, sp, -4",
|
"addi sp, sp, -4",
|
||||||
|
|
||||||
|
"li t0, 0xffffffff",
|
||||||
|
"csrw mideleg, t0",
|
||||||
|
"csrw medeleg, t0",
|
||||||
|
|
||||||
// Install a machine mode trap handler
|
// Install a machine mode trap handler
|
||||||
"la t0, abort",
|
"la t0, abort",
|
||||||
"csrw mtvec, t0",
|
"csrw mtvec, t0",
|
||||||
|
|
@ -48,6 +57,7 @@ pub extern "C" fn _start(_kernel_args: usize, loader_sig: usize) {
|
||||||
ram_top = in(reg) (platform::RAM_BASE + platform::RAM_SIZE),
|
ram_top = in(reg) (platform::RAM_BASE + platform::RAM_SIZE),
|
||||||
// On Precursor - 0x40FFE01C: currently allowed stack extent - 8k - (7 words). 7 words are for kernel backup args - see bootloader in betrusted-soc
|
// On Precursor - 0x40FFE01C: currently allowed stack extent - 8k - (7 words). 7 words are for kernel backup args - see bootloader in betrusted-soc
|
||||||
stack_limit = in(reg) (platform::RAM_BASE + platform::RAM_SIZE - 8192 + 7 * core::mem::size_of::<usize>()),
|
stack_limit = in(reg) (platform::RAM_BASE + platform::RAM_SIZE - 8192 + 7 * core::mem::size_of::<usize>()),
|
||||||
|
ram_base = in(reg) (platform::RAM_BASE),
|
||||||
options(noreturn)
|
options(noreturn)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue