5 #ifndef OPENTITAN_SW_DEVICE_LIB_BASE_MEMORY_H_
6 #define OPENTITAN_SW_DEVICE_LIB_BASE_MEMORY_H_
20 #ifndef OT_PLATFORM_RV32
42 #ifdef OT_PLATFORM_RV32
43 #define OT_PREFIX_IF_NOT_RV32(name) name
45 #define OT_PREFIX_IF_NOT_RV32(name) ot_##name
58 return addr %
alignof(uint32_t);
80 inline uint32_t
read_32(
const void *ptr) {
88 ptr = __builtin_assume_aligned(ptr,
alignof(uint32_t));
90 __builtin_memcpy(&val, ptr,
sizeof(uint32_t));
121 ptr = __builtin_assume_aligned(ptr,
alignof(uint64_t));
123 __builtin_memcpy(&val, ptr,
sizeof(uint64_t));
148 ptr = __builtin_assume_aligned(ptr,
alignof(uint32_t));
149 __builtin_memcpy(ptr, &value,
sizeof(uint32_t));
174 ptr = __builtin_assume_aligned(ptr,
alignof(uint64_t));
175 __builtin_memcpy(ptr, &value,
sizeof(uint64_t));
207 void *OT_PREFIX_IF_NOT_RV32(
memset)(
void *dest,
int value,
size_t len);
225 int OT_PREFIX_IF_NOT_RV32(
memcmp)(
const void *lhs,
const void *rhs,
size_t len);
244 int memrcmp(
const void *lhs,
const void *rhs,
size_t len);
263 void *OT_PREFIX_IF_NOT_RV32(
memchr)(
const void *ptr,
int value,
size_t len);
276 void *OT_PREFIX_IF_NOT_RV32(
memrchr)(
const void *ptr,
int value,
size_t len);
282 #undef OT_PREFIX_IF_NOT_RV32