2021-06-17 20:49:53 +02:00
|
|
|
.section ".note.openbsd.ident", "a"
|
2021-06-19 07:47:10 +02:00
|
|
|
.p2align 2
|
|
|
|
.long 0x8
|
|
|
|
.long 0x4
|
|
|
|
.long 0x1
|
|
|
|
.ascii "OpenBSD\0"
|
|
|
|
.long 0x0
|
|
|
|
.p2align 2
|
2021-06-17 20:49:53 +02:00
|
|
|
|
2021-06-19 07:47:10 +02:00
|
|
|
.section .text
|
|
|
|
.global putchar
|
|
|
|
.global getchar
|
|
|
|
.global _start
|
|
|
|
.extern main
|
|
|
|
|
|
|
|
.p2align 8
|
|
|
|
_start:
|
2022-01-10 16:32:00 +01:00
|
|
|
call main
|
|
|
|
movl $0x0,%edi
|
|
|
|
movq $0x1,%rax
|
|
|
|
syscall
|
2021-06-19 07:47:10 +02:00
|
|
|
|
|
|
|
putchar:
|
|
|
|
mov %rdi,%rax
|
|
|
|
mov %eax,buf
|
|
|
|
mov $0x4,%rax
|
|
|
|
mov $0x1,%rdi
|
|
|
|
mov $buf,%rsi
|
|
|
|
mov $0x1,%rdx
|
|
|
|
syscall
|
|
|
|
retq
|
|
|
|
|
|
|
|
getchar:
|
|
|
|
mov $0x3,%rax
|
|
|
|
mov $0x0,%rdi
|
|
|
|
mov $buf,%rsi
|
|
|
|
mov $0x1,%rdx
|
|
|
|
syscall
|
|
|
|
mov $0x0,%rax
|
|
|
|
mov buf,%eax
|
|
|
|
retq
|
|
|
|
|
|
|
|
.section .data
|
|
|
|
buf:
|
|
|
|
.long 0
|