47 if (stopIndex <= startIndex)
50 while (&it->
entry != pages)
52 if (stopIndex < it->startIndex)
61 if (startIndex >= it->
startIndex && stopIndex <= it->stopIndex)
72 ll_remove(&it->
entry);
110 if (length <
sizeof(*header))
122 if (length < header->shoff)
126 for (uint32_t index = 0; index < header->
shnum; index++)
130 if ((uint32_t)section +
sizeof(*section) - (uint32_t)addr > length)
145 assert(startIndex <= stopIndex);
153 ll_remove(&it->
entry);
158 for (uint32_t index = 0; index < header->
shnum; index++)
162 if ((uint32_t)section +
sizeof(*section) - (uint32_t)addr > length)
168 if (!ACCESS_USER_MEMORY(&k, p, (
void *)section->
addr, section->
size,
true))
176 RELEASE_USER_MEMORY(&k);
void * heapAlloc(uint32_t length)
Allocates a block of kernel memory.
void * memset(void *ptr, int value, size_t num)
Fills a memory region with some specific byte value.
void * pagingAllocatePhysMemFixed(struct process *p, void *addr, uint32_t length, bool rw, bool user)
Allocates several pages of physical memory at a fixed virtual address in a process.
void heapFree(void *addr)
Deallocates a block of kernel memory.
#define LL_INIT(list)
Initializes a linkedList.
#define LL_ENTRY(element, type, field)
void __insertRequiredPage(struct linkedList *pages, uint32_t startIndex, uint32_t stopIndex)
bool elfLoadBinary(struct process *p, void *addr, uint32_t length)
Loads an ELF executable stored in the memory into a process.
void * memcpy(void *destination, const void *source, size_t num)
Copies a block of memory from source to destination.
#define LL_FOR_EACH_SAFE(element, next_element, list, type, field)
Allows to iterate a linkedList similar to a for-loop (safe when deleting elements).