33 const uint32_t length) {
35 fprintf(stderr,
"You need to pass a valid handle to %s\n", __FUNCTION__);
44 "FAILED open memory: %s, please run with sufficient permissions "
50 long page_size = sysconf(_SC_PAGE_SIZE);
52 uint32_t start_address = handle->
address;
53 uint32_t page_offset = start_address % page_size;
54 start_address -= page_offset;
55 handle->
length += page_offset;
58 mmap(NULL, handle->
length, PROT_READ | PROT_WRITE, MAP_SHARED,
62 fprintf(stderr,
"FAILED to memory map requested region: %s\n",
67 return (
void *)(((uint32_t)(handle->
mmaped_region)) + page_offset);
72 fprintf(stderr,
"You need to pass a valid handle to %s\n", __FUNCTION__);
void arm_shared_close(arm_shared *handle)
void * arm_shared_init(arm_shared *handle, const uint32_t address, const uint32_t length)