Page MenuHomeFreeBSD

Move prstatus32 and friends to <sys/procfs.h>.
ClosedPublic

Authored by jhb on Mar 25 2015, 6:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 18, 12:39 AM
Unknown Object (File)
Wed, Jan 8, 6:28 AM
Unknown Object (File)
Oct 27 2024, 6:44 PM
Unknown Object (File)
Oct 26 2024, 1:53 AM
Unknown Object (File)
Oct 26 2024, 1:53 AM
Unknown Object (File)
Oct 26 2024, 1:53 AM
Unknown Object (File)
Oct 26 2024, 1:52 AM
Unknown Object (File)
Oct 26 2024, 1:52 AM
Subscribers

Details

Summary

Move the 32-bit compatible procfs types from freebsd32.h to
<sys/procfs.h> and export them to userland.

  • Define __HAVE_REG32 on platforms that define a reg32 structure and check for this in <sys/procfs.h> to control when to export prstatus32, etc.
  • Add prstatus32_t and prpsinfo32_t typedefs for the 32-bit structures. libbfd looks for these types, and having them fixes 'gcore' in gdb of a 32-bit process on a 64-bit platform.
  • Use the structure definitions from <sys/procfs.h> in gcore's elf32 core dump code instead of duplicating the definitions.

Note that this requires exporting reg32 from <machine/reg.h> to
userland, not just in kernel builds when COMPAT_FREEBSD32 is enabled.
Not sure what the best #ifdef checks are for this, or if LP64 is
fine.

Also, it seems that we don't really need prpsinfo32 or thrmisc32.
The gcore bits in userland don't bother using thrmisc32 at all,
and do no conversion for prpsinfo32.

Also, the thrmisc structure doesn't include a version member, so
THRMISC_VERSION is unused and should perhaps be removed?

Test Plan
  • gcore in gdb's master branch currently generates an over-sized ".reg" section that triggers a warning when gdb reads in the core.
  • Verified that gcore of an i386 process under amd64 still works.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

jhb retitled this revision from to Move prstatus32 and friends to <sys/procfs.h>..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added reviewers: nwhitehorn, kib, peter.
kib edited edge metadata.
kib added inline comments.
sys/mips/include/reg.h
74 ↗(On Diff #4412)

__LP64 is the right test, IMO.

sys/sparc64/include/reg.h
101 ↗(On Diff #4412)

Do we support a userland 32bit ABI on sparc ? I thought that we don't.

sys/sys/procfs.h
102 ↗(On Diff #4412)

May be, use the chance to convert ints to explicitely sized types, like int32_t etc ?
I think bde has such preference, and I agree that it is reasonable for ABI things.

This revision is now accepted and ready to land.Mar 26 2015, 11:30 AM
sys/sparc64/include/reg.h
101 ↗(On Diff #4412)

We don't. It probably doesn't hurt to leave this here though?

sys/sys/procfs.h
102 ↗(On Diff #4412)

Ok. What do you think about my questions of whether or not we even need a prpsinfo32 or thrmisc32? (Or the unused version number for thrmisc?)

jhb edited edge metadata.
  • Stick with LP64.
  • Use fixed-width types and tabify.
This revision now requires review to proceed.Mar 27 2015, 12:47 AM
In D2142#7, @jhb wrote:

Ok. What do you think about my questions of whether or not we even need a prpsinfo32 or thrmisc32? (Or the unused version number for thrmisc?)

I thnk it is _potentially_ useful, so it is prudent to keep them around. THRMISC_VERSION indeed should go away.

WRT sparc64 __HAVE_REG32, I have no objections against it staying there, but please add one sentence about us not supporting sparcv8 binaries.

PowerPC bits look good to me.

jhb edited edge metadata.
  • Note that the sparc64 reg32 is only defined, but not implemented.

I will remove THRMISC_VERSION in a separate commit.

jhb added a reviewer: jhb.
This revision is now accepted and ready to land.Apr 8 2015, 4:16 PM
jhb updated this revision to Diff 4743.

Closed by commit rS281266 (authored by @jhb).