1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

wrap up -bare

This commit is contained in:
Alexander Medvednikov
2019-11-14 10:23:44 +03:00
parent 6eaa2db533
commit 34c4565f7c
7 changed files with 70 additions and 53 deletions

View File

@@ -1,13 +1,13 @@
.intel_syntax noprefix
.text
.globl _start, syscall5
.globl _start, main__syscall5
_start:
xor rbp,rbp
pop rdi
mov rsi,rsp
and rsp,-16
call main
call main__main
mov rdi,rax /* syscall param 1 = rax (ret value of main) */
mov rax,60 /* SYS_exit */
@@ -16,7 +16,7 @@
ret /* should never be reached, but if the OS somehow fails
to kill us, it will cause a segmentation fault */
syscall5:
main__syscall5:
mov rax,rdi
mov rdi,rsi
mov rsi,rdx

View File

@@ -1,16 +1,16 @@
fn syscall5(number, arg1, arg2, arg3, arg4, arg5 voidptr) voidptr
fn write(fd int, data voidptr, nbytes u64) int {
return syscall5(
return syscall5(
1, // SYS_write
fd,
data,
nbytes,
0, // ignored
0 // ignored
)
fd,
data,
nbytes,
0, // ignored
0 // ignored
)
}
fn main() {
C.write(1, "hallo\n", 6)
write(1, "hallo\n", 6)
}