about summary refs log tree commit diff
path: root/crt
diff options
context:
space:
mode:
authorNicholas J. Kain <njkain@gmail.com>2011-02-15 07:32:09 -0500
committerNicholas J. Kain <njkain@gmail.com>2011-02-15 07:32:09 -0500
commit1e12632591ab98a6ea3af8680716c28282552981 (patch)
tree5b79bd9a0b950d6ab414fef8cbb5dfcd1a6d2e83 /crt
parentc2afb747b0296f23cd1903e82ccbdee3fc2978fd (diff)
downloadmusl-1e12632591ab98a6ea3af8680716c28282552981.tar.gz
musl-1e12632591ab98a6ea3af8680716c28282552981.tar.xz
musl-1e12632591ab98a6ea3af8680716c28282552981.zip
Port musl to x86-64. One giant commit!
Diffstat (limited to 'crt')
-rw-r--r--crt/x86_64/crt1.s16
1 files changed, 16 insertions, 0 deletions
diff --git a/crt/x86_64/crt1.s b/crt/x86_64/crt1.s
new file mode 100644
index 00000000..45cbb9db
--- /dev/null
+++ b/crt/x86_64/crt1.s
@@ -0,0 +1,16 @@
+/* Written 2011 Nicholas J. Kain, released as Public Domain */
+.text
+.global _start
+_start:
+	xor %rbp,%rbp   /* rbp:undefined -> mark as zero 0 (ABI) */
+	mov %rdx,%r9    /* 6th arg: ptr to register with atexit() */
+	pop %rsi        /* 2nd arg: argc */
+	mov %rsp,%rdx   /* 3rd arg: argv */
+	andq $-16,%rsp  /* align stack pointer */
+	push %rax       /* 8th arg: glibc ABI compatible */
+	push %rsp       /* 7th arg: glibc ABI compatible */
+	xor %r8,%r8     /* 5th arg: always 0 */
+	xor %rcx,%rcx   /* 4th arg: always 0 */
+	mov $main,%rdi  /* 1st arg: application entry ip */
+	call __libc_start_main /* musl init will run the program */
+.L0:	jmp .L0