Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1423 → Rev 1424

/kernel/trunk/generic/include/mm/as.h
30,11 → 30,10
#define __AS_H__
 
/** Address space area flags. */
#define AS_AREA_READ 1
#define AS_AREA_WRITE 2
#define AS_AREA_EXEC 4
#define AS_AREA_DEVICE 8
#define AS_AREA_ANON 16
#define AS_AREA_READ 1
#define AS_AREA_WRITE 2
#define AS_AREA_EXEC 4
#define AS_AREA_CACHEABLE 8
 
#ifdef KERNEL
 
104,9 → 103,26
#define AS_PF_DEFER 2 /**< The page fault was caused by memcpy_from_uspace()
or memcpy_to_uspace(). */
 
typedef struct share_info share_info_t;
typedef struct mem_backend mem_backend_t;
/** This structure contains information associated with the shared address space area. */
typedef struct {
mutex_t lock; /**< This lock must be acquired only when the as_area lock is held. */
count_t refcount; /**< This structure can be deallocated if refcount drops to 0. */
btree_t pagemap; /**< B+tree containing complete map of anonymous pages of the shared area. */
} share_info_t;
 
/** Address space area backend structure. */
typedef struct {
int (* page_fault)(as_area_t *area, __address addr, pf_access_t access);
void (* frame_free)(as_area_t *area, __address page, __address frame);
void (* share)(as_area_t *area);
} mem_backend_t;
 
/** Backend data stored in address space area. */
typedef struct backend_data {
__native d1;
__native d2;
} mem_backend_data_t;
 
/** Address space area structure.
*
* Each as_area_t structure describes one contiguous area of virtual memory.
114,6 → 130,7
*/
struct as_area {
mutex_t lock;
as_t *as; /**< Containing address space. */
int flags; /**< Flags related to the memory represented by the address space area. */
int attributes; /**< Attributes related to the address space area itself. */
count_t pages; /**< Size of this area in multiples of PAGE_SIZE. */
120,15 → 137,11
__address base; /**< Base address of this area. */
btree_t used_space; /**< Map of used space. */
share_info_t *sh_info; /**< If the address space area has been shared, this pointer will
reference the share info structure. */
reference the share info structure. */
mem_backend_t *backend; /**< Memory backend backing this address space area. */
void *backend_data[2]; /**< Data to be used by the backend. */
};
 
/** Address space area backend structure. */
struct mem_backend {
int (* backend_page_fault)(as_area_t *area, __address addr, pf_access_t access);
void (* backend_frame_free)(as_area_t *area, __address page, __address frame);
/** Data to be used by the backend. */
mem_backend_data_t backend_data;
};
 
extern as_t *AS_KERNEL;
140,11 → 153,10
extern void as_init(void);
extern as_t *as_create(int flags);
extern as_area_t *as_area_create(as_t *as, int flags, size_t size, __address base, int attrs,
mem_backend_t *backend, void **backend_data);
mem_backend_t *backend, mem_backend_data_t *backend_data);
extern int as_area_resize(as_t *as, __address address, size_t size, int flags);
extern int as_area_destroy(as_t *as, __address address);
extern int as_area_get_flags(as_area_t *area);
extern void as_set_mapping(as_t *as, __address page, __address frame);
extern bool as_area_check_access(as_area_t *area, pf_access_t access);
extern int as_page_fault(__address page, pf_access_t access, istate_t *istate);
extern void as_switch(as_t *old, as_t *new);
163,6 → 175,7
/* Backend declarations. */
extern mem_backend_t anon_backend;
extern mem_backend_t elf_backend;
extern mem_backend_t phys_backend;
 
/* Address space area related syscalls. */
extern __native sys_as_area_create(__address address, size_t size, int flags);