Page MenuHomeFreeBSD

Add AT_HWCAP flags for VFP settings for FreeBSD/arm.
ClosedPublic

Authored by jhb on Sep 9 2017, 2:30 PM.

Details

Summary

These flags match the meaning and value of flags in Linux, though
Linux has many more flags.

Test Plan

This is part of a patch series used to test using VFP registers in
gdb on armv7.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhb created this revision.Sep 9 2017, 2:30 PM
emaste added a subscriber: emaste.Sep 9 2017, 2:37 PM
stevek added a subscriber: stevek.Sep 9 2017, 3:15 PM
stevek added inline comments.
sys/arm/arm/vfp.c
120 ↗(On Diff #32847)

Instead of specifically tying this to the elf handling code, why not have a variable in the arch-specific files (machdep.c maybe?) that the elf code will reference? Consider a possible future of both 32-bit and 64-bit ARM programs running on aarch64 system.

jhb added inline comments.Sep 9 2017, 4:07 PM
sys/arm/arm/vfp.c
120 ↗(On Diff #32847)

There are separate elf32_hwcap and elf64_hwcap variables on platforms that support both in case they have different layouts / meanings (I think we should probably try to match Linux's meaning on each architecture when possible). I imagine that we would be setting elf64_hwcap to appropriate values in sys/arm64/arm64/vfp.c along with setting elf32_hwcap under #ifdef COMPAT_FREEBSD32. Alternatively if architectures are known to be the same, then the 64-bit code could just set elf64_hwcap in places and later use a SYSINIT further along in boot that copies the value to elf32_hwcap.

stevek accepted this revision.Sep 9 2017, 6:11 PM

Makes sense. HWCAP_ARM_* values look sane.

This revision is now accepted and ready to land.Sep 9 2017, 6:11 PM
mmel accepted this revision.Sep 10 2017, 5:21 AM
ian added a subscriber: ian.Sep 10 2017, 6:44 PM
ian added inline comments.
sys/arm/include/elf.h
122 ↗(On Diff #32847)

These names differ from the ones linux uses by having _ARM in the middle of them. I think that implies that every port that tries to do runtime feature detection will need patching. Given that they're defined in an MD header, I'm not sure the _ARM is necessary.

Hmm, we'll probably never escape some need to patch ports, because the linux header file that declares all this stuff is linux/auxvec.h and we'll never have one of those.

jhb updated this revision to Diff 32982.Sep 12 2017, 6:45 PM
  • Update for sv_hwcap.
This revision now requires review to proceed.Sep 12 2017, 6:45 PM
jhb added inline comments.Sep 12 2017, 6:48 PM
sys/arm/include/elf.h
122 ↗(On Diff #32847)

Hmm, I thought I had seen them with _ARM_ somewhere (maybe in binutils) but now I can't find them. I'm happy to drop the _ARM_ bit from the name.

jhb updated this revision to Diff 32984.Sep 12 2017, 6:58 PM
  • Trim _ARM from HWCAP names.
jhb marked an inline comment as done.Sep 12 2017, 7:43 PM
jhb added inline comments.
sys/arm/include/elf.h
122 ↗(On Diff #32847)

I had also thought about possibly defining these in elf_common.h instead, but it's probably fine to just leave them here.

This revision was automatically updated to reflect the committed changes.