amd64/124134: [kernel] The kernel doesn't follow the calling
convention in the SVR4/i386 ABI
kostikbel at gmail.com
Sun Dec 5 17:30:17 UTC 2010
The following reply was made to PR amd64/124134; it has been noted by GNATS.
From: Kostik Belousov <kostikbel at gmail.com>
To: pfgshield-freebsd at yahoo.com
Cc: avg at freebsd.org, freebsd-amd64 at freebsd.org, bug-followup at freebsd.org
Subject: Re: amd64/124134: [kernel] The kernel doesn't follow the calling convention in the SVR4/i386 ABI
Date: Sun, 5 Dec 2010 19:24:55 +0200
Content-Type: text/plain; charset=us-ascii
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 |=3D PCB_FULLCTX;
> ... "
> We don't have anything similar to this in exec_setregs(), and from my und=
erstanding the issue could not be easily fixed without breaking binary comp=
atibility 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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)
-----END PGP SIGNATURE-----
More information about the freebsd-amd64