All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: question about variables
  2003-05-15 16:50 question about variables Geiregat Jonas
@ 2003-05-15 16:30 ` wintah
  0 siblings, 0 replies; 2+ messages in thread
From: wintah @ 2003-05-15 16:30 UTC (permalink / raw)
  To: Geiregat Jonas, linux-assembly

On Thu, 15 May 2003 16:50:12 +0000
Geiregat Jonas <kemu@sdf-eu.org> 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).

> 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 ;)


-- 
* Origin: http://pagina.de/wintermute
... learn to swim

^ permalink raw reply	[flat|nested] 2+ messages in thread

* question about variables
@ 2003-05-15 16:50 Geiregat Jonas
  2003-05-15 16:30 ` wintah
  0 siblings, 1 reply; 2+ messages in thread
From: Geiregat Jonas @ 2003-05-15 16:50 UTC (permalink / raw)
  To: linux-assembly

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-05-15 16:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-15 16:50 question about variables Geiregat Jonas
2003-05-15 16:30 ` wintah

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.