Changeset 672 for trunk/kernel/mm/vmm.c
- Timestamp:
- Nov 19, 2020, 11:49:01 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.c
r665 r672 2 2 * vmm.c - virtual memory manager related operations definition. 3 3 * 4 * Authors Ghassan Almaless (2008,2009,2010,2011, 5 * Alain Greiner (2016,2017,2018,2019,2020)4 * Authors Ghassan Almaless (2008,2009,2010,2011,2012) 5 * Alain Greiner (2016,2017,2018,2019,2020) 6 6 * 7 7 * Copyright (c) UPMC Sorbonne Universites … … 63 63 64 64 // check STACK zone 65 assert( ((CONFIG_VMM_STACK_SIZE * CONFIG_THREADS_MAX_PER_CLUSTER) <=65 assert( __FUNCTION__, ((CONFIG_VMM_STACK_SIZE * CONFIG_THREADS_MAX_PER_CLUSTER) <= 66 66 (CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE)) , "STACK zone too small\n"); 67 67 … … 89 89 90 90 // check ltid argument 91 assert( (ltid <= ((CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE) / CONFIG_VMM_STACK_SIZE)),91 assert( __FUNCTION__, (ltid <= ((CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE) / CONFIG_VMM_STACK_SIZE)), 92 92 "slot index %d too large for an user stack vseg", ltid ); 93 93 … … 99 99 100 100 // check requested slot is available 101 assert( (bitmap_state( &mgr->bitmap , ltid ) == false),101 assert( __FUNCTION__, (bitmap_state( &mgr->bitmap , ltid ) == false), 102 102 "slot index %d already allocated", ltid ); 103 103 … … 149 149 150 150 // check index 151 assert( (index <= ((CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE) / CONFIG_VMM_STACK_SIZE)),151 assert( __FUNCTION__, (index <= ((CONFIG_VMM_VSPACE_SIZE - CONFIG_VMM_STACK_BASE) / CONFIG_VMM_STACK_SIZE)), 152 152 "slot index %d too large for an user stack vseg", index ); 153 153 154 154 // check released slot is allocated 155 assert( (bitmap_state( &mgr->bitmap , index ) == true),155 assert( __FUNCTION__, (bitmap_state( &mgr->bitmap , index ) == true), 156 156 "released slot index %d non allocated", index ); 157 157 … … 226 226 227 227 // check HEAP base and size 228 assert( (CONFIG_VMM_HEAP_BASE == 0x40000) & (CONFIG_VMM_STACK_BASE == 0xc0000),228 assert( __FUNCTION__, (CONFIG_VMM_HEAP_BASE == 0x40000) & (CONFIG_VMM_STACK_BASE == 0xc0000), 229 229 "CONFIG_VMM_HEAP_BASE != 0x40000 or CONFIG_VMM_STACK_BASE != 0xc0000" ); 230 230 231 231 // check MMAP vseg max order 232 assert( (CONFIG_VMM_HEAP_MAX_ORDER == 18), "max mmap vseg size is 256K pages" );232 assert( __FUNCTION__, (CONFIG_VMM_HEAP_MAX_ORDER == 18), "max mmap vseg size is 256K pages" ); 233 233 234 234 // get pointer on MMAP allocator … … 252 252 vseg_t * vseg0 = vseg_alloc(); 253 253 254 assert( (vseg0 != NULL) , "cannot allocate vseg" );254 assert( __FUNCTION__, (vseg0 != NULL) , "cannot allocate vseg" ); 255 255 256 256 vseg0->vpn_base = CONFIG_VMM_HEAP_BASE; … … 263 263 vseg_t * vseg1 = vseg_alloc(); 264 264 265 assert( (vseg1 != NULL) , "cannot allocate vseg" );265 assert( __FUNCTION__, (vseg1 != NULL) , "cannot allocate vseg" ); 266 266 267 267 vseg1->vpn_base = CONFIG_VMM_HEAP_BASE << 1; … … 555 555 556 556 // check UTILS zone 557 assert( ((CONFIG_VMM_ARGS_SIZE + CONFIG_VMM_ENVS_SIZE) <= 558 (CONFIG_VMM_ELF_BASE - CONFIG_VMM_UTILS_BASE)) , 559 "UTILS zone too small\n" ); 557 assert( __FUNCTION__ , ((CONFIG_VMM_ARGS_SIZE + CONFIG_VMM_ENVS_SIZE) <= 558 (CONFIG_VMM_ELF_BASE - CONFIG_VMM_UTILS_BASE)) , "UTILS zone too small\n" ); 560 559 561 560 // initialize lock protecting the VSL 562 561 remote_queuelock_init( XPTR( local_cxy , &vmm->vsl_lock ) , LOCK_VMM_VSL ); 563 564 562 565 563 // initialize STACK allocator … … 577 575 vmm->global_pgfault_cost = 0; 578 576 579 /*580 // register "args" vseg in VSL581 base = CONFIG_VMM_UTILS_BASE << CONFIG_PPM_PAGE_SHIFT;582 size = CONFIG_VMM_ARGS_SIZE << CONFIG_PPM_PAGE_SHIFT;583 584 vseg_args = vmm_create_vseg( process,585 VSEG_TYPE_DATA,586 base,587 size,588 0, // file_offset unused589 0, // file_size unused590 XPTR_NULL, // mapper_xp unused591 local_cxy );592 if( vseg_args == NULL )593 {594 printk("\n[ERROR] in %s : cannot register args vseg\n", __FUNCTION__ );595 return -1;596 }597 598 vmm->args_vpn_base = base;599 600 // register "envs" vseg in VSL601 base = (CONFIG_VMM_UTILS_BASE + CONFIG_VMM_ARGS_SIZE) << CONFIG_PPM_PAGE_SHIFT;602 size = CONFIG_VMM_ENVS_SIZE << CONFIG_PPM_PAGE_SHIFT;603 604 vseg_envs = vmm_create_vseg( process,605 VSEG_TYPE_DATA,606 base,607 size,608 0, // file_offset unused609 0, // file_size unused610 XPTR_NULL, // mapper_xp unused611 local_cxy );612 if( vseg_envs == NULL )613 {614 printk("\n[ERROR] in %s : cannot register envs vseg\n", __FUNCTION__ );615 return -1;616 }617 618 vmm->envs_vpn_base = base;619 */620 577 hal_fence(); 621 578 … … 716 673 // FIXME il faut gérer les process copies... 717 674 675 // re-initialise VMM 676 vmm_user_init( process ); 677 718 678 #if DEBUG_VMM_USER_RESET 719 679 cycle = (uint32_t)hal_get_cycles(); … … 1133 1093 1134 1094 // check cluster is reference 1135 assert( (XPTR( local_cxy , process ) == process->ref_xp),1095 assert( __FUNCTION__, (XPTR( local_cxy , process ) == process->ref_xp), 1136 1096 "local cluster must be process reference cluster\n"); 1137 1097 … … 1869 1829 1870 1830 // check arguments 1871 assert( (process != NULL), "process argument is NULL" );1872 assert( (vseg != NULL), "vseg argument is NULL" );1831 assert( __FUNCTION__, (process != NULL), "process argument is NULL" ); 1832 assert( __FUNCTION__, (vseg != NULL), "vseg argument is NULL" ); 1873 1833 1874 1834 // get pointers on local process VMM … … 1960 1920 1961 1921 // check arguments 1962 assert( (process != NULL), "process argument is NULL" );1963 assert( (vseg != NULL), "vseg argument is NULL" );1922 assert( __FUNCTION__, (process != NULL), "process argument is NULL" ); 1923 assert( __FUNCTION__, (vseg != NULL), "vseg argument is NULL" ); 1964 1924 1965 1925 #if DEBUG_VMM_RESIZE_VSEG … … 2228 2188 2229 2189 // check vseg type 2230 assert( ( type != VSEG_TYPE_FILE ) , "illegal vseg type\n" );2190 assert( __FUNCTION__, ( type != VSEG_TYPE_FILE ) , "illegal vseg type\n" ); 2231 2191 2232 2192 // compute target cluster identifier … … 2302 2262 xptr_t mapper_xp = vseg->mapper_xp; 2303 2263 2304 assert( (mapper_xp != XPTR_NULL),2264 assert( __FUNCTION__, (mapper_xp != XPTR_NULL), 2305 2265 "mapper not defined for a FILE vseg\n" ); 2306 2266 … … 2327 2287 xptr_t mapper_xp = vseg->mapper_xp; 2328 2288 2329 assert( (mapper_xp != XPTR_NULL),2289 assert( __FUNCTION__, (mapper_xp != XPTR_NULL), 2330 2290 "mapper not defined for a CODE or DATA vseg\n" ); 2331 2291
Note: See TracChangeset
for help on using the changeset viewer.