From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Message-id: From: Pietro Gagliardi To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-reply-to: Date: Fri, 2 May 2008 06:21:19 -0400 References: Subject: Re: [9fans] Disassembler? Topicbox-Message-UUID: 9cc2713a-ead3-11e9-9d60-3106f5b1d025 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.