X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/5ba3f43ea354af8ad55bea84372a2bc834d8757c..e8c3f78193f1895ea514044358b93b1add9322f3:/bsd/libkern/libkern.h diff --git a/bsd/libkern/libkern.h b/bsd/libkern/libkern.h index e2a47fdef..73545298d 100644 --- a/bsd/libkern/libkern.h +++ b/bsd/libkern/libkern.h @@ -77,6 +77,8 @@ #include #include #include +#include +#include #if defined(__arm__) || defined(__arm64__) #include /* for _ARM_ARCH_* */ @@ -179,11 +181,18 @@ int _consume_printf_args(int, ...); uint16_t crc16(uint16_t crc, const void *bufp, size_t len); uint32_t crc32(uint32_t crc, const void *bufp, size_t len); +#if XNU_KERNEL_PRIVATE +#if KASAN +uint16_t __nosan_crc16(uint16_t crc, const void *bufp, size_t len); +#else +static inline uint16_t +__nosan_crc16(uint16_t crc, const void *bufp, size_t len) { return crc16(crc, bufp, len); } +#endif +#endif + int copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done); int copyinstr(const user_addr_t uaddr, void *kaddr, size_t len, size_t *done); int copyoutstr(const void *kaddr, user_addr_t udaddr, size_t len, size_t *done); -int copyin(const user_addr_t uaddr, void *kaddr, size_t len); -int copyout(const void *kaddr, user_addr_t udaddr, size_t len); #if XNU_KERNEL_PRIVATE extern int copyin_word(const user_addr_t user_addr, uint64_t *kernel_addr, vm_size_t nbytes); #endif @@ -229,6 +238,20 @@ clz(unsigned int num) #endif } +#if XNU_KERNEL_PRIVATE + +/* + * Define a function that for whatever reason needs to exist, but must never be + * called. + */ +#define UNSUPPORTED_API(funcname, ...) \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wunused-parameter\"") \ + funcname(__VA_ARGS__) { panic(__func__ ": unsupported API\n"); } \ + _Pragma("clang diagnostic pop") + +#endif + __END_DECLS #endif /* _LIBKERN_LIBKERN_H_ */