Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/systm.h
| Show First 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | |||||
| #define ovbcopy(f, t, l) bcopy((f), (t), (l)) | #define ovbcopy(f, t, l) bcopy((f), (t), (l)) | ||||
| void explicit_bzero(void * _Nonnull, size_t); | void explicit_bzero(void * _Nonnull, size_t); | ||||
| void *memset(void * _Nonnull buf, int c, size_t len); | void *memset(void * _Nonnull buf, int c, size_t len); | ||||
| void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); | void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); | ||||
| void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); | void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); | ||||
| int memcmp(const void *b1, const void *b2, size_t len); | int memcmp(const void *b1, const void *b2, size_t len); | ||||
| #ifdef __CHERI__ | |||||
| void *memcpy_data(void * _Nonnull to, const void * _Nonnull from, | |||||
| size_t len); | |||||
| void *memmove_data(void * _Nonnull dest, const void * _Nonnull src, | |||||
| size_t n); | |||||
| #else | |||||
| #define memcpy_data memcpy | |||||
| #define memmove_data memmove | |||||
| #endif | |||||
| #ifdef SAN_NEEDS_INTERCEPTORS | #ifdef SAN_NEEDS_INTERCEPTORS | ||||
| #define SAN_INTERCEPTOR(func) \ | #define SAN_INTERCEPTOR(func) \ | ||||
| __CONCAT(SAN_INTERCEPTOR_PREFIX, __CONCAT(_, func)) | __CONCAT(SAN_INTERCEPTOR_PREFIX, __CONCAT(_, func)) | ||||
| void *SAN_INTERCEPTOR(memset)(void *, int, size_t); | void *SAN_INTERCEPTOR(memset)(void *, int, size_t); | ||||
| void *SAN_INTERCEPTOR(memcpy)(void *, const void *, size_t); | void *SAN_INTERCEPTOR(memcpy)(void *, const void *, size_t); | ||||
| void *SAN_INTERCEPTOR(memmove)(void *, const void *, size_t); | void *SAN_INTERCEPTOR(memmove)(void *, const void *, size_t); | ||||
| int SAN_INTERCEPTOR(memcmp)(const void *, const void *, size_t); | int SAN_INTERCEPTOR(memcmp)(const void *, const void *, size_t); | ||||
| Show All 11 Lines | |||||
| #define bzero(buf, len) __builtin_memset((buf), 0, (len)) | #define bzero(buf, len) __builtin_memset((buf), 0, (len)) | ||||
| #define bcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) | #define bcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) | ||||
| #define memset(buf, c, len) __builtin_memset((buf), (c), (len)) | #define memset(buf, c, len) __builtin_memset((buf), (c), (len)) | ||||
| #define memcpy(to, from, len) __builtin_memcpy((to), (from), (len)) | #define memcpy(to, from, len) __builtin_memcpy((to), (from), (len)) | ||||
| #define memmove(dest, src, n) __builtin_memmove((dest), (src), (n)) | #define memmove(dest, src, n) __builtin_memmove((dest), (src), (n)) | ||||
| #define memcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) | #define memcmp(b1, b2, len) __builtin_memcmp((b1), (b2), (len)) | ||||
| #endif /* SAN_NEEDS_INTERCEPTORS */ | #endif /* SAN_NEEDS_INTERCEPTORS */ | ||||
| void *memset_early(void * _Nonnull buf, int c, size_t len); | void *memset_early(void * _Nonnull buf, int c, size_t len); | ||||
emaste: How widely used is bcopy_data in CHERI? Is it reasonable to move those to memmove_data… | |||||
Done Inline ActionsNone of these are widely used. memmove_data is currently completely unused except to implement bcopy_data. I actually think most (or even all) could be memcpy_data (I don't think any of these overlap). The one slightly perverse argument for bcopy_data is that it's safely outside the reserved mem* namespace. brooks: None of these are widely used. memmove_data is currently completely unused except to implement… | |||||
Done Inline ActionsI'll make the s/bcopy/memcpy changes and do some consolidation along the way. brooks: I'll make the s/bcopy/memcpy changes and do some consolidation along the way. | |||||
| #define bzero_early(buf, len) memset_early((buf), 0, (len)) | #define bzero_early(buf, len) memset_early((buf), 0, (len)) | ||||
| void *memcpy_early(void * _Nonnull to, const void * _Nonnull from, size_t len); | void *memcpy_early(void * _Nonnull to, const void * _Nonnull from, size_t len); | ||||
| void *memmove_early(void * _Nonnull dest, const void * _Nonnull src, size_t n); | void *memmove_early(void * _Nonnull dest, const void * _Nonnull src, size_t n); | ||||
| #define bcopy_early(from, to, len) memmove_early((to), (from), (len)) | #define bcopy_early(from, to, len) memmove_early((to), (from), (len)) | ||||
| #define copystr(src, dst, len, outlen) ({ \ | #define copystr(src, dst, len, outlen) ({ \ | ||||
| size_t __r, __len, *__outlen; \ | size_t __r, __len, *__outlen; \ | ||||
| \ | \ | ||||
| ▲ Show 20 Lines • Show All 343 Lines • Show Last 20 Lines | |||||
How widely used is bcopy_data in CHERI? Is it reasonable to move those to memmove_data (possibly moving to memmove first in FreeBSD)? It seems slightly unfortunate to make a new version of a legacy/obsolete interface.