|
|
1.1 root 1:
2: asm(".set NBPG,1024");
3: asm(".set TBIA,10");
4: asm(".set PCBB,14");
5: asm(".set SCBB,18");
6: asm(".set PACC,23");
7: asm(".set PADC,25");
8:
9: long clock_cnt = 0;
10:
11: clock()
12: {
13: clock_cnt++;
14: }
15:
16:
17: /* **********************************************************
18: This routine saved a vector in SCB and set it to a new one
19: input parameters :
20: which1 : Vector no; 0,1,2,..X
21: saved_vec : pointer to a location to saved original vector
22: new_vec : address of new handler
23: **********************************************************
24: */
25: set_handler(which1,saved_vec,new_vec)
26: long which1, *saved_vec, new_vec;
27: { register long *st_base;
28:
29: asm("mfpr $SCBB,r12"); /* st_base = &_scb */
30: st_base += which1;
31: *saved_vec = *st_base; /* Save original vector */
32: *st_base = new_vec;
33: }
34:
35:
36: /* ******************************************************************
37: This routine set new PTE for any Page Table. If input var 'pte'==0
38: then this routine will only READ the PTE specify.
39: Input parameter :
40: reg_no : contain a number specify one of the following :
41: SBR,SLR,P0BR,P0LR,P1BR,P1LR,P2BR,P2LR
42: old_pte : pointer to location to save original PTE
43: (Used to READ pte when var 'pte'==0)
44: which1 : PTE no; 0,1,2...X
45: pte : New pte
46: ******************************************************************
47: */
48: fix_pte(reg_no,which1,old_pte,pte)
49: long reg_no, *old_pte, which1, pte;
50: {
51: register long *st_base;
52:
53: asm("mfpr 4(fp),r12"); /* st_base = base address */
54: st_base += which1;
55: *old_pte = *st_base; /* Save original PTE */
56: if (pte) {
57: *st_base = pte; /* Set new PTE */
58: asm("mtpr $0,$TBIA"); /* Invalidate translation buffers */
59: asm("mtpr $0,$PADC"); /* Purge all data cache */
60: }
61: }
62:
63: uncache(va)
64: long *va;
65: {
66: asm("mtpr 4(fp),$0x1c");
67: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.