-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
Description
Potential API:
int mmu_map(uintptr_t virt, uintptr_t phys, size_t size, uint32_t flags);
int mmu_unmap(uintptr_t virt, size_t size);
virt
: Virtual address. Rounded down to nearest page boundry
phys
: Physical address. Rounded down to nearest page boundry
size
: How many bytes to map. Rounded up to the nearest multiple of page size
flags
: Flags affecting page mapping
Potential flags
values:
#define MMU_FLAG_READ (0x00000001) /** Mapped memory can be read from */
#define MMU_FLAG_WRITE (0x00000002) /** Mapped memory can be written to */
#define MMU_FLAG_EXEC (0x00000004) /** Mapped memory can be executed */
#define MMU_FLAG_KERNEL (0x00000010) /** Mapped memory belongs to the kernel, can cannot be accessed by user processes */
In addition, it may be useful to also create an API that populates (or uses) a handle that can be used to keep track of mapped memory, and unmap it in the future if desired.
typedef struct {
uintptr_t virt; /** Pointer to start of virtual mapped memory region */
uintptr_t phys; /** Pointer to start of physical mapped memory region */
size_t size; /** Size of mapped memory region */
uint32_t flags; /** Flags */
} mmu_map_entry_t;
/* (Name to be determined) */
int mmu_vmap(mmu_map_entry_t *entry);
int mmu_vunmap(mmu_map_entry_t *entry);
Metadata
Metadata
Assignees
Labels
Projects
Status
Done