From: Holger H. <ha...@gm...> - 2009-08-19 07:25:00
|
On Tue, 18 Aug 2009 23:33:46 -0700 "H. Peter Anvin" <hp...@zy...> wrote: > On 08/18/2009 07:34 AM, Holger Hanrath wrote: > > Hi all, > > > > i want to write 3 bytes of argv[0] on stdout but it doesn't work. > > Return code -14 (EFAULT Bad address). Am i missing something here? > > > > System is archlinux 2009.08 x86_64 kernel 2.6.31-rc6 > > nasm 2.05.01 Binutils 2.19.1.20090418 > > > > > > > > stdout equ 1 > > write equ 4 > > exit equ 1 > > > > section .text > > global _start > > _start: > > pop rax ; rax = argc > > pop rax ; rax = argv[0] > > > > mov rdx, 3 ; write 3 bytes > > mov rcx, rax ; rcx = rax = argv[0] > > mov rbx, stdout > > mov rax, write > > int 0x80 > > > > mov rbx, 0 > > mov rax, exit > > int 0x80 > > > > int 0x80 is used for 32-bit system calls. 64 bits uses syscall, and > entirely different system call numbers and a different calling convention. i see that now thanks for pointing out Holger |