[linux] Add linuxprefix

Add a minimal _start required to run main.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Piotr Jaroszyński
2010-06-09 19:55:09 +02:00
committed by Michael Brown
parent 55187e8c4e
commit bb5b66b887
2 changed files with 47 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
#include <linux/unistd.h>
.section ".text"
.code64
.globl _start
.type _start, @function
_start:
xorq %rbp, %rbp
popq %rdi // argc -> C arg1
movq %rsp, %rsi // argv -> C arg2
andq $~15, %rsp // 16-byte align the stack
call main
movq %rax, %rdi // rc -> syscall arg1
movq $__NR_exit, %rax
syscall
.size _start, . - _start