BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / blob / master / memory / namespace.h

// Related

Nucleus

Barry Kernel threads + threads share address space 6217f0d (3 years, 1 month ago)
#ifndef MEMORY_NAMESPACE_H
#define MEMORY_NAMESPACE_H

#include <nucleus/memory.h>
#include <nucleus/object.h>
#include <nucleus/types.h>
#include <nucleus/vfs.h>

/* Structure for a Page in a Cache */
struct Page {
	Object obj;
	off_t offset;
	page_t frame;
};

/* Virtual Memory namespace */
struct VirtualMemory {
	Object obj;
	ObjectList *regions;
	VMRegion *stack;
	page_dir_t pageDir;
};

/* Structure for a Virtual Memory Region object */
struct VMRegion {
	Object obj;
	uintptr_t start, end;
	int prot;
	int flags;
	off_t offset;
	File *front, *back;
};

void switch_dir(page_dir_t dir);
VMRegion *vm_create_region(void *addr, size_t len, int prot, int flags,
                           off_t offset, File *back);

#endif