;nasm -f elf64 -o addr.o addressing.asm ;ld -o addr addr.o ;usare set $pc= addr per saltare all'indirizzo addr (per evitare SIGENV) ;somma n elementi di un vettore BITS 64 %idefine offset SECTION .data valore dd 0xdeadbeaf SECTION .text global _start _start: mov eax, 0xdeadbeaf ; eax=0xdeadbeaf mov ebx, dword [0xdeadbeaf] ; ebx <-- (dword)[0xffffffffdeadbeaf] ... SIGSEGV mov eax, valore ; eax=0x6000ec -> 0xdeadbeaf mov ebx, [valore] ; ebx=0xdeadbeaf mov eax, ebx ; eax=0xdeadbeaf mov eax, [ebx] ; ebx <-- (dword)[0xffffffffdeadbeaf] ... SIGSEGV mov eax, [ebx+2] ; ebx <-- (dword)[0xffffffffdeadbeaf + 2] ... SIGSEGV mov eax, [ebx*4+0xdeadbeaf] ; ebx <-- (dword)[0xffffffffdeadbeaf*4 + 0xdeadbeaf] ... SIGSEGV mov eax, [edx + ebx*4 + 42] mov rax,60 ; exit syscall (x86_64) mov rdi,0 ; status = 0 (exit normally) syscall