File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / d / memman / cp.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 CPMDCB,21
.set DC_OFF,2
.set DC_ON,1
.set MME,9
.set DCR,27
.set PDCS,28
.set CTL_SW,0x41b
	.comm	_tmp_lw,4
	.align	2
	.globl	_cpbuf_sz
_cpbuf_sz:
	.long	1
	.align	2
	.globl	_charcnt
_charcnt:
	.long	0
	.comm	_cpout,204
.set HISR,0x410
	.text
	.align	1
	.globl	_putstr
_putstr:
	.word	L16
 # /*	Console Processor Interface 	*/
 # /*	Tahoe version, Nov. 1982	*/
 # 
 # /****************************************/
 # /*					*/
 # /*	Reduced DCB layout for byte	*/
 # /*	communication.			*/
 # /*					*/
 # /****************************************/
 # 
 # asm(".set CPMDCB,21");
 # asm(".set DC_OFF,2");
 # asm(".set DC_ON,1");
 # asm(".set MME,9");
 # asm(".set DCR,27");
 # asm(".set PDCS,28");
 # asm(".set CTL_SW,0x41b");  /* Addr of switches to turn on Cache, MME, Fault */
 # long tmp_lw;
 # 
 # 
 # #define	CPBUFLEN 200		/* Output buffer length */
 # struct	cphdr
 # {
 # 	char	cp_unit;	/* Done bit & unit # */
 # 	char	cp_comm;	/* Command */
 # 	short	cp_count;	/* Counter (when relevant) */
 # };
 # 
 # struct	cpdcb_o			/* Output structure */
 # {
 # 	struct	cphdr	cp_hdr;
 # 	char	cp_buf[CPBUFLEN]; /* Buffer for output or 'stty' */
 # };
 # 
 # struct	cpdcb_i			/* Structure for input */
 # {
 # 	struct	cphdr	cp_hdr;
 # 	char	cpi_buf[4]; 	/* Buffer for input */
 # };
 # 
 # #define	CPDONE	0x80		/* 'Done' bit in cp_unit */
 # #define	CPTAKE	0x40		/* CP 'ack' to this cpdcb */
 # 
 # 		/* Values for 'unit' */
 # #define	CPUNIT	0		/* The CP itself */
 # #define	CPCONS	1		/* Console line */
 # #define	CPREMOT	2		/* Remote line */
 # 
 # 		/* Values for 'command' */
 # #define	CPRESET 0
 # #define	CPWRITE 1
 # #define	CPREAD	2
 # #define	CPSTTY	3
 # #define	CPBOOT	4
 # 
 # 
 # /*	Put a char to CPU2 console */
 # 
 # #define NCHAR	1
 # 
 # long cpbuf_sz = 1;		/* Buffer size   */
 # long charcnt = 0;
 # struct cpdcb_o cpout;			/* DCB for output */
 # 
 # asm(".set HISR,0x410");
 # 
 # putstr(str)
 # char *str;
 # {	long c_cnt;
	jbr 	L18
L19:
 # 
 # 	cpout.cp_hdr.cp_unit = CPCONS;		/* Reset done bit */
	cvtlb	$1,_cpout
 # 	cpout.cp_hdr.cp_comm = CPWRITE;		/* Set command */
	cvtlb	$1,_cpout+1
 # 	for(c_cnt=0;;c_cnt++) {
	clrl	-56(fp)
L22:
 # 		cpout.cp_buf[c_cnt] = *str++;
	movl	$_cpout+4,r0
	movl	-56(fp),r1
	movb	*4(fp),(r0)[r1]
	incl	4(fp)
 # 		if (cpout.cp_buf[c_cnt]=='\n') {
	movl	$_cpout+4,r0
	movl	-56(fp),r1
	cmpb	(r0)[r1],$10
	jneq	L23
 # 			 c_cnt++;
	incl	-56(fp)
 # 			 cpout.cp_buf[c_cnt]='\r';
	movl	$_cpout+4,r0
	movl	-56(fp),r1
	cvtlb	$13,(r0)[r1]
 # 			 }
 # 		if (cpout.cp_buf[c_cnt]=='\0') break;
L23:
	movl	$_cpout+4,r0
	movl	-56(fp),r1
	tstb	(r0)[r1]
	jneq	L24
	jbr 	L21
 # 	}
L24:
L20:
	incl	-56(fp)
	jbr 	L22
L21:
 # 	if (c_cnt) {
	tstl	-56(fp)
	jeql	L25
 # 		cpout.cp_hdr.cp_count = c_cnt;
	cvtlw	-56(fp),_cpout+2
 # 		cp_poll('\0'); }
	pushl	$0
	callf	$8,_cp_poll
 # }
L25:
	ret
	.set	L16,0x0
L18:
	subl3	$56,fp,sp
	jbr 	L19
	.data
	.text
	.align	1
	.globl	_putchar
_putchar:
	.word	L28
 # 
 # putchar(c)
 # {
	jbr 	L30
L31:
 # 	cpout.cp_hdr.cp_unit = CPCONS;		/* Reset done bit */
	cvtlb	$1,_cpout
 # 	cpout.cp_hdr.cp_comm = CPWRITE;		/* Set command */
	cvtlb	$1,_cpout+1
 # 	cpout.cp_buf[charcnt] = c;
	movl	$_cpout+4,r0
	movl	_charcnt,r1
	cvtlb	4(fp),(r0)[r1]
 # 	cpout.cp_hdr.cp_count = 1;
	cvtlw	$1,_cpout+2
 # 	cp_poll(c);
	pushl	4(fp)
	callf	$8,_cp_poll
 # }
	ret
	.set	L28,0x0
L30:
	jbr 	L31
	.data
	.text
	.align	1
	.globl	_cp_poll
_cp_poll:
	.word	L32
 # 
 # cp_poll(c)
 # char c;
 # {	register long time, r11;
	jbr 	L34
L35:
 # 
 # 	time = 900000;
	movl	$900000,r12
 # 	asm("movab _cpout,r10");
movab _cpout,r10
 # 	asm("andl2 $0xffffff,r10");
andl2 $0xffffff,r10
 # 	asm("mtpr r10,$CPMDCB");
mtpr r10,$CPMDCB
 # 	tmp_lw = (long)(&cpout.cp_hdr.cp_unit);
	movl	$_cpout,_tmp_lw
 # 
 # 	r11 = (long)(&cpout.cp_hdr.cp_unit);
	movl	$_cpout,r11
 # 	while (time-- && !(cpout.cp_hdr.cp_unit & CPDONE)) { 
L36:
	movl	r12,r0
	decl	r12
	tstl	r0
	jeql	L37
	cvtbl	_cpout,r0
	bitl	$128,r0
	jneq	L37
 # 		asm("mtpr r11,$0x1c");			/* mtpr r11,$PDCS */
mtpr r11,$0x1c
 # 		}
	jbr 	L36
L37:
 # 	if (!(cpout.cp_hdr.cp_unit & CPDONE)) cp_hlt();	/* Time out */
	cvtbl	_cpout,r0
	bitl	$128,r0
	jneq	L38
	callf	$4,_cp_hlt
 # 	if (c== '\n') putchar('\r');
L38:
	cmpb	7(fp),$10
	jneq	L40
	pushl	$13
	callf	$8,_putchar
 # }
L40:
	ret
	.set	L32,0x1800
L34:
	jbr 	L35
	.data
	.text
	.align	1
	.globl	_cp_hlt
_cp_hlt:
	.word	L41
 # 
 # cp_hlt()
 # {
	jbr 	L43
L44:
 # 	asm("movl $0xeeeeeeee,r0");
movl $0xeeeeeeee,r0
 # 	asm("movl $0xeeeeeeee,r1");
movl $0xeeeeeeee,r1
 # 	asm("movl $0xeeeeeeee,r2");
movl $0xeeeeeeee,r2
 # 	asm("halt");
halt
 # }
	ret
	.set	L41,0x0
L43:
	jbr 	L44
	.data
 # 

unix.superglobalmegacorp.com

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