53,10 → 53,6 |
#include <adt/btree.h> |
#include <lib/elf.h> |
|
#ifdef __OBJC__ |
#include <lib/objc.h> |
#endif |
|
/** |
* Defined to be true if user address space and kernel address space shadow each |
* other. |
84,47 → 80,6 |
/** The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */ |
#define AS_PF_DEFER 2 |
|
#ifdef __OBJC__ |
@interface as_t : base_t { |
@public |
/** Protected by asidlock. */ |
link_t inactive_as_with_asid_link; |
/** |
* Number of processors on wich is this address space active. |
* Protected by asidlock. |
*/ |
count_t cpu_refcount; |
/** |
* Address space identifier. |
* Constant on architectures that do not support ASIDs. |
* Protected by asidlock. |
*/ |
asid_t asid; |
|
/** Number of references (i.e tasks that reference this as). */ |
atomic_t refcount; |
|
mutex_t lock; |
|
/** B+tree of address space areas. */ |
btree_t as_area_btree; |
|
/** Non-generic content. */ |
as_genarch_t genarch; |
|
/** Architecture specific content. */ |
as_arch_t arch; |
} |
|
+ (pte_t *) page_table_create: (int) flags; |
+ (void) page_table_destroy: (pte_t *) page_table; |
- (void) page_table_lock: (bool) _lock; |
- (void) page_table_unlock: (bool) unlock; |
|
@end |
|
#else |
|
/** Address space structure. |
* |
* as_t contains the list of as_areas of userspace accessible |
168,7 → 123,6 |
void (* page_table_lock)(as_t *as, bool lock); |
void (* page_table_unlock)(as_t *as, bool unlock); |
} as_operations_t; |
#endif |
|
/** |
* This structure contains information associated with the shared address space |
249,10 → 203,7 |
|
extern as_t *AS_KERNEL; |
|
#ifndef __OBJC__ |
extern as_operations_t *as_operations; |
#endif |
|
extern link_t inactive_as_with_asid_head; |
|
extern void as_init(void); |
269,6 → 220,7 |
extern int as_area_resize(as_t *as, uintptr_t address, size_t size, int flags); |
int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size, |
as_t *dst_as, uintptr_t dst_base, int dst_flags_mask); |
extern int as_area_change_flags(as_t *as, int flags, uintptr_t address); |
|
extern int as_area_get_flags(as_area_t *area); |
extern bool as_area_check_access(as_area_t *area, pf_access_t access); |
299,11 → 251,19 |
extern mem_backend_t elf_backend; |
extern mem_backend_t phys_backend; |
|
extern unsigned int elf_load(elf_header_t *header, as_t *as); |
/** |
* This flags is passed when running the loader, otherwise elf_load() |
* would return with a EE_LOADER error code. |
*/ |
#define ELD_F_NONE 0 |
#define ELD_F_LOADER 1 |
|
extern unsigned int elf_load(elf_header_t *header, as_t *as, int flags); |
|
/* Address space area related syscalls. */ |
extern unative_t sys_as_area_create(uintptr_t address, size_t size, int flags); |
extern unative_t sys_as_area_resize(uintptr_t address, size_t size, int flags); |
extern unative_t sys_as_area_change_flags(uintptr_t address, int flags); |
extern unative_t sys_as_area_destroy(uintptr_t address); |
|
/* Introspection functions. */ |