Changeset 513 for soft


Ignore:
Timestamp:
Feb 14, 2015, 5:10:32 PM (9 years ago)
Author:
alain
Message:

Remove the vobj object from mapping_info.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_boot/boot.c

    r493 r513  
    3434//    - The structure of the various multi-threaded software applications:
    3535//      number of tasks, communication channels.
    36 //    - The mapping: grouping of virtual objects (vobj) in the virtual segments (vseg),
    37 //      placement of virtual segments (vseg) in the physical segments (pseg), placement
    38 //      of software tasks on the processors,
     36//    - The mapping: placement of virtual segments (vseg) in the physical
     37//      segments (pseg), placement of software tasks on the processors,
    3938//
    4039// 3) The GIET-VM uses the paged virtual memory to provides two services:
     
    5251//    Each page table (one page table per virtual space) is monolithic, and contains
    5352//    one PT1 (8 Kbytes) and a variable number of PT2s (4 Kbytes each). For each vspace,
    54 //    the numberof PT2s is defined by the size of the PTAB vobj in the mapping.
     53//    the number of PT2s is defined by the size of the PTAB vseg in the mapping.
    5554//    The PT1 is indexed by the ix1 field (11 bits) of the VPN. Each entry is 32 bits.
    5655//    A PT2 is indexed the ix2 field (9 bits) of the VPN. Each entry is a double word.
     
    334333//   vseg can cover several contiguous big physical pages.
    335334//
    336 // 1) First step: it computes the vseg length, and register it in vseg->length field.
    337 //    It computes - for each vobj - the actual vbase address, taking into
    338 //    account the alignment constraints and register it in vobj->vbase field.
     335// 1) First step: it computes various vseg attributes and checks
     336//    alignment constraints.
    339337//
    340338// 2) Second step: it allocates the required number of contiguous physical pages,
     
    345343//    is reserved for the boot vsegs.
    346344//
    347 // 3) Third step (only for vseg that have the VOBJ_TYPE_PTAB): the M page tables
     345// 3) Third step (only for vseg that have the VSEG_TYPE_PTAB): the M page tables
    348346//    associated to the M vspaces must be packed in the same vseg.
    349347//    We divide this vseg in M sub-segments, and compute the vbase and pbase
     
    356354{
    357355    mapping_header_t*   header  = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
    358     mapping_vobj_t*     vobj    = _get_vobj_base(header);
    359356    mapping_cluster_t*  cluster = _get_cluster_base(header);
    360357    mapping_pseg_t*     pseg    = _get_pseg_base(header);
     358
     359    //////////// First step : compute vseg attributes
    361360
    362361    // compute destination cluster pointer & coordinates
     
    366365    unsigned int        y_dest     = cluster->y;
    367366
    368     // compute the first vobj global index
    369     unsigned int        vobj_id = vseg->vobj_offset;
    370    
    371367    // compute the "big" vseg attribute
    372368    unsigned int        big = vseg->big;
     369
     370    // all vsegs must be aligned on 4Kbytes
     371    if ( vseg->vbase & 0x00000FFF )
     372    {
     373        _printf("\n[BOOT ERROR] vseg %s not aligned : vbase = %x\n",
     374                vseg->name, vseg->vbase );
     375        _exit();
     376    }
    373377
    374378    // compute the "is_ram" vseg attribute
     
    379383    // compute the "is_ptab" attribute
    380384    unsigned int        is_ptab;
    381     if ( vobj[vobj_id].type == VOBJ_TYPE_PTAB ) is_ptab = 1;
    382     else                                        is_ptab = 0;
     385    if ( vseg->type == VSEG_TYPE_PTAB ) is_ptab = 1;
     386    else                                is_ptab = 0;
    383387
    384388    // compute actual vspace index
     
    387391    else                           vsid = vspace_id;
    388392
    389     //////////// First step : compute vseg length and vobj(s) vbase
    390 
    391     unsigned int vobj_vbase = vseg->vbase;   // min vbase for first vobj
    392 
    393     for ( vobj_id = vseg->vobj_offset ;
    394           vobj_id < (vseg->vobj_offset + vseg->vobjs) ;
    395           vobj_id++ )
    396     {
    397         // compute and register vobj vbase
    398         vobj[vobj_id].vbase = vaddr_align_to( vobj_vbase, vobj[vobj_id].align );
    399    
    400         // compute min vbase for next vobj
    401         vobj_vbase = vobj[vobj_id].vbase + vobj[vobj_id].length;
    402     }
    403 
    404     // compute and register vseg length (multiple of 4 Kbytes)
    405     vseg->length = vaddr_align_to( vobj_vbase - vseg->vbase, 12 );
    406    
    407393    //////////// Second step : compute ppn and npages 
    408394    //////////// - if identity mapping :  ppn <= vpn
     
    490476    vseg->pbase     = ((paddr_t)ppn) << 12;
    491477    vseg->mapped    = 1;
    492     vseg->next_vseg = pseg->next_vseg;
    493     pseg->next_vseg = (unsigned int)vseg;
    494478
    495479
     
    782766    mapping_vspace_t*   vspace = _get_vspace_base(header);
    783767    mapping_vseg_t*     vseg   = _get_vseg_base(header);
    784     mapping_vobj_t*     vobj   = _get_vobj_base(header);
    785768    mapping_cluster_t*  cluster ;
    786769    mapping_pseg_t*     pseg    ;
     
    808791    ///////// Phase 1 : global vseg containing the PTAB (two barriers required)
    809792
    810     // get local PTAB vseg
     793    // get PTAB global vseg in cluster(cx,cy)
    811794    unsigned int found = 0;
    812795    for (vseg_id = 0; vseg_id < header->globals; vseg_id++)
    813796    {
    814         unsigned int vobj_id = vseg[vseg_id].vobj_offset;
    815797        pseg    = _get_pseg_base(header) + vseg[vseg_id].psegid;
    816798        cluster = _get_cluster_base(header) + pseg->clusterid;
    817         if ( (vobj[vobj_id].type == VOBJ_TYPE_PTAB) &&
     799        if ( (vseg[vseg_id].type == VSEG_TYPE_PTAB) &&
    818800             (cluster->x == cx) && (cluster->y == cy) )
    819801        {
     
    845827    for (vseg_id = 0; vseg_id < header->globals; vseg_id++)
    846828    {
    847         unsigned int vobj_id = vseg[vseg_id].vobj_offset;
    848829        pseg    = _get_pseg_base(header) + vseg[vseg_id].psegid;
    849830        cluster = _get_cluster_base(header) + pseg->clusterid;
    850         if ( (vobj[vobj_id].length > 0x200000) &&
     831        if ( (vseg[vseg_id].length > 0x200000) &&
    851832             (vseg[vseg_id].mapped == 0) &&
    852833             (cluster->x == cx) && (cluster->y == cy) )
     
    930911{
    931912    mapping_header_t* header = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
    932     mapping_vobj_t*   vobj   = _get_vobj_base(header);
    933913    mapping_vseg_t*   vseg   = _get_vseg_base(header);
    934914    mapping_pseg_t*   pseg   = _get_pseg_base(header);
     
    939919    for ( vseg_id = 0 ; (vseg_id < header->vsegs) && (found == 0) ; vseg_id++ )
    940920    {
    941         if ( (vobj[vseg[vseg_id].vobj_offset].type == VOBJ_TYPE_SCHED) &&
     921        if ( (vseg[vseg_id].type == VSEG_TYPE_SCHED) &&
    942922             (pseg[vseg[vseg_id].psegid].clusterid == cluster_id ) )
    943923        {
    944924            *vbase  = vseg[vseg_id].vbase;
    945             *length = vobj[vseg[vseg_id].vobj_offset].length;
     925            *length = vseg[vseg_id].length;
    946926            found = 1;
    947927        }
     
    950930    {
    951931        mapping_cluster_t* cluster = _get_cluster_base(header);
    952         _printf("\n[BOOT ERROR] No vobj of type SCHED in cluster [%d,%d]\n",
     932        _printf("\n[BOOT ERROR] No vseg of type SCHED in cluster [%d,%d]\n",
    953933                cluster[cluster_id].x, cluster[cluster_id].y );
    954934        _exit();
     
    972952    mapping_cluster_t*   cluster = _get_cluster_base(header);
    973953    mapping_vspace_t*    vspace  = _get_vspace_base(header);
     954    mapping_vseg_t*      vseg    = _get_vseg_base(header);
    974955    mapping_task_t*      task    = _get_task_base(header);
    975     mapping_vobj_t*      vobj    = _get_vobj_base(header);
    976956    mapping_periph_t*    periph  = _get_periph_base(header);
    977957    mapping_irq_t*       irq     = _get_irq_base(header);
     
    980960    unsigned int         irq_id;
    981961    unsigned int         vspace_id;
     962    unsigned int         vseg_id;
    982963    unsigned int         task_id;
    983     unsigned int         vobj_id;
    984964
    985965    unsigned int         sched_vbase;          // schedulers array vbase address
     
    11331113            // the task entry point : the start_vector is stored by GCC in the seg_data
    11341114            // segment and we must wait the .elf loading to get the entry point value...
    1135             vobj_id = vspace[vspace_id].start_vobj_id;     
    1136             unsigned int ctx_epc = vobj[vobj_id].vbase + (task[task_id].startid)*4;
    1137 
    1138             // ctx_sp :  Get the vobj containing the stack
    1139             vobj_id = task[task_id].stack_vobj_id;
    1140             unsigned int ctx_sp = vobj[vobj_id].vbase + vobj[vobj_id].length;
     1115            vseg_id = vspace[vspace_id].start_vseg_id;     
     1116            unsigned int ctx_epc = vseg[vseg_id].vbase + (task[task_id].startid)*4;
     1117
     1118            // ctx_sp :  Get the vseg containing the stack
     1119            vseg_id = task[task_id].stack_vseg_id;
     1120            unsigned int ctx_sp = vseg[vseg_id].vbase + vseg[vseg_id].length;
    11411121
    11421122            // get vspace thread index
     
    13321312
    13331313        while ( (lpid >= cluster[cluster_id].procs) ||
    1334                 (_wti_channel_alloc[cx][cy] >= 16) )
     1314                (_wti_channel_alloc[cx][cy] >= 32) )
    13351315        {
    13361316            cluster_id = (cluster_id + 1) % (X_SIZE*Y_SIZE);
     
    15011481    mapping_vspace_t  * vspace  = _get_vspace_base(header);
    15021482    mapping_vseg_t    * vseg    = _get_vseg_base(header);
    1503     mapping_vobj_t    * vobj    = _get_vobj_base(header);
    15041483
    15051484    unsigned int seg_id;
     
    16291608                    // get destination buffer physical address and size
    16301609                    paddr_t      seg_paddr  = vseg[vseg_id].pbase;
    1631                     unsigned int vobj_id    = vseg[vseg_id].vobj_offset;
    1632                     unsigned int seg_size   = vobj[vobj_id].length;
     1610                    unsigned int seg_size   = vseg[vseg_id].length;
    16331611                   
    16341612#if BOOT_DEBUG_ELF
     
    16901668// - The "preloader.elf" file is not loaded, because it has been burned in the ROM.
    16911669// - The "boot.elf" file is not loaded, because it has been loaded by the preloader.
    1692 // This function scans all vobjs defined in the map.bin data structure to collect
     1670// This function scans all vsegs defined in the map.bin data structure to collect
    16931671// all .elf files pathnames, and calls the load_one_elf_file() for each .elf file.
    16941672// As the code can be replicated in several vsegs, the same code can be copied
     
    16991677    mapping_header_t* header = (mapping_header_t *)SEG_BOOT_MAPPING_BASE;
    17001678    mapping_vspace_t* vspace = _get_vspace_base( header );
    1701     mapping_vobj_t*   vobj   = _get_vobj_base( header );
     1679    mapping_vseg_t*   vseg   = _get_vseg_base( header );
     1680
    17021681    unsigned int      vspace_id;
    1703     unsigned int      vobj_id;
     1682    unsigned int      vseg_id;
    17041683    unsigned int      found;
    17051684
    1706     // Scan all vobjs corresponding to global vsegs,
    1707     // to find the pathname to the kernel.elf file
     1685    // Scan all global vsegs to find the pathname to the kernel.elf file
    17081686    found = 0;
    1709     for( vobj_id = 0 ; vobj_id < header->globals ; vobj_id++ )
    1710     {
    1711         if(vobj[vobj_id].type == VOBJ_TYPE_ELF)
     1687    for( vseg_id = 0 ; vseg_id < header->globals ; vseg_id++ )
     1688    {
     1689        if(vseg[vseg_id].type == VSEG_TYPE_ELF)
    17121690        {   
    17131691            found = 1;
     
    17251703    // Load the kernel
    17261704    load_one_elf_file( 1,                           // kernel file
    1727                        vobj[vobj_id].binpath,       // file pathname
     1705                       vseg[vseg_id].binpath,       // file pathname
    17281706                       0 );                         // vspace 0
    17291707
    1730     // loop on the vspaces, scanning all vobjs in the vspace,
     1708    // loop on the vspaces, scanning all vsegs in the vspace,
    17311709    // to find the pathname of the .elf file associated to the vspace.
    17321710    for( vspace_id = 0 ; vspace_id < header->vspaces ; vspace_id++ )
    17331711    {
    1734         // loop on the vobjs in vspace (vobj_id is the global index)
     1712        // loop on the private vsegs
    17351713        unsigned int found = 0;
    1736         for (vobj_id = vspace[vspace_id].vobj_offset;
    1737              vobj_id < (vspace[vspace_id].vobj_offset + vspace[vspace_id].vobjs);
    1738              vobj_id++)
    1739         {
    1740             if(vobj[vobj_id].type == VOBJ_TYPE_ELF)
     1714        for (vseg_id = vspace[vspace_id].vseg_offset;
     1715             vseg_id < (vspace[vspace_id].vseg_offset + vspace[vspace_id].vsegs);
     1716             vseg_id++)
     1717        {
     1718            if(vseg[vseg_id].type == VSEG_TYPE_ELF)
    17411719            {   
    17421720                found = 1;
     
    17541732
    17551733        load_one_elf_file( 0,                          // not a kernel file
    1756                            vobj[vobj_id].binpath,      // file pathname
     1734                           vseg[vseg_id].binpath,      // file pathname
    17571735                           vspace_id );                // vspace index
    17581736
     
    17701748    mapping_cluster_t * cluster = _get_cluster_base(header);
    17711749    mapping_periph_t * periph   = _get_periph_base(header);
    1772     mapping_vobj_t * vobj       = _get_vobj_base(header);
     1750    mapping_vseg_t * vseg       = _get_vseg_base(header);
    17731751    mapping_coproc_t * coproc   = _get_coproc_base(header);
    17741752    mapping_cp_port_t * cp_port = _get_cp_port_base(header);
     
    18901868                  cp_port_id++ )
    18911869            {
    1892                 // get global index of associted vobj
    1893                 unsigned int vobj_id   = cp_port[cp_port_id].mwmr_vobj_id;
     1870                // get global index of associted vseg
     1871                unsigned int vseg_id   = cp_port[cp_port_id].mwmr_vseg_id;
    18941872
    18951873                // get MWMR channel base address
    18961874                page_table_t* ptab  = (page_table_t*)_ptabs_vaddr[0][x][y];
    1897                 unsigned int  vbase = vobj[vobj_id].vbase;
     1875                unsigned int  vbase = vseg[vseg_id].vbase;
    18981876                unsigned int  ppn;
    18991877                unsigned int  flags;
Note: See TracChangeset for help on using the changeset viewer.