@@ -33,66 +33,60 @@ fn main() -> ! {
3333//
3434// Unlike the default routine, it does not initialise any other stacks, or
3535// switch to EL1 mode.
36- core:: arch:: global_asm!(
37- r#"
38- // Work around https://github.com/rust-lang/rust/issues/127269
39- .fpu vfp3-d16
40-
41- .section .text.start
42-
43- .global _start
44- .type _start, %function
45- _start:
36+ #[ unsafe( naked) ]
37+ #[ unsafe( no_mangle) ]
38+ #[ instruction_set( arm:: t32) ]
39+ pub unsafe extern "C" fn _start ( ) {
40+ core:: arch:: naked_asm!(
4641 // Set stack pointer
47- ldr sp, =_hyp_stack
42+ " ldr sp, =_hyp_stack" ,
4843 // Set the HVBAR (for EL2) to _vector_table
49- ldr r1, =_vector_table
50- mcr p15, 4, r1, c12, c0, 0
44+ " ldr r1, =_vector_table" ,
45+ " mcr p15, 4, r1, c12, c0, 0" ,
5146 // Configure HACTLR to let us enter EL1
52- mrc p15, 4, r1, c1, c0, 1
53- mov r2, {hactlr_bits}
54- orr r1, r1, r2
55- mcr p15, 4, r1, c1, c0, 1
47+ " mrc p15, 4, r1, c1, c0, 1" ,
48+ " mov r2, {hactlr_bits}" ,
49+ " orr r1, r1, r2" ,
50+ " mcr p15, 4, r1, c1, c0, 1" ,
5651 // Init .data and .bss
57- bl _init_segments
52+ " bl _init_segments" ,
5853 // Allow VFP coprocessor access
59- mrc p15, 0, r0, c1, c0, 2
60- orr r0, r0, #0xF00000
61- mcr p15, 0, r0, c1, c0, 2
54+ " mrc p15, 0, r0, c1, c0, 2" ,
55+ " orr r0, r0, #0xF00000" ,
56+ " mcr p15, 0, r0, c1, c0, 2" ,
6257 // Enable VFP
63- mov r0, #0x40000000
64- vmsr fpexc, r0
58+ " mov r0, #0x40000000" ,
59+ " vmsr fpexc, r0" ,
6560 // Zero all registers before calling kmain
66- mov r0, 0
67- mov r1, 0
68- mov r2, 0
69- mov r3, 0
70- mov r4, 0
71- mov r5, 0
72- mov r6, 0
73- mov r7, 0
74- mov r8, 0
75- mov r9, 0
76- mov r10, 0
77- mov r11, 0
78- mov r12, 0
61+ " mov r0, 0" ,
62+ " mov r1, 0" ,
63+ " mov r2, 0" ,
64+ " mov r3, 0" ,
65+ " mov r4, 0" ,
66+ " mov r5, 0" ,
67+ " mov r6, 0" ,
68+ " mov r7, 0" ,
69+ " mov r8, 0" ,
70+ " mov r9, 0" ,
71+ " mov r10, 0" ,
72+ " mov r11, 0" ,
73+ " mov r12, 0" ,
7974 // Jump to application
80- bl kmain
75+ " bl kmain" ,
8176 // In case the application returns, loop forever
82- b .
83- .size _start, . - _start
84- "# ,
85- hactlr_bits = const {
86- Hactlr :: new_with_raw_value( 0 )
87- . with_cpuactlr( true )
88- . with_cdbgdci( true )
89- . with_flashifregionr( true )
90- . with_periphpregionr( true )
91- . with_qosr( true )
92- . with_bustimeoutr( true )
93- . with_intmonr( true )
94- . with_err( true )
95- . with_testr1( true )
96- . raw_value( )
97- } ,
98- ) ;
77+ "b ." ,
78+ hactlr_bits = const {
79+ Hactlr :: new_with_raw_value( 0 )
80+ . with_cpuactlr( true )
81+ . with_cdbgdci( true )
82+ . with_flashifregionr( true )
83+ . with_periphpregionr( true )
84+ . with_qosr( true )
85+ . with_bustimeoutr( true )
86+ . with_intmonr( true )
87+ . with_err( true )
88+ . with_testr1( true )
89+ . raw_value( )
90+ } ,
91+ ) ;
92+ }
0 commit comments