ffcall, mac os x (10.6), and assembler

Joshua Root jmr at macports.org
Fri Nov 12 03:35:41 PST 2010


On 2010-11-12 20:05 , Bruce J. Carter wrote:
> I am working on porting ffcall to Mac OS X 10.6 and running into
> issues locating up to date documentation.
> 
> For those that don't know what ffcall is, it is a language independent
> foreign function interface, used, I think, primarily with LISP. The
> ffcall interface has worked well with Mac OS X until the release of
> 10.6, which is all 64 bit Intel. The PPC and Intel 32 bit stuff was/is
> fine. The x86_64 port for suse linux does not compile. The i386 port
> is a good starting point. The issue I have is assembler directives.
> 
> Finding good information on writing assembly for a Mach-O 64 kernel is
> not abundant. Specifically pulling (function pointers) off the stack
> and out of registers. I figured out the file format, that was simple.
> The hard part is finding the directives supported. There is
> insufficient docs on YASM and NASM for x86_64 Mach-O. I have found
> lots of docs at Apple, among other places, but many are out of date
> including Apple's, I also have the Intel and AMD docs which are
> excellent for the instructions and registers, but not the info I need.
> 
> I have attempted to compile for i386 and x86_64. Both fail for the
> obvious reasons. Sorry if I sound a little ignorant and uninformed. It
> has been 20 years since I mucked around with assembler and the Mach
> kernel is a little different beast than straight BSD or linux.
> 
> Any clues, tips, hints would be greatly appreciated.

Not sure where else you could look for documentation if Apple's isn't
sufficient, but you might want to have a look at libffi's code and talk
to its developers, since it must solve many of the same problems.

- Josh


More information about the macports-dev mailing list