Plan 9 from Bell Labs’s /usr/web/sources/extra/9hist/power/l.s

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


## diffname power/l.s 1990/0227
## diff -e /dev/null /n/bootesdump/1990/0227/sys/src/9/mips/l.s
0a
#include "mem.h"

#define SP		R29

#define PROM		(KSEG1+0x1FC00000)
#define	NOOP		NOR R0,R0
#define	WAIT		NOOP; NOOP

/*
 * Boot first processor
 */
TEXT	start(SB), $-4

	MOVW	$setR30(SB), R30
	MOVW	$(CU1|INTR5|INTR4|INTR3|INTR2|INTR1|SW1|SW0), R1
	MOVW	R1, M(STATUS)
	WAIT

	MOVW	$(0x1C<<7), R1
	MOVW	R1, FCR31	/* permit only inexact and underflow */
	NOOP
	MOVD	$0.5, F26
	SUBD	F26, F26, F24
	ADDD	F26, F26, F28
	ADDD	F28, F28, F30

	MOVD	F24, F0
	MOVD	F24, F2
	MOVD	F24, F4
	MOVD	F24, F6
	MOVD	F24, F8
	MOVD	F24, F10
	MOVD	F24, F12
	MOVD	F24, F14
	MOVD	F24, F16
	MOVD	F24, F18
	MOVD	F24, F20
	MOVD	F24, F22

	MOVW	$MACHADDR, R(MACH)
	ADDU	$(BY2PG-4), R(MACH), SP
	MOVW	$0, R(USER)
	MOVW	R0, 0(R(MACH))

	MOVW	$edata(SB), R1
	MOVW	$end(SB), R2

clrbss:
	MOVB	$0, (R1)
	ADDU	$1, R1
	BNE	R1, R2, clrbss

	JAL	main(SB)
	JMP	(R0)

/*
 * Take first processor into user mode
 */

TEXT	touser(SB), $-4
	MOVW	M(STATUS), R1
	OR	$(KUP|IEP), R1
	MOVW	R1, M(STATUS)
	NOOP
	MOVW	$(USTKTOP-20), SP
	MOVW	$(UTZERO+32), R26	/* header appears in text */
	RFE	(R26)

/*
 * Bring subsequent processors on line
 */
TEXT	newstart(SB), $0

	MOVW	$setR30(SB), R30
	MOVW	$(INTR5|INTR4|INTR3|INTR2|INTR1|SW1|SW0), R1
	MOVW	R1, M(STATUS)
	NOOP
	MOVW	$MACHADDR, R(MACH)
	MOVB	(MPID+3), R1
	AND	$7, R1
	SLL	$PGSHIFT, R1, R2
	ADDU	R2, R(MACH)
	ADDU	$(BY2PG-4), R(MACH), SP
	MOVW	$0, R(USER)
	MOVW	R1, 0(R(MACH))
	JAL	online(SB)
	JMP	(R0)

TEXT	firmware(SB), $0

	MOVW	$(PROM+0x18), R1 /**/
/*	MOVW	$(PROM+0x00), R1 /**/
	JMP	(R1)

TEXT	splhi(SB), $0

	MOVW	M(STATUS), R1
	AND	$~IEC, R1, R2
	MOVW	R2, M(STATUS)
	NOOP
	RET

TEXT	spllo(SB), $0

	MOVW	M(STATUS), R1
	OR	$IEC, R1, R2
	MOVW	R2, M(STATUS)
	NOOP
	RET

TEXT	splx(SB), $0

	MOVW	0(FP), R1
	MOVW	M(STATUS), R2
	AND	$IEC, R1
	AND	$~IEC, R2
	OR	R2, R1
	MOVW	R1, M(STATUS)
	NOOP
	RET

TEXT	wbflush(SB), $-4

	MOVW	$WBFLUSH, R1
	MOVW	0(R1), R1
	RET

TEXT	setlabel(SB), $0

	MOVW	0(FP), R2
	MOVW	$0, R1
	MOVW	R31, 0(R2)
	MOVW	R29, 4(R2)
	RET

TEXT	gotolabel(SB), $0

	MOVW	0(FP), R2
	MOVW	$1, R1
	MOVW	0(R2), R31
	MOVW	4(R2), R29
	RET

TEXT	puttlb(SB), $4

	JAL	splhi(SB)
	MOVW	0(FP), R2
	MOVW	4(FP), R3
	MOVW	R1, 4(SP)
	MOVW	R2, M(TLBVIRT)
	MOVW	R3, M(TLBPHYS)
	NOOP
	TLBP
	NOOP
	MOVW	M(INDEX), R4
	BGEZ	R4, index
	TLBWR
	NOOP
	JAL	splx(SB)
	RET
index:
	TLBWI
	NOOP
	JAL	splx(SB)
	RET

TEXT	puttlbx(SB), $0

	MOVW	0(FP), R4
	MOVW	4(FP), R2
	MOVW	8(FP), R3
	SLL	$8, R4
	MOVW	R2, M(TLBVIRT)
	MOVW	R3, M(TLBPHYS)
	MOVW	R4, M(INDEX)
	NOOP
	TLBWI
	NOOP
	RET

TEXT	tlbp(SB), $0
	TLBP
	NOOP
	MOVW	M(INDEX), R1
	RET
	
TEXT	tlbvirt(SB), $0
	TLBP
	NOOP
	MOVW	M(TLBVIRT), R1
	RET
	

TEXT	gettlb(SB), $0

	MOVW	0(FP), R3
	MOVW	4(FP), R4
	SLL	$8, R3
	MOVW	R3, M(INDEX)
	NOOP
	TLBR
	NOOP
	MOVW	M(TLBVIRT), R1
	MOVW	M(TLBPHYS), R2
	NOOP
	MOVW	R1, 0(R4)
	MOVW	R2, 4(R4)
	RET

TEXT	gettlbvirt(SB), $0

	MOVW	0(FP), R3
	SLL	$8, R3
	MOVW	R3, M(INDEX)
	NOOP
	TLBR
	NOOP
	MOVW	M(TLBVIRT), R1
	NOOP
	RET

TEXT	vector80(SB), $-4

	MOVW	$exception(SB), R26
	JMP	(R26)

TEXT	exception(SB), $-4

	MOVW	M(STATUS), R26
	AND	$KUP, R26
	BEQ	R26, waskernel

wasuser:
	MOVW	SP, R26
		/*
		 * set kernel sp: ureg - ureg* - pc
		 * done in 2 steps because R30 is not set
		 * and the loader will make a literal
		 */
	MOVW	$((UREGADDR-2*BY2WD) & 0xffff0000), SP
	OR	$((UREGADDR-2*BY2WD) & 0xffff), SP
	MOVW	R26, 0x10(SP)			/* user SP */
	MOVW	R31, 0x28(SP)
	MOVW	R30, 0x2C(SP)
	MOVW	M(CAUSE), R26
	MOVW	R(MACH), 0x3C(SP)
	MOVW	R(USER), 0x40(SP)
	AND	$(0xF<<2), R26
	SUB	$(CSYS<<2), R26

	JAL	saveregs(SB)

	MOVW	$setR30(SB), R30
	SUBU	$(UREGADDR-2*BY2WD-USERADDR), SP, R(USER)
	MOVW	$MPID, R1
	MOVB	3(R1), R1
	MOVW	$MACHADDR, R(MACH)		/* locn of mach 0 */
	AND	$7, R1
	SLL	$PGSHIFT, R1
	ADDU	R1, R(MACH)			/* add offset for mach # */

	BNE	R26, notsys

	JAL	syscall(SB)

	MOVW	0x28(SP), R31
	MOVW	0x08(SP), R26
	MOVW	0x2C(SP), R30
	MOVW	R26, M(STATUS)
	NOOP
	MOVW	0x0C(SP), R26		/* old pc */
	MOVW	0x10(SP), SP
	RFE	(R26)

notsys:
	JAL	trap(SB)

restore:
	JAL	restregs(SB)
	MOVW	0x28(SP), R31
	MOVW	0x2C(SP), R30
	MOVW	0x3C(SP), R(MACH)
	MOVW	0x40(SP), R(USER)
	MOVW	0x10(SP), SP
	RFE	(R26)

waskernel:
	MOVW	$1, R26			/* not sys call */
	MOVW	SP, -0x90(SP)		/* drop this if possible */
	SUB	$0xA0, SP
	MOVW	R31, 0x28(SP)
	JAL	saveregs(SB)
	JAL	trap(SB)
	JAL	restregs(SB)
	MOVW	0x28(SP), R31
	ADD	$0xA0, SP
	RFE	(R26)

TEXT	saveregs(SB), $-4
	MOVW	R1, 0x9C(SP)
	MOVW	R2, 0x98(SP)
	ADDU	$8, SP, R1
	MOVW	R1, 0x04(SP)		/* arg to base of regs */
	MOVW	M(STATUS), R1
	MOVW	M(EPC), R2
	MOVW	R1, 0x08(SP)
	MOVW	R2, 0x0C(SP)

	BEQ	R26, return		/* sys call, don't save */

	MOVW	M(CAUSE), R1
	MOVW	M(BADVADDR), R2
	MOVW	R1, 0x14(SP)
	MOVW	M(TLBVIRT), R1
	MOVW	R2, 0x18(SP)
	MOVW	R1, 0x1C(SP)
	MOVW	HI, R1
	MOVW	LO, R2
	MOVW	R1, 0x20(SP)
	MOVW	R2, 0x24(SP)
					/* LINK,SB,SP missing */
	MOVW	R28, 0x30(SP)
					/* R27, R26 not saved */
					/* R25, R24 missing */
	MOVW	R23, 0x44(SP)
	MOVW	R22, 0x48(SP)
	MOVW	R21, 0x4C(SP)
	MOVW	R20, 0x50(SP)
	MOVW	R19, 0x54(SP)
	MOVW	R18, 0x58(SP)
	MOVW	R17, 0x5C(SP)
	MOVW	R16, 0x60(SP)
	MOVW	R15, 0x64(SP)
	MOVW	R14, 0x68(SP)
	MOVW	R13, 0x6C(SP)
	MOVW	R12, 0x70(SP)
	MOVW	R11, 0x74(SP)
	MOVW	R10, 0x78(SP)
	MOVW	R9, 0x7C(SP)
	MOVW	R8, 0x80(SP)
	MOVW	R7, 0x84(SP)
	MOVW	R6, 0x88(SP)
	MOVW	R5, 0x8C(SP)
	MOVW	R4, 0x90(SP)
	MOVW	R3, 0x94(SP)
return:
	RET

TEXT	restregs(SB), $-4
					/* LINK,SB,SP missing */
	MOVW	0x30(SP), R28
					/* R27, R26 not saved */
					/* R25, R24 missing */
	MOVW	0x44(SP), R23
	MOVW	0x48(SP), R22
	MOVW	0x4C(SP), R21
	MOVW	0x50(SP), R20
	MOVW	0x54(SP), R19
	MOVW	0x58(SP), R18
	MOVW	0x5C(SP), R17
	MOVW	0x60(SP), R16
	MOVW	0x64(SP), R15
	MOVW	0x68(SP), R14
	MOVW	0x6C(SP), R13
	MOVW	0x70(SP), R12
	MOVW	0x74(SP), R11
	MOVW	0x78(SP), R10
	MOVW	0x7C(SP), R9
	MOVW	0x80(SP), R8
	MOVW	0x84(SP), R7
	MOVW	0x88(SP), R6
	MOVW	0x8C(SP), R5
	MOVW	0x90(SP), R4
	MOVW	0x94(SP), R3
	MOVW	0x24(SP), R2
	MOVW	0x20(SP), R1
	MOVW	R2, LO
	MOVW	R1, HI
	MOVW	0x08(SP), R1
	MOVW	0x98(SP), R2
	MOVW	R1, M(STATUS)
	NOOP
	MOVW	0x9C(SP), R1
	MOVW	0x0C(SP), R26		/* old pc */
	RET

TEXT	rfnote(SB), $0
	MOVW	0(FP), R26		/* 1st arg is &uregpointer */
	SUBU	$(BY2WD), R26, SP	/* pc hole */
	BNE	R26, restore
	

TEXT	clrfpintr(SB), $0
	MOVW	FCR31, R1
	MOVW	R1, R2
	AND	$~(0x3F<<12), R2
	MOVW	R2, FCR31
	RET

TEXT	savefpregs(SB), $0
	MOVW	M(STATUS), R3
	MOVW	0(FP), R1
	MOVW	FCR31, R2

	MOVD	F0, 0x00(R1)
	MOVD	F2, 0x08(R1)
	MOVD	F4, 0x10(R1)
	MOVD	F6, 0x18(R1)
	MOVD	F8, 0x20(R1)
	MOVD	F10, 0x28(R1)
	MOVD	F12, 0x30(R1)
	MOVD	F14, 0x38(R1)
	MOVD	F16, 0x40(R1)
	MOVD	F18, 0x48(R1)
	MOVD	F20, 0x50(R1)
	MOVD	F22, 0x58(R1)
	MOVD	F24, 0x60(R1)
	MOVD	F26, 0x68(R1)
	MOVD	F28, 0x70(R1)
	MOVD	F30, 0x78(R1)

	MOVW	R2, 0x80(R1)
	AND	$~CU1, R3
	MOVW	R3, M(STATUS)
	RET

TEXT	restfpregs(SB), $0
	MOVW	M(STATUS), R3
	MOVW	0(FP), R1
	OR	$CU1, R3
	MOVW	R3, M(STATUS)
	MOVW	0x80(R1), R2

	MOVD	0x00(R1), F0
	MOVD	0x08(R1), F2
	MOVD	0x10(R1), F4
	MOVD	0x18(R1), F6
	MOVD	0x20(R1), F8
	MOVD	0x28(R1), F10
	MOVD	0x30(R1), F12
	MOVD	0x38(R1), F14
	MOVD	0x40(R1), F16
	MOVD	0x48(R1), F18
	MOVD	0x50(R1), F20
	MOVD	0x58(R1), F22
	MOVD	0x60(R1), F24
	MOVD	0x68(R1), F26
	MOVD	0x70(R1), F28
	MOVD	0x78(R1), F30

	MOVW	R2, FCR31
	AND	$~CU1, R3
	MOVW	R3, M(STATUS)
	RET
.
## diffname power/l.s 1990/0419
## diff -e /n/bootesdump/1990/0227/sys/src/9/mips/l.s /n/bootesdump/1990/0419/sys/src/9/mips/l.s
143a
TEXT	gotopc(SB), $0

	MOVW	0(FP), R2
	JAL	(R2)
	RET			/* shouldn't get here */

.
## diffname power/l.s 1990/0424
## diff -e /n/bootesdump/1990/0419/sys/src/9/mips/l.s /n/bootesdump/1990/0424/sys/src/9/mips/l.s
52a
	MOVW	R4, _argc(SB)
	MOVW	R5, _argv(SB)
	MOVW	R6, _env(SB)
.
## diffname power/l.s 1990/0427
## diff -e /n/bootesdump/1990/0424/sys/src/9/mips/l.s /n/bootesdump/1990/0427/sys/src/9/mips/l.s
149a
	MOVW	_argc(SB), R4
	MOVW	_argv(SB), R5
.
148a
	MOVW	$0, R0
.
68c
	MOVW	0(FP), SP
.
63a

.
## diffname power/l.s 1990/0430
## diff -e /n/bootesdump/1990/0427/sys/src/9/mips/l.s /n/bootesdump/1990/0430/sys/src/9/mips/l.s
466a
	RET


TEXT icflush(SB), $-4			/* icflush(physaddr, nbytes) */

	MOVW	M(STATUS), R6
	MOVW	0(FP), R4
	MOVW	4(FP), R5
	MOVW	$KSEG0, R3
	OR	R3, R4
	MOVW	$0, M(STATUS)
	MOVW	$WBFLUSH, R1		/* wbflush */
	MOVW	0(R1), R1
	NOOP
	MOVW	$KSEG1, R3
	MOVW	$icflush0(SB), R2	/* make sure PC is in uncached address space */
	MOVW	$(SWC|ISC), R1
	OR	R3, R2
	JMP	(R2)

TEXT icflush0(SB), $-4

	MOVW	R1, M(STATUS)		/* swap and isolate cache, splhi */
	MOVW	$icflush1(SB), R2
	JMP	(R2)

TEXT icflush1(SB), $-4

_icflush1:
	MOVBU	R0, 0x00(R4)
	MOVBU	R0, 0x04(R4)
	MOVBU	R0, 0x08(R4)
	MOVBU	R0, 0x0C(R4)
	MOVBU	R0, 0x10(R4)
	MOVBU	R0, 0x14(R4)
	MOVBU	R0, 0x18(R4)
	MOVBU	R0, 0x1C(R4)
	MOVBU	R0, 0x20(R4)
	MOVBU	R0, 0x24(R4)
	MOVBU	R0, 0x28(R4)
	MOVBU	R0, 0x2C(R4)
	MOVBU	R0, 0x30(R4)
	MOVBU	R0, 0x34(R4)
	MOVBU	R0, 0x38(R4)
	MOVBU	R0, 0x3C(R4)
	SUB	$0x40, R5
	ADD	$0x40, R4
	BGTZ	R5, _icflush1
	MOVW	$icflush2(SB), R2	/* make sure PC is in uncached address space */
	OR	R3, R2
	JMP	(R2)

TEXT icflush2(SB), $-4

	MOVW	$0, M(STATUS)		/* swap back caches, de-isolate them, and stay splhi */
	NOOP				/* +++ */
	MOVW	R6, M(STATUS)
	RET

TEXT dcflush(SB), $-4			/* dcflush(physaddr, nbytes) */

	MOVW	M(STATUS), R6
	MOVW	0(FP), R4
	MOVW	4(FP), R5
	MOVW	$KSEG0, R3
	OR	R3, R4
	MOVW	$0, M(STATUS)
	MOVW	$WBFLUSH, R1
	MOVW	0(R1), R1
	NOOP
	MOVW	$ISC, R1
	MOVW	R1, M(STATUS)
_dcflush0:
	MOVBU	R0, 0x00(R4)
	MOVBU	R0, 0x04(R4)
	MOVBU	R0, 0x08(R4)
	MOVBU	R0, 0x0C(R4)
	MOVBU	R0, 0x10(R4)
	MOVBU	R0, 0x14(R4)
	MOVBU	R0, 0x18(R4)
	MOVBU	R0, 0x1C(R4)
	MOVBU	R0, 0x20(R4)
	MOVBU	R0, 0x24(R4)
	MOVBU	R0, 0x28(R4)
	MOVBU	R0, 0x2C(R4)
	MOVBU	R0, 0x30(R4)
	MOVBU	R0, 0x34(R4)
	MOVBU	R0, 0x38(R4)
	MOVBU	R0, 0x3C(R4)
	SUB	$0x40, R5
	ADD	$0x40, R4
	BGTZ	R5, _dcflush0
	MOVW	$0, M(STATUS)
	NOOP				/* +++ */
	MOVW	R6, M(STATUS)
.
440a

.
156a
	MOVW	$WBFLUSH, R1		/* flush write buffer */
	MOVW	0(R1), R1
	NOOP

	MOVW	$KSEG1, R3		/* change to uncached address space */
	MOVW	$gotopc0(SB), R2
	OR	R3, R2
	JMP	(R2)
TEXT gotopc0(SB), $-4

	MOVW	$(SWC|ISC), R1		/* swap and isolate cache, stay splhi */
	MOVW	R1, M(STATUS)
	NOOP

	MOVW	$gotopc1(SB), R2	/* change back to cached address space */
	JMP	(R2)
TEXT gotopc1(SB), $-4

	MOVW	$KSEG0, R6		/* init loop variables */
	MOVW	$(64*1024), R8
_gotopc1:
	MOVBU	R0, 0x00(R6)
	SUB	$0x4, R8
	ADD	$0x4, R6
	BGTZ	R8, _gotopc1

	MOVW	$gotopc2(SB), R2	/* change to uncached address space */
	OR	R3, R2
	JMP	(R2)
TEXT gotopc2(SB), $-4

	MOVW	R0, M(STATUS)		/* put caches back, still splhi */
	NOOP

	JMP	(R7)

.
154,155d
150,151c
	MOVW	0(FP), R7		/* save arguments for later */
.
148c
TEXT	gotopc(SB), $-4
.
60a
 * 	- argument is stack pointer to user
.
10a
 *   - why is the processor number loaded from R0 ?????
.
## diffname power/l.s 1990/0504
## diff -e /n/bootesdump/1990/0430/sys/src/9/mips/l.s /n/bootesdump/1990/0504/sys/src/9/mips/l.s
559c
	MOVW	R10, M(STATUS)
.
532,550c
	MOVBU	R0, 0x00(R8)
	MOVBU	R0, 0x04(R8)
	MOVBU	R0, 0x08(R8)
	MOVBU	R0, 0x0C(R8)
	MOVBU	R0, 0x10(R8)
	MOVBU	R0, 0x14(R8)
	MOVBU	R0, 0x18(R8)
	MOVBU	R0, 0x1C(R8)
	MOVBU	R0, 0x20(R8)
	MOVBU	R0, 0x24(R8)
	MOVBU	R0, 0x28(R8)
	MOVBU	R0, 0x2C(R8)
	MOVBU	R0, 0x30(R8)
	MOVBU	R0, 0x34(R8)
	MOVBU	R0, 0x38(R8)
	MOVBU	R0, 0x3C(R8)
	SUB	$0x40, R9
	ADD	$0x40, R8
	BGTZ	R9, _icflush1
.
512c
	OR	R3, R8
.
508,510c
	MOVW	M(STATUS), R10
	MOVW	0(FP), R8
	MOVW	4(FP), R9
.
505c
/*
 *  we avoid using R4, R5, R6, and R7 so gotopc can call us without saving them
 */
.
155,189c
	MOVW	_env(SB), R6
	MOVW	R0, 4(SP)
	MOVW	$(64*1024), R1
	MOVW	R1, 8(SP)
	JAL	icflush(SB)
.
150c
TEXT	gotopc(SB), $8
.
## diffname power/l.s 1990/1113
## diff -e /n/bootesdump/1990/0504/sys/src/9/mips/l.s /n/bootesdump/1990/1113/sys/src/9/mips/l.s
408c
	JMP	restore
.
## diffname power/l.s 1991/01151
## diff -e /n/bootesdump/1990/1113/sys/src/9/mips/l.s /n/bootesdump/1991/01151/sys/src/9/mips/l.s
11d
## diffname power/l.s 1991/0118
## diff -e /n/bootesdump/1991/01151/sys/src/9/mips/l.s /n/bootesdump/1991/0118/sys/src/9/mips/l.s
450a
	NOOP
.
## diffname power/l.s 1991/0126
## diff -e /n/bootesdump/1991/0118/sys/src/9/mips/l.s /n/bootesdump/1991/0126/sys/src/9/mips/l.s
141c
TEXT	gotolabel(SB), $-4
.
133c
TEXT	setlabel(SB), $-4
.
## diffname power/l.s 1991/0314
## diff -e /n/bootesdump/1991/0201/sys/src/9/mips/l.s /n/bootesdump/1991/0314/sys/src/9/power/l.s
472a
	RET

TEXT	fcr31(SB), $0

	MOVW	FCR31, R1
.
450c
	MOVW	fpstat+4(FP), R2
.
## diffname power/l.s 1991/0425
## diff -e /n/bootesdump/1991/0314/sys/src/9/power/l.s /n/bootesdump/1991/0425/sys/src/9/power/l.s
240a
	MOVW	$exception(SB), R26
	JMP	(R26)

TEXT	vector0(SB), $-4

	MOVW	$utlbmiss(SB), R26
	MOVW	M(TLBVIRT), R27
	SLL	$(STLBLOG-9), R27		/* delay slot fodder */
	JMP	(R26)

TEXT	utlbmiss(SB), $-4

	SRL	$(STLBLOG), R27, R26
	XOR	R26, R27
	AND	$((STLBSIZE-1)<<3), R27
	MOVW	R27, M(TLBPHYS)			/* scratch register, store */

	MOVW	$((MACHADDR+4) & 0xffff0000), R26
	MOVW	$MPID, R27
	MOVB	3(R27), R27
	AND	$7, R27
	SLL	$PGSHIFT, R27
	ADDU	R27, R26
	
	MOVW	M(TLBPHYS), R27			/* scratch register, load */
	MOVW	((MACHADDR+4) & 0xffff)(R26), R26
	ADDU	R26, R27
	MOVW	4(R27), R26
	MOVW	R26, M(TLBPHYS)

	MOVW	M(TLBVIRT), R26
	MOVW	(R27), R27
	BNE	R26, R27, stlbm

	TLBP
	MOVW	M(EPC), R27
	MOVW	M(INDEX), R26
	BGEZ	R26, uind
	TLBWR
	NOOP
	RFE	(R27)
uind:
	TLBWI
	NOOP
	RFE	(R27)		
stlbm:	
.
177a

.
## diffname power/l.s 1991/0426
## diff -e /n/bootesdump/1991/0425/sys/src/9/power/l.s /n/bootesdump/1991/0426/sys/src/9/power/l.s
283,286c

.
281c
	MOVW	M(EPC), R27
.
276,279d
254c
	SRL	$6, R27, R26			/* right adjusted vpn */
	SLL	$(STLBLOG-6), R27		/* left adjusted pid */
.
249c
	SRL	$(6-3), R27			/* delay slot fodder, right adjust */
.
## diffname power/l.s 1991/0607
## diff -e /n/bootesdump/1991/0426/sys/src/9/power/l.s /n/bootesdump/1991/0607/sys/src/9/power/l.s
176d
166d
163d
## diffname power/l.s 1991/0705
## diff -e /n/bootesdump/1991/0607/sys/src/9/power/l.s /n/bootesdump/1991/0705/sys/src/9/power/l.s
582,612c
	MOVW	$dcflush0(SB), R2	/* Jump to uncache space */
	MOVW	$0xA0000000, R1
	OR	R1, R2
	JMP	(R2)
	NOP

TEXT dcflush0(SB), $-4

	MOVW	$833, R12		/* cache_pass magdc */
	MOVW	$0x10000, R9		/* dcache size */

	MOVW	$0, R13
	MOVW	M(STATUS), R11

	BEQ	R9, R0, _dcflush3
	MOVW	$0x10000, R2		/* isolate data cache */

	NOP
	NOP
	NOP
	NOP
	NOP
	MOVW	R2, M(STATUS)
	NOP
	NOP
	NOP
	NOP
	NOP
	
	MOVW	R4, R8
	MOVW	R5, R9
	AND	$0xFFFC, R8
	MOVW	$0x9F200000, R1
	OR	R1, R8

	MOVW	$dcflush1(SB), R2
	JMP	(R2)
	NOP

TEXT dcflush1(SB), $-4
_dcflush1:
	SGT	R12, R13, R1
	BNE	R1, _dcflush2

	MOVW	$0, R13
	MOVW	R11, M(STATUS)
	MOVW	$0x10000, R2		/* isolate data cache */

	NOP
	NOP
	NOP
	NOP
	NOP
	MOVW	R2, M(STATUS)
	NOP
	NOP
	NOP
	NOP
	NOP

_dcflush2:
	MOVW	R0, 0(R8)
	MOVW	R0, 4(R8)
	MOVW	R0, 8(R8)
	MOVW	R0, 12(R8)
	MOVW	R0, 16(R8)
	MOVW	R0, 20(R8)
	MOVW	R0, 24(R8)
	MOVW	R0, 28(R8)
	ADDU	$-32, R9
	ADDU	$1, R13
	ADDU	$32, R8
	BGTZ	R9, _dcflush1

	MOVW	$dcflush3(SB), R2	/* Jump to uncache space */
	MOVW	$0xA0000000, R1
	OR	R1, R2
	JMP	(R2)
	NOP

TEXT dcflush3(SB), $-4
_dcflush3:
	NOP
	NOP
	NOP
	NOP
	NOP
	MOVW	R11, M(STATUS)
	NOP
	NOP
	NOP
	NOP
	NOP

	MOVW	$dcflush4(SB), R2
	JMP	(R2)
	NOP

TEXT dcflush4(SB), $-4
.
577,579c
TEXT dcflush(SB), $-4
.
572,574c
	MOVW	$icflush4(SB), R2
	JMP	(R2)
	NOP

TEXT icflush4(SB), $-4
.
570c
TEXT icflush3(SB), $-4
_icflush3:
	NOP
	NOP
	NOP
	NOP
	NOP
	MOVW	R11, M(STATUS)
	NOP
	NOP
	NOP
	NOP
	NOP
.
568a
	NOP
.
566,567c

	MOVW	$icflush3(SB), R2	/* Jump to uncache space */
	MOVW	$0xA0000000, R1
	OR	R1, R2
.
547,564c
	SGT	R12, R13, R1
	BNE	R1, _icflush2

	MOVW	$0, R13
	MOVW	R11, M(STATUS)
	MOVW	$0x30000, R2		/* swap and isolate */

	NOP
	NOP
	NOP
	NOP
	NOP
	MOVW	R2, M(STATUS)
	NOP
	NOP
	NOP
	NOP
	NOP

_icflush2:
	MOVW	R0, 0(R8)
	MOVW	R0, 4(R8)
	MOVW	R0, 8(R8)
	MOVW	R0, 12(R8)
	MOVW	R0, 16(R8)
	MOVW	R0, 20(R8)
	MOVW	R0, 24(R8)
	MOVW	R0, 28(R8)
	ADDU	$-32, R9
	ADDU	$1, R13
	ADDU	$32, R8
.
545d
542a
	NOP
.
540c
	MOVW	$833, R12		/* cache_pass magic */
	MOVW	$0x10000, R9		/* icache size */

	MOVW	$0, R13
	MOVW	M(STATUS), R11

	BEQ	R9, R0, _icflush3
	MOVW	$0x30000, R2		/* swap and isolate */

	NOP
	NOP
	NOP
	NOP
	NOP
	MOVW	R2, M(STATUS)
	NOP
	NOP
	NOP
	NOP
	NOP
	
	MOVW	R4, R8
	MOVW	R5, R9
	AND	$0xFFFC, R8
	MOVW	$0x9F200000, R1
	OR	R1, R8

.
536a
	NOP
.
523,535c
TEXT icflush(SB), $-4
	MOVW	0(FP), R4
	MOVW	4(FP), R5
	MOVW	$icflush0(SB), R2	/* Jump to uncache space */
	MOVW	$0xA0000000, R1
	OR	R1, R2
.
518,521c
#define NOP	WORD	$0x0
.
156,158d
150a
	MOVW	$(64*1024), R1
	MOVW	R1, 8(SP)
	JAL	icflush(SB)
.
## diffname power/l.s 1991/0711
## diff -e /n/bootesdump/1991/0705/sys/src/9/power/l.s /n/bootesdump/1991/0711/sys/src/9/power/l.s
280a

.
265c
	MOVW	(R26), R26
	SRL	$5, R27				/* R27 is now index * 8 */
.
257,258c
	MOVW	$((MACHADDR+4) & 0xffff0000), R26	/* get &mach[0].stb BUG */	
	OR	$((MACHADDR+4) & 0xffff), R26
	MOVW	$MPID, R27				/* add BY2PG*machno */
.
254c
	AND	$(STLBSIZE-1), R27
	SLL	$8, R27
	/* R27 = (((tlbvirt<<1)^(tlbvirt>>12)) & (STLBSIZE-1)) << 8 (8 to clear zero in TLBPHYS) */
.
251,252c
	MOVW	R27, R26
	SLL	$1, R26
	SRL	$12, R27
.
246d
## diffname power/l.s 1991/0726
## diff -e /n/bootesdump/1991/0711/sys/src/9/power/l.s /n/bootesdump/1991/0726/sys/src/9/power/l.s
148a
TEXT	getcallerpc(SB), $0

	MOVW	(SP), R1
	RET

.
## diffname power/l.s 1991/1011
## diff -e /n/bootesdump/1991/0726/sys/src/9/power/l.s /n/bootesdump/1991/1011/sys/src/9/power/l.s
124a
	RET

TEXT	spllo(SB), $0

	MOVW	M(STATUS), R1
	OR	$IEC, R1, R2
	MOVW	R2, M(STATUS)
	NOOP
	RET

TEXT	spldone(SB), $0

.
117a
	MOVW	R31, 8(R(MACH))	/* save PC in m->splpc */
.
108,115d
101a
	MOVW	R31, 8(R(MACH))	/* save PC in m->splpc */
.
## diffname power/l.s 1991/1208
## diff -e /n/bootesdump/1991/1011/sys/src/9/power/l.s /n/bootesdump/1991/1208/sys/src/9/power/l.s
641c
	MOVW	R1, R4
.
537c
	MOVW	R1, R4
.
501d
473d
463d
459c
	MOVW	R1, R26			/* 1st arg is &uregpointer */
.
363a
	MOVW	4(SP), R1		/* first arg for trap */
.
331a
	MOVW	4(SP), R1			/* first arg for syscall, trap */
.
238,240c
	SLL	$8, R1
	MOVW	R1, M(INDEX)
.
224,225c
	SLL	$8, R1
	MOVW	R1, M(INDEX)
.
222d
201c
	MOVW	R1, M(INDEX)
.
198c
	SLL	$8, R1
.
195d
190d
181,182c
	MOVW	M(INDEX), R3
	BGEZ	R3, index
.
174,177c
	MOVW	4(FP), R2
	MOVW	R1, M(TLBVIRT)
	MOVW	R2, M(TLBPHYS)
.
165c
	MOVW	0(FP), R7
.
162,163c
	MOVW	R1, 0(FP)		/* save arguments for later */
	MOVW	$(64*1024), R7
	MOVW	R7, 8(SP)
.
151,152d
149c
	MOVW	0(R1), R31
	MOVW	4(R1), R29
.
143,144d
141c
	MOVW	R31, 0(R1)
	MOVW	R29, 4(R1)
.
112d
70d
65a
	MOVW	R1, SP
.
## diffname power/l.s 1992/0222
## diff -e /n/bootesdump/1991/1208/sys/src/9/power/l.s /n/bootesdump/1992/0222/sys/src/9/power/l.s
154c
	MOVW	4(SP), R1
.
## diffname power/l.s 1992/0318
## diff -e /n/bootesdump/1992/0222/sys/src/9/power/l.s /n/bootesdump/1992/0318/sys/src/9/power/l.s
66c
	MOVW	R1, SP			/* user stack pointer */
.
## diffname power/l.s 1992/0319
## diff -e /n/bootesdump/1992/0318/sys/src/9/power/l.s /n/bootesdump/1992/0319/sys/src/9/power/l.s
154c
	MOVW	0(SP), R1
.
## diffname power/l.s 1992/0610
## diff -e /n/bootesdump/1992/0319/sys/src/9/power/l.s /n/bootesdump/1992/0610/sys/src/9/power/l.s
96,97c
	SLL	$3, R1
	ADD	$PROM, R1
.
## diffname power/l.s 1992/0629
## diff -e /n/bootesdump/1992/0610/sys/src/9/power/l.s /n/bootesdump/1992/0629/sys/src/9/power/l.s
127a
TEXT	muxlock(SB),$0

	MOVW	R1, R2		/* sbsem */
	MOVW	4(FP), R3	/* lk->val */

	MOVW	M(STATUS), R5	/* splhi */
	AND	$~IEC, R5, R4
	MOVW	R4, M(STATUS)

	MOVW	0(R2),R4	/* grab sbsem */
	AND	$1, R4
	BNE	R4, f1
	MOVW	0(R3),R4
	BNE	R4, f0

	MOVW	$1, R1
	MOVW	R1, 0(R3)	/* lk->val = 1 */
	MOVW	R0, 0(R2)	/* *sbsem = 0 */
	MOVW	R5, M(STATUS)	/* splx */
	RET

f0:	MOVW	R0, 0(R2)	/* *sbsem = 0 */
f1:	MOVW	R5, M(STATUS)	/* splx */
	MOVW	R0, R1		/* return 0 */
	RET

.
## diffname power/l.s 1992/0819
## diff -e /n/bootesdump/1992/0629/sys/src/9/power/l.s /n/bootesdump/1992/0819/sys/src/9/power/l.s
173,174c
	MOVW	0(R1), R29
	MOVW	4(R1), R31
.
166,167c
	MOVW	R29, 0(R1)
	MOVW	R31, 4(R1)
.
## diffname power/l.s 1992/0907
## diff -e /n/bootesdump/1992/0819/sys/src/9/power/l.s /n/bootesdump/1992/0907/sys/src/9/power/l.s
273a
	MOVW	$((MACHADDR+368) & 0xffff0000), R26	/* get m->tlbfault BUG */	
	OR	$((MACHADDR+368) & 0xffff), R26
	MOVW	(R26), R27
	ADD	$1, R27
	MOVW	R27, (R26)

.
## diffname power/l.s 1992/1129
## diff -e /n/bootesdump/1992/0907/sys/src/9/power/l.s /n/bootesdump/1992/1129/sys/src/9/power/l.s
494a

	AND	$~CU1, R3
	MOVW	R3, M(STATUS)
.
490a

	MOVW	M(STATUS), R3
	OR	$CU1, R3
	MOVW	R3, M(STATUS)
	WAIT

.
353c
	MOVW	$MACHADDR, R(MACH)		/* locn of &mach[0] */
.
## diffname power/l.s 1993/0106
## diff -e /n/bootesdump/1992/1129/sys/src/9/power/l.s /n/bootesdump/1993/0106/sys/src/9/power/l.s
525a
	WAIT
.
508c
	MOVW	FCR31, R2		/* Read stalls the fpu until inst. complete. */
	WAIT
.
496,501c
	MOVW	FCR31, R1		/* Read it to stall the fpu */
	WAIT
	MOVW	R0, FCR31
	WAIT
.
## diffname power/l.s 1993/0205
## diff -e /n/bootesdump/1993/0106/sys/src/9/power/l.s /n/bootesdump/1993/0205/sys/src/9/power/l.s
135a
	NOOP
.
131c
	MOVW	4(FP), R3	/* &lk->val */
.
## diffname power/l.s 1993/0206
## diff -e /n/bootesdump/1993/0205/sys/src/9/power/l.s /n/bootesdump/1993/0206/sys/src/9/power/l.s
195c
	JMP	(R1)
.
186,190d
184c
TEXT	gotopc(SB), $-4
.
## diffname power/l.s 1993/0219
## diff -e /n/bootesdump/1993/0206/sys/src/9/power/l.s /n/bootesdump/1993/0219/sys/src/9/power/l.s
184c
TEXT	gotopc(SB), $8

	MOVW	R1, 0(FP)
	MOVW	$(64*1024), R1
	MOVW	R1, 8(SP)
	MOVW	R0, R1
	JAL	icflush(SB)
	MOVW	0(FP), R1
.
## diffname power/l.s 1993/0403
## diff -e /n/bootesdump/1993/0219/sys/src/9/power/l.s /n/bootesdump/1993/0403/sys/src/9/power/l.s
234c
	MOVW	M(INDEX), R2
	MOVW	R0, R1
	BLTZ	R2, bad
	MOVW	$1, R1
bad:
.
231a
	MOVW	M(TLBVIRT), R2
	AND	$(~(BY2PG-1)), R1, R4	/* get the VPN */
	AND	$((NTLBPID-1)<<6), R2	/* get the pid */
	OR	R4, R2
	MOVW	R2, M(TLBVIRT)
	NOOP
.
## diffname power/l.s 1993/0501
## diff -e /n/bootesdump/1993/0403/sys/src/9/power/l.s /n/fornaxdump/1993/0501/sys/src/brazil/power/l.s
519c
	MOVW	FCR31, R2	/* Read stalls the fpu until inst. complete. */
.
509c
	MOVW	FCR31, R1	/* Read it to stall the fpu */
.
420c
	BEQ	R26, return		/* syscall, don't save */
.
409a
TEXT	forkret(SB), $0
	MOVW	R0, R1			/* Fake out system call return */
	JMP	sysrestore

.
398c
	MOVW	$1, R26			/* not syscall */
.
375a
sysrestore:
.
370,371c
	MOVW	8(R(MACH)), R(USER)		/* set up to mach->p */
	MOVW	4(SP), R1			/* first arg for syscall/trap */
.
363d
343,350c
	MOVW	$(MACHADDR&0xffff0000), R27	
	OR	$(MACHADDR&0xffff), R27
	MOVW	$MPID, R26
	MOVB	3(R26), R26
	AND	$7, R26
	SLL	$PGSHIFT, R26
	ADDU	R26,R27			/* R27->current mach */
	MOVW	8(R27), R26		/* R27 = mach->proc */
	MOVW	8(R26), R27		/* mach->proc->kstack */
	MOVW	SP, R26			/* save user sp */
	ADDU	$(KSTACK-UREGSIZE-2*BY2WD), R27, SP
	
.
337d
308,310c
	MOVW	$((MACHADDR+4)&0xffff0000), R26	/* get &mach[0].stb BUG */	
	OR	$((MACHADDR+4)&0xffff), R26
	MOVW	$MPID, R27			/* add BY2PG*machno */
.
305,306c
	/*
	 * R27 = (((tlbvirt<<1)^(tlbvirt>>12)) & (STLBSIZE-1)) << 8 
	 * (8 to clear zero in TLBPHYS)
	 */
	MOVW	R27, M(TLBPHYS)
.
292c
*/
.
286,287c
/* 	get m->tlbfault BUG
	MOVW	$((MACHADDR+368) & 0xffff0000), R26
.
281a
TEXT	vector80(SB), $-4
.
280c
TEXT getcause(SB), $0
	MOVW	M(CAUSE), R1
	RET
.
270d
255d
240,244c
	MOVW	M(INDEX), R1
.
232,237d
198a
TEXT	putcontext(SB), $4

	SLL	$6, R1
	MOVW	R1, M(TLBVIRT)
	RET

.
197c
	JMP	(R7)
.
191,192c
	MOVW	0(FP), R7
.
186,189c
	MOVW	R1, 0(FP)		/* save arguments for later */
	MOVW	$(64*1024), R7
	MOVW	R7, 8(SP)
.
136d
131c
	MOVW	4(FP), R3	/* lk->val */
.
111c
	MOVW	R31, 0xC(R(MACH))	/* save PC in m->splpc */
.
102c
	MOVW	R31, 0xC(R(MACH))	/* save PC in m->splpc */
.
## diffname power/l.s 1994/0406
## diff -e /n/fornaxdump/1993/0501/sys/src/brazil/power/l.s /n/fornaxdump/1994/0406/sys/src/brazil/power/l.s
791a
	RET

TEXT	getstatus(SB), $0
	MOVW	M(STATUS), R1
.
305,307c
	MOVW	$((MACHADDR+4) & 0xffff0000), R26	/* get &mach[0].stb BUG */	
	OR	$((MACHADDR+4) & 0xffff), R26
	MOVW	$MPID, R27				/* add BY2PG*machno */
.
299,303c
	/* R27 = (((tlbvirt<<1)^(tlbvirt>>12)) & (STLBSIZE-1)) << 8 (8 to clear zero in TLBPHYS) */
	MOVW	R27, M(TLBPHYS)			/* scratch register, store */
.
280c
/*
 	get m->tlbfault BUG
.
241,242d
## diffname power/l.s 1995/0108
## diff -e /n/fornaxdump/1994/0406/sys/src/brazil/power/l.s /n/fornaxdump/1995/0108/sys/src/brazil/power/l.s
134c
	AND	$~IE, R5, R4
.
123c
	OR	$IE, R1, R2
.
113,114c
	AND	$IE, R1
	AND	$~IE, R2
.
104c
	AND	$~IE, R1, R2
.
## diffname power/l.s 1997/0327 # deleted
## diff -e /n/fornaxdump/1995/0108/sys/src/brazil/power/l.s /n/emeliedump/1997/0327/sys/src/brazil/power/l.s
1,792d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.