9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Disassembler?
@ 2008-05-02 10:14 Anant Narayanan
  2008-05-02 10:21 ` Pietro Gagliardi
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Anant Narayanan @ 2008-05-02 10:14 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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




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

* Re: [9fans] Disassembler?
  2008-05-02 10:14 [9fans] Disassembler? Anant Narayanan
@ 2008-05-02 10:21 ` Pietro Gagliardi
  2008-05-02 11:20 ` erik quanstrom
  2008-05-02 11:32 ` Charles Forsyth
  2 siblings, 0 replies; 5+ messages in thread
From: Pietro Gagliardi @ 2008-05-02 10:21 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


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.




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

* Re: [9fans] Disassembler?
  2008-05-02 10:14 [9fans] Disassembler? Anant Narayanan
  2008-05-02 10:21 ` Pietro Gagliardi
@ 2008-05-02 11:20 ` erik quanstrom
  2008-05-02 11:32 ` Charles Forsyth
  2 siblings, 0 replies; 5+ messages in thread
From: erik quanstrom @ 2008-05-02 11:20 UTC (permalink / raw)
  To: 9fans

> 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

if i understand you correctly, that's because print is in a library
and is called not inline.  you can use acid on the executable to
	asm(print)
which disassembles code starting at print.

- erik




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

* Re: [9fans] Disassembler?
  2008-05-02 10:14 [9fans] Disassembler? Anant Narayanan
  2008-05-02 10:21 ` Pietro Gagliardi
  2008-05-02 11:20 ` erik quanstrom
@ 2008-05-02 11:32 ` Charles Forsyth
  2008-05-02 11:53   ` Charles Forsyth
  2 siblings, 1 reply; 5+ messages in thread
From: Charles Forsyth @ 2008-05-02 11:32 UTC (permalink / raw)
  To: 9fans

i normally give the -a option to 8l(1)




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

* Re: [9fans] Disassembler?
  2008-05-02 11:32 ` Charles Forsyth
@ 2008-05-02 11:53   ` Charles Forsyth
  0 siblings, 0 replies; 5+ messages in thread
From: Charles Forsyth @ 2008-05-02 11:53 UTC (permalink / raw)
  To: 9fans

> i normally give the -a option to 8l(1)

or use db(1) or acid(1)




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

end of thread, other threads:[~2008-05-02 11:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-02 10:14 [9fans] Disassembler? Anant Narayanan
2008-05-02 10:21 ` Pietro Gagliardi
2008-05-02 11:20 ` erik quanstrom
2008-05-02 11:32 ` Charles Forsyth
2008-05-02 11:53   ` Charles Forsyth

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