sfl-examples/lecture-demos/gdb-and-asm-intro/demo.asm

36 lines
492 B
NASM

bits 64
SECTION .data
var1: dq 0x0
var2: dq 0x0
SECTION .text
global _start
_start:
int3
read:
mov rax, 0
add rax, 4
mov rbx, rax
sub rax, 4
xor rax, 0x10101010
xor rax, rax
sub rax, 1
add rax, 1
mov rax, -1
mov rax, 0xFFFFFFFFFFFFFFFF
mov [var1], rax
mov rax, var1
exit:
; sys_exit(42)
mov rax,60 ; system call number (sys_exit)
mov rdi,42 ; system call return value
syscall
times 64 nop