Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Mar 2018 18:45:28 +0100
From:      "Fabian Freyer" <fabian.freyer@physik.tu-berlin.de>
To:        rumpkernel-users@freelists.org
Cc:        freebsd-virtualization@freebsd.org
Subject:   Re: rumpkernel and bhyve: triple faults
Message-ID:  <A3574A92-0514-44AE-BE20-6BFDAE803407@physik.tu-berlin.de>
In-Reply-To: <C49D0E56-10A4-49D8-A843-E371395831B5@physik.tu-berlin.de>
References:  <C49D0E56-10A4-49D8-A843-E371395831B5@physik.tu-berlin.de>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 3156 and 4880).

--=_MailMate_969387E7-81FE-4CE4-B9E3-F313ED190F6E_=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 6 Mar 2018, at 7:45, Fabian Freyer wrote:
> Tracking down bios_crtc_base, I find that it=E2=80=99s loaded in
> rumprun/platform/hw/arch/amd64/locore.S:70:
>
> 	/* save BIOS data area values */
> 	movw BIOS_COM1_BASE, %bx
> 	movw %bx, bios_com1_base
> 	movw BIOS_CRTC_BASE, %bx
> 	movw %bx, bios_crtc_base
>
> Where BIOS_CRTC_BASE is 0x463 and BIOS_COM1_BASE is 0x400. Checking the=
 bhyve
> device node in /dev/vmm with xxd(1), I find the words at these addresse=
s to be
> Uninitialised:
>
> 00000400: 0000                                     ..
> 00000483: 0000                                     ..
>
> I=E2=80=99m not sure where to go from here. Is this a bug in bhyve(4), =
should these
> values be initialised somehow, or should I patch rumpkernel(7) to skip =
this check
> when running on bhyve(4)?

I=E2=80=99ve chased this bug down a bit further to what I believe is an i=
ssue with the
rumprun toolchain I am building on FreeBSD with the misc/rumprun port [1]=
=2E

objdump -t helloer-rumprun.elf list a number of symbols in the *COM* sect=
ion, which
holds unallocated C external variables [2]:

objdump -t helloer-rumprun.elf | grep \*COM\*
00000001 l     O *COM*   00000001 pic1mask
00000004 l     O *COM*     00000004 pgalloc_totalkb
00000004 l     O *COM*     00000004 pgalloc_usedkb
00001000 l     O *COM*     00000020 multiboot_cmdline
00000002 l     O *COM*     00000002 bios_crtc_base
00000001 l     O *COM*     00000001 pic2mask
00000002 l     O *COM*     00000002 bios_com1_base

As the pagetable in pagetable.s maps the first page as non-present, acces=
sing any
of these will result in a fault. I=E2=80=99m pretty sure that these shoul=
dn=E2=80=99t be undefined.

A build on Linux (which boots fine) shows these not to be uninitialised:
00000000003e3480 g     O .bss	0000000000000002 bios_com1_base
00000000003e44a0 g     O .bss	0000000000000002 bios_crtc_base

Further down the rabbit hole, this goes on in rumprun.o:

On Linux, bios_crtc_base is not a local symbol:
0000000000000002       O *COM*  0000000000000002 bios_crtc_base
0000000000000002       O *COM*  0000000000000002 bios_com1_base

While on FreeBSD, they are marked as local:
0000000000000002 l     O *COM*  0000000000000002 bios_crtc_base
0000000000000002 l     O *COM*  0000000000000002 bios_com1_base

Fabian

[1] https://svnweb.freebsd.org/ports/head/misc/rumprun/Makefile?view=3Dma=
rkup&pathrev=3D459195
[2] http://man7.org/linux/man-pages/man5/elf.5.html / SHN_COMMON
--=_MailMate_969387E7-81FE-4CE4-B9E3-F313ED190F6E_=
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename=signature.asc
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iQJWBAEBCgBAFiEEX6JoxdmEemcFacQZmealkcs85+YFAlqiyDgiHGZhYmlhbi5m
cmV5ZXJAcGh5c2lrLnR1LWJlcmxpbi5kZQAKCRCZ5qWRyzzn5ve+EAC3okXKpevy
pZecEHqzMRZvT69OtLYYADqwUWxUatoXWv+X9jzyYG+L7XGf2w1EJSEAKDbGpYb9
6pLWXk3Yd38HHL1w0nd5UhOynunw/ru9Ka6vtZYJcQHi39UOVdgqIm7s9x/0HmOv
/7f25q5eDaBLRYqPFUpwLegJ46UVtCGJu2eN1EyeTifx/yNw0DTQDo96JPY0SPhE
jgoX1eTggerv5Rn1O8hhToVibdNBQLcv+9uM1CET5EgWAOwEDcvZAlgpCq+eu3x8
9yEfy5UgIKMa0wgq7aUzqfGxdhLdnE5A2pHyits3TFcev/HXhzsP471Z0lAGDe9z
ap+hG2gcCsEwLjA3UmjtGXD2nBO7yI+7l/me/jfKsSGhoyoA1F+PNa9ElUbmKabz
wBE0tylxv1CC47r/V/vWcnvszpmIklaYg+on3AYM9Y0MCmgwKzSjE+uUsgzCkIBt
mxx3JukFVGFiUQldTKhnxcorvmeArYtUf3mGh2p/wOp8ZaZ9loUJ5ZmmT046/ssC
yOll/2Tbas5uuDPFeZw+iNpfM2POeQZ5Mjm/rJ3ZoO0EYb3WXo6IiDeUrkvJwW0y
UDNTrx1v2jLoZi3VR5uqA3VBfng4RRkBWVb4GofM/N0jFfTaqzNbYzA37lypssxa
2e14RvWdO8gU9lWtcDCr/7Ah2NUJsizw1A==
=6hrC
-----END PGP SIGNATURE-----

--=_MailMate_969387E7-81FE-4CE4-B9E3-F313ED190F6E_=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A3574A92-0514-44AE-BE20-6BFDAE803407>