From: Lorenzo <lollo_c@alice.it>
To: linux-assembly@vger.kernel.org
Subject: Re: Very newbie question...
Date: Sat, 12 Nov 2005 08:34:22 +0100 [thread overview]
Message-ID: <43759AFE.8000904@alice.it> (raw)
In-Reply-To: <000301c5e715$e7a90370$619f3b80@NMAPod505BTLR>
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
>
next prev parent reply other threads:[~2005-11-12 7:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-11 23:05 Very newbie question Lorenzo
2005-11-11 23:16 ` John Rodriguez
2005-11-12 1:04 ` Brian Raiter
2005-11-12 7:35 ` Lorenzo
2005-11-12 7:34 ` Lorenzo [this message]
2005-11-11 23:29 ` Frederic Marmond
2005-11-12 7:35 ` Lorenzo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43759AFE.8000904@alice.it \
--to=lollo_c@alice.it \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).