WIP ARM: Use mes-style crt1.M1.

This commit is contained in:
Jan (janneke) Nieuwenhuizen 2022-05-07 15:18:07 +02:00
parent 0cb8177d7a
commit 823da6108b
2 changed files with 44 additions and 1 deletions

View File

@ -31,6 +31,7 @@ DEFINE add____$i8,%r0 0090e2 # adds r0, r0, #xx; ADDSI = immediate op1 '09' op
# 1090e2 # adds r1, r0, #xx; ADDSI = immediate op1 '09' op2 'e2'
DEFINE add____$i8,%r1 1091e2 # adds r1, r1, #xx
DEFINE add____$i8,%r13 d09de2 # adds r13, r13, #xx
DEFINE add____$i8,%ebp e28cc0 # adds ip, ip, #xx
DEFINE sub____$i8,%r0 0050e2 # subs r0, r0, #xx
DEFINE sub____$i8,%r1 1051e2 # subs r1, r1, #xx
DEFINE add____%r0,%r0 000090e0 # adds r0, r0, r0

View File

@ -1,6 +1,7 @@
### GNU Mes --- Maxwell Equations of Software
### Copyright (C) 2016 Jeremiah Orians
### Copyright © 2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2017,2018,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
###
### This file is part of GNU Mes.
###
@ -17,6 +18,47 @@
### You should have received a copy of the GNU General Public License
### along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
:UNUSED_start
;; ??? from M2
'0' SP BP NO_SHIFT MOVE_ALWAYS ; Setup Base Pointer
push___%lr
push___%ebp
mov____%esp,%ebp
allocate_stack_4180
!0 mov____$i8,%r0
mov____%r0,0x32 &GLOBAL___stdin
!1 mov____$i8,%r0
mov____%r0,0x32 &GLOBAL___stdout
!2 mov____$i8,%r0
mov____%r0,0x32 &GLOBAL___stderr
!8 ldr____%r0,(%fp,+#$i8)
mov____%fp,%r1
!12 add____%r1,$i8
add____%r2,%r1,%r0,lsl#2
!4 add____%r2,$i8
mov____%r2,0x32 &GLOBAL_environ
; M2-Planet calling convention pushes forward
push___%r0 ; argc
push___%r1 ; argv
push___%r2 ; environ
!4 add____$i8,%ebp ;M2-Planet calling convention
^~FUNCTION_main bl
!0x0 add____$i8,%esp
!0x0 cmp____$i8,%r0
SYS_exit mov____$i8,%r7
swi____$0
:__start_loop
wfi
!0x1 mov____$i8,%r0
!0x0 cmp____$i8,%r0
^~__start_loop b
mov____%ebp,%esp
pop____%ebp
ret
:_start
'0' SP BP NO_SHIFT MOVE_ALWAYS ; Setup Base Pointer