Files | |
file | as.h |
file | buddy.h |
file | frame.h |
file | page.h |
file | slab.h |
file | tlb.h |
file | as.c |
Address space related functions. | |
file | backend_anon.c |
Backend for anonymous memory address space areas. | |
file | backend_elf.c |
Backend for address space areas backed by an ELF image. | |
file | backend_phys.c |
Backend for address space areas backed by continuous physical memory. | |
file | buddy.c |
Buddy allocator framework. | |
file | frame.c |
Physical frame allocator. | |
file | page.c |
Virtual Address Translation subsystem. | |
file | slab.c |
Slab allocator. | |
file | tlb.c |
Generic TLB shootdown algorithm. | |
Data Structures | |
struct | buddy_system_operations |
struct | buddy_system |
struct | page_mapping_operations |
struct | slab_magazine_t |
struct | slab_mag_cache_t |
struct | slab_cache_t |
struct | tlb_shootdown_msg |
struct | frame_t |
struct | zone_t |
struct | slab_t |
Defines | |
#define | AS_AREA_READ 1 |
#define | AS_AREA_WRITE 2 |
#define | AS_AREA_EXEC 4 |
#define | AS_AREA_CACHEABLE 8 |
#define | BUDDY_SYSTEM_INNER_BLOCK 0xff |
#define | ONE_FRAME 0 |
#define | TWO_FRAMES 1 |
#define | STACK_FRAMES ONE_FRAME |
#define | ZONES_MAX 16 |
#define | ZONE_JOIN 0x1 |
#define | FRAME_KA 0x1 |
#define | FRAME_PANIC 0x2 |
#define | FRAME_ATOMIC 0x4 |
#define | FRAME_NO_RECLAIM 0x8 |
#define | FRAME_OK 0 |
#define | FRAME_NO_MEMORY 1 |
#define | FRAME_ERROR 2 |
#define | IS_BUDDY_ORDER_OK(index, order) ((~(((__native) -1) << (order)) & (index)) == 0) |
#define | IS_BUDDY_LEFT_BLOCK(zone, frame) (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) |
#define | IS_BUDDY_RIGHT_BLOCK(zone, frame) (((frame_index((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) |
#define | IS_BUDDY_LEFT_BLOCK_ABS(zone, frame) (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 0) |
#define | IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame) (((frame_index_abs((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1) |
#define | frame_alloc(order, flags) frame_alloc_generic(order, flags, NULL, NULL) |
#define | frame_alloc_rc(order, flags, status) frame_alloc_generic(order, flags, status, NULL) |
#define | frame_alloc_rc_zone(order, flags, status, zone) frame_alloc_generic(order, flags, status, zone) |
#define | PAGE_CACHEABLE_SHIFT 0 |
#define | PAGE_NOT_CACHEABLE_SHIFT PAGE_CACHEABLE_SHIFT |
#define | PAGE_PRESENT_SHIFT 1 |
#define | PAGE_NOT_PRESENT_SHIFT PAGE_PRESENT_SHIFT |
#define | PAGE_USER_SHIFT 2 |
#define | PAGE_KERNEL_SHIFT PAGE_USER_SHIFT |
#define | PAGE_READ_SHIFT 3 |
#define | PAGE_WRITE_SHIFT 4 |
#define | PAGE_EXEC_SHIFT 5 |
#define | PAGE_GLOBAL_SHIFT 6 |
#define | PAGE_NOT_CACHEABLE (0<<PAGE_CACHEABLE_SHIFT) |
#define | PAGE_CACHEABLE (1<<PAGE_CACHEABLE_SHIFT) |
#define | PAGE_PRESENT (0<<PAGE_PRESENT_SHIFT) |
#define | PAGE_NOT_PRESENT (1<<PAGE_PRESENT_SHIFT) |
#define | PAGE_USER (1<<PAGE_USER_SHIFT) |
#define | PAGE_KERNEL (0<<PAGE_USER_SHIFT) |
#define | PAGE_READ (1<<PAGE_READ_SHIFT) |
#define | PAGE_WRITE (1<<PAGE_WRITE_SHIFT) |
#define | PAGE_EXEC (1<<PAGE_EXEC_SHIFT) |
#define | PAGE_GLOBAL (1<<PAGE_GLOBAL_SHIFT) |
#define | SLAB_MIN_MALLOC_W 4 |
#define | SLAB_MAX_MALLOC_W 18 |
#define | SLAB_MAG_SIZE 4 |
#define | SLAB_INSIDE_SIZE (PAGE_SIZE >> 3) |
#define | SLAB_MAX_BADNESS(cache) ((PAGE_SIZE << (cache)->order) >> 2) |
#define | SLAB_RECLAIM_ALL 0x1 |
#define | SLAB_CACHE_NOMAGAZINE 0x1 |
#define | SLAB_CACHE_SLINSIDE 0x2 |
#define | SLAB_CACHE_MAGDEFERRED (0x4 | SLAB_CACHE_NOMAGAZINE) |
#define | TLB_MESSAGE_QUEUE_LEN 10 |
Typedefs | |
typedef enum pf_access | pf_access_t |
typedef page_mapping_operations | page_mapping_operations_t |
typedef enum tlb_invalidate_type | tlb_invalidate_type_t |
typedef tlb_shootdown_msg | tlb_shootdown_msg_t |
Enumerations | |
enum | pf_access { PF_ACCESS_READ, PF_ACCESS_WRITE, PF_ACCESS_EXEC } |
enum | tlb_invalidate_type { TLB_INVL_INVALID = 0, TLB_INVL_ALL, TLB_INVL_ASID, TLB_INVL_PAGES } |
Functions | |
void | buddy_system_create (buddy_system_t *b, __u8 max_order, buddy_system_operations_t *op, void *data) |
link_t * | buddy_system_alloc (buddy_system_t *b, __u8 i) |
bool | buddy_system_can_alloc (buddy_system_t *b, __u8 order) |
void | buddy_system_free (buddy_system_t *b, link_t *block) |
void | buddy_system_structure_print (buddy_system_t *b, size_t elem_size) |
size_t | buddy_conf_size (int max_order) |
link_t * | buddy_system_alloc_block (buddy_system_t *b, link_t *block) |
static __address | PFN2ADDR (pfn_t frame) |
static pfn_t | ADDR2PFN (__address addr) |
static count_t | SIZE2FRAMES (size_t size) |
void | frame_init (void) |
pfn_t | frame_alloc_generic (__u8 order, int flags, int *status, int *pzone) |
void | frame_free (pfn_t pfn) |
void | frame_reference_add (pfn_t pfn) |
int | zone_create (pfn_t start, count_t count, pfn_t confframe, int flags) |
void * | frame_get_parent (pfn_t frame, int hint) |
void | frame_set_parent (pfn_t frame, void *data, int hint) |
void | frame_mark_unavailable (pfn_t start, count_t count) |
__address | zone_conf_size (count_t count) |
void | zone_merge (int z1, int z2) |
void | zone_merge_all (void) |
void | zone_print_list (void) |
void | zone_print_one (int znum) |
void | page_init (void) |
void | page_table_lock (as_t *as, bool lock) |
void | page_table_unlock (as_t *as, bool unlock) |
void | page_mapping_insert (as_t *as, __address page, __address frame, int flags) |
void | page_mapping_remove (as_t *as, __address page) |
pte_t * | page_mapping_find (as_t *as, __address page) |
pte_t * | page_table_create (int flags) |
void | page_table_destroy (pte_t *page_table) |
void | map_structure (__address s, size_t size) |
__address | hw_map (__address physaddr, size_t size) |
slab_cache_t * | slab_cache_create (char *name, size_t size, size_t align, int(*constructor)(void *obj, int kmflag), int(*destructor)(void *obj), int flags) |
void | slab_cache_destroy (slab_cache_t *cache) |
void * | slab_alloc (slab_cache_t *cache, int flags) |
void | slab_free (slab_cache_t *cache, void *obj) |
count_t | slab_reclaim (int flags) |
void | slab_cache_init (void) |
void | slab_enable_cpucache (void) |
void | slab_print_list (void) |
void * | malloc (unsigned int size, int flags) |
void | free (void *obj) |
void | tlb_init (void) |
void | tlb_shootdown_start (tlb_invalidate_type_t type, asid_t asid, __address page, count_t count) |
void | tlb_shootdown_finalize (void) |
void | tlb_shootdown_ipi_recv (void) |
void | tlb_arch_init (void) |
void | tlb_print (void) |
void | tlb_shootdown_ipi_send (void) |
void | tlb_invalidate_all (void) |
void | tlb_invalidate_asid (asid_t asid) |
void | tlb_invalidate_pages (asid_t asid, __address page, count_t cnt) |
SPINLOCK_INITIALIZE (inactive_as_with_asid_lock) | |
LIST_INITIALIZE (inactive_as_with_asid_head) | |
static int | area_flags_to_page_flags (int aflags) |
static as_area_t * | find_area_and_lock (as_t *as, __address va) |
static bool | check_area_conflicts (as_t *as, __address va, size_t size, as_area_t *avoid_area) |
static void | sh_info_remove_reference (share_info_t *sh_info) |
void | as_init (void) |
as_t * | as_create (int flags) |
void | as_destroy (as_t *as) |
as_area_t * | as_area_create (as_t *as, int flags, size_t size, __address base, int attrs, mem_backend_t *backend, mem_backend_data_t *backend_data) |
int | as_area_resize (as_t *as, __address address, size_t size, int flags) |
int | as_area_destroy (as_t *as, __address address) |
int | as_area_share (as_t *src_as, __address src_base, size_t acc_size, as_t *dst_as, __address dst_base, int dst_flags_mask) |
bool | as_area_check_access (as_area_t *area, pf_access_t access) |
int | as_page_fault (__address page, pf_access_t access, istate_t *istate) |
void | as_switch (as_t *old, as_t *new) |
int | as_area_get_flags (as_area_t *a) |
size_t | as_get_size (__address base) |
int | used_space_insert (as_area_t *a, __address page, count_t count) |
int | used_space_remove (as_area_t *a, __address page, count_t count) |
__native | sys_as_area_create (__address address, size_t size, int flags) |
__native | sys_as_area_resize (__address address, size_t size, int flags) |
__native | sys_as_area_destroy (__address address) |
static int | anon_page_fault (as_area_t *area, __address addr, pf_access_t access) |
static void | anon_frame_free (as_area_t *area, __address page, __address frame) |
static void | anon_share (as_area_t *area) |
static int | elf_page_fault (as_area_t *area, __address addr, pf_access_t access) |
static void | elf_frame_free (as_area_t *area, __address page, __address frame) |
static void | elf_share (as_area_t *area) |
static int | phys_page_fault (as_area_t *area, __address addr, pf_access_t access) |
static void | phys_share (as_area_t *area) |
static index_t | frame_index (zone_t *zone, frame_t *frame) |
static index_t | frame_index_abs (zone_t *zone, frame_t *frame) |
static int | frame_index_valid (zone_t *zone, index_t index) |
static index_t | make_frame_index (zone_t *zone, frame_t *frame) |
static void | frame_initialize (frame_t *frame) |
static int | zones_add_zone (zone_t *newzone) |
static zone_t * | find_zone_and_lock (pfn_t frame, int *pzone) |
static int | zone_can_alloc (zone_t *z, __u8 order) |
static zone_t * | find_free_zone_lock (__u8 order, int *pzone) |
static link_t * | zone_buddy_find_block (buddy_system_t *b, link_t *child, __u8 order) |
static void | zone_buddy_print_id (buddy_system_t *b, link_t *block) |
static link_t * | zone_buddy_find_buddy (buddy_system_t *b, link_t *block) |
static link_t * | zone_buddy_bisect (buddy_system_t *b, link_t *block) |
static link_t * | zone_buddy_coalesce (buddy_system_t *b, link_t *block_1, link_t *block_2) |
static void | zone_buddy_set_order (buddy_system_t *b, link_t *block, __u8 order) |
static __u8 | zone_buddy_get_order (buddy_system_t *b, link_t *block) |
static void | zone_buddy_mark_busy (buddy_system_t *b, link_t *block) |
static void | zone_buddy_mark_available (buddy_system_t *b, link_t *block) |
static pfn_t | zone_frame_alloc (zone_t *zone, __u8 order) |
static void | zone_frame_free (zone_t *zone, index_t frame_idx) |
static frame_t * | zone_get_frame (zone_t *zone, index_t frame_idx) |
static void | zone_mark_unavailable (zone_t *zone, index_t frame_idx) |
static void | _zone_merge (zone_t *z, zone_t *z1, zone_t *z2) |
static void | return_config_frames (zone_t *newzone, zone_t *oldzone) |
static void | zone_reduce_region (zone_t *zone, pfn_t frame_idx, count_t count) |
static void | zone_construct (pfn_t start, count_t count, zone_t *z, int flags) |
SPINLOCK_INITIALIZE (slab_cache_lock) | |
static | LIST_INITIALIZE (slab_cache_list) |
static slab_t * | slab_space_alloc (slab_cache_t *cache, int flags) |
static count_t | slab_space_free (slab_cache_t *cache, slab_t *slab) |
static slab_t * | obj2slab (void *obj) |
static count_t | slab_obj_destroy (slab_cache_t *cache, void *obj, slab_t *slab) |
static void * | slab_obj_create (slab_cache_t *cache, int flags) |
static slab_magazine_t * | get_mag_from_cache (slab_cache_t *cache, int first) |
static void | put_mag_to_cache (slab_cache_t *cache, slab_magazine_t *mag) |
static count_t | magazine_destroy (slab_cache_t *cache, slab_magazine_t *mag) |
static slab_magazine_t * | get_full_current_mag (slab_cache_t *cache) |
static void * | magazine_obj_get (slab_cache_t *cache) |
static slab_magazine_t * | make_empty_current_mag (slab_cache_t *cache) |
static int | magazine_obj_put (slab_cache_t *cache, void *obj) |
static int | comp_objects (slab_cache_t *cache) |
static int | badness (slab_cache_t *cache) |
static void | make_magcache (slab_cache_t *cache) |
static void | _slab_cache_create (slab_cache_t *cache, char *name, size_t size, size_t align, int(*constructor)(void *obj, int kmflag), int(*destructor)(void *obj), int flags) |
static count_t | _slab_reclaim (slab_cache_t *cache, int flags) |
static void | _slab_free (slab_cache_t *cache, void *obj, slab_t *slab) |
SPINLOCK_INITIALIZE (tlblock) | |
Variables | |
page_mapping_operations_t * | page_mapping_operations |
as_operations_t * | as_operations = NULL |
as_t * | AS_KERNEL = NULL |
mem_backend_t | anon_backend |
mem_backend_t | elf_backend |
mem_backend_t | phys_backend |
struct { | |
SPINLOCK_DECLARE (lock) | |
const char * name | |
iroutine f | |
int count | |
zone_t * info [ZONES_MAX] | |
} | zones |
static struct buddy_system_operations | zone_buddy_system_operations |
page_mapping_operations_t * | page_mapping_operations = NULL |
static slab_cache_t | mag_cache |
static slab_cache_t | slab_cache_cache |
static slab_cache_t * | slab_extern_cache |
static slab_cache_t * | malloc_caches [SLAB_MAX_MALLOC_W-SLAB_MIN_MALLOC_W+1] |
char * | malloc_names [] |
|
Definition at line 42 of file as.h. Referenced by area_flags_to_page_flags(), as_area_share(), load_segment(), sys_as_area_create(), and task_run_program(). |
|
Definition at line 41 of file as.h. Referenced by area_flags_to_page_flags(), as_area_check_access(), as_area_create(), and load_segment(). |
|
Address space area flags. Definition at line 39 of file as.h. Referenced by area_flags_to_page_flags(), as_area_check_access(), load_segment(), and task_run_program(). |
|
Definition at line 40 of file as.h. Referenced by area_flags_to_page_flags(), as_area_check_access(), as_area_create(), elf_share(), load_segment(), and task_run_program(). |
|
Definition at line 41 of file buddy.h. Referenced by buddy_system_alloc_block(), buddy_system_create(), and buddy_system_free(). |
|
Definition at line 92 of file frame.h. Referenced by anon_page_fault(), clock_counter_init(), cpu_init(), klog_init(), pt_mapping_insert(), and ptl0_create(). |
|
Definition at line 93 of file frame.h. Referenced by fb_init(), smp_init(), and thr_constructor(). |
|
Definition at line 94 of file frame.h. Referenced by slab_space_alloc(). |
|
Definition at line 62 of file frame.h. Referenced by acpi_madt_parse(), clock_counter_init(), cpu_init(), ddi_iospace_enable_arch(), fb_init(), frame_alloc_generic(), ipc_irq_send_msg(), ipc_irq_send_notif(), klog_init(), make_empty_current_mag(), pm_init(), and smp_init(). |
|
|
|
Definition at line 60 of file frame.h. Referenced by cpu_init(), pt_mapping_insert(), ptl0_create(), slab_space_alloc(), smp_init(), and thr_constructor(). |
|
Definition at line 66 of file frame.h. Referenced by frame_alloc_generic(). |
|
Definition at line 63 of file frame.h. Referenced by frame_alloc_generic(), and make_empty_current_mag(). |
|
Definition at line 65 of file frame.h. Referenced by frame_alloc_generic(), slab_space_alloc(), and smp_init(). |
|
Definition at line 61 of file frame.h. Referenced by cpu_init(), frame_alloc_generic(), and ptl0_create(). |
|
|
|
Definition at line 89 of file frame.h. Referenced by zone_buddy_find_buddy(). |
|
Definition at line 86 of file frame.h. Referenced by zone_buddy_find_buddy(). |
|
|
|
Definition at line 90 of file frame.h. Referenced by zone_buddy_find_buddy(). |
|
Definition at line 47 of file frame.h. Referenced by anon_page_fault(), pt_mapping_insert(), ptl0_create(), and smp_init(). |
|
Definition at line 55 of file page.h. Referenced by area_flags_to_page_flags(), page_arch_init(), and pt_mapping_insert(). |
|
|
|
Definition at line 65 of file page.h. Referenced by area_flags_to_page_flags(), and pt_mapping_insert(). |
|
|
|
Definition at line 67 of file page.h. Referenced by page_arch_init(). |
|
|
|
|
|
|
|
Definition at line 54 of file page.h. Referenced by hw_map(), map_sdt(), map_structure(), and smp_init(). |
|
|
|
Definition at line 58 of file page.h. Referenced by pt_mapping_find(), pt_mapping_insert(), and pt_mapping_remove(). |
|
|
|
Definition at line 57 of file page.h. Referenced by area_flags_to_page_flags(), and pt_mapping_insert(). |
|
|
|
Definition at line 63 of file page.h. Referenced by area_flags_to_page_flags(). |
|
|
|
Definition at line 60 of file page.h. Referenced by area_flags_to_page_flags(), and pt_mapping_insert(). |
|
|
|
Definition at line 64 of file page.h. Referenced by area_flags_to_page_flags(), and pt_mapping_insert(). |
|
|
|
We add magazine cache later, if we have this flag Definition at line 66 of file slab.h. Referenced by btree_init(), slab_cache_init(), and slab_enable_cpucache(). |
|
Do not use per-cpu cache Definition at line 63 of file slab.h. Referenced by _slab_cache_create(), _slab_free(), _slab_reclaim(), slab_alloc(), slab_cache_destroy(), and slab_cache_init(). |
|
Have control structure inside SLAB Definition at line 64 of file slab.h. Referenced by _slab_cache_create(), badness(), comp_objects(), slab_cache_init(), slab_print_list(), slab_space_alloc(), and slab_space_free(). |
|
If object size is less, store control structure inside SLAB Definition at line 53 of file slab.h. Referenced by _slab_cache_create(). |
|
Initial Magazine size (TODO: dynamically growing magazines) Definition at line 50 of file slab.h. Referenced by make_empty_current_mag(), and slab_cache_init(). |
|
Maximum wasted space we allow for cache Definition at line 56 of file slab.h. Referenced by _slab_cache_create(). |
|
Maximum size to be allocated by malloc Definition at line 47 of file slab.h. Referenced by malloc(), and slab_cache_init(). |
|
Minimum size to be allocated by malloc Definition at line 44 of file slab.h. Referenced by malloc(), and slab_cache_init(). |
|
Reclaim all possible memory, because we are in memory stress Definition at line 59 of file slab.h. Referenced by _slab_reclaim(), frame_alloc_generic(), and slab_cache_destroy(). |
|
Definition at line 53 of file frame.h. Referenced by cpu_init(), thr_constructor(), and thread_create(). |
|
Number of TLB shootdown messages that can be queued in processor tlb_messages queue. Definition at line 46 of file tlb.h. Referenced by tlb_shootdown_ipi_recv(), and tlb_shootdown_start(). |
|
|
|
If possible, merge with neighbouring zones |
|
Maximum number of zones in system Definition at line 56 of file frame.h. Referenced by zones_add_zone(). |
|
|
|
|
|
|
|
|
|
Page fault access type. |
|
Type of TLB shootdown message. |
|
Initialize allocated memory as a slab cache Definition at line 563 of file slab.c. References ALIGN_UP, badness(), comp_objects(), fnzb, interrupts_disable(), interrupts_restore(), list_append(), list_initialize(), make_magcache(), memsetb(), SIZE2FRAMES(), SLAB_CACHE_NOMAGAZINE, SLAB_CACHE_SLINSIDE, SLAB_INSIDE_SIZE, SLAB_MAX_BADNESS, spinlock_initialize(), spinlock_lock, and spinlock_unlock(). Referenced by slab_cache_create(), and slab_cache_init(). Here is the call graph for this function: ![]() |
|
Return object to cache, use slab if known Definition at line 748 of file slab.c. References slab_cache_t::allocated_objs, atomic_dec(), slab_cache_t::flags, interrupts_disable(), interrupts_restore(), magazine_obj_put(), SLAB_CACHE_NOMAGAZINE, and slab_obj_destroy(). Referenced by free(), and slab_free(). Here is the call graph for this function: ![]() |
|
Reclaim space occupied by objects that are already free
Definition at line 647 of file slab.c. References atomic_get(), config, config_t::cpu_count, slab_mag_cache_t::current, slab_cache_t::flags, get_mag_from_cache(), slab_mag_cache_t::last, slab_cache_t::mag_cache, slab_cache_t::magazine_counter, magazine_destroy(), NULL, SLAB_CACHE_NOMAGAZINE, SLAB_RECLAIM_ALL, spinlock_lock, and spinlock_unlock(). Referenced by slab_cache_destroy(), and slab_reclaim(). Here is the call graph for this function: ![]() |
|
Join 2 zones Expect zone_t *z to point to space at least zone_conf_size large Assume z1 & z2 are locked
Definition at line 538 of file frame.c. References ASSERT, zone_t::base, buddy_conf_size(), zone_t::buddy_system, buddy_system_create(), zone_t::busy_count, zone_t::count, zone_t::flags, fnzb, frame_initialize(), zone_t::free_count, overlaps(), spinlock_initialize(), and zone_buddy_system_operations. Referenced by zone_merge(). Here is the call graph for this function: ![]() |
|
Definition at line 74 of file frame.h. References FRAME_WIDTH. Referenced by anon_frame_free(), anon_share(), elf_frame_free(), elf_share(), frame_arch_init(), frame_init(), hw_map(), init_e820_memory(), obj2slab(), ptl0_destroy(), return_config_frames(), sh_info_remove_reference(), slab_space_alloc(), slab_space_free(), and thr_destructor(). |
|
Free a frame that is backed by the anonymous memory backend. The address space area and page tables must be already locked.
Definition at line 159 of file backend_anon.c. References ADDR2PFN(), and frame_free(). Here is the call graph for this function: ![]() |
|
Service a page fault in the anonymous memory address space area. The address space area and page tables must be already locked.
Definition at line 74 of file backend_anon.c. References ALIGN_DOWN, as_area_check_access(), btree_insert(), btree_search(), frame_alloc, FRAME_SIZE, btree_node::key, btree_node::keys, memsetb(), mutex_lock, ONE_FRAME, PAGE_SIZE, and PFN2ADDR(). Here is the call graph for this function: ![]() |
|
Share the anonymous address space area. Sharing of anonymous area is done by duplicating its entire mapping to the pagemap. Page faults will primarily search for frames there. The address space and address space area must be already locked.
Definition at line 173 of file backend_anon.c. References ADDR2PFN(), ASSERT, btree_insert(), count, frame_reference_add(), btree_node::key, btree_node::keys, list_get_instance, mutex_lock, link::next, NULL, page_mapping_find(), PAGE_SIZE, page_table_lock(), page_table_unlock(), and btree_node::value. Here is the call graph for this function: ![]() |
|
Convert address space area flags to page flags.
Definition at line 832 of file as.c. References AS_AREA_CACHEABLE, AS_AREA_EXEC, AS_AREA_READ, AS_AREA_WRITE, PAGE_CACHEABLE, PAGE_EXEC, PAGE_PRESENT, PAGE_READ, PAGE_USER, and PAGE_WRITE. Referenced by as_area_get_flags(). |
|
Check access mode for address space area. The address space area must be locked prior to this call.
Definition at line 634 of file as.c. References AS_AREA_EXEC, AS_AREA_READ, AS_AREA_WRITE, PF_ACCESS_EXEC, PF_ACCESS_READ, and PF_ACCESS_WRITE. Referenced by anon_page_fault(), elf_page_fault(), and phys_page_fault(). |
|
Create address space area of common attributes. The created address space area is added to the target address space.
Definition at line 198 of file as.c. References AS_AREA_EXEC, AS_AREA_WRITE, btree_create(), btree_insert(), check_area_conflicts(), interrupts_disable(), interrupts_restore(), malloc(), memsetb(), mutex_initialize(), mutex_lock, mutex_unlock(), NULL, PAGE_SIZE, and SIZE2FRAMES(). Referenced by as_area_share(), ddi_physmem_map(), load_segment(), sys_as_area_create(), and task_run_program(). Here is the call graph for this function: ![]() |
|
Destroy address space area.
Definition at line 417 of file as.c. References AS, ASSERT, ENOENT, find_area_and_lock(), interrupts_disable(), interrupts_restore(), btree_node::key, btree_node::keys, list_get_instance, mutex_lock, mutex_unlock(), link::next, page_mapping_find(), page_mapping_remove(), PAGE_SIZE, page_table_lock(), page_table_unlock(), TLB_INVL_PAGES, tlb_shootdown_start(), and btree_node::value. Referenced by as_destroy(), and sys_as_area_destroy(). Here is the call graph for this function: ![]() |
|
Compute flags for virtual address translation subsytem. The address space area must be locked. Interrupts must be disabled.
Definition at line 862 of file as.c. References area_flags_to_page_flags(). Referenced by phys_page_fault(). Here is the call graph for this function: ![]() |
|
Find address space area and change it.
Definition at line 258 of file as.c. References AS, ASSERT, ENOENT, ENOTSUP, EPERM, find_area_and_lock(), interrupts_disable(), interrupts_restore(), list_empty(), list_get_instance, mutex_lock, mutex_unlock(), overlaps(), page_mapping_find(), page_mapping_remove(), PAGE_SIZE, page_table_lock(), page_table_unlock(), PAGE_WIDTH, panic, phys_backend, SIZE2FRAMES(), TLB_INVL_PAGES, tlb_shootdown_start(), and used_space_remove(). Referenced by sys_as_area_resize(). Here is the call graph for this function: ![]() |
|
Share address space area with another or the same address space. Address space area mapping is shared with a new address space area. If the source address space area has not been shared so far, a new sh_info is created. The new address space area simply gets the sh_info of the source area. The process of duplicating the mapping is done through the backend share function.
Definition at line 517 of file as.c. References AS_AREA_CACHEABLE, as_area_create(), btree_create(), ENOENT, ENOMEM, ENOTSUP, EPERM, find_area_and_lock(), interrupts_disable(), interrupts_restore(), malloc(), mutex_initialize(), mutex_lock, mutex_unlock(), PAGE_SIZE, and sh_info_remove_reference(). Referenced by answer_preprocess(). Here is the call graph for this function: ![]() |
|
Create address space.
Definition at line 114 of file as.c. References btree_create(), link_initialize(), malloc(), mutex_initialize(), and page_table_create(). Referenced by as_init(), and task_run_program(). Here is the call graph for this function: ![]() |
|
Destroy adress space. When there are no tasks referencing this address space (i.e. its refcount is zero), the address space can be destroyed. Definition at line 140 of file as.c. References AS, as_area_destroy(), AS_KERNEL, ASSERT, interrupts_disable(), list_empty(), list_get_instance, list_remove(), spinlock_lock, and spinlock_unlock(). Referenced by task_destroy(), and task_run_program(). Here is the call graph for this function: ![]() |
|
Return size of the address space area with given base. Definition at line 1070 of file as.c. References AS, find_area_and_lock(), interrupts_disable(), interrupts_restore(), mutex_unlock(), and PAGE_SIZE. Referenced by request_preprocess(). Here is the call graph for this function: ![]() |
|
Initialize address space subsystem. Definition at line 101 of file as.c. References as_arch_init(), as_create(), AS_KERNEL, and panic. Referenced by main_bsp_separated_stack(). Here is the call graph for this function: ![]() |
|
Handle page fault within the current address space. This is the high-level page fault handler. It decides whether the page fault can be resolved by any backend and if so, it invokes the backend to resolve the page fault. Interrupts are assumed disabled.
Definition at line 664 of file as.c. References AS, ASSERT, find_area_and_lock(), mutex_lock, mutex_unlock(), page_fault(), page_mapping_find(), page_table_lock(), page_table_unlock(), PF_ACCESS_EXEC, PF_ACCESS_READ, PF_ACCESS_WRITE, and THREAD. Referenced by page_fault(). Here is the call graph for this function: ![]() |
|
Switch address spaces. Note that this function cannot sleep as it is essentially a part of scheduling. Sleeping here would lead to deadlock on wakeup.
Definition at line 762 of file as.c. References AS, as_install_arch, AS_KERNEL, ASSERT, interrupts_disable(), interrupts_restore(), list_append(), list_remove(), mutex_lock_active, mutex_unlock(), spinlock_lock, and spinlock_unlock(). Referenced by scheduler_separated_stack(). Here is the call graph for this function: ![]() |
|
Return wasted space in slab Definition at line 531 of file slab.c. References comp_objects(), slab_cache_t::flags, slab_cache_t::order, PAGE_SIZE, slab_cache_t::size, and SLAB_CACHE_SLINSIDE. Referenced by _slab_cache_create(). Here is the call graph for this function: ![]() |
|
Return size needed for the buddy configuration data Definition at line 51 of file buddy.c. Referenced by _zone_merge(), zone_conf_size(), and zone_construct(). |
|
Allocate block from buddy system.
Definition at line 170 of file buddy.c. References ASSERT, buddy_system_operations::bisect, buddy_system_free(), list_empty(), list_remove(), buddy_system_operations::mark_busy, buddy_system::max_order, link::next, NULL, buddy_system::op, buddy_system::order, and buddy_system_operations::set_order. Referenced by zone_frame_alloc(). Here is the call graph for this function: ![]() |
|
Allocate PARTICULAR block from buddy system @ return Block of data or NULL if no such block was found Definition at line 130 of file buddy.c. References ASSERT, buddy_system_operations::bisect, buddy_system_free(), BUDDY_SYSTEM_INNER_BLOCK, buddy_system_operations::find_block, buddy_system_operations::get_order, list_remove(), buddy_system_operations::mark_available, buddy_system_operations::mark_busy, buddy_system::op, and buddy_system_operations::set_order. Referenced by zone_mark_unavailable(). Here is the call graph for this function: ![]() |
|
Check if buddy system can allocate block
Definition at line 104 of file buddy.c. References list_empty(), buddy_system::max_order, and buddy_system::order. Referenced by zone_can_alloc(). Here is the call graph for this function: ![]() |
|
Create buddy system Allocate memory for and initialize new buddy system.
Definition at line 68 of file buddy.c. References ASSERT, buddy_system_operations::bisect, BUDDY_SYSTEM_INNER_BLOCK, buddy_system_operations::coalesce, buddy_system::data, buddy_system_operations::find_buddy, buddy_system_operations::get_order, list_initialize(), buddy_system_operations::mark_busy, buddy_system::max_order, buddy_system::op, buddy_system::order, and buddy_system_operations::set_order. Referenced by _zone_merge(), and zone_construct(). Here is the call graph for this function: ![]() |
|
Return block to buddy system.
Definition at line 230 of file buddy.c. References ASSERT, BUDDY_SYSTEM_INNER_BLOCK, buddy_system_operations::find_buddy, buddy_system_operations::get_order, list_append(), list_remove(), buddy_system::max_order, buddy_system::op, and buddy_system::order. Referenced by buddy_system_alloc(), buddy_system_alloc_block(), and zone_frame_free(). Here is the call graph for this function: ![]() |
|
Prints out structure of buddy system
Definition at line 291 of file buddy.c. References list_empty(), buddy_system::max_order, link::next, buddy_system::order, and printf(). Here is the call graph for this function: ![]() |
|
Check area conflicts with other areas. The address space must be locked and interrupts must be disabled.
Definition at line 997 of file as.c. References btree_leaf_node_left_neighbour(), btree_leaf_node_right_neighbour(), btree_search(), btree_node::keys, mutex_lock, mutex_unlock(), NULL, overlaps(), PAGE_SIZE, and btree_node::value. Referenced by as_area_create(). Here is the call graph for this function: ![]() |
|
Return number of objects that fit in certain cache size Definition at line 522 of file slab.c. References slab_cache_t::flags, slab_cache_t::order, PAGE_SIZE, slab_cache_t::size, and SLAB_CACHE_SLINSIDE. Referenced by _slab_cache_create(), and badness(). |
|
Free a frame that is backed by the ELF backend. The address space area and page tables must be already locked.
Definition at line 204 of file backend_elf.c. References ADDR2PFN(), ALIGN_UP, ASSERT, entry, frame_free(), FRAME_SIZE, PAGE_SIZE, PAGE_WIDTH, and PF_W. Here is the call graph for this function: ![]() |
|
Service a page fault in the ELF backend address space area. The address space area and page tables must be already locked.
Definition at line 73 of file backend_elf.c. References ALIGN_DOWN, ALIGN_UP, as_area_check_access(), ASSERT, btree_search(), entry, FRAME_SIZE, btree_node::key, btree_node::keys, mutex_lock, PAGE_SIZE, and PAGE_WIDTH. Here is the call graph for this function: ![]() |
|
Share ELF image backed address space area. If the area is writable, then all mapped pages are duplicated in the pagemap. Otherwise only portions of the area that are not backed by the ELF image are put into the pagemap. The address space and address space area must be locked prior to the call.
Definition at line 243 of file backend_elf.c. References ADDR2PFN(), AS_AREA_WRITE, ASSERT, btree_insert(), btree_leaf_node_left_neighbour(), btree_search(), count, entry, frame_reference_add(), btree_node::key, btree_node::keys, btree_node::leaf_link, list_get_instance, mutex_lock, link::next, NULL, page_mapping_find(), PAGE_SIZE, page_table_lock(), page_table_unlock(), and btree_node::value. Here is the call graph for this function: ![]() |
|
Find address space area and lock it. The address space must be locked and interrupts must be disabled.
Definition at line 941 of file as.c. References btree_search(), btree_node::keys, mutex_lock, PAGE_SIZE, and btree_node::value. Referenced by as_area_destroy(), as_area_resize(), as_area_share(), as_get_size(), and as_page_fault(). Here is the call graph for this function: ![]() |
|
Find AND LOCK zone that can allocate order frames Assume interrupts are disabled!!
Definition at line 233 of file frame.c. References NULL, spinlock_lock, spinlock_unlock(), zone_can_alloc(), and zones. Referenced by frame_alloc_generic(). Here is the call graph for this function: ![]() |
|
Try to find a zone where can we find the frame
Definition at line 187 of file frame.c. References zone_t::base, zone_t::count, NULL, spinlock_lock, spinlock_unlock(), and zones. Referenced by frame_free(), frame_get_parent(), frame_mark_unavailable(), frame_reference_add(), and frame_set_parent(). Here is the call graph for this function: ![]() |
|
Allocate power-of-two frames of physical memory.
Definition at line 934 of file frame.c. References ASSERT, zone_t::base, find_free_zone_lock(), FRAME_ATOMIC, FRAME_NO_MEMORY, FRAME_NO_RECLAIM, FRAME_OK, FRAME_PANIC, interrupts_disable(), interrupts_restore(), NULL, panic, slab_reclaim(), SLAB_RECLAIM_ALL, spinlock_unlock(), and zone_frame_alloc(). Here is the call graph for this function: ![]() |
|
Free a frame. Find respective frame structure for supplied PFN. Decrement frame reference count. If it drops to zero, move the frame structure to free list.
Definition at line 1000 of file frame.c. References ASSERT, zone_t::base, find_zone_and_lock(), interrupts_disable(), interrupts_restore(), NULL, spinlock_unlock(), and zone_frame_free(). Referenced by anon_frame_free(), elf_frame_free(), ptl0_destroy(), sh_info_remove_reference(), slab_space_alloc(), slab_space_free(), and thr_destructor(). Here is the call graph for this function: ![]() |
|
Definition at line 912 of file frame.c. References ASSERT, zone_t::base, find_zone_and_lock(), frame_t::parent, spinlock_unlock(), and zone_get_frame(). Referenced by obj2slab(). Here is the call graph for this function: ![]() |
|
Definition at line 104 of file frame.c. References zone_t::frames. Referenced by zone_buddy_find_block(), zone_buddy_find_buddy(), and zone_buddy_print_id(). |
|
Definition at line 108 of file frame.c. References zone_t::base, and zone_t::frames. Referenced by zone_buddy_find_buddy(). |
|
Definition at line 112 of file frame.c. References zone_t::count. Referenced by zone_buddy_find_buddy(). |
|
Initialize physical memory management Initialize physical memory managemnt. Definition at line 1068 of file frame.c. References init_task_t::addr, ADDR2PFN(), config_t::base, init_t::cnt, config, config_t::cpu_active, frame_arch_init(), frame_mark_unavailable(), init, config_t::kernel_size, init_task_t::size, SIZE2FRAMES(), spinlock_initialize(), init_t::tasks, and zones. Referenced by main_ap(), and main_bsp_separated_stack(). Here is the call graph for this function: ![]() |
|
Initialize frame structure Initialize frame structure.
Definition at line 129 of file frame.c. References frame_t::buddy_order, and frame_t::refcount. Referenced by _zone_merge(), and zone_construct(). |
|
Mark given range unavailable in frame zones Definition at line 1048 of file frame.c. References zone_t::base, find_zone_and_lock(), spinlock_unlock(), and zone_mark_unavailable(). Referenced by frame_arch_init(), and frame_init(). Here is the call graph for this function: ![]() |
|
Add reference to frame. Find respective frame structure for supplied PFN and increment frame reference count.
Definition at line 1026 of file frame.c. References ASSERT, zone_t::base, find_zone_and_lock(), zone_t::frames, interrupts_disable(), interrupts_restore(), NULL, frame_t::refcount, and spinlock_unlock(). Referenced by anon_share(), and elf_share(). Here is the call graph for this function: ![]() |
|
Set parent of frame Definition at line 902 of file frame.c. References ASSERT, zone_t::base, find_zone_and_lock(), frame_t::parent, spinlock_unlock(), and zone_get_frame(). Referenced by slab_space_alloc(). Here is the call graph for this function: ![]() |
|
Definition at line 900 of file slab.c. References _slab_free(), slab_t::cache, and obj2slab(). Referenced by bubblesort(), code_free(), code_from_uspace(), ddi_iospace_enable_arch(), futex_ht_remove_callback(), qsort(), sh_info_remove_reference(), slab_cache_destroy(), sys_io(), sys_sysinfo_valid(), sys_sysinfo_value(), sys_thread_create(), task_destroy(), task_destroy_arch(), and uinit(). Here is the call graph for this function: ![]() |
|
Find full magazine, set it as current and return it Assume cpu_magazine lock is held Definition at line 384 of file slab.c. References slab_magazine_t::busy, CPU, slab_mag_cache_t::current, get_mag_from_cache(), slab_mag_cache_t::last, slab_cache_t::mag_cache, magazine_destroy(), and NULL. Referenced by magazine_obj_get(). Here is the call graph for this function: ![]() |
|
Finds a full magazine in cache, takes it from list and returns it
Definition at line 327 of file slab.c. References atomic_dec(), slab_magazine_t::link, list_empty(), list_get_instance, list_remove(), slab_cache_t::magazine_counter, slab_cache_t::magazines, link::next, NULL, link::prev, spinlock_lock, and spinlock_unlock(). Referenced by _slab_reclaim(), and get_full_current_mag(). Here is the call graph for this function: ![]() |
|
Definition at line 81 of file page.c. References ADDR2PFN(), ALIGN_UP, AS_KERNEL, FRAME_SIZE, KERNEL_ADDRESS_SPACE_END_ARCH, last_frame, page_mapping_insert(), PAGE_NOT_CACHEABLE, PAGE_SIZE, panic, and PFN2ADDR(). Referenced by ega_init(), and fb_init(). Here is the call graph for this function: ![]() |
|
|
|
This list contains address spaces that are not active on any processor and that have valid ASID. |
|
Free all objects in magazine and free memory associated with magazine
Definition at line 363 of file slab.c. References atomic_dec(), slab_magazine_t::busy, slab_cache_t::cached_objs, NULL, slab_magazine_t::objs, and slab_obj_destroy(). Referenced by _slab_reclaim(), and get_full_current_mag(). Here is the call graph for this function: ![]() |
|
Try to find object in CPU-cache magazines
Definition at line 418 of file slab.c. References atomic_dec(), slab_magazine_t::busy, slab_cache_t::cached_objs, CPU, get_full_current_mag(), slab_cache_t::mag_cache, NULL, slab_magazine_t::objs, spinlock_lock, and spinlock_unlock(). Referenced by slab_alloc(). Here is the call graph for this function: ![]() |
|
Put object into CPU-cache magazine
Definition at line 495 of file slab.c. References atomic_inc(), slab_magazine_t::busy, slab_cache_t::cached_objs, CPU, slab_cache_t::mag_cache, make_empty_current_mag(), slab_magazine_t::objs, spinlock_lock, and spinlock_unlock(). Referenced by _slab_free(). Here is the call graph for this function: ![]() |
|
Assure that the current magazine is empty, return pointer to it, or NULL if no empty magazine is available and cannot be allocated Assume mag_cache[CPU->id].lock is held We have 2 magazines bound to processor. First try the current. If full, try the last. If full, put to magazines list. allocate new, exchange last & current Definition at line 453 of file slab.c. References slab_magazine_t::busy, CPU, slab_mag_cache_t::current, FRAME_ATOMIC, FRAME_NO_RECLAIM, slab_mag_cache_t::last, mag_cache, slab_cache_t::mag_cache, NULL, put_mag_to_cache(), slab_magazine_t::size, slab_alloc(), and SLAB_MAG_SIZE. Referenced by magazine_obj_put(). Here is the call graph for this function: ![]() |
|
Compute pfn_t from frame_t pointer & zone pointer Definition at line 118 of file frame.c. References zone_t::frames. Referenced by zone_frame_alloc(). |
|
Initialize mag_cache structure in slab cache Definition at line 546 of file slab.c. References ASSERT, config, config_t::cpu_count, slab_cache_t::mag_cache, malloc(), memsetb(), and spinlock_initialize(). Referenced by _slab_cache_create(), and slab_enable_cpucache(). Here is the call graph for this function: ![]() |
|
Definition at line 885 of file slab.c. References ASSERT, fnzb, malloc_caches, slab_alloc(), SLAB_MAX_MALLOC_W, and SLAB_MIN_MALLOC_W. Referenced by acpi_madt_parse(), as_area_create(), as_area_share(), as_create(), bubblesort(), code_from_uspace(), cpu_init(), ddi_iospace_enable_arch(), fb_init(), futex_find(), hash_table_create(), ipc_irq_make_table(), make_magcache(), pm_init(), qsort(), sys_io(), sys_sysinfo_valid(), sys_sysinfo_value(), sys_thread_create(), sysinfo_create_path(), task_create(), and task_run_program(). Here is the call graph for this function: ![]() |
|
Map memory structure Identity-map memory structure considering possible crossings of page boundaries.
Definition at line 72 of file page.c. References AS_KERNEL, page_mapping_insert(), PAGE_NOT_CACHEABLE, and PAGE_SIZE. Referenced by map_sdt(). Here is the call graph for this function: ![]() |
|
Map object to slab structure Definition at line 216 of file slab.c. References ADDR2PFN(), and frame_get_parent(). Referenced by free(), and slab_obj_destroy(). Here is the call graph for this function: ![]() |
|
Definition at line 58 of file page.c. References page_arch_init(). Referenced by main_ap(), and main_bsp_separated_stack(). Here is the call graph for this function: ![]() |
|
Find mapping for virtual page Find mapping for virtual page. The page table must be locked and interrupts must be disabled.
Definition at line 134 of file page.c. References ASSERT, page_mapping_operations::mapping_find, and page_mapping_operations. Referenced by anon_share(), as_area_destroy(), as_area_resize(), as_page_fault(), elf_share(), sys_futex_sleep_timeout(), and sys_futex_wakeup(). |
|
Insert mapping of page to frame. Map virtual address page to physical address frame using flags. Allocate and setup any missing page tables. The page table must be locked and interrupts must be disabled.
Definition at line 96 of file page.c. References ASSERT, page_mapping_operations::mapping_insert, and page_mapping_operations. Referenced by hw_map(), map_sdt(), map_structure(), page_arch_init(), phys_page_fault(), and smp_init(). |
|
Remove mapping of page. Remove any mapping of page within address space as. TLB shootdown should follow in order to make effects of this call visible. The page table must be locked and interrupts must be disabled.
Definition at line 115 of file page.c. References ASSERT, page_mapping_operations::mapping_remove, and page_mapping_operations. Referenced by as_area_destroy(), and as_area_resize(). |
|
Create page table. Depending on architecture, create either address space private or global page table.
Definition at line 876 of file as.c. References as_operations, and ASSERT. Referenced by as_create(). |
|
Destroy page table. Destroy page table in architecture specific way.
Definition at line 890 of file as.c. References as_operations, and ASSERT. |
|
Lock page table. This function should be called before any page_mapping_insert(), page_mapping_remove() and page_mapping_find(). Locking order is such that address space areas must be locked prior to this call. Address space can be locked prior to this call in which case the lock argument is false.
Definition at line 910 of file as.c. References as_operations, and ASSERT. Referenced by anon_share(), as_area_destroy(), as_area_resize(), as_page_fault(), elf_share(), sys_futex_sleep_timeout(), and sys_futex_wakeup(). |
|
Unlock page table.
Definition at line 923 of file as.c. References as_operations, and ASSERT. Referenced by anon_share(), as_area_destroy(), as_area_resize(), as_page_fault(), elf_share(), sys_futex_sleep_timeout(), and sys_futex_wakeup(). |
|
Definition at line 69 of file frame.h. References FRAME_WIDTH. Referenced by anon_page_fault(), clock_counter_init(), cpu_init(), fb_init(), hw_map(), klog_init(), pt_mapping_insert(), ptl0_create(), slab_space_alloc(), smp_init(), thr_constructor(), zone_create(), zone_merge(), zone_print_list(), and zone_print_one(). |
|
Service a page fault in the address space area backed by physical memory. The address space area and page tables must be already locked.
Definition at line 68 of file backend_phys.c. References ALIGN_DOWN, AS, as_area_check_access(), as_area_get_flags(), ASSERT, FRAME_SIZE, page_mapping_insert(), PAGE_SIZE, panic, and used_space_insert(). Here is the call graph for this function: ![]() |
|
Share address space area backed by physical memory. Do actually nothing as sharing of address space areas that are backed up by physical memory is very easy. Note that the function must be defined so that as_area_share() will succeed. Definition at line 90 of file backend_phys.c. |
|
Prepend magazine to magazine list in cache Definition at line 348 of file slab.c. References atomic_inc(), slab_magazine_t::link, list_prepend(), slab_cache_t::magazine_counter, slab_cache_t::magazines, spinlock_lock, and spinlock_unlock(). Referenced by make_empty_current_mag(). Here is the call graph for this function: ![]() |
|
Return old configuration frames into the zone We have several cases
Definition at line 620 of file frame.c. References ADDR2PFN(), ASSERT, zone_t::base, frame_t::buddy_order, zone_t::busy_count, zone_t::count, zone_t::frames, SIZE2FRAMES(), zone_conf_size(), and zone_frame_free(). Referenced by zone_merge(). Here is the call graph for this function: ![]() |
|
Remove reference to address space area share info. If the reference count drops to 0, the sh_info is deallocated.
Definition at line 1475 of file as.c. References ADDR2PFN(), ASSERT, btree_destroy(), frame_free(), free(), btree_node::keys, list_get_instance, mutex_lock, mutex_unlock(), link::next, and btree_node::value. Referenced by as_area_share(). Here is the call graph for this function: ![]() |
|
Definition at line 79 of file frame.h. References FRAME_WIDTH. Referenced by _slab_cache_create(), as_area_create(), as_area_resize(), fb_init(), frame_init(), init_e820_memory(), return_config_frames(), zone_create(), and zone_merge(). |
|
Allocate new object from cache - if no flags given, always returns memory Definition at line 725 of file slab.c. References slab_cache_t::allocated_objs, atomic_inc(), slab_cache_t::flags, interrupts_disable(), interrupts_restore(), magazine_obj_get(), NULL, SLAB_CACHE_NOMAGAZINE, and slab_obj_create(). Referenced by _btree_insert(), btree_create(), ipc_call_alloc(), make_empty_current_mag(), malloc(), node_split(), slab_cache_create(), slab_space_alloc(), thr_constructor(), and thread_create(). Here is the call graph for this function: ![]() |
|
Create slab cache Definition at line 626 of file slab.c. References _slab_cache_create(), slab_alloc(), and slab_cache_cache. Referenced by btree_init(), ipc_init(), slab_cache_init(), and thread_init(). Here is the call graph for this function: ![]() |
|
Check that there are no slabs and remove cache from system Definition at line 691 of file slab.c. References _slab_reclaim(), slab_cache_t::flags, free(), slab_cache_t::full_slabs, interrupts_disable(), interrupts_restore(), slab_cache_t::link, list_empty(), list_remove(), slab_cache_t::mag_cache, panic, slab_cache_t::partial_slabs, slab_cache_cache, SLAB_CACHE_NOMAGAZINE, slab_free(), SLAB_RECLAIM_ALL, spinlock_lock, and spinlock_unlock(). Here is the call graph for this function: ![]() |
|
Initialize slab subsytem Definition at line 817 of file slab.c. References _slab_cache_create(), mag_cache, malloc_caches, malloc_names, NULL, slab_cache_cache, slab_cache_create(), SLAB_CACHE_MAGDEFERRED, SLAB_CACHE_NOMAGAZINE, SLAB_CACHE_SLINSIDE, slab_extern_cache, SLAB_MAG_SIZE, SLAB_MAX_MALLOC_W, and SLAB_MIN_MALLOC_W. Referenced by main_bsp_separated_stack(). Here is the call graph for this function: ![]() |
|
Enable cpu_cache Kernel calls this function, when it knows the real number of processors. Allocate slab for cpucache and enable it on all existing slabs that are SLAB_CACHE_MAGDEFERRED Definition at line 861 of file slab.c. References slab_cache_t::flags, list_get_instance, make_magcache(), link::next, SLAB_CACHE_MAGDEFERRED, spinlock_lock, and spinlock_unlock(). Referenced by main_bsp_separated_stack(). Here is the call graph for this function: ![]() |
|
Return slab object to cache Definition at line 765 of file slab.c. References _slab_free(), and NULL. Referenced by _btree_remove(), ipc_call_free(), slab_cache_destroy(), slab_space_free(), thr_constructor(), thr_destructor(), thread_create(), and thread_destroy(). Here is the call graph for this function: ![]() |
|
Take new object from slab or create new if needed
Definition at line 274 of file slab.c. References slab_t::available, slab_cache_t::constructor, slab_cache_t::full_slabs, slab_t::link, list_empty(), list_get_instance, list_prepend(), list_remove(), link::next, slab_t::nextavail, NULL, slab_cache_t::partial_slabs, slab_cache_t::size, slab_obj_destroy(), slab_space_alloc(), spinlock_lock, spinlock_unlock(), and slab_t::start. Referenced by slab_alloc(). Here is the call graph for this function: ![]() |
|
Return object to slab and call a destructor
Definition at line 232 of file slab.c. References ASSERT, slab_t::available, slab_t::cache, slab_cache_t::destructor, slab_t::link, list_prepend(), list_remove(), slab_t::nextavail, obj2slab(), slab_cache_t::objects, slab_cache_t::partial_slabs, slab_cache_t::size, slab_space_free(), spinlock_lock, spinlock_unlock(), and slab_t::start. Referenced by _slab_free(), magazine_destroy(), and slab_obj_create(). Here is the call graph for this function: ![]() |
|
Definition at line 795 of file slab.c. References slab_cache_t::allocated_objs, slab_cache_t::allocated_slabs, atomic_get(), slab_cache_t::cached_objs, slab_cache_t::flags, interrupts_disable(), interrupts_restore(), list_get_instance, slab_cache_t::name, link::next, slab_cache_t::objects, slab_cache_t::order, printf(), slab_cache_t::size, SLAB_CACHE_SLINSIDE, spinlock_lock, and spinlock_unlock(). Referenced by cmd_slabs(). Here is the call graph for this function: ![]() |
|
Definition at line 771 of file slab.c. References _slab_reclaim(), list_get_instance, link::next, spinlock_lock, and spinlock_unlock(). Referenced by frame_alloc_generic(). Here is the call graph for this function: ![]() |
|
Allocate frames for slab space and initialize Definition at line 157 of file slab.c. References ADDR2PFN(), slab_cache_t::allocated_slabs, atomic_inc(), slab_t::available, slab_t::cache, slab_cache_t::flags, frame_alloc_rc_zone, frame_free(), FRAME_KA, FRAME_OK, frame_set_parent(), slab_t::nextavail, NULL, slab_cache_t::objects, slab_cache_t::order, PAGE_SIZE, PFN2ADDR(), slab_cache_t::size, slab_alloc(), SLAB_CACHE_SLINSIDE, slab_extern_cache, and slab_t::start. Referenced by slab_obj_create(). Here is the call graph for this function: ![]() |
|
Deallocate space associated with slab
Definition at line 204 of file slab.c. References ADDR2PFN(), slab_cache_t::allocated_slabs, atomic_dec(), slab_cache_t::flags, frame_free(), slab_cache_t::order, SLAB_CACHE_SLINSIDE, slab_extern_cache, slab_free(), and slab_t::start. Referenced by slab_obj_destroy(). Here is the call graph for this function: ![]() |
|
This lock is used for synchronisation between sender and recipients of TLB shootdown message. It must be acquired before CPU structure lock. |
|
|
|
This lock protects inactive_as_with_asid_head list. It must be acquired before as_t mutex. |
|
Wrapper for as_area_create(). Definition at line 1512 of file as.c. References anon_backend, AS, AS_AREA_CACHEABLE, as_area_create(), and NULL. Here is the call graph for this function: ![]() |
|
Wrapper for as_area_destroy. Definition at line 1527 of file as.c. References AS, and as_area_destroy(). Here is the call graph for this function: ![]() |
|
Wrapper for as_area_resize. Definition at line 1521 of file as.c. References AS, and as_area_resize(). Here is the call graph for this function: ![]() |
|
|
|
Definition at line 62 of file tlb.c. References tlb_arch_init. Referenced by main_ap(), and main_bsp_separated_stack(). |
|
Invalidate all entries in TLB. Definition at line 42 of file tlb.c. Referenced by tlb_invalidate_asid(), and tlb_shootdown_ipi_recv(). |
|
Invalidate all entries in TLB that belong to specified address space.
Definition at line 51 of file tlb.c. References tlb_invalidate_all(). Referenced by tlb_shootdown_ipi_recv(). Here is the call graph for this function: ![]() |
|
Invalidate TLB entries for specified page range belonging to specified address space.
Definition at line 62 of file tlb.c. References invlpg(), and PAGE_SIZE. Referenced by tlb_shootdown_ipi_recv(). Here is the call graph for this function: ![]() |
|
|
|
Finish TLB shootdown sequence. Definition at line 128 of file tlb.c. References CPU, and spinlock_unlock(). Here is the call graph for this function: ![]() |
|
Receive TLB shootdown message. Definition at line 140 of file tlb.c. References ASSERT, count, CPU, panic, spinlock_lock, spinlock_unlock(), tlb_invalidate_all(), tlb_invalidate_asid(), tlb_invalidate_pages(), TLB_INVL_ALL, TLB_INVL_ASID, TLB_INVL_PAGES, and TLB_MESSAGE_QUEUE_LEN. Referenced by tlb_shootdown_ipi(). Here is the call graph for this function: ![]() |
|
Definition at line 134 of file tlb.c. References ipi_broadcast(), and VECTOR_TLB_SHOOTDOWN_IPI. Here is the call graph for this function: ![]() |
|
Send TLB shootdown message. This function attempts to deliver TLB shootdown message to all other processors. This function must be called with interrupts disabled.
Definition at line 81 of file tlb.c. References config, CPU, config_t::cpu_count, cpus, spinlock_lock, TLB_INVL_ALL, and TLB_MESSAGE_QUEUE_LEN. Referenced by as_area_destroy(), and as_area_resize(). |
|
Mark portion of address space area as used. The address space area must be already locked.
Definition at line 1098 of file as.c. References ALIGN_DOWN, ASSERT, btree_insert(), btree_leaf_node_left_neighbour(), btree_leaf_node_right_neighbour(), btree_remove(), btree_search(), btree_node::key, btree_node::keys, overlaps(), PAGE_SIZE, and btree_node::value. Referenced by phys_page_fault(). Here is the call graph for this function: ![]() |
|
Mark portion of address space area as unused. The address space area must be already locked.
Definition at line 1325 of file as.c. References ALIGN_DOWN, ASSERT, btree_remove(), btree_search(), btree_node::key, btree_node::keys, PAGE_SIZE, and btree_node::value. Referenced by as_area_resize(). Here is the call graph for this function: ![]() |
|
Buddy system bisect implementation
Definition at line 349 of file frame.c. References frame_t::buddy_link, frame_t::buddy_order, and list_get_instance. |
|
Buddy system coalesce implementation
Definition at line 366 of file frame.c. References list_get_instance. |
|
Buddy system find_block implementation Find block that is parent of current list. That means go to lower addresses, until such block is found
Definition at line 273 of file frame.c. References frame_t::buddy_link, frame_t::buddy_order, buddy_system::data, frame_index(), zone_t::frames, list_get_instance, and NULL. Here is the call graph for this function: ![]() |
|
Buddy system find_buddy implementation
Definition at line 311 of file frame.c. References ASSERT, frame_t::buddy_link, frame_t::buddy_order, buddy_system::data, frame_index(), frame_index_abs(), frame_index_valid(), zone_t::frames, IS_BUDDY_LEFT_BLOCK_ABS, IS_BUDDY_ORDER_OK, IS_BUDDY_RIGHT_BLOCK_ABS, list_get_instance, NULL, and frame_t::refcount. Here is the call graph for this function: ![]() |
|
Buddy system get_order implementation
Definition at line 396 of file frame.c. References frame_t::buddy_order, and list_get_instance. |
|
Buddy system mark_available implementation
Definition at line 421 of file frame.c. References list_get_instance, and frame_t::refcount. |
|
Buddy system mark_busy implementation
Definition at line 408 of file frame.c. References list_get_instance, and frame_t::refcount. |
|
Definition at line 292 of file frame.c. References buddy_system::data, frame_index(), list_get_instance, and printf(). Here is the call graph for this function: ![]() |
|
Buddy system set_order implementation
Definition at line 383 of file frame.c. References frame_t::buddy_order, and list_get_instance. |
|
Definition at line 220 of file frame.c. References zone_t::buddy_system, and buddy_system_can_alloc(). Referenced by find_free_zone_lock(), and zone_merge(). Here is the call graph for this function: ![]() |
|
Compute configuration data size for zone
Definition at line 820 of file frame.c. References buddy_conf_size(), and fnzb. Referenced by return_config_frames(), zone_create(), and zone_merge(). Here is the call graph for this function: ![]() |
|
Create frame zone Create new frame zone.
Definition at line 779 of file frame.c. References zone_t::base, buddy_conf_size(), zone_t::buddy_system, buddy_system_create(), zone_t::busy_count, zone_t::count, zone_t::flags, fnzb, frame_initialize(), zone_t::free_count, spinlock_initialize(), and zone_buddy_system_operations. Here is the call graph for this function: ![]() |
|
Create and add zone to system
Definition at line 845 of file frame.c. References init_task_t::addr, ASSERT, config_t::base, init_t::cnt, config, init, config_t::kernel_size, overlaps(), PFN2ADDR(), init_task_t::size, SIZE2FRAMES(), init_t::tasks, and zone_conf_size(). Referenced by init_e820_memory(). Here is the call graph for this function: ![]() |
|
Allocate frame in particular zone Assume zone is locked Panics if allocation is impossible.
Definition at line 453 of file frame.c. References ASSERT, zone_t::buddy_system, buddy_system_alloc(), zone_t::busy_count, zone_t::free_count, list_get_instance, and make_frame_index(). Referenced by frame_alloc_generic(), and zone_merge(). Here is the call graph for this function: ![]() |
|
Free frame from zone Assume zone is locked
Definition at line 483 of file frame.c. References ASSERT, frame_t::buddy_link, frame_t::buddy_order, zone_t::buddy_system, buddy_system_free(), zone_t::busy_count, zone_t::frames, zone_t::free_count, and frame_t::refcount. Referenced by frame_free(), and return_config_frames(). Here is the call graph for this function: ![]() |
|
Return frame from zone Definition at line 505 of file frame.c. References ASSERT, count, and zone_t::frames. Referenced by frame_get_parent(), frame_set_parent(), and zone_mark_unavailable(). |
|
Mark frame in zone unavailable to allocation Definition at line 512 of file frame.c. References ASSERT, frame_t::buddy_link, zone_t::buddy_system, buddy_system_alloc_block(), zone_t::free_count, frame_t::refcount, and zone_get_frame(). Referenced by frame_mark_unavailable(). Here is the call graph for this function: ![]() |
|
Merge zones z1 and z2
Definition at line 687 of file frame.c. References _zone_merge(), zone_t::base, zone_t::busy_count, zone_t::count, fnzb, interrupts_disable(), interrupts_restore(), PFN2ADDR(), return_config_frames(), SIZE2FRAMES(), spinlock_lock, spinlock_unlock(), zone_can_alloc(), zone_conf_size(), zone_frame_alloc(), zone_reduce_region(), and zones. Referenced by zone_merge_all(). Here is the call graph for this function: ![]() |
|
Merge all zones into one big zone It is reasonable to do this on systems whose bios reports parts in chunks, so that we could have 1 zone (it's faster). Definition at line 758 of file frame.c. References count, zone_merge(), and zones. Referenced by arch_post_mm_init(). Here is the call graph for this function: ![]() |
|
Prints list of zones Definition at line 1096 of file frame.c. References zone_t::base, zone_t::busy_count, zone_t::free_count, interrupts_disable(), NULL, PFN2ADDR(), printf(), spinlock_lock, spinlock_unlock(), and zones. Referenced by cmd_zones(). Here is the call graph for this function: ![]() |
|
Prints zone details.
Definition at line 1119 of file frame.c. References interrupts_disable(), NULL, PFN2ADDR(), spinlock_lock, and zones. Referenced by cmd_zone(). Here is the call graph for this function: ![]() |
|
Reduce allocated block to count of order 0 frames The allocated block need 2^order frames of space. Reduce all frames in block to order 0 and free the unneeded frames. This means, that when freeing the previously allocated block starting with frame_idx, you have to free every frame.
Definition at line 653 of file frame.c. References ASSERT, frame_t::buddy_order, zone_t::frames, and frame_t::refcount. Referenced by zone_merge(). |
|
Insert-sort zone into zones list
Definition at line 144 of file frame.c. References zone_t::base, zone_t::count, interrupts_disable(), overlaps(), panic, printf(), spinlock_lock, zones, and ZONES_MAX. Here is the call graph for this function: ![]() |
|
Initial value: { .page_fault = anon_page_fault, .frame_free = anon_frame_free, .share = anon_share } Definition at line 58 of file backend_anon.c. Referenced by sys_as_area_create(), and task_run_program(). |
|
Kernel address space. Definition at line 93 of file as.c. Referenced by as_destroy(), as_init(), as_switch(), hw_map(), main_bsp_separated_stack(), map_sdt(), map_structure(), page_arch_init(), ptl0_create(), and smp_init(). |
|
Definition at line 81 of file as.c. Referenced by as_arch_init(), page_table_create(), page_table_destroy(), page_table_lock(), and page_table_unlock(). |
|
|
|
Initial value: { .page_fault = elf_page_fault, .frame_free = elf_frame_free, .share = elf_share } Definition at line 57 of file backend_elf.c. Referenced by load_segment(). |
|
Definition at line 53 of file interrupt.c. |
|
|
|
Magazine cache Definition at line 118 of file slab.c. Referenced by make_empty_current_mag(), and slab_cache_init(). |
|
Caches for malloc Definition at line 129 of file slab.c. Referenced by malloc(), and slab_cache_init(). |
|
Initial value: { "malloc-16","malloc-32","malloc-64","malloc-128", "malloc-256","malloc-512","malloc-1K","malloc-2K", "malloc-4K","malloc-8K","malloc-16K","malloc-32K", "malloc-64K","malloc-128K","malloc-256K" } Definition at line 130 of file slab.c. Referenced by slab_cache_init(). |
|
Definition at line 52 of file interrupt.c. |
|
Virtual operations for page subsystem. Definition at line 56 of file page.c. Referenced by page_mapping_find(), page_mapping_insert(), and page_mapping_remove(). |
|
Virtual operations for page subsystem. Definition at line 56 of file page.c. Referenced by page_mapping_find(), page_mapping_insert(), and page_mapping_remove(). |
|
Initial value: { .page_fault = phys_page_fault, .frame_free = NULL, .share = phys_share } Definition at line 52 of file backend_phys.c. Referenced by as_area_resize(), and ddi_physmem_map(). |
|
Cache for cache descriptors Definition at line 120 of file slab.c. Referenced by slab_cache_create(), slab_cache_destroy(), and slab_cache_init(). |
|
Cache for external slab descriptors This time we want per-cpu cache, so do not make it static
Definition at line 127 of file slab.c. Referenced by slab_cache_init(), slab_space_alloc(), and slab_space_free(). |
|
Initial value: { .find_buddy = zone_buddy_find_buddy, .bisect = zone_buddy_bisect, .coalesce = zone_buddy_coalesce, .set_order = zone_buddy_set_order, .get_order = zone_buddy_get_order, .mark_busy = zone_buddy_mark_busy, .mark_available = zone_buddy_mark_available, .find_block = zone_buddy_find_block, .print_id = zone_buddy_print_id } Definition at line 427 of file frame.c. Referenced by _zone_merge(), and zone_construct(). |
|
Referenced by find_free_zone_lock(), find_zone_and_lock(), frame_init(), zone_merge(), zone_merge_all(), zone_print_list(), zone_print_one(), and zones_add_zone(). |