| wiki1321: Vmm_data_structures (Version 3) | ||
|
base memory object#The object structure is shared between both the pathmgr and memmgr components of procnto. They mostly keep to themselves, but there were a couple of places where interface breaking goes on - these are marked with comments in the source.
struct mm_object {
struct object_header hdr;
struct pathmgr_stuff {
time_t mtime;
mode_t mode;
uid_t uid;
gid_t gid;
} pm;
struct memmgr_stuff {
struct proc_mux_lock *mux;
struct pa_quantum *pmem;
struct pa_quantum **pmem_cache;
struct mm_object_ref *refs;
struct pa_restrict *restrict;
off64_t size;
unsigned flags;
} mm;
};
The pm fields are for use by path manager.
OBJECT_MEM_ANON#
struct mm_object_anon {
struct mm_object mem;
};
OBJECT_MEM_SHARED#
struct mm_object_shared {
struct mm_object mem;
volatile unsigned name_refs;
unsigned special;
intptr_t vaddr;
};
OBJECT_MEM_FD#
struct mm_object_fd {
struct mm_object mem;
int fd;
time_t ftime;
ino_t ino;
dev_t dev;
char *name;
unsigned pending_dones;
};
OBJECT_MEM_TYPED#
struct mm_object_typed {
struct mm_object_shared shmem;
char *name;
};
mm_aspace (ADDRESS)#
struct mm_aspace {
struct mm_map_head map;
struct {
uintptr_t vmem;
uintptr_t data;
uintptr_t stack;
uintptr_t memlock;
uintptr_t rss;
} rlimit;
OBJECT *anon;
struct _memmgr_rwlock rwlock;
unsigned fault_owner;
unsigned flags;
uintptr_t tmap_base;
size_t tmap_size;
struct cpu_mm_aspace cpu;
};
mm_map#
struct mm_map {
struct mm_map *next;
struct mm_object_ref *obj_ref;
off64_t offset;
struct {
struct mm_map *next;
struct mm_map **owner;
} ref;
uintptr_t start;
uintptr_t end;
int reloc;
unsigned mmap_flags;
unsigned extra_flags;
unsigned short last_page_bss;
uint8_t spare;
volatile uint8_t inuse;
};
mm_object_ref#
struct mm_object_ref {
struct mm_object_ref *next;
struct mm_aspace *adp;
OBJECT *obp;
struct mm_map *first_ref;
int fd;
};
pa_quantum#
struct pa_free_link {
struct pa_quantum *next; // must be first entry
struct pa_quantum **owner;
};
struct pa_inuse_link {
struct pa_quantum *next; // must be first entry
_Uint32t qpos;
};
struct pa_quantum {
union {
struct pa_inuse_link inuse;
struct pa_free_link flink;
} u;
_Int32t run;
_Uint16t blk;
_Uint16t flags;
};
pa_quantum_fake#
struct pa_quantum_fake {
struct pa_quantum q;
paddr_t paddr;
};
Since the physical memory list of an object must be made up of quantums, and we only allocate enough pa_quantum's to cover the system ram for a box, something special has to be done when the user requests a direct physical mapping. In those cases, we create a pa_quantum_fake. These differ from a normal pa_quantum in that they have a paddr field attached to them to give the physical address (normal pa_quantum's obtain the physical address from information in the block head structure) and the fact that
no matter how many pages the mapping is for, only one pa_quantum_fake structure is allocated, as opposed to the array of pa_quantum's that would be used to cover the same amount of physical memory. Code can tell the difference between the two by the fact that pa_quantum_fake's blk field is set to PAQ_BLK_FAKE.
|
||