authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-09-11 07:32:44+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-09-12 20:10:45-07:00
logb56a667ecdb9f34dbd60d247d4237bc008755979
tree52f200c6650f96d4d6d699ef64f642cc1621a05e
parentcf691543323be9bb663aac2d19f62412435a4d39

start: Rewrite arm code to work for thumb1 too.

0ecc6332b4eb1ced547ffa38f57471134aaa4d13 improved things for thumb2, but thumb1 has a much smaller permissible instruction set. This commit makes that work.

1 files changed, 7 insertions(+), 5 deletions(-)

lib/std/start.zig+7-5
......@@ -280,12 +280,14 @@ fn _start() callconv(.Naked) noreturn {
280280 \\ b %[posixCallMainAndExit]
281281 ,
282282 .arm, .armeb, .thumb, .thumbeb =>
283 \\ mov fp, #0
284 \\ mov lr, #0
283 // Note that this code must work for Thumb-1.
284 \\ movs v1, #0
285 \\ mov fp, v1
286 \\ mov lr, v1
285287 \\ mov a1, sp
286 \\ mov ip, sp
287 \\ and ip, ip, #-16
288 \\ mov sp, ip
288 \\ subs v1, #16
289 \\ ands v1, a1
290 \\ mov sp, v1
289291 \\ b %[posixCallMainAndExit]
290292 ,
291293 .csky =>