Reindent
This commit is contained in:
parent
c22e3e4376
commit
4c3bfa3052
44
src/main.rs
44
src/main.rs
|
@ -14,33 +14,33 @@ mod uart;
|
||||||
unsafe extern "C" fn _start() -> ! {
|
unsafe extern "C" fn _start() -> ! {
|
||||||
use core::arch::asm;
|
use core::arch::asm;
|
||||||
asm!(
|
asm!(
|
||||||
// before we use the `la` pseudo-instruction for the first time,
|
// before we use the `la` pseudo-instruction for the first time,
|
||||||
// we need to set `gp` (google linker relaxation)
|
// we need to set `gp` (google linker relaxation)
|
||||||
".option push",
|
".option push",
|
||||||
".option norelax",
|
".option norelax",
|
||||||
"la gp, _global_pointer",
|
"la gp, _global_pointer",
|
||||||
".option pop",
|
".option pop",
|
||||||
|
|
||||||
// set the stack pointer
|
// set the stack pointer
|
||||||
"la sp, _init_stack_top",
|
"la sp, _init_stack_top",
|
||||||
|
|
||||||
"la sp, _init_stack_top",
|
"la sp, _init_stack_top",
|
||||||
|
|
||||||
// clear the BSS
|
// clear the BSS
|
||||||
"la t0, _bss_start",
|
"la t0, _bss_start",
|
||||||
"la t1, _bss_end",
|
"la t1, _bss_end",
|
||||||
"bgeu t0, t1, 2f",
|
"bgeu t0, t1, 2f",
|
||||||
"1:",
|
"1:",
|
||||||
"sb zero, 0(t0)",
|
"sb zero, 0(t0)",
|
||||||
"addi t0, t0, 1",
|
"addi t0, t0, 1",
|
||||||
"bne t0, t1, 1b",
|
"bne t0, t1, 1b",
|
||||||
"2:",
|
"2:",
|
||||||
// BSS is clear!
|
// BSS is clear!
|
||||||
|
|
||||||
// "tail-call" to {entry} (call without saving a return address)
|
// "tail-call" to {entry} (call without saving a return address)
|
||||||
"tail {entry}",
|
"tail {entry}",
|
||||||
entry = sym entry, // {entry} refers to the function [entry] below
|
entry = sym entry, // {entry} refers to the function [entry] below
|
||||||
options(noreturn) // we must handle "returning" from assembly
|
options(noreturn) // we must handle "returning" from assembly
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,4 +73,4 @@ fn on_panic(_info: &PanicInfo) -> ! {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO unit testing
|
// TODO unit testing
|
||||||
|
|
Loading…
Reference in a new issue