|
|
1.1 root 1: LL0:
2: .data
3: .set SBR,0
4: .set SLR,1
5: .set P0BR,2
6: .set P0LR,3
7: .set P1BR,4
8: .set P1LR,5
9: .set P2BR,6
10: .set P2LR,7
11: .set IPL,8
12: .set MAPEN,9
13: .set MME,9
14: .set TBIA,10
15: .set TBIS,11
16: .set DCK,12
17: .set CCK,13
18: .set PCBB,14
19: .set KSP,19
20: .set USP,20
21: .set CPMDCB,21
22: .set PADC,25
23: .set DCR,27
24: .set DC_ON,1
25: .set DC_OFF,2
26: .set TB_ON,256
27: .set TB_OFF,512
28: .comm _dummy,4
29: .text
30: .align 1
31: .globl _mfpr
32: _mfpr:
33: .word L16
34: #
35: # #include "definitions"
36: #
37: # extern long r_no, pt_base, ctlblk;
38: # long dummy;
39: #
40: # /* To get value of base registers */
41: # mfpr(sr)
42: # long sr;
43: # {
44: jbr L18
45: L19:
46: # asm("mfpr 4(fp),_dummy");
47: mfpr 4(fp),_dummy
48: # return(dummy);
49: movl _dummy,r0
50: ret
51: # }
52: ret
53: .set L16,0x0
54: L18:
55: jbr L19
56: .data
57: .text
58: .align 1
59: .globl _fixpv_pte
60: _fixpv_pte:
61: .word L21
62: #
63: # /* This routine modify the valid,protection bits (bit 27-31) of PTE
64: # in any Page table. Input parameter :
65: # reg_no : contain a number specify one of the following :
66: # SBR,SLR,P0BR,P0LR,P1BR,P1LR,P2BR,P2LR
67: # old_pte : pointer to location to save original PTE
68: # (This could be used to read any PTE when pvbits_msk = 0)
69: # which1 : PTE no; 0,1,2...X
70: # pvbits_msk : bit 27-31 of PTE
71: # */
72: # fixpv_pte(reg_no,which1,old_pte,pvbits_msk)
73: # long reg_no, *old_pte, which1, pvbits_msk;
74: # {
75: jbr L23
76: L24:
77: # long *st_base;
78: #
79: # r_no = reg_no;
80: movl 4(fp),_r_no
81: #
82: # /* asm("mfpr _r_no,_pt_base"); */ /* Get base address */
83: # pt_base = mfpr(r_no);
84: pushl _r_no
85: callf $8,_mfpr
86: movl r0,_pt_base
87: #
88: # st_base = (long *)pt_base;
89: movl _pt_base,-56(fp)
90: # st_base += which1;
91: shll $2,8(fp),r0
92: addl2 r0,-56(fp)
93: # *old_pte = *st_base; /* Save original PTE */
94: movl *-56(fp),*12(fp)
95: # /* Mask access and valid bits off */
96: # *st_base = (*st_base) & (~(PTE_PROT | PTE_V));
97: andl3 $134217727,*-56(fp),r0
98: movl r0,*-56(fp)
99: # *st_base = (*st_base)|(pvbits_msk); /* Set V,protection bits */
100: orl3 16(fp),*-56(fp),r0
101: movl r0,*-56(fp)
102: # asm("mtpr $0,$TBIA"); /* Invalidate translation buffers */
103: mtpr $0,$TBIA
104: # }
105: ret
106: .set L21,0x0
107: L23:
108: subl3 $56,fp,sp
109: jbr L24
110: .data
111: .text
112: .align 1
113: .globl _fixmuc_pte
114: _fixmuc_pte:
115: .word L26
116: #
117: # /* This routine modify the modify,used,uncachable bits (22-24) of PTE
118: # in any Page table. Input parameter :
119: # reg_no : contain a number specify one of the following :
120: # SBR,SLR,P0BR,P0LR,P1BR,P1LR,P2BR,P2LR
121: # old_pte : pointer to location to save original PTE
122: # (This could be used to read any PTE when pvbits_msk = 0)
123: # which1 : PTE no; 0,1,2...X
124: # pvbits_msk : bits 22-24 of PTE; if mask < 0 then just read back PTE.
125: # */
126: # fixmuc_pte(reg_no,which1,old_pte,pvbits_msk)
127: # long reg_no, *old_pte, which1, pvbits_msk;
128: # {
129: jbr L28
130: L29:
131: # long *st_base;
132: #
133: # r_no = reg_no;
134: movl 4(fp),_r_no
135: #
136: # /* asm("mfpr _r_no,_pt_base"); */ /* Get base address */
137: # pt_base = mfpr(r_no);
138: pushl _r_no
139: callf $8,_mfpr
140: movl r0,_pt_base
141: #
142: # st_base = (long *)pt_base;
143: movl _pt_base,-56(fp)
144: # st_base += which1;
145: shll $2,8(fp),r0
146: addl2 r0,-56(fp)
147: # *old_pte = *st_base; /* Save original PTE */
148: movl *-56(fp),*12(fp)
149: # if (pvbits_msk < 0) return;
150: tstl 16(fp)
151: jgeq L30
152: ret
153: # *st_base=(*st_base)&(~(PTE_UC|PTE_M|PTE_U)); /* Mask NC,M,U bit off */
154: L30:
155: andl3 $-29360129,*-56(fp),r0
156: movl r0,*-56(fp)
157: # *st_base = (*st_base)|(pvbits_msk);
158: orl3 16(fp),*-56(fp),r0
159: movl r0,*-56(fp)
160: # asm("mtpr $0,$TBIA"); /* Invalidate translation buffers */
161: mtpr $0,$TBIA
162: # }
163: ret
164: .set L26,0x0
165: L28:
166: subl3 $56,fp,sp
167: jbr L29
168: .data
169: .text
170: .align 1
171: .globl _fixpfn_pte
172: _fixpfn_pte:
173: .word L32
174: #
175: # /* This routine modify the page frame number (bit 0-21) of PTE
176: # in any Page table. Input parameter :
177: # reg_no : contain a number specify one of the following :
178: # SBR,SLR,P0BR,P0LR,P1BR,P1LR,P2BR,P2LR
179: # old_pte : pointer to location to save original PTE
180: # (This could be used to read any PTE when pvbits_msk = 0)
181: # which1 : PTE no; 0,1,2...X
182: # pfn : New page frame no. (bit 0 thru 19 of pfn )
183: # */
184: # fixpfn_pte(reg_no,which1,old_pte,pfn)
185: # long reg_no, *old_pte, which1, pfn;
186: # {
187: jbr L34
188: L35:
189: # long *st_base;
190: #
191: # r_no = reg_no;
192: movl 4(fp),_r_no
193: #
194: # /* asm("mfpr _r_no,_pt_base"); */ /* Get base address */
195: # pt_base = mfpr(r_no);
196: pushl _r_no
197: callf $8,_mfpr
198: movl r0,_pt_base
199: #
200: # st_base = (long *)pt_base;
201: movl _pt_base,-56(fp)
202: # st_base += which1;
203: shll $2,8(fp),r0
204: addl2 r0,-56(fp)
205: # *old_pte = *st_base; /* Save original PTE */
206: movl *-56(fp),*12(fp)
207: # *st_base = (*st_base)&(~PTE_PFN); /* Mask PFN off */
208: andl3 $-4194304,*-56(fp),r0
209: movl r0,*-56(fp)
210: # *st_base = (*st_base)|(pfn & PTE_PFN); /* Set new PFN */
211: andl3 $4194303,16(fp),r0
212: orl3 r0,*-56(fp),r0
213: movl r0,*-56(fp)
214: # *st_base = (*st_base)&0xff7fffff; /* Set PTE_M bit off */
215: andl3 $-8388609,*-56(fp),r0
216: movl r0,*-56(fp)
217: # asm("mtpr $0,$TBIA"); /* Invalidate translation buffers */
218: mtpr $0,$TBIA
219: # asm("mtpr $0,$PADC"); /* Purge all data cache */
220: mtpr $0,$PADC
221: # }
222: ret
223: .set L32,0x0
224: L34:
225: subl3 $56,fp,sp
226: jbr L35
227: .data
228: .text
229: .align 1
230: .globl _set_handler
231: _set_handler:
232: .word L37
233: #
234: # /* This routine saved a vector in SCB and set it to a new one
235: # input parameters :
236: # which1 : Vector no; 0,1,2,..X
237: # saved_vec : pointer to a location to saved original vector
238: # new_vec : address of new handler
239: # stack : 'K' or 'k' : service on Kernel stack
240: # otherwise : service on Interrupt stack
241: # */
242: #
243: #
244: # set_handler(which1,saved_vec,new_vec)
245: # long which1, *saved_vec, new_vec;
246: # { long *st_base;
247: jbr L39
248: L40:
249: #
250: # asm("movab _scb,_ctlblk");
251: movab _scb,_ctlblk
252: # st_base = (long *)ctlblk; /* address of SCB is at page 2 */
253: movl _ctlblk,-56(fp)
254: # st_base += which1;
255: shll $2,4(fp),r0
256: addl2 r0,-56(fp)
257: # *saved_vec = *st_base; /* Save original vector */
258: movl *-56(fp),*8(fp)
259: # *st_base = new_vec;
260: movl 12(fp),*-56(fp)
261: # }
262: ret
263: .set L37,0x0
264: L39:
265: subl3 $56,fp,sp
266: jbr L40
267: .data
268: .text
269: .align 1
270: .globl _write_pg
271: _write_pg:
272: .word L42
273: #
274: #
275: # /* This routine write the who page of memory with "value"
276: # Inpur parameters :
277: # space : Has 1 of these values (0,1,2,3) correspond to
278: # P0, P1, P2, System space respectively.
279: # page_no : Virtual page no. to be written
280: # value : Value to be written
281: # v_type : | 0 : value is used to write in all locations.
282: # | 1 : value is the start value and is incremented
283: # | for next locations.
284: # */
285: #
286: # write_pg(space,page_no,value,v_type)
287: # long space, page_no, value, v_type;
288: # {
289: jbr L44
290: L45:
291: # long *lptr;
292: # int ix;
293: #
294: # lptr = (long *)(((space & 0x3)<<30)|((page_no & 0xfffff)<<PGSHIFT));
295: andl3 $3,4(fp),r0
296: shll $30,r0,r0
297: andl3 $1048575,8(fp),r1
298: shll $10,r1,r1
299: orl2 r1,r0
300: movl r0,-56(fp)
301: # for (ix=0;ix<NBPG;ix += 4)
302: clrl -60(fp)
303: L48:
304: cmpl -60(fp),$1024
305: jgeq L47
306: # {
307: # *lptr++ = value;
308: movl 12(fp),*-56(fp)
309: addl2 $4,-56(fp)
310: # if (v_type) value += 4;
311: tstl 16(fp)
312: jeql L49
313: addl2 $4,12(fp)
314: # }
315: L49:
316: L46:
317: addl2 $4,-60(fp)
318: jbr L48
319: L47:
320: # }
321: ret
322: .set L42,0x0
323: L44:
324: subl3 $60,fp,sp
325: jbr L45
326: .data
327: .text
328: .align 1
329: .globl _read_pg
330: _read_pg:
331: .word L51
332: #
333: # /* This routine read the who page of memory .
334: # Inpur parameters :
335: # space : Has 1 of these values (0,1,2,3) correspond to
336: # P0, P1, P2, System space respectively.
337: # page_no : Virtual page no. to be read.
338: # start_dst : pointer to array of longwords.
339: # */
340: #
341: # read_pg(space,page_no,start_dst)
342: # long space, page_no, *start_dst;
343: # {
344: jbr L53
345: L54:
346: # long *lptr;
347: # int ix;
348: #
349: # lptr = (long *)(((space & 0x3)<<30)|((page_no & 0xfffff)<<PGSHIFT));
350: andl3 $3,4(fp),r0
351: shll $30,r0,r0
352: andl3 $1048575,8(fp),r1
353: shll $10,r1,r1
354: orl2 r1,r0
355: movl r0,-56(fp)
356: # for (ix=0;ix<NBPG;ix += 4)
357: clrl -60(fp)
358: L57:
359: cmpl -60(fp),$1024
360: jgeq L56
361: # *start_dst++ = *lptr++ ;
362: movl *-56(fp),*12(fp)
363: addl2 $4,-56(fp)
364: addl2 $4,12(fp)
365: L55:
366: addl2 $4,-60(fp)
367: jbr L57
368: L56:
369: # }
370: ret
371: .set L51,0x0
372: L53:
373: subl3 $60,fp,sp
374: jbr L54
375: .data
376: #
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.