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 {...@@ -280,12 +280,14 @@ fn _start() callconv(.Naked) noreturn {
280 \\ b %[posixCallMainAndExit]280 \\ b %[posixCallMainAndExit]
281 ,281 ,
282 .arm, .armeb, .thumb, .thumbeb =>282 .arm, .armeb, .thumb, .thumbeb =>
283 \\ mov fp, #0283 // Note that this code must work for Thumb-1.
284 \\ mov lr, #0284 \\ movs v1, #0
285 \\ mov fp, v1
286 \\ mov lr, v1
285 \\ mov a1, sp287 \\ mov a1, sp
286 \\ mov ip, sp288 \\ subs v1, #16
287 \\ and ip, ip, #-16289 \\ ands v1, a1
288 \\ mov sp, ip290 \\ mov sp, v1
289 \\ b %[posixCallMainAndExit]291 \\ b %[posixCallMainAndExit]
290 ,292 ,
291 .csky =>293 .csky =>