35 #define PAGETABLE_SIZE 0x1000 36 #define PAGETABLE_MASK 0x3FF 37 #define PAGETABLE_BITS 10 38 #define PAGETABLE_COUNT 0x400 116 static inline bool ACCESS_USER_MEMORY(
struct userMemory *k,
struct process *p,
void *src_addr, uint32_t byte_length,
bool rw)
127 return (k->
addr != NULL);
130 static inline bool ACCESS_USER_MEMORY_STRUCT(
struct userMemory *k,
struct process *p,
void *src_addr, uint32_t count, uint32_t struct_length,
bool rw)
132 uint64_t byte_length = (uint64_t)count * struct_length;
133 if ((byte_length >> 32) != 0)
return false;
134 return ACCESS_USER_MEMORY(k, p, src_addr, byte_length, rw);
137 static inline void RELEASE_USER_MEMORY(
struct userMemory *k)
void pagingDumpPageTable(struct process *p)
Dumps information about the page table of a specific process.
void * pagingReAllocatePhysMem(struct process *p, void *addr, uint32_t old_length, uint32_t new_length, bool rw, bool user)
Reallocates a specific range of virtual memory in a process.
void pagingReleaseProcessPageTable(struct process *p)
Releases the page directory and page table of a specific process.
uint32_t interrupt_0x0E(uint32_t interrupt, uint32_t error, struct thread *t)
void pagingAllocProcessPageTable(struct process *p)
Allocates the page directory and page table for a specific process.
void pagingInit()
Initializes paging.
void pagingReserveArea(struct process *p, void *addr, uint32_t length, bool user)
Marks the memory in a specific memory area as reserved.
void * pagingAllocatePhysMemFixedUnpageable(struct process *p, void *addr, uint32_t length, bool rw, bool user)
Allocates several pages of unpageable physical memory at a fixed virtual address in a process...
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 * pagingAllocatePhysMemUnpageable(struct process *p, uint32_t length, bool rw, bool user)
Allocates several pages of unpageable physical memory in a process.
struct userMemory __attribute__
void pagingDumpBootMap()
Dumps a list of all entries in the boot map.
void * pagingAllocatePhysMem(struct process *p, uint32_t length, bool rw, bool user)
Allocates several pages of physical memory in a process.
bool pagingTryReleaseUserMem(struct process *p, void *addr, uint32_t length)
Releases several pages of physical memory of a process.
void * pagingSearchArea(struct process *p, uint32_t length)
Searches for a consecutive area of length free pages in a process.
bool pagingTryReleasePhysMem(struct process *p, void *addr, uint32_t length)
Releases several pages of physical memory of a process.
void * pagingTryAllocatePhysMem(struct process *p, uint32_t length, bool rw, bool user)
Tries to allocates several pages of physical memory in a process.
void * pagingTryAllocatePhysMemFixed(struct process *p, void *addr, uint32_t length, bool rw, bool user)
Allocates several pages of unpageable physical memory at a fixed virtual address in a process...
void * pagingTrySearchArea(struct process *p, uint32_t length)
Searches for a consecutive area of length free pages in a process.
void pagingReleasePhysMem(struct process *p, void *addr, uint32_t length)
Releases several pages of physical memory in a process.
uint32_t pagingGetPhysMem(struct process *p, void *addr)
Returns the physical page index for a virtual address.
void * pagingTryMapUserMem(struct process *src_p, void *src_addr, uint32_t length, bool rw)
Maps some virtual memory of a usermode process into the kernel.
void pagingForkProcessPageTable(struct process *destination, struct process *source)
Duplicate a page table and assigns it to a destination process.
void pagingInsertBootMap(uint32_t startIndex, uint32_t stopIndex)
Appends a specific range of physical pages to the bootmap.
void pagingFillProcessInfo(struct process *p, struct processInfo *info)
Fills out all memory related fields in the processInfo structure.
void * pagingMapRemoteMemory(struct process *dst_p, struct process *src_p, void *dst_addr, void *src_addr, uint32_t length, bool rw, bool user)
Maps some virtual memory from one process to another one.