Ignore:
Timestamp:
Jun 12, 2012, 4:21:27 PM (12 years ago)
Author:
karaoui
Message:

giet-vm new version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sys/sys_handler.c

    r158 r160  
    1212
    1313#include <sys_handler.h>
    14 #include <boot_handler.h>
     14//#include <boot_handler.h>
    1515#include <drivers.h>
    1616#include <ctx_handler.h>
     
    4949    &_sys_ukn,          /* 0x18 */
    5050    &_sys_ukn,          /* 0x19 */
    51     &_mwmr_base,        /* 0x1A */
     51    &_vobj_get_vbase,   /* 0x1A */
    5252    &_sys_ukn,          /* 0x1B */
    5353    &_sys_ukn,          /* 0x1C */
     
    117117                            unsigned int*       buffer)
    118118{
    119     mapping_header_t*   header  = (mapping_header_t*)&seg_boot_mapping_base;
     119    mapping_header_t*   header  = (mapping_header_t*)&seg_mapping_base;
    120120    mapping_cluster_t*  cluster = _get_cluster_base( header );
    121121
     
    131131}
    132132/////////////////////////////////////////////////////////////////////////////
    133 // _mwmr_base()
    134 // returns in buffer argument the base address of the MWMR channel
    135 // identified by the (vspace_name / channel_name) couple.
     133// _vobj_get_base()
     134// returns 0: success, else: failed.
     135// give access to the base address of a vobj identified by the (vspace_name / channel_name ) couple.
     136// The "type" argument is here for checking purpose.
    136137/////////////////////////////////////////////////////////////////////////////
    137 unsigned int _mwmr_base( char* vspace_name,
    138                          char* channel_name,
    139                          unsigned int* buffer )
     138unsigned int _vobj_get_vbase( char* vspace_name, char* vobj_name,
     139                        unsigned vobj_type, unsigned int* vobj_buffer)
    140140{
    141     mapping_header_t* header = (mapping_header_t*)&seg_boot_mapping_base;
     141    mapping_header_t* header = (mapping_header_t*)&seg_mapping_base;
    142142    mapping_vspace_t* vspace = _get_vspace_base( header );
    143     mapping_vseg_t*   vseg   = _get_vseg_base( header );
     143    mapping_vobj_t*    vobj  = _get_vobj_base( header );
    144144
    145145    unsigned int    vspace_id;
    146     unsigned int    vseg_id;
     146    unsigned int    vobj_id;
     147       
    147148
    148149    // scan vspaces
     
    151152        if ( _strncmp( vspace[vspace_id].name, vspace_name, 31) == 0 )
    152153        {
    153             // scan vsegs
    154             for ( vseg_id = vspace[vspace_id].vseg_offset ;
    155                   vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs) ;
    156                   vseg_id++ )
     154            // scan vobjs
     155            for(vobj_id= vspace[vspace_id].vobj_offset; vobj_id < (vspace[vspace_id].vobj_offset + vspace[vspace_id].vobjs); vobj_id++)
    157156            {
    158                 if ( _strncmp( vseg[vseg_id].name, channel_name, 31) == 0 )
     157
     158                if ( _strncmp( vobj[vobj_id].name, vobj_name, 31) == 0 )
    159159                {
    160                     *buffer = vseg[vseg_id].vbase;
     160                    if(vobj[vobj_id].type != vobj_type)
     161                        return -1;//wrong type
     162
     163                    *vobj_buffer = (unsigned int)vobj[vobj_id].vaddr;
    161164                    return 0;
    162165                }
     
    165168    }
    166169    // not found !!!
    167     return 1;
     170    return -2;
    168171}
    169172
Note: See TracChangeset for help on using the changeset viewer.