|
|
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:
10: # INIT.X for the FPP Events Tests
11:
12: # This file is a diagnostic version of locore.s.
13: # It contains the following:
14: # *system data area = scb, dump buffer, interrupt stack,
15: # *system page table,user page tables,pcbs,iomap, & io buffers.
16: #
17: # *system code = interrupt vectors, initialization of system data,
18: # *memory size calculation,initialization of SPT, zeroing of
19: # *unused memory, & loading of SBR & SLR.
20: # *
21: # *at the end of this code, you are ready to go to virtual mode.
22: # * --- GOOD LUCK!
23:
24: ##########################################################################
25: #
26: # 22-Mar-85 : Stole the code from the Demand Paging Test directory
27: # 16-Jul-85 : Added the test for the FPP WCS / NO-FPP WCS
28: #
29: ##########################################################################
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: .set TTRAP,0x32
64: .set TRANS,0x30
65: .set PRIVS,0x2c
66:
67: .text
68:
69: /* PROCESSOR STORAGE AREA */
70: #include "pstorage.s"
71:
72: .globl _Entry
73: _Entry:
74: jmp start
75: .space (1024-6)
76:
77: /* globl dump buffer to be used for communication */
78: /* between tests & interrupt handlers, & other misc. */
79: /* purposes. */
80:
81: /* Physical page 3 : Used for global variables */
82:
83: .set NLWU,35 /*no. of longwords already used */
84: /*this must be changed when you define */
85: /*additional variables below before */
86: /*_dbuf */
87: .globl _Codek
88: _Codek: .long 0 /* Code cache key */
89:
90: .globl _restart
91: _restart:
92: .space 4 /*contains restart address for restarting*/
93: /*after power is restored (loaded by */
94: /*power fail interrupt handler & used by*/
95: /*CPU 2 */
96: .globl _maxmem
97: _maxmem:
98: .space 4 /*memory size in no of bytes */
99:
100: .globl _maxpages
101: _maxpages:
102: .space 4 /*memory size in no. of physical pages */
103:
104: .globl _lastadd
105: _lastadd:
106: .space 4 /*address of the last long word */
107:
108: .globl _unused
109: _unused:
110: .space 4 /*first unused page in system space */
111:
112: .globl _ctlblk
113: _ctlblk:
114: .long 0 /* pointer to SCB */
115:
116: .globl _savvec0 /*save vectors area */
117: _savvec0:
118: .space 4
119:
120: .globl _savvec1 /*save vectors area */
121: _savvec1:
122: .space 4
123:
124: .globl _savvec2 /*save vectors area */
125: _savvec2:
126: .space 4
127:
128: .globl _savvec3 /*save vectors area */
129: _savvec3:
130: .space 4
131:
132: .globl _savvec4 /*save vectors area */
133: _savvec4:
134: .space 4
135:
136: .globl _savvec5 /*save vectors area */
137: _savvec5:
138: .space 4
139: .globl _savvec6 /*save vectors area */
140: _savvec6:
141: .space 4
142: .globl _savvec7 /*save vectors area */
143: _savvec7:
144: .space 4
145:
146: .globl _savvec8 /*save vectors area */
147: _savvec8:
148: .space 4
149:
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 _ret_adr
166: _ret_adr:
167: .long 0
168: .globl _exp_par0
169: _exp_par0:
170: .long 0
171: .globl _exp_par1
172: _exp_par1:
173: .long 0
174: .globl _f_vaddr
175: _f_vaddr:
176: .long 0 /* VA that caused fault */
177:
178: .globl _f_ptr
179: _f_ptr:
180: .long 0 /* Pointer to fault parameters */
181: .globl _df_cnt
182: _df_cnt:
183: .long 0 /* Count of data fault */
184:
185: .globl _if_cnt
186: _if_cnt:
187: .long 0 /* Count of Instruction fault */
188:
189: .globl _newepc
190: _newepc:
191: .long 0
192:
193: .globl _errcnt
194: _errcnt:
195: .long 0
196:
197: .globl _clk_cnt
198: _clk_cnt:
199: .long 0
200:
201: .globl _ttcnt
202: _ttcnt:
203: .long 0 /* Count of Trap exception */
204: .globl _trcnt
205: _trcnt:
206: .long 0 /* Count of Translation fault */
207:
208: .globl _Ufpte
209: _Ufpte: .long 0
210: .globl _Ulpte
211: _Ulpte: .long 0
212:
213: .globl _dbuf /*dump buffer left out of 1K */
214: _dbuf:
215: .space NBPG - (NLWU *4)
216: edbuf:
217:
218:
219: .globl _intstack /* Interrupt stack */
220: _intstack: /* Physical pages 4 & 5 */
221: .space NISP*NBPG
222: eintstack:
223:
224:
225: .set SYSPTSIZE,512 /* No. of entries in SPT */
226:
227: /*
228: System Page Table -- physical page 6 & 7
229: */
230: .align 2
231: .globl _Sysmap
232: _Sysmap:
233: .space SYSPTSIZE*4 /* 512 max pages allowed for system */
234: eSysmap:
235: .globl _Syssize
236: .set _Syssize,(eSysmap-_Sysmap)/4 /* should be SYSPTSIZE */
237:
238: .globl _iomap /* Physical page 8 */
239: _iomap: .space 1024 /* IOMAP - unused */
240: .globl _eiomap
241: _eiomap:
242:
243: .globl _pcb0 /* Physical page 9 */
244: _pcb0: .space 128 /*process control block 0 */
245: .globl _pcb1
246: _pcb1: .space 128 /*process control block 1 */
247: .globl _pcb2
248: _pcb2: .space 128 /*process control block 2 */
249: .globl _pcb3
250: _pcb3: .space 128 /*process control block 3 */
251: .globl _pcb4
252: _pcb4: .space 128 /*process control block 4 */
253: .globl _pcb5
254: _pcb5: .space 128 /*process control block 5 */
255: .globl _pcb6
256: _pcb6: .space 128 /*process control block 6 */
257: .globl _pcb7
258: _pcb7: .space 128 /*process control block 7 */
259:
260: /*
261: *user #0 page tables -- P0PT, P1PT, P2PT
262: *physical memory -- page10, 11, & 12 respectively
263: */
264: .align 2
265: .globl _u0p0pt
266: _u0p0pt:
267: .space 1024 /*255 max pages for user #0 text */
268: .globl _u0p1pt
269: _u0p1pt:
270: .space 1024 /*255 max pages for user #0 data */
271: .globl _u0p2pt
272: _u0p2pt:
273: .space 1020 /*255 max pages for user #0 stack */
274: eu0p2pt:
275: .space 4
276:
277: /*
278: *user #1 page tables -- P0PT, P1PT, P2PT
279: *physical memory -- page13 ,14, & 15 respectively
280: */
281: .align 2
282: .globl _u1p0pt
283: _u1p0pt:
284: .space 1024 /*255 max pages for user #1 text */
285: .globl _u1p1pt
286: _u1p1pt:
287: .space 1024 /*255 max pages for user #1 data */
288: .globl _u1p2pt
289: _u1p2pt:
290: .space 1020 /*255 max pages for user #1 stack */
291: eu1p2pt:
292: .space 4
293:
294:
295: /*
296: *user #2 page tables -- P0PT, P1PT, P2PT
297: *physical memory -- page 16, 17 , & 18 respectively
298: */
299: .align 2
300: .globl _u2p0pt
301: _u2p0pt:
302: .space 1024 /*255 max pages for user #2 text */
303: .globl _u2p1pt
304: _u2p1pt:
305: .space 1024 /*255 max pages for user #2 data */
306: .globl _u2p2pt
307: _u2p2pt:
308: .space 1020 /*255 max pages for user #2 stack */
309: eu2p2pt:
310: .space 4
311:
312:
313: /*
314: *user #3 page tables -- P0PT, P1PT, P2PT
315: *physical memory -- page 19, 20 , & 21 respectively
316: */
317: .align 2
318: .globl _u3p0pt
319: _u3p0pt:
320: .space 1024 /*255 max pages for user #3 text */
321: .globl _u3p1pt
322: _u3p1pt:
323: .space 1024 /*255 max pages for user #3 data */
324: .globl _u3p2pt
325: _u3p2pt:
326: .space 1020 /*255 max pages for user #3 stack */
327: eu3p2pt:
328: .space 4
329:
330: /*
331: *user #4 thru 6 page tables
332: *physical memory -- pages 22 thru 30
333: */
334: .globl _u4p0pt
335: _u4p0pt:
336: .space (9*NBPG) - 4
337: eu6p2pt:
338: .space 4
339:
340: /*
341: Area used for Kernel stack
342: physical memory -- page 31, 32 , 33
343: */
344:
345: .align 2
346: .globl _Kstack /* Kernel stack */
347: _Kstack: /* Physical pages 31,32,33 */
348: .space 3*NBPG
349: .globl ekstack
350: ekstack:
351:
352:
353: .globl _iob0 /*io buffer 0 */
354: _iob0: .space 1024
355: .globl _iob1 /*io buffer 1 */
356: _iob1: .space 1024
357: .globl _iob2 /*io buffer 2 */
358: _iob2: .space 1024
359: .globl _iob3 /*io buffer 3 */
360: _iob3: .space 1024
361: .globl _iob4 /*io buffer 4 */
362: _iob4: .space 1024
363: .globl _iob5 /*io buffer 5 */
364: _iob5: .space 1024
365: .globl _iob6 /*io buffer 6 */
366: _iob6: .space 1024
367: esysdata:
368:
369: /* SYSTEM CONTROL BLOCK */
370: #include "scblock.s"
371:
372:
373:
374: #include "evthandlers.s"
375:
376: #define ACBL(_n1,_n2,_n3,_n4) addl2 _n2,_n3; cmpl _n3,_n1; bleq _n4;
377:
378:
379:
380: /*
381: *INITIALIZATION CODE
382: *
383: * MME off; mode = k; IPL = 31; IS = 1
384: *
385: */
386:
387:
388: .globl start
389: start:
390: mtpr $0,$MME /* Disable MME */
391: movl r0,_run_list
392: movl r1,_OPTIONS
393: movl r3,_evt_inst /* save a test inst's op-code */
394: clrl _nonstop /* clear the continuous run flag */
395: movl r2,_count /* save the test count */
396: bneq 1f /* is count = 0 ? */
397: movl $1,_count /* yes -set cycle count = 1 */
398: 1: bgeq 1f /* is count < 0 ? */
399: movl $1,_nonstop /* yes -set NONSTOP flag */
400: 1:
401: clrl _no_fpp_wcs /* clear the NO-FPP WCS flag */
402: mtpr $0x400,$DCR /* check for FPP WCS loaded */
403: tstl r1 /* r1 = 0 if NO-FPP WCS loaded */
404: bneq 1f
405: movl $1,_no_fpp_wcs /* set the NO-FPP WCS flag */
406: 1:
407: movab _scb,r0
408: andl2 $0x3ffffc00,r0
409: mtpr r0,$SCBB /* Set SCBB */
410: mtpr $0x1f,$IPL /* Set IPL to HIGH */
411:
412: andl3 $4,r11,_ss1 /* messages sense switch */
413:
414: #
415: # clear the option flags
416: #
417: clrl _halt_flg /* clear the halt on error flag */
418: clrl _loop_on_err /* clear the loop on error flag */
419: movl $1,_prt_error /* clear the print error messages flag */
420: movl $1,_prt_hdrs /* clear the print header messages flag */
421: movl $1,_en_data_cache /* clear the enable data cache flag */
422:
423: #
424: # set the option flags as needed
425: #
426: bitl $1,_OPTIONS /* bit(0) = HALT ON ERROR */
427: beql 1f
428: movl $1,_halt_flg /* set the HALT ON ERROR flag */
429: 1:
430: bitl $2,_OPTIONS /* bit(1) = LOOP ON ERROR */
431: beql 1f
432: movl $1,_loop_on_err /* set the LOOP ON ERROR flag */
433: 1:
434: bitl $4,_OPTIONS /* bit(2) = PRINT ERROR MESSAGES */
435: beql 1f
436: clrl _prt_error /* set the PRINT ERROR MESSAGES flag */
437: 1:
438: bitl $8,_OPTIONS /* bit(3) = PRINT HEADER MESSAGES */
439: beql 1f
440: clrl _prt_hdrs /* set the PRINT HEADER MESSAGES flag */
441: 1:
442: bitl $16,_OPTIONS /* bit(4) = ENABLE DATA CAHE flag */
443: beql 1f
444: clrl _en_data_cache /* set the ENABLE DATA CACHE flag */
445: 1:
446:
447: clrl _exp_event /* clear the fpp event expected flag */
448: movpsl r1
449: andl2 $0xffffff00,r1 /* Mask out flags */
450: cmpl r1,$0x041f0000 /*IS on,modes =k & IPL = 31? */
451: beql 1f
452: 2: movl $1,r0
453: movl $0x041f0000,r2
454: halt /* PSL not initialized as expected */
455: 1:
456: movl $_intstack+NISP*NBPG,r0
457: andl2 $0x3fffffff,r0 /* Mask out bit 30,31 */
458: mtpr r0,$ISP /* init. ISP */
459: movl r0,sp /* in case we get exception */
460: movab (sp),fp /* Initialize FP */
461: #
462: # Clear system data area all the way upto system code
463: # this includes dump buffer,interrupt stack,spt,iomap,pcbs,user
464: # page tables, & io buffer area.
465: #
466: 3:
467: movab esysdata,r7
468: movab _restart,r6
469: 1: clrl (r6)
470: ACBL(r7,$4,r6,1b)
471: #
472: # Initialize System Page Table
473: #
474: 5:
475: clrl r2
476: movab esysdata,r1 /* R1 = Last address in system data area */
477: andl2 $0x3fffffff,r1 /* Mask out bit 30,31 */
478: shar $PGSHIFT,r1,r1 /* Get page no. of last system data addr */
479: /* Map systm data area 1 to 1,kernel writable */
480: 1:
481: orl3 $PG_V|PG_KW,r2,_Sysmap[r2]
482: aoblss r1,r2,1b
483:
484: #
485: # Map system text area 1 to 1, Kernel read/write.
486: # For this to work, the label _etext must exist at the end
487: # of system code; Add in 4 more pages for data area used in C
488: #
489: movab _Esys,r1 /* Map System text 1 to 1; Kernel R/W */
490: andl2 $0x3fffffff,r1
491: shar $PGSHIFT,r1,r1
492: 1:
493: orl3 $PG_V|PG_KW,r2,_Sysmap[r2]
494: aobleq r1,r2,1b
495: #
496: # Map from here to last page used by user :
497: # invalid, User access, & virtual = physical
498: #
499: movl r2,_unused /* Save first unused physical page no */
500: movl r2,_Ufpte /* First PTE of User */
501: movl $0x80000,r1 /* Allow this much memory for User */
502: shar $PGSHIFT,r1,r1
503: movl r1,_Ulpte /* Last PTE of User */
504:
505: 1:
506: orl3 $PG_V|PG_UW,r2,_Sysmap[r2] /* Valid / User Read/Write */
507: aoblss r1,r2,1b
508:
509: #
510: # Initialize SBR, SLR
511: #
512: sysrdy:
513: mtpr $_Sysmap,$SBR /* Set SYSTEM BASE REG */
514: mtpr $_Syssize,$SLR
515: mtpr $64,$DCR /* Enable fault */
516:
517: # GO TO VIRTUAL MODE
518: # Double map the kernel into user addresses :
519: # This will enable system to go to virtual mode the 1st time !!
520: #
521:
522: orl3 $0xc0000000,$_Sysmap,r0
523: mtpr r0,$P0BR /* Double map P0BR to SBR */
524: mtpr $_Syssize,$P0LR
525: mtpr $1,$PADC /* Purge all data cache */
526: mtpr $1,$PACC /* Purge all code cache */
527: mtpr $1,$TBIA /* Purge all Trans. buffer */
528:
529: mtpr $_pcb0,$0xe /* Init. PCBB to PCB_0 */
530:
531: movab _pcb0,r0
532: movab ekstack,PCB_KSP(r0) /* Init. PCB_KSP */
533: movab eustack,PCB_USP(r0) /* Init. PCB_USP */
534: mfpr $P0BR,PCB_P0BR(r0) /* " PCB_P0BR */
535: mfpr $P0LR,PCB_P0LR(r0) /* " PCB_P0LR */
536: movl $0x0000000,PCB_PSL(r0) /* Set PCB_PSL : Kernel Mode */
537:
538: mfpr $SCBB,r0 /* get the SCB pointer */
539: movab _Clock_handler,CLOCKVEC(r0) /* Set new clock handler */
540:
541: movab ekstack,sp /* set the stack pointer */
542: movab (sp),fp /* Initialize FP */
543:
544: movl $1,_Codek
545: mtpr _Codek,$CCK /* Set code cache key */
546:
547: callf $4,_monitor
548:
549:
550:
551:
552: # /****************************************************************************
553: # * Real Time Clock Handler routine
554: # ****************************************************************************/
555: .align 2
556: .globl _Clock_handler
557: _Clock_handler:
558: movl $1,_rtc_occurred /* set the clock event flag */
559: rei /* return to the test routine */
560:
561:
562:
563: # /****************************************************************************
564: # * STACK AREA
565: # ****************************************************************************/
566:
567: .globl _Esys /* end of systems only code */
568: _Esys:
569: .space NBPG
570:
571: .globl _Ustack /* basic stack space */
572: _Ustack:
573: .space (2*NBPG)-4 /* 2 pages */
574: .globl eustack
575: eustack:
576: .long 0 /* initial user stack ptr */
577:
578: .globl U_area
579: U_area:
580:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.