@@ -88,7 +88,7 @@ global_asm!(
8888 .p2align 2
8989 .type _xtensa_lx_rt_zero_fill,@function
9090_xtensa_lx_rt_zero_fill:
91- entry a1, 0
91+ entry a1, 0 // Leaf function, no need to reserve stack
9292 bgeu a2, a3, .Lfill_done // If start >= end, skip zeroing
9393 movi.n a5, 0
9494
@@ -111,7 +111,7 @@ _xtensa_lx_rt_zero_fill:
111111 .p2align 2
112112 .type _xtensa_lx_rt_copy,@function
113113_xtensa_lx_rt_copy:
114- entry a1, 0
114+ entry a1, 0 // Leaf function, no need to reserve stack
115115 bgeu a3, a4, .Lcopy_done // If start >= end, skip copying
116116.Lcopy_loop:
117117 l32i.n a5, a2, 0 // Load word from source pointer
@@ -127,35 +127,35 @@ _xtensa_lx_rt_copy:
127127 .p2align 2
128128 .type Reset,@function
129129Reset:
130- entry a1, 0
130+ entry a1, 0x10 // We're using call4/callx4, reserve 16 bytes for register spill area
131131 movi a0, 0 // Trash the return address. Debuggers may use this to stop unwinding.
132132
133133 wsr.intenable a0 // Disable interrupts
134134
135- l32r a5 , sym_stack_start_cpu0 // a5 is our temporary value register
136- mov sp, a5 // Set the stack pointer.
135+ l32r a2 , sym_stack_start_cpu0 // a2 is our temporary value register
136+ mov sp, a2 // Set the stack pointer.
137137
138- l32r a5 , sym__pre_init
139- callx8 a5 // Call the pre-initialization function.
138+ l32r a2 , sym__pre_init
139+ callx4 a2 // Call the pre-initialization function.
140140
141141.Linit_bss:
142- l32r a5 , sym__zero_bss // Do we need to zero-initialize memory?
143- callx8 a5
144- beqz a10 , .Linit_data // No -> skip to copying initialized data
142+ l32r a2 , sym__zero_bss // Do we need to zero-initialize memory?
143+ callx4 a2
144+ beqz a6 , .Linit_data // No -> skip to copying initialized data
145145
146- l32r a10 , sym_bss_start // Set input range to .bss
147- l32r a11 , sym_bss_end //
148- call8 _xtensa_lx_rt_zero_fill // Zero-fill
146+ l32r a6 , sym_bss_start // Set input range to .bss
147+ l32r a7 , sym_bss_end //
148+ call4 _xtensa_lx_rt_zero_fill // Zero-fill
149149
150150.Linit_data:
151- l32r a5 , sym__init_data // Do we need to initialize data sections?
152- callx8 a5
153- beqz a10 , .Linit_data_done // If not, skip initialization
151+ l32r a2 , sym__init_data // Do we need to initialize data sections?
152+ callx4 a2
153+ beqz a6 , .Linit_data_done // If not, skip initialization
154154
155- l32r a10 , sym_sidata // Arguments - source data pointer
156- l32r a11 , sym_data_start // - destination pointer
157- l32r a12 , sym_data_end // - destination end pointer
158- call8 _xtensa_lx_rt_copy // Copy .data section
155+ l32r a6 , sym_sidata // Arguments - source data pointer
156+ l32r a7 , sym_data_start // - destination pointer
157+ l32r a8 , sym_data_end // - destination end pointer
158+ call4 _xtensa_lx_rt_copy // Copy .data section
159159
160160.Linit_data_done:
161161 memw // Make sure all writes are completed before proceeding. At this point, all static variables have been initialized.
@@ -184,14 +184,14 @@ cfg_global_asm!(
184184
185185global_asm ! (
186186 "
187- l32r a5 , sym_init_start // vector table address
188- wsr.vecbase a5
187+ l32r a2 , sym_init_start // vector table address
188+ wsr.vecbase a2
189189
190- l32r a5 , sym__post_init
191- callx8 a5
190+ l32r a2 , sym__post_init
191+ callx4 a2
192192
193- l32r a5 , sym_main // program entry point
194- callx8 a5
193+ l32r a2 , sym_main // program entry point
194+ callx4 a2
195195 " ,
196196) ;
197197
0 commit comments