new type: ptraddr_t

ptraddr_t is an unsigned integer type that can hold the address of any
pointer.  It differes from uintptr_t in that it does not carry
provenance which is useful for CHERI in that it can disambigurate the
provenance of uintptr_t expressions.  It differes from size_t in that
some segmented architecture (not supported by FreeBSD) may have a size_t
that does not hold an address.

ptraddr_t is not yet standardized, but is currently proposed for
inclusion in C++2Y.

Prefer the compiler defined __PTRADDR_TYPE__ defintion where available
as this a new type and we don't need to worry about historical values.
Fall back to __size_t where unavailable.

Reviewed by:	kib, markj
Effort:		CHERI upstreaming
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D53817
This commit is contained in:
Brooks Davis
2025-11-27 14:54:55 +00:00
parent 39cbfc78b5
commit dca634d154
3 changed files with 17 additions and 2 deletions
+3 -2
View File
@@ -24,7 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd October 1, 2025
.Dd November 27, 2025
.Dt ARCH 7
.Os
.Sh NAME
@@ -48,7 +48,8 @@ and later, unless otherwise noted.
.Fx
uses a flat address space.
Variables of types
.Vt unsigned long
.Vt unsigned long ,
.Vt ptraddr_t ,
and
.Vt size_t
have the same representation.