boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

start.S (597B)


      1 /* tcc-libc entry stub — same role as P1/entry-libc.P1pp's p1_main:
      2  * call __libc_init(argc, argv) so `environ` is set, then main(argc,
      3  * argv), then exit with main's return value. Linux aarch64 brings
      4  * argc at [sp] and argv at sp+8 on entry. */
      5 
      6     .globl _start
      7 _start:
      8     ldr  x0, [sp]            /* argc */
      9     add  x1, sp, #8          /* argv */
     10     stp  x0, x1, [sp, #-16]! /* save across __libc_init call */
     11     bl   __libc_init
     12     ldp  x0, x1, [sp], #16
     13     bl   main
     14     /* main's return is in x0 — feed it to exit(2). */
     15     mov  x8, #93             /* NR_exit */
     16     svc  #0