ARM: Add fake asm for crt1.c.
* lib/linux/arm-mes-gcc/crt1.c (_start)[__TINYC__]: Use fake asm.
This commit is contained in:
parent
ed59c243a8
commit
420d422e34
|
@ -1,6 +1,6 @@
|
|||
/* -*-comment-start: "//";comment-end:""-*-
|
||||
* GNU Mes --- Maxwell Equations of Software
|
||||
* Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2017,2018,2019,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
* Copyright © 2019,2020 Danny Milosavljevic <dannym@scratchpost.org>
|
||||
*
|
||||
* This file is part of GNU Mes.
|
||||
|
@ -22,9 +22,9 @@
|
|||
#include <mes/lib-mini.h>
|
||||
//int main (int argc, char *argv[], char *envp[]);
|
||||
|
||||
/* Note: GCC automatically emits a preable in order to set up the frame pointer:
|
||||
"push {fp}"
|
||||
"add fp, sp, 0"
|
||||
#if !__TINYC__
|
||||
/* Note: GCC automatically emits a preable in order to set up the
|
||||
frame pointer: "push {fp}" "add fp, sp, 0"
|
||||
*/
|
||||
// *INDENT-OFF*
|
||||
void
|
||||
|
@ -70,8 +70,52 @@ _start ()
|
|||
"ldr r1,[sp, #4]\n\t" /* argv */
|
||||
"ldr r2,[sp, #8]\n\t" /* envp */
|
||||
"bl main\n\t"
|
||||
"mov r7, #1\n\t"
|
||||
"mov r7, #1\n\t"
|
||||
"swi #0\n\t"
|
||||
"wfi \n\t"
|
||||
);
|
||||
}
|
||||
#else //__TINYC__
|
||||
__asm__ (".global _start\n");
|
||||
__asm__ ("_start:\n");
|
||||
__asm__ (".int 0xe52db004\n"); //push {fp} ; (str fp, [sp, #-4]!)
|
||||
__asm__ (".int 0xe28db000\n"); //add fp, sp, #0
|
||||
__asm__ (".int 0xe3a00000\n"); //mov r0, #0
|
||||
__asm__ (".int 0xe1a02000\n"); //mov r2, r0
|
||||
__asm__ (".int 0xe3003000\n"); //movw r3, #0
|
||||
__asm__ (".int 0xe3403000\n"); //movt r3, #0
|
||||
__asm__ (".int 0xe5832000\n"); //str r2, [r3]
|
||||
__asm__ (".int 0xe3a00001\n"); //mov r0, #1
|
||||
__asm__ (".int 0xe1a02000\n"); //mov r2, r0
|
||||
__asm__ (".int 0xe3003000\n"); //movw r3, #0
|
||||
__asm__ (".int 0xe3403000\n"); //movt r3, #0
|
||||
__asm__ (".int 0xe5832000\n"); //str r2, [r3]
|
||||
__asm__ (".int 0xe3a00002\n"); //mov r0, #2
|
||||
__asm__ (".int 0xe1a02000\n"); //mov r2, r0
|
||||
__asm__ (".int 0xe3003000\n"); //movw r3, #0
|
||||
__asm__ (".int 0xe3403000\n"); //movt r3, #0
|
||||
__asm__ (".int 0xe5832000\n"); //str r2, [r3]
|
||||
__asm__ (".int 0xe59b0004\n"); //ldr r0, [fp, #4]
|
||||
__asm__ (".int 0xe28b1008\n"); //add r1, fp, #8
|
||||
__asm__ (".int 0xe2802001\n"); //add r2, r0, #1
|
||||
__asm__ (".int 0xe1a02102\n"); //lsl r2, r2, #2
|
||||
__asm__ (".int 0xe0822001\n"); //add r2, r2, r1
|
||||
__asm__ (".int 0xe52d2004\n"); //push {r2} ; (str r2, [sp, #-4]!)
|
||||
__asm__ (".int 0xe52d1004\n"); //push {r1} ; (str r1, [sp, #-4]!)
|
||||
__asm__ (".int 0xe52d0004\n"); //push {r0} ; (str r0, [sp, #-4]!)
|
||||
__asm__ (".int 0xe1a02002\n"); //mov r2, r2
|
||||
__asm__ (".int 0xe3003000\n"); //movw r3, #0
|
||||
__asm__ (".int 0xe3403000\n"); //movt r3, #0
|
||||
__asm__ (".int 0xe5832000\n"); //str r2, [r3]
|
||||
__asm__ (".int 0xe59d0000\n"); //ldr r0, [sp]
|
||||
__asm__ (".int 0xe59d1004\n"); //ldr r1, [sp, #4]
|
||||
__asm__ (".int 0xe59d2008\n"); //ldr r2, [sp, #8]
|
||||
__asm__ (".int 0xebfffffe\n"); //bl 0 <main>
|
||||
__asm__ (".int 0xe3a07001\n"); //mov r7, #1
|
||||
__asm__ (".int 0xef000000\n"); //svc 0x00000000
|
||||
__asm__ (".int 0xe320f003\n"); //wfi
|
||||
__asm__ (".int 0xe320f000\n"); //nop {0}
|
||||
__asm__ (".int 0xe28bd000\n"); //add sp, fp, #0
|
||||
__asm__ (".int 0xe49db004\n"); //pop {fp} ; (ldr fp, [sp], #4)
|
||||
__asm__ (".int 0xe12fff1e\n"); //bx lr
|
||||
#endif //__TINYC__
|
||||
|
|
Loading…
Reference in a new issue