K
kid joe
Hello all:
I'm writing a small assembly program that will open a file, process
it, then close it again. I'm trying to build a simple "framework" for it
at the moment. I've got the open, close, and exit system calls in place,
but I think there's something wrong.
My code is below. It seems to work OK, it just runs silently as given
below. But if I try it with a non-existent file (e.g. change /dev/zero to
/dev/zer) then no error message is produced.
Thanks for any advice!
section .text
path db "/dev/zero",0x00
global _start
_start:
mov eax,5 ; open
mov ebx,path
xor ecx,ecx ; O_RDONLY
mov edx,0x100 ; S_IRUSR
int 0x80
xchg eax,ebx ; put fd into ebx
mov eax,6 ; close
int 0x80
mov eax,1 ; exit
int 0x80
I'm writing a small assembly program that will open a file, process
it, then close it again. I'm trying to build a simple "framework" for it
at the moment. I've got the open, close, and exit system calls in place,
but I think there's something wrong.
My code is below. It seems to work OK, it just runs silently as given
below. But if I try it with a non-existent file (e.g. change /dev/zero to
/dev/zer) then no error message is produced.
Thanks for any advice!
section .text
path db "/dev/zero",0x00
global _start
_start:
mov eax,5 ; open
mov ebx,path
xor ecx,ecx ; O_RDONLY
mov edx,0x100 ; S_IRUSR
int 0x80
xchg eax,ebx ; put fd into ebx
mov eax,6 ; close
int 0x80
mov eax,1 ; exit
int 0x80