|
|
1.1 ! root 1: ! 2: ! 3: long r_no, pt_base, ctlblk; ! 4: ! 5: /* This routine modify the page frame number (bit 0-21) of PTE ! 6: in any Page table. Input parameter : ! 7: reg_no : contain a number specify one of the following : ! 8: SBR,SLR,P0BR,P0LR,P1BR,P1LR,P2BR,P2LR ! 9: old_pte : pointer to location to save original PTE ! 10: (This could be used to read any PTE when pvbits_msk = 0) ! 11: which1 : PTE no; 0,1,2...X ! 12: pfn : New page frame no. (bit 0 thru 19 of pfn ) ! 13: */ ! 14: fixpfn_pte(reg_no,which1,old_pte,pfn) ! 15: long reg_no, *old_pte, which1, pfn; ! 16: { ! 17: long *st_base; ! 18: ! 19: r_no = reg_no; ! 20: ! 21: asm("mfpr _r_no,_pt_base"); /* Get base address */ ! 22: ! 23: st_base = (long *)pt_base; ! 24: st_base += which1; ! 25: *old_pte = *st_base; /* Save original PTE */ ! 26: *st_base = (*st_base)&(~PTE_PFN); /* Mask PFN off */ ! 27: *st_base = (*st_base)|(pfn & PTE_PFN); /* Set new PFN */ ! 28: *st_base = (*st_base)&0xff7fffff; /* Set PTE_M bit off */ ! 29: asm("mtpr $0,$TBIA"); /* Invalidate translation buffers */ ! 30: asm("mtpr $0,$PADC"); /* Purge all data cache */ ! 31: } ! 32: ! 33: /* This routine saved a vector in SCB and set it to a new one ! 34: input parameters : ! 35: which1 : Vector no; 0,1,2,..X ! 36: saved_vec : pointer to a location to saved original vector ! 37: new_vec : address of new handler ! 38: stack : 'K' or 'k' : service on Kernel stack ! 39: otherwise : service on Interrupt stack ! 40: */ ! 41: set_handler(which1,saved_vec,new_vec) ! 42: long which1, *saved_vec, new_vec; ! 43: { long *st_base; ! 44: ! 45: asm("movab _scb,_ctlblk"); ! 46: st_base = (long *)ctlblk; /* address of SCB is at page 2 */ ! 47: st_base += which1; ! 48: *saved_vec = *st_base; /* Save original vector */ ! 49: *st_base = new_vec; ! 50: } ! 51:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.