9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Pietro Gagliardi <pietro10@mac.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] Disassembler?
Date: Fri,  2 May 2008 06:21:19 -0400	[thread overview]
Message-ID: <A6C2015E-B5F6-4E45-A6C0-94C058946D0A@mac.com> (raw)
In-Reply-To: <FDDBD0C9-7A87-4C89-85F9-8242D7B63949@kix.in>


On May 2, 2008, at 6:14 AM, Anant Narayanan wrote:

> Hi,
>
> Is there a tool available which can convert plan 9 a.out executables
> to plan 9 assembly code? I'd like to know how the C compiler stores
> arguments for a system call on the stack for x86.
>
> 8c -S does not help, since all it displays is: `call print', instead
> of what instructions are actually executed when print is called.
>
> Regards,
> Anant
>
>

8c doesn't use push or pop. It stores values directly onto the stack
with MOVL AX, 4(SP) for the second argument. This implies you'll need
to allocate enough stack space:

	TEXT x, 0, $12

will give you enough for 2 arguments (don't tell me why not 3).

The compilers push arguments left to right every 4 bytes.




  reply	other threads:[~2008-05-02 10:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02 10:14 Anant Narayanan
2008-05-02 10:21 ` Pietro Gagliardi [this message]
2008-05-02 11:20 ` erik quanstrom
2008-05-02 11:32 ` Charles Forsyth
2008-05-02 11:53   ` Charles Forsyth

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=A6C2015E-B5F6-4E45-A6C0-94C058946D0A@mac.com \
    --to=pietro10@mac.com \
    --cc=9fans@9fans.net \
    /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).