Changeset 577 for trunk/kernel/mm
- Timestamp:
- Oct 5, 2018, 10:54:14 AM (6 years ago)
- Location:
- trunk/kernel/mm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/kmem.c
r567 r577 190 190 uint32_t size; // ln( pages ) if PPM / bytes if KHM / unused if KCM 191 191 void * ptr; // memory buffer if KHM or KCM / page descriptor if PPM 192 uint32_t irq_state;193 194 192 195 193 type = req->type; -
trunk/kernel/mm/vmm.c
r567 r577 29 29 #include <hal_gpt.h> 30 30 #include <hal_vmm.h> 31 #include <hal_macros.h> 31 32 #include <printk.h> 32 33 #include <memcpy.h> … … 46 47 #include <kmem.h> 47 48 #include <vmm.h> 48 #include <cluster_info.h>49 49 50 50 ////////////////////////////////////////////////////////////////////////////////// … … 1408 1408 cxy_t page_cxy; 1409 1409 kmem_req_t req; 1410 1411 uint32_t type = vseg->type; 1412 uint32_t flags = vseg->flags; 1410 uint32_t index; 1411 1412 uint32_t type = vseg->type; 1413 uint32_t flags = vseg->flags; 1414 uint32_t x_size = LOCAL_CLUSTER->x_size; 1415 uint32_t y_size = LOCAL_CLUSTER->y_size; 1413 1416 1414 1417 // check vseg type … … 1417 1420 if( flags & VSEG_DISTRIB ) // distributed => cxy depends on vpn LSB 1418 1421 { 1419 uint32_t x_size = LOCAL_CLUSTER->x_size; 1420 uint32_t y_size = LOCAL_CLUSTER->y_size; 1421 uint32_t y_width = LOCAL_CLUSTER->y_width; 1422 uint32_t index = vpn & ((x_size * y_size) - 1); 1423 uint32_t x = index / y_size; 1424 uint32_t y = index % y_size; 1425 1426 // If the cluster selected from VPN's LSBs is empty, then we select one randomly 1427 // cluster_random_select() ensures that its randomly selected cluster is not empty 1428 if ( cluster_info_is_active( LOCAL_CLUSTER->cluster_info[x][y] ) == 0 ) { 1429 cxy_t cxy = cluster_random_select(); 1430 x = ( ( cxy >> y_width ) & 0xF); 1431 y = ( cxy & 0xF ); 1422 index = vpn & ((x_size * y_size) - 1); 1423 page_cxy = HAL_CXY_FROM_XY( (index / y_size) , (index % y_size) ); 1424 1425 // If the cluster selected from VPN's LSBs is empty, we select one randomly 1426 if ( cluster_is_active( page_cxy ) == false ) 1427 { 1428 page_cxy = cluster_random_select(); 1432 1429 } 1433 page_cxy = ( x << y_width ) + y;1434 1435 // if ( LOCAL_CLUSTER->valid[x][y] == false ) page_cxy = cluster_random_select();1436 1437 1430 } 1438 1431 else // other cases => cxy specified in vseg
Note: See TracChangeset
for help on using the changeset viewer.