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

LL0:
	.data
	.set SBR,0
	.set SLR,1
	.set P0BR,2
	.set P0LR,3
	.set P1BR,4
	.set P1LR,5
	.set P2BR,6
	.set P2LR,7
	.set IPL,8
	.set MAPEN,9
	.set MME,9
	.set TBIA,10
	.set TBIS,11
	.set DCK,12
	.set CCK,13
	.set PCBB,14
	.set KSP,19
	.set USP,20
	.set CPMDCB,21
	.set PADC,25
	.set DCR,27
	.set DC_ON,1
	.set DC_OFF,2
	.set TB_ON,256
	.set TB_OFF,512
	.comm	_dummy,4
	.text
	.align	1
	.globl	_mfpr
_mfpr:
	.word	L16
 # 
 # #include "definitions"
 # 
 # extern long r_no, pt_base, ctlblk;
 # long dummy;
 # 
 # /* To get value of base registers */
 # mfpr(sr)
 # long sr;
 # {
	jbr 	L18
L19:
 # 	asm("mfpr 4(fp),_dummy");
mfpr 4(fp),_dummy
 # 	return(dummy);
	movl	_dummy,r0
	ret
 # }
	ret
	.set	L16,0x0
L18:
	jbr 	L19
	.data
	.text
	.align	1
	.globl	_fixpv_pte
_fixpv_pte:
	.word	L21
 # 
 # /* This routine modify the valid,protection bits (bit 27-31) 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
 # 	pvbits_msk : bit 27-31 of PTE 
 # */
 # fixpv_pte(reg_no,which1,old_pte,pvbits_msk)
 # long reg_no, *old_pte, which1, pvbits_msk;
 # {	
	jbr 	L23
L24:
 # 	long *st_base;
 # 
 # 	r_no = reg_no;
	movl	4(fp),_r_no
 # 
 # /*	asm("mfpr _r_no,_pt_base"); */		/* Get base address  */
 # 	pt_base = mfpr(r_no);
	pushl	_r_no
	callf	$8,_mfpr
	movl	r0,_pt_base
 # 
 # 	st_base = (long *)pt_base;
	movl	_pt_base,-56(fp)
 # 	st_base += which1;
	shll	$2,8(fp),r0
	addl2	r0,-56(fp)
 # 	*old_pte = *st_base;			/* Save original PTE */
	movl	*-56(fp),*12(fp)
 # 	/* Mask access and valid bits off */
 # 	*st_base = (*st_base) & (~(PTE_PROT | PTE_V));
	andl3	$134217727,*-56(fp),r0
	movl	r0,*-56(fp)
 # 	*st_base = (*st_base)|(pvbits_msk);  	/* Set V,protection bits */
	orl3	16(fp),*-56(fp),r0
	movl	r0,*-56(fp)
 # 	asm("mtpr $0,$TBIA");		/* Invalidate translation buffers */
mtpr $0,$TBIA
 # }
	ret
	.set	L21,0x0
L23:
	subl3	$56,fp,sp
	jbr 	L24
	.data
	.text
	.align	1
	.globl	_fixmuc_pte
_fixmuc_pte:
	.word	L26
 # 
 # /* This routine modify the modify,used,uncachable bits (22-24) 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
 # 	pvbits_msk : bits 22-24 of PTE; if mask < 0 then just read back PTE. 
 # */
 # fixmuc_pte(reg_no,which1,old_pte,pvbits_msk)
 # long reg_no, *old_pte, which1, pvbits_msk;
 # {	
	jbr 	L28
L29:
 # 	long *st_base;
 # 
 # 	r_no = reg_no;
	movl	4(fp),_r_no
 # 
 # /*	asm("mfpr _r_no,_pt_base"); */		/* Get base address  */
 # 	pt_base = mfpr(r_no);
	pushl	_r_no
	callf	$8,_mfpr
	movl	r0,_pt_base
 # 
 # 	st_base = (long *)pt_base;
	movl	_pt_base,-56(fp)
 # 	st_base += which1;
	shll	$2,8(fp),r0
	addl2	r0,-56(fp)
 # 	*old_pte = *st_base;			/* Save original PTE */
	movl	*-56(fp),*12(fp)
 # 	if (pvbits_msk < 0) return;
	tstl	16(fp)
	jgeq	L30
	ret
 # 	*st_base=(*st_base)&(~(PTE_UC|PTE_M|PTE_U)); /* Mask NC,M,U bit off */
L30:
	andl3	$-29360129,*-56(fp),r0
	movl	r0,*-56(fp)
 # 	*st_base = (*st_base)|(pvbits_msk);  
	orl3	16(fp),*-56(fp),r0
	movl	r0,*-56(fp)
 # 	asm("mtpr $0,$TBIA");		/* Invalidate translation buffers */
mtpr $0,$TBIA
 # }
	ret
	.set	L26,0x0
L28:
	subl3	$56,fp,sp
	jbr 	L29
	.data
	.text
	.align	1
	.globl	_fixpfn_pte
_fixpfn_pte:
	.word	L32
 # 
 # /* 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;
 # {	
	jbr 	L34
L35:
 # 	long *st_base;
 # 
 # 	r_no = reg_no;
	movl	4(fp),_r_no
 # 
 # /*	asm("mfpr _r_no,_pt_base"); */		/* Get base address  */
 # 	pt_base = mfpr(r_no);
	pushl	_r_no
	callf	$8,_mfpr
	movl	r0,_pt_base
 # 
 # 	st_base = (long *)pt_base;
	movl	_pt_base,-56(fp)
 # 	st_base += which1;
	shll	$2,8(fp),r0
	addl2	r0,-56(fp)
 # 	*old_pte = *st_base;			/* Save original PTE */
	movl	*-56(fp),*12(fp)
 # 	*st_base = (*st_base)&(~PTE_PFN); 	/* Mask PFN off */
	andl3	$-4194304,*-56(fp),r0
	movl	r0,*-56(fp)
 # 	*st_base = (*st_base)|(pfn & PTE_PFN);  /* Set new PFN */
	andl3	$4194303,16(fp),r0
	orl3	r0,*-56(fp),r0
	movl	r0,*-56(fp)
 # 	*st_base = (*st_base)&0xff7fffff;  	/* Set PTE_M bit off */
	andl3	$-8388609,*-56(fp),r0
	movl	r0,*-56(fp)
 # 	asm("mtpr $0,$TBIA");		/* Invalidate translation buffers */
mtpr $0,$TBIA
 # 	asm("mtpr $0,$PADC");		/* Purge all data cache */
mtpr $0,$PADC
 # }
	ret
	.set	L32,0x0
L34:
	subl3	$56,fp,sp
	jbr 	L35
	.data
	.text
	.align	1
	.globl	_set_handler
_set_handler:
	.word	L37
 # 
 # /* 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;
	jbr 	L39
L40:
 # 
 # 	asm("movab _scb,_ctlblk");
movab _scb,_ctlblk
 # 	st_base = (long *)ctlblk;	/* address of SCB is at page 2 */
	movl	_ctlblk,-56(fp)
 # 	st_base += which1;
	shll	$2,4(fp),r0
	addl2	r0,-56(fp)
 # 	*saved_vec = *st_base;		/* Save original vector */
	movl	*-56(fp),*8(fp)
 # 	*st_base = new_vec;
	movl	12(fp),*-56(fp)
 # }
	ret
	.set	L37,0x0
L39:
	subl3	$56,fp,sp
	jbr 	L40
	.data
	.text
	.align	1
	.globl	_write_pg
_write_pg:
	.word	L42
 # 
 # 
 # /* This routine write the who page of memory with "value"
 #    Inpur parameters :
 # 	space	: Has 1 of these values (0,1,2,3) correspond to
 # 		  P0, P1, P2, System space respectively.
 # 	page_no	: Virtual page no. to be written
 # 	value   : Value to be written
 # 	v_type	: | 0 : value is used to write in all locations.
 # 		  | 1 : value is the start value and is incremented
 # 		  |     for next locations.
 # */
 # 
 # write_pg(space,page_no,value,v_type)
 # long space, page_no, value, v_type;
 # {
	jbr 	L44
L45:
 # 	long *lptr;
 # 	int ix;
 # 
 # 	lptr = (long *)(((space & 0x3)<<30)|((page_no & 0xfffff)<<PGSHIFT));
	andl3	$3,4(fp),r0
	shll	$30,r0,r0
	andl3	$1048575,8(fp),r1
	shll	$10,r1,r1
	orl2	r1,r0
	movl	r0,-56(fp)
 # 	for (ix=0;ix<NBPG;ix += 4)
	clrl	-60(fp)
L48:
	cmpl	-60(fp),$1024
	jgeq	L47
 # 		{
 # 		  *lptr++ = value;
	movl	12(fp),*-56(fp)
	addl2	$4,-56(fp)
 # 		  if (v_type) value += 4;
	tstl	16(fp)
	jeql	L49
	addl2	$4,12(fp)
 # 		}
L49:
L46:
	addl2	$4,-60(fp)
	jbr 	L48
L47:
 # }
	ret
	.set	L42,0x0
L44:
	subl3	$60,fp,sp
	jbr 	L45
	.data
	.text
	.align	1
	.globl	_read_pg
_read_pg:
	.word	L51
 # 
 # /* This routine read the who page of memory .
 #    Inpur parameters :
 # 	space	: Has 1 of these values (0,1,2,3) correspond to
 # 		  P0, P1, P2, System space respectively.
 # 	page_no	: Virtual page no. to be read.
 # 	start_dst : pointer to array of longwords.
 # */
 # 
 # read_pg(space,page_no,start_dst)
 # long space, page_no, *start_dst;
 # {
	jbr 	L53
L54:
 # 	long *lptr;
 # 	int ix;
 # 
 # 	lptr = (long *)(((space & 0x3)<<30)|((page_no & 0xfffff)<<PGSHIFT));
	andl3	$3,4(fp),r0
	shll	$30,r0,r0
	andl3	$1048575,8(fp),r1
	shll	$10,r1,r1
	orl2	r1,r0
	movl	r0,-56(fp)
 # 	for (ix=0;ix<NBPG;ix += 4)
	clrl	-60(fp)
L57:
	cmpl	-60(fp),$1024
	jgeq	L56
 # 		  *start_dst++ = *lptr++ ;
	movl	*-56(fp),*12(fp)
	addl2	$4,-56(fp)
	addl2	$4,12(fp)
L55:
	addl2	$4,-60(fp)
	jbr 	L57
L56:
 # }
	ret
	.set	L51,0x0
L53:
	subl3	$60,fp,sp
	jbr 	L54
	.data
 # 

unix.superglobalmegacorp.com

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