From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3e1162e60604220935x1c95f223sd295b1c6fdb772a0@mail.gmail.com> Date: Sat, 22 Apr 2006 09:35:35 -0700 From: "David Leimbach" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] OS X threads + dynamic linking In-Reply-To: <0ad26600f43ce6f44c61e6f6d78ed116@swtch.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <3e1162e60604210924h2a12fd99n171afc7893b5e646@mail.gmail.com> <0ad26600f43ce6f44c61e6f6d78ed116@swtch.com> Topicbox-Message-UUID: 4465e762-ead1-11e9-9d60-3106f5b1d025 On 4/21/06, Russ Cox wrote: > > Actually, this code violates the ABI. The stack needs to be aligned > > on a 16byte address. > > > > http://developer.apple.com/documentation/DeveloperTools/Conceptual/LowL= evelABI/index.html > > > > So the assembly block should be: > > > > asm( > > "pushal\n" > > "movl 8(%ebp), %ebx\n" > > "movl 12(%ebp), %eax\n" > > "xchgl %esp, %eax\n" > > "subl $0xc, %esp\n" //need to align the stack... can't j= ust pushl > > "pushl %eax\n" > > "call *%ebx\n" > > "popl %esp\n" > > "popal\n" > > ); > > > > Just don't compile with -Os because gcc freaking inlines runonstack. > > Whom to throttle for that one? > > The real version doesn't use inline assembly, so it's not a problem. > I just wanted a single file demonstrating the problem. > > After aligning the stack pointer properly, the x86 OS X code > now in CVS does appear to work. > > Thanks very much for tracking this down. > Hey no problem... I want to use it on my new system :) Thanks for "making it go". > Russ > >