1
- use core:: hint;
2
-
3
1
/// Tock programs' entry point. Called by the kernel at program start. Sets up
4
2
/// the stack then calls rust_start() for the remainder of setup.
5
3
#[ doc( hidden) ]
@@ -14,12 +12,12 @@ use core::hint;
14
12
// Due to Rust issue: https://github.com/rust-lang/rust/issues/42779 we can't have
15
13
// args to the function
16
14
pub unsafe extern "C" fn _start ( ) -> ! {
17
- llvm_asm ! (
18
- // Compute the stack top.
19
- //
20
- // struct hdr* myhdr = (struct hdr*) app_start;
21
- // uint32_t stacktop = (((uint32_t) mem_start + myhdr->stack_size + 7) & 0xfffffff8);
22
- "lw t0, 36(a0) // t0 = myhdr->stack_size
15
+ asm ! (
16
+ // Compute the stack top.
17
+ //
18
+ // struct hdr* myhdr = (struct hdr*) app_start;
19
+ // uint32_t stacktop = (((uint32_t) mem_start + myhdr->stack_size + 7) & 0xfffffff8);
20
+ "lw t0, 36(a0) // t0 = myhdr->stack_size
23
21
addi t0, t0, 7 // t0 = myhdr->stack_size + 7
24
22
add t0, t0, a1 // t0 = mem_start + myhdr->stack_size + 7
25
23
li t1, 7 // t1 = 7
@@ -89,14 +87,10 @@ pub unsafe extern "C" fn _start() -> ! {
89
87
mv s0, sp // Set the frame pointer to sp.
90
88
mv a1, s1 // second arg is stacktop
91
89
mv a2, t1 // third arg is app_heap_break that we told the kernel
92
- jal rust_start"
93
- : // No output operands
94
- :
95
- : "memory" , "x10" , "x11" , "x12" , "x13" , "x14" , "x15" , "x16" , "x17" ,
96
- "x5" , "x6" , "x7" , "x28" , "x29" , "x30" , "x31" , "x1" // Clobbers
97
- : "volatile" // Options
98
- ) ;
99
- hint:: unreachable_unchecked ( ) ;
90
+ jal rust_start" ,
91
+ // No clobbers needed for a noreturn asm! block.
92
+ options( noreturn) ,
93
+ )
100
94
}
101
95
102
96
/// Ensure an abort symbol exists.
0 commit comments