Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Dec 2010 19:24:55 +0200
From:      Kostik Belousov <kostikbel@gmail.com>
To:        pfgshield-freebsd@yahoo.com
Cc:        freebsd-amd64@freebsd.org, avg@freebsd.org, bug-followup@freebsd.org
Subject:   Re: amd64/124134: [kernel] The kernel doesn't follow the calling convention in the SVR4/i386 ABI
Message-ID:  <20101205172455.GB184@deviant.kiev.zoral.com.ua>
In-Reply-To: <739586.26564.qm@web113517.mail.gq1.yahoo.com>
References:  <201012051355.oB5Dtex4077823@freefall.freebsd.org> <739586.26564.qm@web113517.mail.gq1.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--2B/JsCI69OhZNC5r
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Dec 05, 2010 at 07:08:07AM -0800, pfgshield-freebsd@yahoo.com wrote:
> The code has certainly changed a lot  ...
>=20
> Reading the posting on the link with a possible fix:
>=20
> "...
> 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
>=20
> 	pcb->pcb_flags |=3D PCB_FULLCTX;
> ... "
>=20
> 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.
>=20
> This PR was only for reference though as it doesn't cause trouble for us:=
 I'm OK with the PR being closed.
>=20

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.

--2B/JsCI69OhZNC5r
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (FreeBSD)

iEYEARECAAYFAkz7yuYACgkQC3+MBN1Mb4g0+gCdHr3LI4WutdnTD8He0+hFYF72
Z6IAoMXjfMPwXwmBlJhaxXlG+gV9vs4t
=yePc
-----END PGP SIGNATURE-----

--2B/JsCI69OhZNC5r--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101205172455.GB184>