Skip to contentSkip to conversation

question about variables

DISCUSSION Geiregat Jonas 2 participants 2 messages May 15, 2003

lore
Share & tools
lore
#1 lore raw
In reply to Geiregat Jonas
Quoted 9 lines · On Thu, 15 May 2003 16:50:12 +0000 Geiregat Jonas <[email protected]> wrote:

Hey, I have 2question about linux assembly
I have written a basic programme
It's really simple I use the open, read and write syscall
To open a file (/etc/passwd) read it and print it out to the screen.
Now when reading the file I read it into a buffer declared like this
(using nasm)
section .bss
buffer resd 1
so I reserve one double word of space. so that is 4bytes. /etc/passwd >is much bigger then that but still I see the whole file printed I find >this strange (I'm also not sure about the 1 behind resd I think it's >stands for reserve 1 doubleword of space)

Yep, it seems strange. Anyway, if you want to print the whole file (even manipulate it), the sys_mmap syscall would be a lot better (open the file, then with mmap project it on memory, it dinamically creates a zone for the file and loads it, so you can access it withouth having to deal with pointers & stuff).

Quoted 2 lines

My other question is how can I accept, command line arguments in asm using nasm

Check out the stack, the pointers for arguments the user provides are stacked there when the program begins ;)

Signature · 2 lines
* Origin: http://pagina.de/wintermute
... learn to swim
#0 lore raw

Hey, I have 2question about linux assembly
I have written a basic programme
It's really simple I use the open, read and write syscall
To open a file (/etc/passwd) read it and print it out to the screen. Now when reading the file I read it into a buffer declared like this (using nasm) section .bss
buffer resd 1

so I reserve one double word of space. so that is 4bytes. /etc/passwd is much bigger then that but still I see the whole file printed I find this strange (I'm also not sure about the 1 behind resd I think it's stands for reserve 1 doubleword of space)

My other question is how can I accept, command line arguments in asm using nasm Regards Jonas