Ignore:
Timestamp:
Jun 29, 2014, 12:31:06 PM (10 years ago)
Author:
alain
Message:

Introducing support for distributed page tables, kernel code and user code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_python/mapping.py

    r341 r348  
    335335    ############################    add one (or several) global vseg into mapping
    336336    def addGlobal( self,
    337                    name,                # vseg name
    338                    vbase,               # virtual base address
    339                    size,                # vobj length (bytes)
    340                    mode,                # CXWU flags
    341                    vtype,               # vobj type
    342                    x,                   # destination x coordinate
    343                    y,                   # destination y coordinate
    344                    pseg,                # destination pseg name
    345                    identity   = False,  # identity mapping required if true
    346                    binpath    = '' ):   # pathname for binary code
     337                   name,                  # vseg name
     338                   vbase,                 # virtual base address
     339                   size,                  # vobj length (bytes)
     340                   mode,                  # CXWU flags
     341                   vtype,                 # vobj type
     342                   x,                     # destination x coordinate
     343                   y,                     # destination y coordinate
     344                   pseg,                  # destination pseg name
     345                   identity = False,      # identity mapping required if true
     346                   binpath  = '',         # pathname for binary code
     347                   local    = False ):    # non shared vseg when true
    347348
    348349        assert mode in VSEGMODES
     
    355356
    356357        # add one vseg into mapping
    357         vseg = Vseg( name, vbase, mode, x, y, pseg, identity )
     358        vseg = Vseg( name, vbase, mode, x, y, pseg,
     359                     identity = identity, local = local )
     360
    358361        self.globs.append( vseg )
    359362        self.total_globals += 1
     
    393396                 y,                     # destination y coordinate
    394397                 pseg,                  # destination pseg name
    395                  binpath = '',          # pathname for binary code
    396                  align   = 0,           # alignment required
    397                  init    = 0 ):         # initial value
     398                 binpath    = '',       # pathname for binary code
     399                 align      = 0,        # alignment required
     400                 init       = 0,        # initial value
     401                 local = False ):       # non shared when true
    398402
    399403        assert mode in VSEGMODES
     
    404408
    405409        # add one vseg into mapping
    406         vseg = Vseg( name, vbase, mode, x, y, pseg )
     410        vseg = Vseg( name, vbase, mode, x, y, pseg, local = local )
    407411        vspace.vsegs.append( vseg )
    408412        vseg.index = self.total_vsegs
     
    478482                byte_stream.append( '\0' )
    479483        else:
    480             print 'error in str2bytes() string %s too long' % s
     484            print '[genmap error] in str2bytes() : string %s too long' % s
    481485            sys.exit(1)
    482486
     
    700704        kernel_init_found    = False
    701705        for vseg in self.globs:
     706
    702707            if ( vseg.name == 'seg_boot_code' ):
    703708                boot_code_vbase      = vseg.vbase
     
    732737        # check if all required vsegs have been found
    733738        if ( boot_code_found      == False ):
    734              print 'error in giet_vsegs() : seg_boot_code vseg missing'
     739             print '[genmap error] in giet_vsegs() : seg_boot_code vseg missing'
    735740             sys.exit()
    736741
    737742        if ( boot_data_found      == False ):
    738              print 'error in giet_vsegs() : seg_boot_data vseg missing'
     743             print '[genmap error] in giet_vsegs() : seg_boot_data vseg missing'
    739744             sys.exit()
    740745
    741746        if ( kernel_data_found    == False ):
    742              print 'error in giet_vsegs() : seg_kernel_data vseg missing'
     747             print '[genmap error] in giet_vsegs() : seg_kernel_data vseg missing'
    743748             sys.exit()
    744749
    745750        if ( kernel_uncdata_found == False ):
    746              print 'error in giet_vsegs() : seg_kernel_uncdata vseg missing'
     751             print '[genmap error] in giet_vsegs() : seg_kernel_uncdata vseg missing'
    747752             sys.exit()
    748753
    749754        if ( kernel_code_found    == False ):
    750              print 'error in giet_vsegs() : seg_kernel_data vseg missing'
     755             print '[genmap error] in giet_vsegs() : seg_kernel_code vseg missing'
    751756             sys.exit()
    752757
    753758        if ( kernel_init_found    == False ):
    754              print 'error in giet_vsegs() : seg_kernel_init vseg missing'
     759             print '[genmap error] in giet_vsegs() : seg_kernel_init vseg missing'
    755760             sys.exit()
    756761
     
    10021007                boot_mapping_base       = vseg.vbase
    10031008                boot_mapping_size       = vseg.vobjs[0].length
    1004                 boot_mapping_ident      = vseg.ident
     1009                boot_mapping_identity   = vseg.identity
    10051010                boot_mapping_found      = True
    10061011
     
    10081013                boot_code_base          = vseg.vbase
    10091014                boot_code_size          = vseg.vobjs[0].length
    1010                 boot_code_ident         = vseg.ident
     1015                boot_code_identity      = vseg.identity
    10111016                boot_code_found         = True
    10121017
     
    10141019                boot_data_base          = vseg.vbase
    10151020                boot_data_size          = vseg.vobjs[0].length
    1016                 boot_data_ident         = vseg.ident
     1021                boot_data_identity      = vseg.identity
    10171022                boot_data_found         = True
    10181023
     
    10201025                boot_buffer_base        = vseg.vbase
    10211026                boot_buffer_size        = vseg.vobjs[0].length
    1022                 boot_buffer_ident       = vseg.ident
     1027                boot_buffer_identity    = vseg.identity
    10231028                boot_buffer_found       = True
    10241029
     
    10261031                boot_stack_base         = vseg.vbase
    10271032                boot_stack_size         = vseg.vobjs[0].length
    1028                 boot_stack_ident        = vseg.ident
     1033                boot_stack_identity     = vseg.identity
    10291034                boot_stack_found        = True
    10301035
    10311036        # check that BOOT vsegs are found and identity mapping
    1032         if ( (boot_mapping_found == False) or (boot_mapping_ident == False) ):
    1033              print 'error in hard_config() : seg_boot_mapping missing or not ident'
     1037        if ( (boot_mapping_found == False) or (boot_mapping_identity == False) ):
     1038             print '[genmap error] in hard_config() : seg_boot_mapping missing or not ident'
    10341039             sys.exit()
    10351040
    1036         if ( (boot_code_found == False) or (boot_code_ident == False) ):
    1037              print 'error in hard_config() : seg_boot_code missing or not ident'
     1041        if ( (boot_code_found == False) or (boot_code_identity == False) ):
     1042             print '[genmap error] in hard_config() : seg_boot_code missing or not ident'
    10381043             sys.exit()
    10391044
    1040         if ( (boot_data_found == False) or (boot_data_ident == False) ):
    1041              print 'error in hard_config() : seg_boot_data missing or not ident'
     1045        if ( (boot_data_found == False) or (boot_data_identity == False) ):
     1046             print '[genmap error] in hard_config() : seg_boot_data missing or not ident'
    10421047             sys.exit()
    10431048
    1044         if ( (boot_buffer_found == False) or (boot_buffer_ident == False) ):
    1045              print 'error in hard_config() : seg_boot_buffer missing or not ident'
     1049        if ( (boot_buffer_found == False) or (boot_buffer_identity == False) ):
     1050             print '[genmap error] in hard_config() : seg_boot_buffer missing or not ident'
    10461051             sys.exit()
    10471052
    1048         if ( (boot_stack_found == False) or (boot_stack_ident == False) ):
    1049              print 'error in giet_vsegs() : seg_boot_stack missing or not ident'
     1053        if ( (boot_stack_found == False) or (boot_stack_identity == False) ):
     1054             print '[genmap error] in giet_vsegs() : seg_boot_stack missing or not ident'
    10501055             sys.exit()
    10511056
     
    12851290
    12861291            if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ):
    1287                 print 'error in netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % (cluster.x, cluster.y)
     1292                print '[genmap error] in netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % (cluster.x, cluster.y)
    12881293                sys.exit(1)   
    12891294             
     
    13121317                                hwi_id = irq.srcid
    13131318                        if ( hwi_id == 0xFFFFFFFF ):
    1314                             print 'error in netbsd.dts() ISR_DMA channel %d not found' % channel
     1319                            print '[genmap error] in netbsd.dts() ISR_DMA channel %d not found' % channel
    13151320                            sys.exit(1)
    13161321
     
    13331338                        if ( irq.isrtype == 'ISR_MMC' ): irq_in = irq.srcid
    13341339                    if ( irq_in == 0xFFFFFFFF ):
    1335                         print 'error in netbsd.dts() ISR_MMC not found'
     1340                        print '[genmap error] in netbsd.dts() ISR_MMC not found'
    13361341                        sys.exit(1)
    13371342
     
    13631368                            if ( irq.isrtype == 'ISR_BDV' ): irq_in = irq.srcid
    13641369                        if ( irq_in == 0xFFFFFFFF ):
    1365                             print 'error in netbsd.dts() ISR_BDV not found'
     1370                            print '[genmap error] in netbsd.dts() ISR_BDV not found'
    13661371                            sys.exit(1)
    13671372
     
    13731378
    13741379                    elif ( periph.subtype == 'HBA' ):
    1375                         print 'error in netbsd_dts() : HBA peripheral not supported by NetBSD'
     1380                        print '[genmap error] in netbsd_dts() : HBA peripheral not supported by NetBSD'
    13761381                        sys.exit(1)
    13771382
     
    13831388                            if ( irq.isrtype == 'ISR_SPI' ): irq_in = irq.srcid
    13841389                        if ( irq_in == 0xFFFFFFFF ):
    1385                             print 'error in netbsd.dts() ISR_SPI not found'
     1390                            print '[genmap error] in netbsd.dts() ISR_SPI not found'
    13861391                            sys.exit(1)
    13871392
     
    14241429                                hwi_id = irq.srcid
    14251430                        if ( hwi_id == 0xFFFFFFFF ):
    1426                             print 'error in netbsd.dts() ISR_TTY_RX channel %d not found' % channel
     1431                            print '[genmap error] in netbsd.dts() ISR_TTY_RX channel %d not found' % channel
    14271432                            sys.exit(1)
    14281433
     
    14611466                                hwi_id = irq.srcid
    14621467                        if ( hwi_id == 0xFFFFFFFF ):
    1463                             print 'error in netbsd.dts() ISR_NIC_RX channel %d not found' % channel
     1468                            print '[genmap error] in netbsd.dts() ISR_NIC_RX channel %d not found' % channel
    14641469                            sys.exit(1)
    14651470
     
    14771482                                hwi_id = irq.srcid
    14781483                        if ( hwi_id == 0xFFFFFFFF ):
    1479                             print 'error in netbsd.dts() ISR_NIC_TX channel %d not found' % channel
     1484                            print '[genmap error] in netbsd.dts() ISR_NIC_TX channel %d not found' % channel
    14801485                            sys.exit(1)
    14811486
     
    15051510                                hwi_id = irq.srcid
    15061511                        if ( hwi_id == 0xFFFFFFFF ):
    1507                             print 'error in netbsd.dts() ISR_CMA channel %d not found' % channel
     1512                            print '[genmap error] in netbsd.dts() ISR_CMA channel %d not found' % channel
    15081513                            sys.exit(1)
    15091514
     
    15211526                elif ( periph.ptype == 'TIM' ): 
    15221527
    1523                     print 'error in netbsd_dts() : TIM peripheral not supported by NetBSD'
     1528                    print '[genmap error] in netbsd_dts() : TIM peripheral not supported by NetBSD'
    15241529                    sys.exit(1)
    15251530
     
    15271532                elif ( periph.ptype == 'MWR' ):
    15281533
    1529                     print 'error in netbsd_dts() : MWR peripheral not supported by NetBSD'
     1534                    print '[genmap error] in netbsd_dts() : MWR peripheral not supported by NetBSD'
    15301535                    sys.exit(1)
    15311536
    15321537                # research ICU component
    15331538                elif ( periph.ptype == 'ICU' ): 
    1534                     print 'error in netbsd_dts() : ICU peripheral not supported by NetBSD'
     1539                    print '[genmap error] in netbsd_dts() : ICU peripheral not supported by NetBSD'
    15351540                    sys.exit(1)
    15361541
     
    17141719        # check index
    17151720        if (self.index != expected):
    1716             print 'error in Cluster.cbin() : cluster global index = %d / expected = %d' \
     1721            print '[genmap error] in Cluster.cbin() : cluster global index = %d / expected = %d' \
    17171722                  % (self.index, expected )
    17181723            sys.exit(1)
     
    17991804        # check index
    18001805        if (self.index != expected):
    1801             print 'error in Vspace.cbin() : vspace global index = %d / expected = %d' \
     1806            print '[genmap error] in Vspace.cbin() : vspace global index = %d / expected = %d' \
    18021807                  % (self.index, expected )
    18031808            sys.exit(1)
     
    18091814                vobj_start_id = vseg.vobjs[0].index
    18101815        if ( vobj_start_id == 0xFFFFFFFF ):
    1811             print 'error in Vspace.cbin() : startname %s not found for vspace %s' \
     1816            print '[genmap error] in Vspace.cbin() : startname %s not found for vspace %s' \
    18121817                  % ( self.startname, self.name )
    18131818            sys.exit(1)
     
    19081913        # check index
    19091914        if (self.index != expected):
    1910             print 'error in Task.cbin() : task global index = %d / expected = %d' \
     1915            print '[genmap error] in Task.cbin() : task global index = %d / expected = %d' \
    19111916                  % (self.index, expected )
    19121917            sys.exit(1)
     
    19211926                vobj_stack_id = vseg.vobjs[0].index
    19221927        if ( vobj_stack_id == 0xFFFFFFFF ):
    1923             print 'error in Task.cbin() : stackname %s not found for task %s in vspace %s' \
     1928            print '[genmap error] in Task.cbin() : stackname %s not found for task %s in vspace %s' \
    19241929                  % ( self.stackname, self.name, vspace.name )
    19251930            sys.exit(1)
     
    19311936                vobj_heap_id = vseg.vobjs[0].index
    19321937        if ( vobj_heap_id == 0xFFFFFFFF ):
    1933             print 'error in Task.cbin() : heapname %s not found for task %s in vspace %s' \
     1938            print '[genmap error] in Task.cbin() : heapname %s not found for task %s in vspace %s' \
    19341939                  % ( self.heapname, self.name, vspace.name )
    19351940            sys.exit(1)
     
    19691974                  y,
    19701975                  psegname,
    1971                   ident = False ):
     1976                  identity = False,
     1977                  local    = False ):
    19721978
    19731979        assert mode in VSEGMODES
    19741980
    1975         self.index      = 0                   # global index ( set by addVseg() )
    1976         self.name       = name                # vseg name
    1977         self.vbase      = vbase & 0xFFFFFFFF  # virtual base address in vspace
    1978         self.mode       = mode                # CXWU access rights
    1979         self.x          = x                   # x coordinate of destination cluster
    1980         self.y          = y                   # y coordinate of destination cluster
    1981         self.psegname   = psegname            # name of pseg in destination cluster
    1982         self.ident      = ident               # identity mapping required
    1983         self.vobjs      = []
     1981        self.index    = 0                   # global index ( set by addVseg() )
     1982        self.name     = name                # vseg name
     1983        self.vbase    = vbase & 0xFFFFFFFF  # virtual base address in vspace
     1984        self.mode     = mode                # CXWU access rights
     1985        self.x        = x                   # x coordinate of destination cluster
     1986        self.y        = y                   # y coordinate of destination cluster
     1987        self.psegname = psegname            # name of pseg in destination cluster
     1988        self.identity = identity            # identity mapping required
     1989        self.local    = local               # one copy per cluster
     1990        self.vobjs    = []
    19841991        return
    19851992
     
    19891996        s =  '            <vseg name="%s" vbase="0x%x" mode="%s" x="%d" y="%d" psegname="%s"' \
    19901997             % ( self.name, self.vbase, self.mode, self.x, self.y, self.psegname )
    1991         if ( self.ident ):  s += ' ident="1" >\n'
    1992         else:               s += ' >\n'
    1993         for vobj in self.vobjs: s += vobj.xml()
     1998        if ( self.identity ): s += ' ident="1"'
     1999        if ( self.local ):    s += ' local="1"'
     2000        s += ' >\n'
     2001        for vobj in self.vobjs:  s += vobj.xml()
    19942002        s += '            </vseg>\n'
    19952003
     
    20042012        # check index
    20052013        if (self.index != expected):
    2006             print 'error in Vseg.cbin() : vseg global index = %d / expected = %d' \
     2014            print '[genmap error] in Vseg.cbin() : vseg global index = %d / expected = %d' \
    20072015                  % (self.index, expected )
    20082016            sys.exit(1)
     
    20162024                pseg_id = pseg.index
    20172025        if (pseg_id == 0xFFFFFFFF):
    2018             print 'error in Vseg.cbin() : psegname %s not found for vseg %s in cluster %d' \
     2026            print '[genmap error] in Vseg.cbin() : psegname %s not found for vseg %s in cluster %d' \
    20192027                  % ( self.psegname, self.name, cluster_id )
    20202028            sys.exit(1)
     
    20262034                mode_id = x
    20272035        if ( mode_id == 0xFFFFFFFF ):
    2028             print 'error in Vseg.cbin() : undefined vseg mode %s' % self.mode
     2036            print '[genmap error] in Vseg.cbin() : undefined vseg mode %s' % self.mode
    20292037            sys.exit(1)
    20302038
     
    20432051        byte_stream += mapping.int2bytes( 4,  0 )               # linked list of vsegs on same pseg
    20442052        byte_stream += mapping.int2bytes( 1,  0 )               # mapped when non zero
    2045         byte_stream += mapping.int2bytes( 1,  self.ident )      # identity mapping when non zero
    2046         byte_stream += mapping.int2bytes( 2,  0 )               # reserved (padding)
     2053        byte_stream += mapping.int2bytes( 1,  self.identity )   # identity mapping when non zero
     2054        byte_stream += mapping.int2bytes( 1,  self.local )      # non shared if non zero
     2055        byte_stream += mapping.int2bytes( 1,  0 )               # reserved (padding)
    20472056
    20482057        if ( verbose ):
     
    20982107        # check index
    20992108        if (self.index != expected):
    2100             print 'error in Vobj.cbin() : vobj global index = %d / expected = %d' \
     2109            print '[genmap error] in Vobj.cbin() : vobj global index = %d / expected = %d' \
    21012110                  % (self.index, expected )
    21022111            sys.exit(1)
     
    21102119                vtype_int = x
    21112120        if ( vtype_int == 0xFFFFFFFF ):
    2112             print 'error in Vobj.cbin() : undefined vobj type %s' % self.vtype
     2121            print '[genmap error] in Vobj.cbin() : undefined vobj type %s' % self.vtype
    21132122            sys.exit(1)
    21142123
     
    21572166        # check index
    21582167        if (self.index != expected):
    2159             print 'error in Proc.cbin() : proc global index = %d / expected = %d' \
     2168            print '[genmap error] in Proc.cbin() : proc global index = %d / expected = %d' \
    21602169                  % (self.index, expected )
    21612170            sys.exit(1)
     
    22042213        # check index
    22052214        if (self.index != expected):
    2206             print 'error in Pseg.cbin() : pseg global index = %d / expected = %d' \
     2215            print '[genmap error] in Pseg.cbin() : pseg global index = %d / expected = %d' \
    22072216                  % (self.index, expected )
    22082217            sys.exit(1)
     
    22142223                segtype_int = x
    22152224        if ( segtype_int == 0xFFFFFFFF ):
    2216             print 'error in Pseg.cbin() : undefined segment type %s' % self.segtype
     2225            print '[genmap error] in Pseg.cbin() : undefined segment type %s' % self.segtype
    22172226            sys.exit(1)
    22182227
     
    22782287        # check index
    22792288        if (self.index != expected):
    2280             print 'error in Periph.cbin() : periph global index = %d / expected = %d' \
     2289            print '[genmap error] in Periph.cbin() : periph global index = %d / expected = %d' \
    22812290                  % (self.index, expected )
    22822291            sys.exit(1)
     
    22962305            if ( self.ptype == PERIPHTYPES[x] ):  ptype_id = x
    22972306        if ( ptype_id == 0xFFFFFFFF ):
    2298             print 'error in Periph.cbin() : undefined peripheral type %s' % self.ptype
     2307            print '[genmap error] in Periph.cbin() : undefined peripheral type %s' % self.ptype
    22992308            sys.exit(1)
    23002309
     
    23552364        # check index
    23562365        if (self.index != expected):
    2357             print 'error in Irq.cbin() : irq global index = %d / expected = %d' \
     2366            print '[genmap error] in Irq.cbin() : irq global index = %d / expected = %d' \
    23582367                  % (self.index, expected )
    23592368            sys.exit(1)
     
    23652374                irqtype_id = x
    23662375        if ( irqtype_id == 0xFFFFFFFF ):
    2367             print 'error in Irq.cbin() : undefined irqtype %s' % self.irqtype
     2376            print '[genmap error] in Irq.cbin() : undefined irqtype %s' % self.irqtype
    23682377            sys.exit(1)
    23692378
     
    23742383                isrtype_id = x
    23752384        if ( isrtype_id == 0xFFFFFFFF ):
    2376             print 'error in Irq.cbin() : undefined isrtype %s' % self.isrtype
     2385            print '[genmap error] in Irq.cbin() : undefined isrtype %s' % self.isrtype
    23772386            sys.exit(1)
    23782387
     
    24082417    def xml( self ):    # xml for Coproc 
    24092418
    2410         print 'error in Coproc.xml() : not defined yet'
     2419        print '[genmap error] in Coproc.xml() : not defined yet'
    24112420        sys.exit(1)
    24122421
     
    24212430        # check index
    24222431        if (self.index != expected):
    2423             print 'error in Coproc.cbin() : coproc global index = %d / expected = %d' \
     2432            print '[genmap error] in Coproc.cbin() : coproc global index = %d / expected = %d' \
    24242433                  % (self.index, expected )
    24252434            sys.exit(1)
     
    24632472    def xml( self ):    # xml for Cpport
    24642473
    2465         print 'error in Cpport.xml() : not defined yet'
     2474        print '[genmap error] in Cpport.xml() : not defined yet'
    24662475        sys.exit(1)
    24672476
     
    24762485        # check index
    24772486        if ( self.index != expected ):
    2478             print 'error in Cpport.cbin() : port global index = %d / expected = %d' \
     2487            print '[genmap error] in Cpport.cbin() : port global index = %d / expected = %d' \
    24792488                  % ( self.index, expected )
    24802489            sys.exit(1)
     
    24922501                vspace_id = vspace.index
    24932502        if (vspace_id == 0xFFFFFFFF):
    2494             print 'error in Cpport.cbin() : vspace name %s not found' \
     2503            print '[genmap error] in Cpport.cbin() : vspace name %s not found' \
    24952504                  % ( self.vspacename )
    24962505            sys.exit(1)
     
    25032512                    mwmr_id = vobj.index
    25042513        if (mwmr_id == 0xFFFFFFFF):
    2505             print 'error in Cpport.cbin() : mwmr vobj name %s not found in vspace %s' \
     2514            print '[genmap error] in Cpport.cbin() : mwmr vobj name %s not found in vspace %s' \
    25062515                  % ( self.mwmrname, self.vspacename )
    25072516            sys.exit(1)
Note: See TracChangeset for help on using the changeset viewer.