#include <sys/cdefs.h>
#include <sys/types.h>
#include <mach/vm_param.h>
+#include <libkern/crc.h>
+#include <libkern/copyio.h>
#if defined(__arm__) || defined(__arm64__)
#include <arm/arch.h> /* for _ARM_ARCH_* */
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
#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_ */