Date: Sat, 5 Jan 2019 15:22:00 -0800 From: Mark Millard <marklmi@yahoo.com> To: Kyle Evans <kevans@FreeBSD.org>, freebsd-emulation@freebsd.org, ports-list freebsd <freebsd-ports@freebsd.org> Cc: Sean Bruno <sbruno@freebsd.org> Subject: qemu-arm-static has target_sigframe missing sf_fvp field so target_sigframe is too small Message-ID: <693D6101-25B5-4D88-BD5F-1F8BD34AEA1D@yahoo.com>
next in thread | raw e-mail | index | archive | help
[The context here is FreeBSD head -r341836 based and ports head -r488859 = based.] Note: I assume that "struct target_sigframe" is meant to match the = memory layout of the target's native "struct sigframe". Otherwise the reported = differences below could be irrelevant. For armv7 (and likely armv6) the following code: printf("sizeof(struct sigframe) =3D %lu\n", (unsigned long) = sizeof(struct sigframe)); // arm: printf("sf_si %lu\n", (unsigned long) offsetof(struct sigframe, = sf_si)); printf("sf_uc %lu\n", (unsigned long) offsetof(struct sigframe, = sf_uc)); printf("sf_vfp %lu\n", (unsigned long) offsetof(struct sigframe, = sf_vfp)); produces: sizeof(struct sigframe) =3D 592 sf_si 0 sf_uc 64 sf_vfp 328 However gdb reports for qemu-arm-static (on amd64): (gdb) p/d sizeof(struct target_sigframe) $3 =3D 324 (gdb) p/d &((struct target_sigframe *)0)->sf_si $4 =3D 0 (gdb) p/d &((struct target_sigframe *)0)->sf_uc $5 =3D 64 (gdb) p/d &((struct target_sigframe *)0)->sf_vfp There is no member named sf_vfp. So the first two fields have matching offsets. But note: sf_vfp is at 328, after the size of target_sigframe (324). It looks like both contexts have 260 for the size of sf_uc so the difference is padding before sf_vfp . /usr/include/machine/frame.h has: struct sigframe { siginfo_t sf_si; /* actual saved siginfo */ ucontext_t sf_uc; /* actual saved ucontext */ mcontext_vfp_t sf_vfp; /* actual saved VFP context */ }; sf_vfp was added in -r315947 (2017-Mar-26) and is in 11.2 . = /wrkdirs/usr/ports/emulators/qemu-user-static/work/qemu-bsd-user-4ef7d07/b= sd-user/arm/target_arch_signal.h has: struct target_sigframe { target_siginfo_t sf_si; /* saved siginfo */ target_ucontext_t sf_uc; /* saved ucontext */ }; =3D=3D=3D Mark Millard marklmi at yahoo.com ( dsl-only.net went away in early 2018-Mar)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?693D6101-25B5-4D88-BD5F-1F8BD34AEA1D>