51 prev_end = cur_vm_entry->
base + cur_vm_entry->
size;
65 prev_end = cur_vm_entry->
base + cur_vm_entry->
size;
158 struct vm_entry *s_entry = node->value;
void * kmalloc(size_t size, struct malloc_type *type, int flags)
Allocates memory for one of the kernel's structures.
void kfree(void *)
Frees an object that kmalloc() gave.
void * memcpy(void *dst, const void *src, size_t n)
Copies n bytes; dst and src must not overlap.
void pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, uint32_t prot)
Changes the permissions of the mapped pages of a range of an address space.
void pmap_remove_all(struct pmap *pmap)
Unmaps the whole user half of an address space, and frees its page tables.
A queue's node, holding one entry.
int flags
its flags (VM_COPY: to be copied before it's written to)
A mapping (map entry): a range of an address space, its permissions, and where its pages come from.
struct vm_anon * vm_anon
its anon: the pages the process wrote to
uint32_t flags
its permissions and flags (VM_*)
vaddr_t base
where the mapping starts in its address space
struct vm_object * vm_object
its object: what its other pages come from (a file)
struct qnode * qnode
its node in its address space's list of mappings
An address space: its mappings, and its page tables.
struct pmap * pmap
its page tables (the architecture's)
struct queue vm_entries
its mappings (map entries), in address order
#define VM_KW
kernel write
#define VM_COPY
to be copied before it's written to
int vm_space_insert(struct vm_space *vm_space, struct vm_entry *vm_entry)
Adds a map entry to an address space, in address order.
#define VM_SHARED
shared: a fork doesn't copy it
void vm_entry_destroy(struct vm_entry *vm_entry)
Releases what a map entry holds: its references to its anon and its object.
void vm_anon_incref(struct vm_anon *vm_anon)
Adds a reference to an anon: another mapping shares it (a fork).
int vm_space_fork(struct vm_space *parent, struct vm_space *child)
Copies an address space's mappings into another, for fork().
void vm_object_incref(struct vm_object *vm_object)
Adds a reference to a vm object: one more mapping of it.
void vm_space_destroy(struct vm_space *vm_space)
Removes all the mappings of an address space: its entries are released and freed, and its page tables...
struct vm_entry * vm_space_find(struct vm_space *vm_space, vaddr_t vaddr)
Finds the map entry that an address is in.