Re: Very newbie question...

Lorenzo <[email protected]>
Newsgroups org.kernel.vger.linux-assembly
Message-ID <[email protected]>
I have tried to do a program like yours and all is ok.
The "Hello World" work well but i don't want to use this method.
In the same page,

http://asm.sourceforge.net/articles/linasm.html, there is another thing:

" Syscalls whos number of args is greater than five still expect the
syscall number to be in %eax, but the args are arranged in memory and the
pointer to the first arg is stored in %ebx."

I know that "Hello World" is composed of less then five args but i want to know both methods (put all in eax,ebx,ecx,edx,esi,edi registers or put the syscall in eax, push the others and put the pointer to the stack in ebx).
Thx :)



John Rodriguez wrote:

>I am still newbie myself, but one thing that I noticed is that you pass some
>parameters via registers and others via the stack pointer.
>
>The write sys call takes 3 param (as you prob already know), the file
>descriptor (1 = stdout), the pointer to the buffer, and its size.
>
>The write sys call itself is syscall 4.
>
>According to http://asm.sourceforge.net/articles/linasm.html
>"For all syscalls, the syscall number goes in %eax. For syscalls that have
>less than six args, the args go in %ebx,%ecx,%edx,%esi,%edi in order. The
>return value of the syscall is stored in %eax."
>
>Here is my own example that I wrote about a year ago.
>
>section .data
>hello   db  'Hello, World!', 0Ah
>len     equ $-hello
>
>section .text
>global  _start
>_start:
>mov     edx, len
>mov     ecx, hello
>mov     ebx, 1
>mov     eax, 4
>int     80h
>mov     ebx, 0
>mov     eax, 1
>int     80h
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.