1 #include <stddef.h> 2 #include <stdint.h> 3 #include <trusty_err.h> 4 #include <trusty_syscalls.h> 5 #ifdef HWASAN_ENABLED 6 #include <lib/hwasan/hwasan_shadow.h> 7 #endif /* HWASAN_ENABLED */ 8 memref_create(void * addr,size_t size,uint32_t mmap_prot)9int memref_create(void* addr, size_t size, uint32_t mmap_prot) { 10 #ifdef HWASAN_ENABLED 11 /* Remove tag because kernel treats this address as a value. */ 12 addr = hwasan_remove_ptr_tag(addr); 13 #endif 14 /* Check size fits in a uint32_t until size_t in syscalls is supported */ 15 if (size > UINT32_MAX) { 16 return ERR_INVALID_ARGS; 17 } 18 return _trusty_memref_create(addr, size, mmap_prot); 19 } 20