Page MenuHomeFreeBSD

Centralize compatability translation macros.
ClosedPublic

Authored by brooks on Apr 3 2020, 9:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 21 2024, 12:02 AM
Unknown Object (File)
Feb 21 2024, 12:02 AM
Unknown Object (File)
Feb 21 2024, 12:02 AM
Unknown Object (File)
Feb 21 2024, 12:02 AM
Unknown Object (File)
Jan 13 2024, 7:30 AM
Unknown Object (File)
Dec 20 2023, 7:19 AM
Unknown Object (File)
Dec 12 2023, 5:45 AM
Unknown Object (File)
Nov 13 2023, 5:56 AM
Subscribers

Details

Summary

Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/compat.h
and replace existing definitation with includes where required. This
eliminates duplicate code and allows Linux and FreeBSD compatability
headers to be included in the same files (mostly storage drivers).

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

  • mpr: we need PTRIN unconditionally

unfoobar diff after arc malfunction.

CI run without the last mps fix: https://cirrus-ci.com/task/5297194320265216

Universe kernel build in progress (source of the mpr and mps fixes)

sys/dev/mpt/mpt_user.c
39 ↗(On Diff #70177)

This seems wrong, but it's the condition below...

Current version passes universe (except for an unrelated config error on riscv).

For the generic CP() type copy operations, I'd suggest _Static_assert size checks. Exceptions can have an exceptional copy mechanism (maybe provided here).

style(9): Lots of missing spaces in TS/TV CP.

Seems like PTROUT_CP() is going to truncate and generally be useless if used in compat32 ABIs. I guess a CP() size check would prevent that kind of misuse.

I feel like compat.h might be a bit too generic of a name? Maybe 'abi_compat.h' instead?

sys/dev/mpt/mpt_user.c
602 ↗(On Diff #70177)

It's matching these. These should probably all be COMPAT_FREEBSD32 instead, but what you have now is fine.

  • Improve whitespace and use a consistant style.
In D24275#535453, @cem wrote:

For the generic CP() type copy operations, I'd suggest _Static_assert size checks. Exceptions can have an exceptional copy mechanism (maybe provided here).

While this seems like a good idea, I think it's out of scope for this reorganization and exceptions are quite common (see TV_CP for example...) so would be a bunch of work to fix.

style(9): Lots of missing spaces in TS/TV CP.

Fixed.

Seems like PTROUT_CP() is going to truncate and generally be useless if used in compat32 ABIs. I guess a CP() size check would prevent that kind of misuse.

PTROUT* should be eliminated, but that's also beyond the current scope. IIRC there's a mix of exporting kernel VAs which we shouldn't do at all and mindlessly sloshing user pointers back and forth between the 32-bit structs and the native versions.

  • Use a less generic name for the header (abi_compat.h).
This revision was not accepted when it landed; it landed in state Needs Review.Apr 14 2020, 8:31 PM
This revision was automatically updated to reflect the committed changes.