diff --git a/facilities/crti.o b/facilities/crti.o new file mode 100644 index 0000000..313e528 Binary files /dev/null and b/facilities/crti.o differ diff --git a/facilities/crti.s b/facilities/crti.s new file mode 100644 index 0000000..e714fa4 --- /dev/null +++ b/facilities/crti.s @@ -0,0 +1,37 @@ + #this constant has to be set to a kernel-specific value + .equ TERMINATESYS, 18 + + + # remember that $sp has to be set by kernel too + + # useful constants + + # This is the standard __start function for generic program + # activation: it loads r15 with starting address and + # at main() function return calls kernel TERMINATE service + # (a SYSCALL with r0 == TERMINATE) + + .text + .global __start + .extern main + +__start: + # $sp has to be set to correct value by kernel + + SUB sp, sp, #16 + STR fp, [sp], #12 + MOV fp, sp + + B main + + MOV sp, fp + LDR fp, [sp], #12 + ADD sp, sp, #16 + + # calls kernel TERMINATE service + + MOV r0, #TERMINATESYS + + SWI 8 + + diff --git a/qarm.pro b/qarm.pro index 58fd99a..0a30d25 100644 --- a/qarm.pro +++ b/qarm.pro @@ -140,4 +140,6 @@ OTHER_FILES += \ icons/window_default-48.png \ icons/poweron.png \ install.sh \ - default/uarm + default/uarm \ + facilities/crti.o \ + facilities/crti.s