File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / ioex / sys.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


asm(".set NBPG,1024");
asm(".set TBIA,10");
asm(".set PCBB,14");
asm(".set SCBB,18");
asm(".set PACC,23");
asm(".set PADC,25");

long clock_cnt = 0;

clock()
{
	clock_cnt++;
}


/*	**********************************************************
 	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
	**********************************************************
*/
set_handler(which1,saved_vec,new_vec)
long which1, *saved_vec, new_vec; 
{	register long *st_base;

	asm("mfpr $SCBB,r12"); 		/* st_base = &_scb */
	st_base += which1;
	*saved_vec = *st_base;		/* Save original vector */
	*st_base = new_vec;
}


/*	******************************************************************
 	This routine set new PTE for any Page Table. If input var 'pte'==0
   	then this routine will only READ the PTE specify.
   	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
		     (Used to READ pte when var 'pte'==0)
	which1     : PTE no; 0,1,2...X
	pte	   : New pte
	******************************************************************
*/
fix_pte(reg_no,which1,old_pte,pte)
long reg_no, *old_pte, which1, pte;
{	
	register long *st_base;

	asm("mfpr 4(fp),r12"); 		/* st_base = base address  */
	st_base += which1;
	*old_pte = *st_base;		/* Save original PTE */
	if (pte) {
		*st_base = pte;  		/* Set new PTE */
		asm("mtpr $0,$TBIA");	/* Invalidate translation buffers */
		asm("mtpr $0,$PADC");		/* Purge all data cache */
		}
}

uncache(va)
long *va;
{
	asm("mtpr 4(fp),$0x1c");
}

unix.superglobalmegacorp.com

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