AT_HWCAP is populated with the value of global elf32_hwcap and
elf64_hwcap values. Platform-specific code can adjust these
global variables to control the values passed in exec.
Details
- Reviewers
kib jhibbits - Commits
- rS323579: Add AT_HWCAP and AT_EHDRFLAGS on all platforms.
This is part of a series which I tested by using VFP registers with
gdb on armv7. powerpc could probably set elf*_hwcap easily as I think
we currently export sysctls with those values now.
I think moving AT_* to elf_common.h is still a useful followup.
Diff Detail
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 11523 Build 11877: arc lint + arc unit
Event Timeline
Looks good to me.
I think it's sensible to follow up with migration to a single elf.h, probably @jhibbits can first make powerpc's match the rest?
sys/kern/imgact_elf.c | ||
---|---|---|
140 | Shouldn't this be per elf brand or per sysvec, I am not sure which one is more useful, perhaps sysvec is enough. I believe that requiring that linux and native hwcap bits always match is not going to work, even ifit is now. |
sys/kern/imgact_elf.c | ||
---|---|---|
140 | The callback that uses it (elf32/64freebsd_fixup) is already per-sysvec. Non-FreeBSD ABIs have to use a separate sv_fixup callback to set their ABI-specific auxv values which won't use this variable (e.g. elf_linux_fixup in sys/amd64/linux32/linux32_sysvec.c) |
sys/kern/imgact_elf.c | ||
---|---|---|
140 | Yes, I do not like that the variable is global instead of living in sysvecent. |
sys/kern/imgact_elf.c | ||
---|---|---|
140 | Hmm, I could either store a pointer to a variable in sysvecent or the variable itself in the sysvecent. The latter would require exporting the entire sysvecent as an extern and probably makes it harder to share values across sysvecent if needed (e.g. I imagine on aarch64 the same hwcap might end up being shared for an eventual COMPAT_FREEBSD32), so perhaps the first is better? |
sys/kern/imgact_elf.c | ||
---|---|---|
140 | A pointer to a variable sounds fine. |
On ARM platforms I expect we'll need more bits. Linux already has AT_HWCAP2, it might pay to include it from the start.
- Replace elf32/64_hwcap with a sv_hwcap pointer in sysentvec.
- Only provide AT_HWCAP if the pointer exists.
Re: AT_HWCAP2, once elf.h is unified (which I will probably work on soon) it will be fairly easy to add.
One question is if 'u_long' is the right type for 'sv_hwcap'.
De-facto long becomes the way to express the 'native word size' of a machine. It is used more often than register_t, and I think that register_t is actually wrong e.g. on mips n32 for this purpose.
So the actual initialization of *sv_hwcap for native sysents will follow in a separate patch, I suppose ?
You can see the other patches for arm in this series if you click on 'Stack' in the revision contents box (and I'd appreciate your review on any of the others if you wish). So far I've only implemented this for arm. ppc is probably trivial to add, and arm64 may very well use the same values as 32-bit arm, but I'll defer to Andrew on that. Also, the values I have supported for arm so far are fairly limited, but more can be added by others easily enough.