MentOS  0.8.0
The Mentoring Operating System
vmem_map.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "mem/buddysystem.h"
9 #include "mem/zone_allocator.h"
10 #include "mem/paging.h"
11 
13 #define VIRTUAL_MEMORY_SIZE_MB 128
14 
16 typedef struct virt_map_page_manager_t {
20 
22 typedef struct virt_map_page_t {
26 
29 int virt_init(void);
30 
35 uint32_t virt_map_physical_pages(page_t *page, int pfn_count);
36 
41 
49 
54 
58 int virt_unmap(uint32_t addr);
59 
64 
71 void virt_memcpy(
72  mm_struct_t *dst_mm,
73  uint32_t dst_vaddr,
74  mm_struct_t *src_mm,
75  uint32_t src_vaddr,
76  uint32_t size);
Buddy System.
Implementation of a memory paging management.
unsigned int uint32_t
Define the unsigned 32-bit integer.
Definition: stdint.h:18
Buddy system instance, that represents a memory area managed by the buddy system.
Definition: buddysystem.h:50
The base structure representing a bb page.
Definition: buddysystem.h:25
Memory Descriptor, used to store details about the memory of a user process.
Definition: paging.h:109
Page descriptor. Use as a bitmap to understand the order of the block and if it is free or allocated.
Definition: zone_allocator.h:25
Virtual mapping manager.
Definition: vmem_map.h:16
bb_instance_t bb_instance
The buddy system used to manage the pages.
Definition: vmem_map.h:18
Virtual mapping.
Definition: vmem_map.h:22
bb_page_t bbpage
A buddy system page.
Definition: vmem_map.h:24
int virtual_check_address(uint32_t addr)
Checks if an address belongs to the virtual memory mapping.
Definition: vmem_map.c:222
virt_map_page_t * virt_map_alloc(uint32_t size)
Allocates virtual pages for a given size.
Definition: vmem_map.c:175
void virt_memcpy(mm_struct_t *dst_mm, uint32_t dst_vaddr, mm_struct_t *src_mm, uint32_t src_vaddr, uint32_t size)
Memcpy from different processes virtual addresses.
Definition: vmem_map.c:272
int virt_init(void)
Initialize the virtual memory mapper.
Definition: vmem_map.c:34
struct virt_map_page_t virt_map_page_t
Virtual mapping.
int virt_unmap_pg(virt_map_page_t *page)
Unmap a page.
Definition: vmem_map.c:243
struct virt_map_page_manager_t virt_map_page_manager_t
Virtual mapping manager.
uint32_t virt_map_vaddress(mm_struct_t *mm, virt_map_page_t *vpage, uint32_t vaddr, uint32_t size)
Maps a virtual address to a virtual memory area.
Definition: vmem_map.c:191
int virt_unmap(uint32_t addr)
Unmaps a virtual address from the virtual memory.
Definition: vmem_map.c:227
uint32_t virt_map_physical_pages(page_t *page, int pfn_count)
Maps physical pages to virtual memory.
Definition: vmem_map.c:141
Implementation of the Zone Allocator.