ish/kernel/mm.h
Theodore Dubois a3f58a23ae Move emu/memory.[ch] to kernel/
A long time ago, for linux, emu and kernel were separated into separate
library targets, but for some reason memory.c was kept in emu/ despite
only being linked into kernel. Now's a good time to move it where it
belongs.
2024-11-07 21:38:17 -08:00

37 lines
772 B
C

#ifndef KERNEL_MM_H
#define KERNEL_MM_H
#include "kernel/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;
addr_t auxv_start;
addr_t auxv_end;
addr_t stack_start;
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