|
My Kernel v0.1.0
|
Segment driver. More...
#include <vm.h>
Data Fields | |
| struct vm_segment *(* | vm_alloc )(struct address_space *, vaddr_t, size_t, vm_flags_t) |
| Allocate a segment of virtual memory. More... | |
| struct vm_segment *(* | vm_alloc_at )(struct address_space *, paddr_t, size_t, vm_flags_t) |
| Allocate a segment of virtual memory mapped to a physical address. More... | |
| void(* | vm_free )(struct address_space *, struct vm_segment *) |
| Free a contiguous virtual memory segment. More... | |
| error_t(* | vm_resize )(struct address_space *, struct vm_segment *, size_t) |
| Resize a virtual memory segment. More... | |
| error_t(* | vm_fault )(struct address_space *, struct vm_segment *) |
| Handle a page fault exception on a known segment. More... | |
There exists different types of memory segments. A segment driver defines the operations that can be performed on a segment (allocating, freeing).
| struct vm_segment *(* vm_segment_driver::vm_alloc) (struct address_space *, vaddr_t, size_t, vm_flags_t) |
| as | The address space this segment belongs to |
| start | If specified, the segment should start at this address |
| size | The size of the segment |
| struct vm_segment *(* vm_segment_driver::vm_alloc_at) (struct address_space *, paddr_t, size_t, vm_flags_t) |
| as | The address space this segment belongs to |
| start | Start of the physical address range |
| size | The size of the segment |
size bytes.| error_t(* vm_segment_driver::vm_fault) (struct address_space *, struct vm_segment *) |
| as | The address space the segment belongs to |
| segment | The memory segment inside which the faulty address is located. |
| void(* vm_segment_driver::vm_free) (struct address_space *, struct vm_segment *) |
This function is also responsible for freeing the physical backing storage (pmm_free), and removing any eventual MMU entries.
| error_t(* vm_segment_driver::vm_resize) (struct address_space *, struct vm_segment *, size_t) |
When expanding, if the required virtual memory range has already been allocated, this function returns E_NOMEM.
Calling this function with a size of 0 is equivalent to vm_free().
| size | The new size of the segment |