On MacOSX (Re: Croquet

John M McIntosh johnmci at smalltalkconsulting.com
Thu Nov 14 08:03:52 UTC 2002


Air air, what day is it.

mm this would be more fun if it was generating cash.

After spending much time tinkering with the FFI code and reading rather  
old/dry manuals on powerpc assembler calling convention I happened to  
miss this gem in one of them. "Alignment Padding—Space inserted in  
order to quadword-align the stack pointer. "

Naa, that couldn't be an issue could it? No I'm only passing 3  
parameters into glTexParameteri, why no silly prolog code would ever  
think about being clever and assuming they got extra bytes there on the  
stack to abuse because stacks are quadword-aligned. Nope then of course
diddling with that extra free 4 bytes in that quadword-aligned stack  
couldn't mean I"ll override the stack chain if I wanted to stuff  
something there at the non-existent parm 4, nope couldn't conceive of  
such a thing. Why if it did then the program would crash out in the  
boonies and it would be ugly ugly to debug.  Certainly any reasonable  
compiler wouldn't ignore that tenant from the powerpc compilers writers  
guide, nope nope. Who in the world would need to do FFI calls anyways  
and handcraft assembler that violates the spirit of the guidebook? Nope  
not those squeaker.

If you assume someone is being clever, then debugging becomes easier.

So this gets one beyond crashing and into does it work? Yes!!! I've the  
only working carbon os-x Croquet VM on the planet. I think I'll put it  
on eBay. No? After some sleep, I'll attempt to assemble a VM and a new  
FFI tomorrow so some of you mad desperate squeakers who've tossed notes  
in my email box can waste their weekend away.

For the truly desperate what you need to do is build a new VM using the  
3.4 image with the required
macintosh special change sets. Then build a new mac FFI plugin and  
change a line of code in  sqMacFFI.s

	addi r5, r5, 24 /* linkage area */
to
	addi r5, r5, 32 /* linkage area and cheat on padding */

This isn't the elegant solution, rather a raw ugly fix so I can reflect  
on the correct assembler to round up the value by 16.
--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===




More information about the Squeak-dev mailing list