Re: Executable entry point
Re: Executable entry point
- Subject: Re: Executable entry point
- From: Filipe Cabecinhas <email@hidden>
- Date: Sun, 18 Mar 2007 11:02:55 +0000
Thank you very much, now it runs :D
I have now another problem.
As far as I could see (by going through the source of Darwin, when I
want to call a system call directly (I can't link the output of my
compiler with the libc, I have to link it with my run-time library) I
should do the following:
push the arguments to the stack(for example (write): push nbytes,
push str, push fd)
set eax to the system call number (4)
call __sysenter_trap
sysenter_trap:
put the esp in ecx
sysenter
I think I should call the trap so the system call has an address to
return to, right?
But my problem is, when I return from sysenter, it goes to a weird
position instead of going to the address after the call __sysenter_trap.
Am I doing anything wrong?
Thanks for the help
Filipe Cabecinhas
On 18 Mar, 2007, at 07:50, Geoffrey Lee wrote:
The question is: how does darwin know where is the entry point of the
binary and how can I choose it?
Use -e flag in ld(1). It is actually stored in the thread state,
the kernel loads this thread state when the binary is loaded, you can
see for yourself with otool -l, srr0 on ppc and eip on 32bit x86.
- gl
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden