Skip to content

Commit

Permalink
start: Rewrite arm code to work for thumb1 too.
Browse files Browse the repository at this point in the history
0ecc633 improved things for thumb2, but thumb1
has a much smaller permissible instruction set. This commit makes that work.
  • Loading branch information
alexrp authored and andrewrk committed Sep 13, 2024
1 parent cf69154 commit b56a667
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/std/start.zig
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,14 @@ fn _start() callconv(.Naked) noreturn {
\\ b %[posixCallMainAndExit]
,
.arm, .armeb, .thumb, .thumbeb =>
\\ mov fp, #0
\\ mov lr, #0
// Note that this code must work for Thumb-1.
\\ movs v1, #0
\\ mov fp, v1
\\ mov lr, v1
\\ mov a1, sp
\\ mov ip, sp
\\ and ip, ip, #-16
\\ mov sp, ip
\\ subs v1, #16
\\ ands v1, a1
\\ mov sp, v1
\\ b %[posixCallMainAndExit]
,
.csky =>
Expand Down

0 comments on commit b56a667

Please sign in to comment.