HomeFreeBSD

Reduce code duplication in machine/_types.h

Description

Reduce code duplication in machine/_types.h

Many of these typedefs are the same across all architectures or can
be set based on an architecture-independent compiler-provided macro
(e.g. SIZEOF_SIZE_T). These macros have been available since GCC 4.6
and Clang sometime before 3.0 (godbolt.org does not have any older clang
versions installed).

I originally considered using the compiler-provided __FOO_TYPE__ directly.
However, in order to do so we have to check that those match the previous
typedef exactly (not just that they have the same size) since any change
would be an ABI break. For example, changing long to long long results
in different C++ name mangling. Additionally, Clang and GCC disagree on
the underlying type for some of (u)int*_fast_t types, so this change
only moves the definitions that are identical across all architectures
and does not touch those types.

This de-deduplication will allow us to have a smaller diff downstream in
CheriBSD: we only have to only change the (u)intptr_t definition in
sys/_types.h in CheriBSD instead of having to change machine/_types.h for
all CHERI-enabled architectures (currently RISC-V, AArch64 and MIPS).

Reviewed By: imp, kib
Differential Revision: https://reviews.freebsd.org/D29895

Details

Provenance
arichardsonAuthored on Jun 14 2021, 10:18 AM
Reviewer
imp
Differential Revision
D29895: Reduce code duplication in machine/_types.h
Parents
rG15fa52a56494: Add more GIC and GICv3 registers
Branches
Unknown
Tags
Unknown