Annotation of cci/d/macro4/init.x, revision 1.1

1.1     ! root        1: /************************************************************************/
        !             2: /*                          Revision History                           */
        !             3: /*                             ----------                              */
        !             4: /*     Rev 1.0                                          1 Aug 85       */
        !             5: /*                                                                     */
        !             6: /*     Initial release of the diagnostic                               */
        !             7: /*                                                                     */
        !             8: /*                             ----------                              */
        !             9: /*     Rev 1.1                                         17 Dec 85       */
        !            10: /*                                                                     */
        !            11: /*     Added a data pattern to subd.datal.c to check if ECNW0276       */
        !            12: /*     is installed in the FS board                                    */
        !            13: /*                                                                     */
        !            14: /************************************************************************/
        !            15: 
        !            16: /*     init.s for the MACRO4 floating point processor test             */
        !            17: 
        !            18: 
        !            19: /*     This file is a diagnostic version of locore.s.                  */
        !            20: /*     It contains the following:                                      */
        !            21: /*     *system data area = scb, dump buffer, interrupt stack,          */
        !            22: /*     *system page table,user page tables,pcbs,iomap, & io buffers.   */
        !            23: /*                                                                     */
        !            24: /*     *system code = interrupt vectors, initialization of system data,*/
        !            25: /*     *memory size calculation,initialization of SPT, zeroing of      */
        !            26: /*     *unused memory, & loading of SBR & SLR.                         */
        !            27: /*     *                                                               */
        !            28: /*     *at the end of this code, you are ready to go to virtual mode.  */
        !            29: /*     * --- GOOD LUCK!                                                */
        !            30: 
        !            31: 
        !            32: /*     privileged registers addresses  */
        !            33: #include       "prvreg.h"
        !            34:        
        !            35: /*     program status long word definition     */
        !            36: #include       "psl.h" 
        !            37: 
        !            38: /*     page table entry definition             */
        !            39: #include       "pte.h"
        !            40:        
        !            41: /*     process control block offsets   */
        !            42: #include       "pcboffset.h"   
        !            43: 
        !            44: /*     fundamental constants for globl use     */
        !            45: #include       "const.h"       
        !            46: 
        !            47: /*     system control block offsets*/
        !            48: #include       "scboffset.h"
        !            49: /*     SPT offsets                             */
        !            50: #include       "sptoffset.h"
        !            51: 
        !            52: /*     trap numbers*/
        !            53: #include       "trap.h"        
        !            54: 
        !            55: 
        !            56: #define V_TRAP         0
        !            57: #define V_SYSCALL      4
        !            58: 
        !            59:        .set    HIGH,0x1f       /*mask for disabling all interrupts     */
        !            60:        .set    MCKVEC,4        /*scb offset for machinecheck vector    */
        !            61:        .set    NISP,2          /*no. of interrupt stack pages          */
        !            62:        .set    DONE,255        /*user process done code                */
        !            63: 
        !            64:        .text
        !            65: 
        !            66: #include "pstorage.s"          /* PROCESSOR STORAGE AREA               */
        !            67: 
        !            68:        .globl  _Entry
        !            69: _Entry:
        !            70:        jmp     start
        !            71:        .space  (1024-6)
        !            72: 
        !            73: /*             globl dump buffer to be used for communication          */
        !            74: /*             between tests & interrupt handlers, & other misc.       */
        !            75: /*             purposes.                                               */
        !            76:                                
        !            77: /*     Physical page 3 : Used for global variables             */
        !            78: 
        !            79:        .set    NLWU,35         /*no. of longwords already used         */
        !            80:                                /*this must be changed when you define  */
        !            81:                                /*additional variables below before     */
        !            82:                                /*_dbuf                                 */
        !            83: 
        !            84: 
        !            85:        .globl  _restart
        !            86: _restart:
        !            87:        .space  4               /*contains restart address for restarting*/
        !            88:                                /*after power is restored (loaded by    */
        !            89:                                /*power fail interrupt handler & used by*/
        !            90:                                /*CPU 2                                 */      
        !            91:        .globl  _maxmem
        !            92: _maxmem:
        !            93:        .space  4               /*memory size in no of bytes            */
        !            94: 
        !            95:        .globl  _maxpages
        !            96: _maxpages:
        !            97:        .space  4               /*memory size in no. of physical pages  */
        !            98: 
        !            99:        .globl  _lastadd
        !           100: _lastadd:
        !           101:        .space  4               /*address of the last long word         */
        !           102: 
        !           103:        .globl  _unused
        !           104: _unused:
        !           105:        .space  4               /*first unused page in system space     */
        !           106: 
        !           107:        .globl  _ctlblk
        !           108: _ctlblk:
        !           109:        .long   0               /* pointer to SCB */
        !           110: 
        !           111:        .globl  _savvec0        /*save vectors area                     */
        !           112: _savvec0:
        !           113:        .space  4
        !           114: 
        !           115:        .globl  _savvec1        /*save vectors area                     */
        !           116: _savvec1:
        !           117:        .space  4
        !           118: 
        !           119:        .globl  _savvec2        /*save vectors area                     */
        !           120: _savvec2:
        !           121:        .space  4
        !           122: 
        !           123:        .globl  _savvec3        /*save vectors area                     */
        !           124: _savvec3:
        !           125:        .space  4
        !           126: 
        !           127:        .globl  _savvec4        /*save vectors area                     */
        !           128: _savvec4:
        !           129:        .space  4
        !           130: 
        !           131:        .globl  _savvec5        /*save vectors area                     */
        !           132: _savvec5:
        !           133:        .space  4
        !           134:        .globl  _savvec6        /*save vectors area                     */
        !           135: _savvec6:
        !           136:        .space  4
        !           137:        .globl  _savvec7        /*save vectors area                     */
        !           138: _savvec7:
        !           139:        .space  4
        !           140: 
        !           141:        .globl  _savvec8        /*save vectors area                     */
        !           142: _savvec8:
        !           143:        .space  4
        !           144: 
        !           145:        .globl  badrtn
        !           146: badrtn:
        !           147:        .long   0 
        !           148: 
        !           149:        .globl  _dbuf           /*dump buffer left out of 1K            */
        !           150:        .globl  _r_no
        !           151: _r_no:
        !           152:        .long   0
        !           153:        .globl  _pt_base
        !           154: _pt_base:
        !           155:        .long   0
        !           156:        .globl  _saved_psl
        !           157: _saved_psl:
        !           158:        .long   0
        !           159:        .globl  _saved_sp
        !           160: _saved_sp:
        !           161:        .long   0
        !           162:        .globl  _saved_fp
        !           163: _saved_fp:
        !           164:        .long   0
        !           165:        .globl  _p_ptr
        !           166: _p_ptr:
        !           167:        .long   0
        !           168:        .globl  _ret_adr
        !           169: _ret_adr:
        !           170:        .long   0
        !           171:        .globl  _exp_par0
        !           172: _exp_par0:
        !           173:        .long   0
        !           174:        .globl  _exp_par1
        !           175: _exp_par1:
        !           176:        .long   0
        !           177:        .globl  _exp_par2
        !           178: _exp_par2:
        !           179:        .long   0
        !           180:        .globl  _exp_par3
        !           181: _exp_par3:
        !           182:        .long   0
        !           183:        .globl  _act_par0
        !           184: _act_par0:
        !           185:        .long   0
        !           186:        .globl  _act_par1
        !           187: _act_par1:
        !           188:        .long   0
        !           189:        .globl  _act_par2
        !           190: _act_par2:
        !           191:        .long   0
        !           192:        .globl  _act_par3
        !           193: _act_par3:
        !           194:        .long   0
        !           195:        .globl  _clk_cnt
        !           196: _clk_cnt:
        !           197:        .long   0               /* Clock int. count */
        !           198:        .globl  _errcnt
        !           199: _errcnt:
        !           200:        .long   0
        !           201:        .globl  _hlt_flg
        !           202: _hlt_flg:
        !           203:        .long   0
        !           204:        .globl  _endprog
        !           205: _endprog:
        !           206:        .long   0
        !           207: _dbuf:
        !           208:        .space  NBPG - (NLWU *4)
        !           209: edbuf:
        !           210: 
        !           211: 
        !           212:        .globl  _intstack       /* Interrupt stack                      */
        !           213: _intstack:                     /* Physical pages 4 & 5                 */
        !           214:        .space  NISP*NBPG
        !           215: eintstack:
        !           216: 
        !           217: 
        !           218:        .set    SYSPTSIZE,512   /* No. of entries in SPT                */
        !           219:  
        !           220: /*
        !           221:        System Page Table -- physical page 6 & 7
        !           222: */ 
        !           223:        .align  2
        !           224:        .globl  _Sysmap
        !           225: _Sysmap:
        !           226:        .space  SYSPTSIZE*4     /* 512 max pages allowed for system     */
        !           227: eSysmap:
        !           228:        .globl  _Syssize
        !           229:        .set    _Syssize,(eSysmap-_Sysmap)/4    /* should be SYSPTSIZE  */
        !           230:        
        !           231:        .globl  _iomap          /* Physical page 8      */
        !           232: _iomap:        .space  1024            /* IOMAP - unused       */
        !           233:        .globl  _eiomap
        !           234: _eiomap:
        !           235: 
        !           236:        .globl  _pcb0           /* Physical page 9      */
        !           237: _pcb0: .space  128             /*process control block 0               */
        !           238:        .globl  _pcb1
        !           239: _pcb1: .space 128              /*process control block 1               */
        !           240:        .globl  _pcb2
        !           241: _pcb2: .space 128              /*process control block 2               */
        !           242:        .globl  _pcb3
        !           243: _pcb3: .space 128              /*process control block 3               */
        !           244:        .globl  _pcb4
        !           245: _pcb4: .space 128              /*process control block 4               */
        !           246:        .globl  _pcb5
        !           247: _pcb5: .space 128              /*process control block 5               */
        !           248:        .globl  _pcb6
        !           249: _pcb6: .space 128              /*process control block 6               */
        !           250:        .globl  _pcb7
        !           251: _pcb7: .space 128              /*process control block 7               */
        !           252: 
        !           253: /*
        !           254:        *user #0 page tables -- P0PT, P1PT, P2PT                        
        !           255:        *physical memory     --  page10, 11, & 12  respectively
        !           256: */
        !           257:        .align  2
        !           258:        .globl  _u0p0pt
        !           259: _u0p0pt:
        !           260:        .space  1024            /*255 max pages for user #0 text        */
        !           261:        .globl  _u0p1pt
        !           262: _u0p1pt:       
        !           263:        .space  1024            /*255 max pages for user #0 data        */
        !           264:        .globl  _u0p2pt
        !           265: _u0p2pt:       
        !           266:        .space  1020            /*255 max pages for user #0 stack       */
        !           267: eu0p2pt:
        !           268:        .space  4
        !           269: 
        !           270: /*
        !           271:        *user #1 page tables -- P0PT, P1PT, P2PT                        
        !           272:        *physical memory     --  page13 ,14, & 15  respectively
        !           273: */
        !           274:        .align  2
        !           275:        .globl  _u1p0pt
        !           276: _u1p0pt:
        !           277:        .space  1024            /*255 max pages for user #1 text        */
        !           278:        .globl  _u1p1pt
        !           279: _u1p1pt:       
        !           280:        .space  1024            /*255 max pages for user #1 data        */
        !           281:        .globl  _u1p2pt
        !           282: _u1p2pt:       
        !           283:        .space  1020            /*255 max pages for user #1 stack       */
        !           284: eu1p2pt:
        !           285:        .space  4
        !           286: 
        !           287: 
        !           288: /*
        !           289:        *user #2 page tables -- P0PT, P1PT, P2PT                        
        !           290:        *physical memory     --  page 16, 17 , & 18  respectively
        !           291: */
        !           292:        .align  2
        !           293:        .globl  _u2p0pt
        !           294: _u2p0pt:
        !           295:        .space  1024            /*255 max pages for user #2 text        */
        !           296:        .globl  _u2p1pt
        !           297: _u2p1pt:       
        !           298:        .space  1024            /*255 max pages for user #2 data        */
        !           299:        .globl  _u2p2pt
        !           300: _u2p2pt:       
        !           301:        .space  1020            /*255 max pages for user #2 stack       */
        !           302: eu2p2pt:
        !           303:        .space  4
        !           304: 
        !           305: 
        !           306: /*
        !           307:        *user #3 page tables -- P0PT, P1PT, P2PT                        
        !           308:        *physical memory     --  page 19, 20 , & 21  respectively
        !           309: */
        !           310:        .align  2
        !           311:        .globl  _u3p0pt
        !           312: _u3p0pt:
        !           313:        .space  1024            /*255 max pages for user #3 text        */
        !           314:        .globl  _u3p1pt
        !           315: _u3p1pt:       
        !           316:        .space  1024            /*255 max pages for user #3 data        */
        !           317:        .globl  _u3p2pt
        !           318: _u3p2pt:       
        !           319:        .space  1020            /*255 max pages for user #3 stack       */
        !           320: eu3p2pt:
        !           321:        .space  4
        !           322: 
        !           323: /*
        !           324:        *user #4 thru 6 page tables
        !           325:        *physical memory -- pages 22 thru 30
        !           326: */
        !           327:        .globl  _u4p0pt
        !           328: _u4p0pt:
        !           329:        .space  (9*NBPG) - 4
        !           330: eu6p2pt:
        !           331:        .space  4
        !           332: 
        !           333: 
        !           334: /*
        !           335:        Area used for Kernel stack                      
        !           336:        physical memory --  page 31, 32 , 33
        !           337: */
        !           338: 
        !           339:        .align  2
        !           340:        .globl  _Kstack         /* Kernel stack */
        !           341: _Kstack:                       /* Physical pages 31,32,33 */
        !           342:        .space  3*NBPG
        !           343:        .globl  ekstack 
        !           344: ekstack:
        !           345: 
        !           346:        .globl  _iob0           /*io buffer 0 */
        !           347: _iob0: .space  1024
        !           348:        .globl  _iob1           /*io buffer 1 */
        !           349: _iob1: .space  1024
        !           350:        .globl  _iob2           /*io buffer 2 */
        !           351: _iob2: .space  1024
        !           352:        .globl  _iob3           /*io buffer 3 */
        !           353: _iob3: .space  1024
        !           354:        .globl  _iob4           /*io buffer 4 */
        !           355: _iob4: .space  1024
        !           356:        .globl  _iob5           /*io buffer 5 */
        !           357: _iob5: .space  1024
        !           358:        .globl  _iob6           /*io buffer 6 */
        !           359: _iob6: .space  1024
        !           360: esysdata:
        !           361: 
        !           362: #include "scblock.s"           /* SYSTEM CONTROL BLOCK (SCB) AREA      */
        !           363: 
        !           364: #include       "evthandlers.s" /*event handlers                        */
        !           365: 
        !           366: #define        ACBL(_n1,_n2,_n3,_n4) \
        !           367: addl2  _n2,_n3;\
        !           368: cmpl   _n3,_n1;\
        !           369: bleq   _n4;
        !           370: 
        !           371:        .set    MEMUNIT,64*1024
        !           372:        .set    MAXPHYSMEM,8*1024*1024-1
        !           373:        .set    ERRCD,0x7
        !           374:        .set    APE,0x1
        !           375:        .set    DCE,0x3
        !           376:        .set    VTO,0x4
        !           377: 
        !           378: 
        !           379: 
        !           380: /*
        !           381:        *INITIALIZATION CODE
        !           382:        *
        !           383:        * MME off; mode = k; IPL = 31; IS = 1
        !           384:        *
        !           385: */
        !           386: 
        !           387:        .globl  start
        !           388: start:
        !           389:        mtpr    $0,$MME         /* Disable MME */
        !           390:        movl    r0,_run_list
        !           391:        movl    r1,_OPTIONS
        !           392:        clrl    _nonstop        /* clear the continuous run flag */
        !           393:        movl    r2,_count       /* save the test count           */
        !           394:        bneq    1f              /* is count = 0 ?                */
        !           395:        movl    $1,_count       /*   yes -set cycle count = 1    */
        !           396: 1:     bgeq    1f              /* is count < 0 ?                */
        !           397:        movl    $1,_nonstop     /*   yes -set NONSTOP flag       */
        !           398: 1:
        !           399:        clrl    _no_fpp_wcs     /* clear the NO-FPP WCS flag     */
        !           400:        mtpr    $0x400,$DCR     /* check for FPP WCS loaded      */
        !           401:        tstl    r1              /* r1 = 0 if NO-FPP WCS loaded   */
        !           402:        bneq    1f
        !           403:        movl    $1,_no_fpp_wcs  /* set the NO-FPP WCS flag       */
        !           404: 1:
        !           405:        movab   _scb,r0
        !           406:        andl2   $0x3ffffc00,r0
        !           407:        mtpr    r0,$SCBB        /* Set SCBB  */
        !           408:        mtpr    $0x1f,$IPL      /* Set IPL to HIGH */
        !           409: 
        !           410: #
        !           411: # clear the option flags
        !           412: #
        !           413:        clrl    _halt_flg       /* clear the halt on error flag             */
        !           414:        clrl    _loop_on_err    /* clear the loop on error flag             */
        !           415:        movl    $1,_prt_error   /* clear the print error messages flag      */
        !           416:        movl    $1,_prt_hdrs    /* clear the print header messages flag     */
        !           417:        movl    $1,_en_data_cache  /* clear the enable data cache flag      */
        !           418: 
        !           419: #
        !           420: # set the option flags as needed
        !           421: #
        !           422:        bitl    $1,_OPTIONS     /* bit(0) = HALT ON ERROR */
        !           423:        beql    1f
        !           424:        movl    $1,_halt_flg    /* set the HALT ON ERROR flag */
        !           425: 1:
        !           426:        bitl    $2,_OPTIONS     /* bit(1) = LOOP ON ERROR */
        !           427:        beql    1f
        !           428:        movl    $1,_loop_on_err /* set the LOOP ON ERROR flag */
        !           429: 1:
        !           430:        bitl    $4,_OPTIONS     /* bit(2) = PRINT ERROR MESSAGES */
        !           431:        beql    1f
        !           432:        clrl    _prt_error      /* clear the PRINT ERROR MESSAGES flag */
        !           433: 1:
        !           434:        bitl    $8,_OPTIONS     /* bit(3) = PRINT HEADER MESSAGES */
        !           435:        beql    1f
        !           436:        clrl    _prt_hdrs       /* clear the PRINT HEADER MESSAGES flag */
        !           437: 1:
        !           438:        bitl    $16,_OPTIONS    /* bit(4) = ENABLE DATA CACHE flag */
        !           439:        beql    1f
        !           440:        clrl    _en_data_cache  /* clear the ENABLE DATA CACHE flag */
        !           441: 1:
        !           442: 
        !           443:        movpsl  r1
        !           444:        andl2   $0xffffff00,r1          /* Mask out flags               */
        !           445:        cmpl    r1,$0x041f0000          /*IS on,modes =k & IPL = 31?    */
        !           446:        beql    1f
        !           447: 2:     movl    $1,r0
        !           448:        movl    $0x041f0000,r2
        !           449:        halt                    /* PSL not initialized as expected      */
        !           450: /*
        !           451: #      Mask out bit 30,31 of SCB vectors
        !           452: #      Will turm them back on when ready to go virtual in 
        !           453: #      system space
        !           454: */
        !           455: 1:
        !           456:        clrl    _clk_cnt
        !           457:        movl    $7,r0           /* R0 : Vector no. of clock int. */
        !           458:        movab   _Hardclk,_scb[r0]       /* New vector for clock */
        !           459: 
        !           460:        movl    $_intstack+NISP*NBPG,r0
        !           461:        andl2   $0x3fffffff,r0          /* Mask out bit 30,31 */
        !           462:        mtpr    r0,$ISP                 /* init. ISP            */
        !           463:        movl    r0,sp                   /* in case we get exception     */
        !           464:        movab   (sp),fp                 /* Initialize FP                */
        !           465: /*
        !           466:        Clear system data area all the way upto system code
        !           467:        this includes dump buffer,interrupt stack,spt,iomap,pcbs,user 
        !           468:        page tables, & io buffer area.
        !           469: */
        !           470: 3:     
        !           471:        movab   esysdata,r7
        !           472:        movab   _restart,r6
        !           473: 1:     clrl    (r6)
        !           474:        ACBL(r7,$4,r6,1b)
        !           475: 
        !           476:        .globl  _ready
        !           477: _ready:
        !           478:        mtpr    $64,$DCR        /* Enable fault */                              
        !           479:        andl3   $0x3ffffc00,$_end+NBPG-1,_endprog
        !           480:        
        !           481:        mtpr    $_pcb0,$0xe             /* Init. PCBB to PCB_0 */
        !           482:        movab   _pcb0,r0
        !           483:        movab   ekstack,PCB_KSP(r0)     /* Init. PCB_KSP             */
        !           484:        movab   eustack,PCB_USP(r0)     /* Init. PCB_USP             */
        !           485:        mfpr    $P0BR,PCB_P0BR(r0)      /*  "    PCB_P0BR            */
        !           486:        mfpr    $P0LR,PCB_P0LR(r0)      /*  "    PCB_P0LR            */
        !           487:        movl    $0x001f000,PCB_PSL(r0)  /* Set PCB_PSL : Kernel Mode */
        !           488:        ldpctx                          /* load the process context  */
        !           489: 
        !           490:        mtpr    $1,$PACC                /* purge the code cache      */
        !           491:        mtpr    $1,$CCK                 /* Set code cache key to 1   */
        !           492:        mtpr    $2,$27                  /* Disable Data cache        */
        !           493:        clrl    _cycle
        !           494:        clrl    _errcnt
        !           495:        clrl    _error
        !           496:        callf   $4,_monitor             /* start the test monitor   */
        !           497: 
        !           498: 
        !           499: 
        !           500: # /****************************************************************************
        !           501: # *                    USER STACK AREA
        !           502: # ****************************************************************************/
        !           503: 
        !           504:        .globl  _Esys                   /* end of systems only code */
        !           505: _Esys:
        !           506:        .space  NBPG
        !           507:        
        !           508:        .globl  _Ustack                 /* basic stack space */
        !           509: _Ustack:
        !           510:        .space  (2*NBPG)-4              /* 2 pages */
        !           511:        .globl  eustack
        !           512: eustack:
        !           513:        .long   0                       /* initial user stack ptr */
        !           514: 
        !           515:        .globl  U_area
        !           516: U_area:
        !           517: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.