File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / ioex / subs.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (6 years, 11 months ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b



long r_no, pt_base, ctlblk;

/* This routine modify the page frame number (bit 0-21) of PTE
   in any Page table. Input parameter :
	reg_no     : contain a number specify one of the following :
		     SBR,SLR,P0BR,P0LR,P1BR,P1LR,P2BR,P2LR
	old_pte    : pointer to location to save original PTE
		     (This could be used to read any PTE when pvbits_msk = 0)
	which1     : PTE no; 0,1,2...X
	pfn	   : New page frame no. (bit 0 thru 19 of pfn )
*/
fixpfn_pte(reg_no,which1,old_pte,pfn)
long reg_no, *old_pte, which1, pfn;
{	
	long *st_base;

	r_no = reg_no;

	asm("mfpr _r_no,_pt_base"); 		/* Get base address  */

	st_base = (long *)pt_base;
	st_base += which1;
	*old_pte = *st_base;			/* Save original PTE */
	*st_base = (*st_base)&(~PTE_PFN); 	/* Mask PFN off */
	*st_base = (*st_base)|(pfn & PTE_PFN);  /* Set new PFN */
	*st_base = (*st_base)&0xff7fffff;  	/* Set PTE_M bit off */
	asm("mtpr $0,$TBIA");		/* Invalidate translation buffers */
	asm("mtpr $0,$PADC");		/* Purge all data cache */
}

/* This routine saved a vector in SCB and set it to a new one
   input parameters :
	which1 : Vector no; 0,1,2,..X
	saved_vec : pointer to a location to saved original vector
	new_vec   : address of new handler
	stack     : 'K' or 'k' : service on Kernel stack
		    otherwise  : service on Interrupt stack
*/
set_handler(which1,saved_vec,new_vec)
long which1, *saved_vec, new_vec; 
{	long *st_base;

	asm("movab _scb,_ctlblk");
	st_base = (long *)ctlblk;	/* address of SCB is at page 2 */
	st_base += which1;
	*saved_vec = *st_base;		/* Save original vector */
	*st_base = new_vec;
}


unix.superglobalmegacorp.com

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