Changeset 614 for trunk/kernel/mm/vmm.c
- Timestamp:
- Jan 15, 2019, 1:59:32 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/vmm.c
r611 r614 64 64 intptr_t base; 65 65 intptr_t size; 66 uint32_t i; 66 67 67 68 #if DEBUG_VMM_INIT … … 69 70 uint32_t cycle = (uint32_t)hal_get_cycles(); 70 71 if( DEBUG_VMM_INIT ) 71 printk("\n[%s] thread[%x,%x] enter for process %x / cycle %d\n",72 __FUNCTION__ , this->process->pid, this->trdid, process->pid 72 printk("\n[%s] thread[%x,%x] enter for process %x in cluster %x / cycle %d\n", 73 __FUNCTION__ , this->process->pid, this->trdid, process->pid, local_cxy, cycle ); 73 74 #endif 74 75 … … 183 184 vmm->mmap_mgr.first_free_vpn = CONFIG_VMM_HEAP_BASE; 184 185 busylock_init( &vmm->mmap_mgr.lock , LOCK_VMM_MMAP ); 185 186 uint32_t i;187 186 for( i = 0 ; i < 32 ; i++ ) list_root_init( &vmm->mmap_mgr.zombi_list[i] ); 188 187 … … 195 194 cycle = (uint32_t)hal_get_cycles(); 196 195 if( DEBUG_VMM_INIT ) 197 printk("\n[%s] thread[%x,%x] exit / process %x / entry_point%x / cycle %d\n",198 __FUNCTION__, this->process->pid, this->trdid, process->pid, process->vmm.entry_point, cycle );196 printk("\n[%s] thread[%x,%x] exit for process %x in cluster %x / cycle %d\n", 197 __FUNCTION__, this->process->pid, this->trdid, process->pid, local_cxy, cycle ); 199 198 #endif 200 199 … … 944 943 vpn_t free; 945 944 946 // mmap vseg size must be power of 2 945 #if DEBUG_VMM_MMAP_ALLOC 946 thread_t * this = CURRENT_THREAD; 947 uint32_t cycle = (uint32_t)hal_get_cycles(); 948 if( DEBUG_VMM_MMAP_ALLOC < cycle ) 949 printk("\n[%s] thread[%x,%x] enter / cycle %d\n", 950 __FUNCTION__, this->process->pid, this->trdid, cycle ); 951 #endif 952 953 // vseg size must be power of 2 947 954 // compute actual size and index in zombi_list array 948 955 size = POW2_ROUNDUP( npages ); … … 952 959 mmap_mgr_t * mgr = &vmm->mmap_mgr; 953 960 961 printk("\n@@@ in %s : size = %d / index = %d / first = %d / empty = %d\n", 962 __FUNCTION__, size, index, mgr->vpn_size, list_is_empty(&mgr->zombi_list[index]) ); 963 954 964 // get lock on mmap allocator 955 965 busylock_acquire( &mgr->lock ); … … 958 968 if( list_is_empty( &mgr->zombi_list[index] ) ) // from mmap zone 959 969 { 970 971 printk("\n@@@ from mmap zone\n" ); 972 960 973 // check overflow 961 974 free = mgr->first_free_vpn; 962 if( (free + size) > mgr->vpn_size ) return ENOMEM;963 964 // update STACKallocator975 if( (free + size) > mgr->vpn_size ) return -1; 976 977 // update MMAP allocator 965 978 mgr->first_free_vpn += size; 966 979 … … 970 983 else // from zombi_list 971 984 { 985 986 printk("\n@@@ from zombi_list\n" ); 987 972 988 // get pointer on zombi vseg from zombi_list 973 989 vseg = LIST_FIRST( &mgr->zombi_list[index] , vseg_t , zlist ); … … 982 998 // release lock on mmap allocator 983 999 busylock_release( &mgr->lock ); 1000 1001 #if DEBUG_VMM_MMAP_ALLOC 1002 cycle = (uint32_t)hal_get_cycles(); 1003 if( DEBUG_VMM_DESTROY < cycle ) 1004 printk("\n[%s] thread[%x,%x] exit / vpn_base %x / vpn_size %x / cycle %d\n", 1005 __FUNCTION__, this->process->pid, this->trdid, base, size, cycle ); 1006 #endif 984 1007 985 1008 // returns vpn_base, vpn_size … … 1009 1032 uint32_t cycle = (uint32_t)hal_get_cycles(); 1010 1033 if( DEBUG_VMM_CREATE_VSEG < cycle ) 1011 printk("\n[%s] thread[%x,%x] enter / %s / cxy %x / cycle %d\n",1012 __FUNCTION__, this->process->pid, this->trdid, vseg_type_str(type), cxy, cycle );1034 printk("\n[%s] thread[%x,%x] enter for process %x / %s / cxy %x / cycle %d\n", 1035 __FUNCTION__, this->process->pid, this->trdid, process->pid, vseg_type_str(type), cxy, cycle ); 1013 1036 #endif 1014 1037 … … 1092 1115 if( vseg != NULL ) 1093 1116 { 1094 printk("\n[ERROR] in %s for process %x : new vseg [vpn_base = %x / vpn_size =%x]\n"1095 " overlap existing vseg [vpn_base = %x / vpn_size =%x]\n",1117 printk("\n[ERROR] in %s for process %x : new vseg [vpn_base %x / vpn_size %x]\n" 1118 " overlap existing vseg [vpn_base %x / vpn_size %x]\n", 1096 1119 __FUNCTION__ , process->pid, vpn_base, vpn_size, vseg->vpn_base, vseg->vpn_size ); 1097 1120 return NULL; … … 1106 1129 return NULL; 1107 1130 } 1131 1132 #if DEBUG_VMM_CREATE_VSEG 1133 if( DEBUG_VMM_CREATE_VSEG < cycle ) 1134 printk("\n[%s] thread[%x,%x] : base %x / size %x / vpn_base %x / vpn_size %x\n", 1135 __FUNCTION__, this->process->pid, this->trdid, base, size, vpn_base, vpn_size ); 1136 #endif 1108 1137 1109 1138 // initialize vseg descriptor
Note: See TracChangeset
for help on using the changeset viewer.