amd64/124134: [kernel] The kernel doesn't follow the calling
convention in the SVR4/i386 ABI
Kostik Belousov
kostikbel at gmail.com
Sun Dec 5 17:38:13 UTC 2010
On Sun, Dec 05, 2010 at 07:08:07AM -0800, pfgshield-freebsd at yahoo.com wrote:
> The code has certainly changed a lot ...
>
> Reading the posting on the link with a possible fix:
>
> "...
> Can you try to add to kernel sources, into file sys/amd64/amd64/machdep.c
> function exec_setregs(td, entry, stack, ps_strings)
> somewhere at the end
>
> pcb->pcb_flags |= PCB_FULLCTX;
> ... "
>
> We don't have anything similar to this in exec_setregs(), and from my understanding the issue could not be easily fixed without breaking binary compatibility so I would think the issue is still there.
>
> This PR was only for reference though as it doesn't cause trouble for us: I'm OK with the PR being closed.
>
I looked at the PR before. Looking again now, I have the same conclusion,
that is I do not understand what is the issue.
On the first return into usermode after the successfull execve(2), kernel
sets the following registers:
- %rsp (properly aligned)
- %rdi (1st parameter in usermode ABI; contains the pointer to startup
frame, i.e. &argc)
- all other GP registers are zeroed.
ABI rev. 0.99 requires the following setup:
- %rsp properly aligned and has the value &argc
- %rdx points to a function to be registered with atexit(3), or NULL.
We do satisfy the ABI requirement for %rdx content in the trivial way,
by passing 0.
The layout of the startup frame also seems conforming.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-amd64/attachments/20101205/7f619df8/attachment.pgp
More information about the freebsd-amd64
mailing list