baremetal: exit at the end of main instead of infinite loop

run: interpret lkmc_test_fail as the last line of test as an error
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2018-11-08 22:00:03 +00:00
parent fc9e0c28a5
commit b1e16a59a1
8 changed files with 58 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
/* https://github.com/cirosantilli/arm-assembly-cheat/blob/c19e187e98e99f2f4a042783ca238aa4eb2292ab/v8/floating_point.S */
.global main
main:
/* 1.5 + 2.5 == 4.0 */
fmov d0, #1.5
fmov d1, #2.5
fadd d2, d0, d1
fmov d3, #4.0
fcmp d2, d3
beq 1f
bl assert_fail
1:
/* Now in 32-bit. */
fmov s0, #1.5
fmov s1, #2.5
fadd s2, s0, s1
fmov s3, #4.0
fcmp s2, s3
beq 1f
bl assert_fail
1:
ret

View File

@@ -0,0 +1,4 @@
/* Return to ensure that the post main works. */
.global main
main:
ret

View File

@@ -0,0 +1,6 @@
#include <stdio.h>
void main(void) {
puts("hello");
return;
}

View File

@@ -8,4 +8,5 @@ mystart:
ldr x0, =stack_top
mov sp, x0
bl main
b .
mov x0, #0
bl exit

View File

@@ -2,4 +2,5 @@
mystart:
ldr sp, =stack_top
bl main
b .
mov r0, #0
bl exit

3
baremetal/return.c Normal file
View File

@@ -0,0 +1,3 @@
void main(void) {
return;
}