Changeset 577 for trunk/kernel/mm


Ignore:
Timestamp:
Oct 5, 2018, 10:54:14 AM (6 years ago)
Author:
alain
Message:

Fix small bugs.

Location:
trunk/kernel/mm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/kmem.c

    r567 r577  
    190190        uint32_t    size;    // ln( pages ) if PPM / bytes if KHM / unused if KCM
    191191        void      * ptr;     // memory buffer if KHM or KCM / page descriptor if PPM
    192         uint32_t    irq_state;
    193 
    194192
    195193        type  = req->type;
  • trunk/kernel/mm/vmm.c

    r567 r577  
    2929#include <hal_gpt.h>
    3030#include <hal_vmm.h>
     31#include <hal_macros.h>
    3132#include <printk.h>
    3233#include <memcpy.h>
     
    4647#include <kmem.h>
    4748#include <vmm.h>
    48 #include <cluster_info.h>
    4949
    5050//////////////////////////////////////////////////////////////////////////////////
     
    14081408    cxy_t        page_cxy;
    14091409    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;
    14131416
    14141417// check vseg type
     
    14171420    if( flags & VSEG_DISTRIB )    // distributed => cxy depends on vpn LSB
    14181421    {
    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();
    14321429        }
    1433         page_cxy = ( x << y_width ) + y;
    1434 
    1435 //      if ( LOCAL_CLUSTER->valid[x][y] == false ) page_cxy = cluster_random_select();
    1436 
    14371430    }
    14381431    else                          // other cases => cxy specified in vseg
Note: See TracChangeset for help on using the changeset viewer.