git: 96e05e2d1dfc - main - sys/_types.h: define __(u)int(f)ptr_t for CHERI

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 27 Nov 2025 14:56:07 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=96e05e2d1dfc69f67d3099440561530501cc09b5

commit 96e05e2d1dfc69f67d3099440561530501cc09b5
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2025-11-27 14:54:56 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2025-11-27 14:54:56 +0000

    sys/_types.h: define __(u)int(f)ptr_t for CHERI
    
    On pure-capability ABIs, uintptr_t and variants are capabilities and
    defined to the new primative type __uintcap_t and variants.  This is
    required to allow pointers (capabilities) to round trip through
    uintptr_t as required by the C standard.
    
    Reviewed by:    kib, markj
    Effort:         CHERI upstreaming
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D53819
---
 sys/sys/_types.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sys/sys/_types.h b/sys/sys/_types.h
index 3589fcb87a9e..4f5b8e5db273 100644
--- a/sys/sys/_types.h
+++ b/sys/sys/_types.h
@@ -67,7 +67,12 @@ typedef	__uint32_t	__uint_least32_t;
 typedef	__uint64_t	__uint_least64_t;
 typedef	__uint64_t	__uintmax_t;
 
-#if __SIZEOF_POINTER__ == 8
+#ifdef __CHERI__
+typedef	__intcap_t	__intptr_t;
+typedef	__intcap_t	__intfptr_t;
+typedef	__uintcap_t	__uintptr_t;
+typedef	__uintcap_t	__uintfptr_t;
+#elif __SIZEOF_POINTER__ == 8
 typedef	__int64_t	__intptr_t;
 typedef	__int64_t	__intfptr_t;
 typedef	__uint64_t	__uintptr_t;