mirror of
https://github.com/ish-app/ish.git
synced 2026-01-25 14:06:40 +00:00
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.
37 lines
772 B
C
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
|