Mach-O binary format support and Darwin syscall personality [Was: uts banner changes]

From: Kyle Moffett
Date: Tue Dec 12 2006 - 07:25:08 EST


On Dec 11, 2006, at 13:26:13, Linus Torvalds wrote:
On Mon, 11 Dec 2006, Olaf Hering wrote:
Hmm, even moving this to linux_banner doesnt work, just because __initdata is in a different section.

Heh. Let's just change the "version_read_proc" string to not trigger.

Something like this instead (which replaces the "Linux" with "%s" in /proc, and just takes it from "utsname()->sysname" instead. So now you can lie and call yourself "OS X" in your virtual partition if you want to ;)

Funny you should mention that... I'm currently tinkering with a binfmt_mach_o kernel module and associated Darwin syscall personality to try to load and run console Mach-O binaries natively under PPC or X86 linux (depending on what architectures the Mach-O binary supports).

I've basically got the binary loader part working; the Mach-O dynamic loader gets mapped into memory at the appropriate location, the kernel jumps to the specified location in the code... and then the program comes crashing to a halt when it starts calling invalid syscalls with bogus arguments.

So now I have to figure out how to set up a new syscall personality with a bunch of wrapper syscalls which reorder arguments and translate constant values before calling into the rest of the Linux code. I'm fairly sure it's possible because you can run some Solaris binaries under Linux if you turn on the appropriate BINFMT_* config option(s), but I'm totally unsure as to _how_.

I'd much appreciate any advice you can give!

Cheers,
Kyle Moffett

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/