On Tue, 12 Dec 2006, Kyle Moffett wrote:
>
> Virtually all of my easily accessible computers right now are PowerPC and all
> of my assembly experience is PPC and MIPS, so as far as the x86-syscall
> support I have no clue whatsoever.
Ok. On ppc, the issues are perhaps a bit more straightforward, because
there is really just one way to do system calls: "sc".
That said, powerpc simply doesn't historically do any system call
translation, so you'll just have to implement the same kind of translation
layer that sparc has done, for example.
See: DoSyscall in arch/powerpc/kernel/entry_32.S. Right now it just does
...
cmplwi 0,r0,NR_syscalls
lis r10,sys_call_table@h
ori r10,r10,sys_call_table@l
slwi r0,r0,2
bge- 66f
lwzx r10,r10,r0 /* Fetch system call handler [ptr] */
mtlr r10
addi r9,r1,STACK_FRAME_OVERHEAD
PPC440EP_ERR42
blrl /* Call handler */
.globl ret_from_syscall
ret_from_syscall:
...
ie it uses one global table ("sys_call_table" and "NR_syscalls") for
everything, and you'd need to make it use different tables (and table
sizes) conditionally on the "Apple binary flag"
Alternatively, you could perhaps fit it in the exception table itself
(arch/powerpc/kernel/entry.S), but that gets just nastier and more
low-level, so I doubt it's all that great an idea.
> So I guess all I have to do is:
> (A) Write a bunch of new syscall handlers taking arguments of the same types
> as the Darwin syscall handlers,
Yes. The big issue tends to be to translate all the errno's and the fcntl
structure pointers etc. THAT can be quite painful indeed. You might ask
David Miller and company about their SunOS stuff, and look at things like
arch/sparc/kernel/{sys_sunos.c,sunos_ioctl.c}
for some sorry examples.
> (B) Figure out how to switch tables depending on the "syscall personality"
> of "current"
See above. "DoSyscall" is where you enter.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]