ish/kernel/mm.h
2019-01-10 19:12:12 -05:00

34 lines
701 B
C

#ifndef KERNEL_MM_H
#define KERNEL_MM_H
#include "emu/memory.h"
#include "misc.h"
// uses mem.lock instead of having a lock of its own
struct mm {
atomic_uint refcount;
struct mem mem;
addr_t vdso; // immutable
addr_t start_brk; // immutable
addr_t brk;
// crap for procfs
addr_t argv_start;
addr_t argv_end;
addr_t env_start;
addr_t env_end;
struct fd *exefile;
};
// Create a new address space
struct mm *mm_new(void);
// Clone (COW) the address space
struct mm *mm_copy(struct mm *mm);
// Increment the refcount
void mm_retain(struct mm *mem);
// Decrement the refcount, destroy everything in the space if 0
void mm_release(struct mm *mem);
#endif