minix/servers/vm/memtype.h
Ben Gras d343041caa VM: make mapping types explicit
Introduce explicit abstractions for different mapping types,
handling the instantiation, forking, pagefaults and freeing of
anonymous memory, direct physical mappings, shared memory and
physically contiguous anonymous memory as separate types, making
region.c more generic.

Also some other genericification like merging the 3 munmap cases
into one.

COW and SMAP safemap code is still implicit in region.c.
2012-10-12 14:52:01 +02:00

27 lines
835 B
C

#ifndef _MEMTYPE_H
#define _MEMTYPE_H 1
struct vmproc;
struct vir_region;
struct phys_region;
typedef struct mem_type {
char *name; /* human-readable name */
int (*ev_new)(struct vir_region *region);
void (*ev_delete)(struct vir_region *region);
int (*ev_reference)(struct phys_region *pr);
int (*ev_unreference)(struct phys_region *pr);
int (*ev_pagefault)(struct vmproc *vmp, struct vir_region *region,
struct phys_region *ph, int write);
int (*ev_resize)(struct vmproc *vmp, struct vir_region *vr, vir_bytes len);
int (*writable)(struct phys_region *pr);
int (*ev_sanitycheck)(struct phys_region *pr, char *file, int line);
int (*ev_copy)(struct vir_region *vr, struct vir_region *newvr);
u32_t (*regionid)(struct vir_region *vr);
int (*refcount)(struct vir_region *vr);
} mem_type_t;
#endif