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

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


## diffname carrera/l.s 1993/0903
## diff -e /dev/null /n/fornaxdump/1993/0903/sys/src/brazil/carrera/l.s
0a
#include "mem.h"

#define SP		R29

#define PROM		(KSEG1+0x1C000000)
#define	NOOP		WORD	$0x27
#define FCRNOOP		NOOP; NOOP; NOOP
#define	WAIT		NOOP; NOOP
#define	NOOP4		NOOP; NOOP; NOOP; NOOP

#define	ERET		NOOP4;NOOP4;WORD	$0x42000018;NOOP4;NOOP4

#define	CONST(x,r)	MOVW $((x)&0xffff0000), r; OR  $((x)&0xffff), r

/*
 *  R4000 instructions
 */
#define	LD(base, rt)		WORD	$((067<<26)|((base)<<21)|((rt)<<16))
#define STD(rt, base)		WORD	$((077<<26)|((base)<<21)|((rt)<<16))
#define	DSLL(sa, rt, rd)	WORD	$(((rt)<<16)|((rd)<<11)|((sa)<<6)|070)
#define	DSRA(sa, rt, rd)	WORD	$(((rt)<<16)|((rd)<<11)|((sa)<<6)|073)
#define	LL(base, rt)		WORD	$((060<<26)|((base)<<21)|((rt)<<16))
#define	SC(base, rt)		WORD	$((070<<26)|((base)<<21)|((rt)<<16))

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

	MOVW	$setR30(SB), R30
	MOVW	$(CU1|INTR7|INTR6|INTR5|INTR4|INTR3|INTR2|INTR1|INTR0), R1
	MOVW	R1, M(STATUS)
	WAIT

	MOVW	$TLBROFF, R1
	MOVW	R1, M(WIRED)

	MOVW	$((0x1C<<7)|(1<<24)), 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

	MOVW	R4, _argc(SB)
	MOVW	R5, _argv(SB)
	MOVW	R6, _env(SB)
	JAL	main(SB)
	JMP	(R0)

/*
 * Take first processor into user mode
 * 	- argument is stack pointer to user
 */

TEXT	touser(SB), $-4

	MOVW	$(UTZERO+32), R2	/* header appears in text */
	MOVW	(R2), R3		/* fault now */
	MOVW	M(STATUS), R4
	WAIT
	AND	$(~KMODEMASK), R4
	OR	$(KUSER|EXL|IE), R4
	MOVW	R4, M(STATUS)
	WAIT
	MOVW	R1, SP
	MOVW	R2, M(EPC)
	NOOP4
	ERET

TEXT	firmware(SB), $0

	SLL	$3, R1
	MOVW	$(PROM+0x774), R1
	JMP	(R1)

TEXT	splhi(SB), $0

	MOVW	R31, 12(R(MACH))	/* save PC in m->splpc */
	MOVW	M(STATUS), R1
	WAIT
	AND	$~IE, R1, R2
	MOVW	R2, M(STATUS)
	WAIT
	RET

TEXT	splx(SB), $0

	MOVW	R31, 12(R(MACH))	/* save PC in m->splpc */
	MOVW	M(STATUS), R2
	WAIT
	AND	$IE, R1
	AND	$~IE, R2
	OR	R2, R1
	MOVW	R1, M(STATUS)
	WAIT
	RET

TEXT	spllo(SB), $0

	MOVW	M(STATUS), R1
	WAIT
	OR	$IE, R1, R2
	MOVW	R2, M(STATUS)
	WAIT
	RET

TEXT	machstatus(SB), $0

	MOVW	M(STATUS), R1
	WAIT
	RET

TEXT	spldone(SB), $0

	RET

TEXT	wbflush(SB), $-4

	RET

TEXT	setlabel(SB), $-4

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

TEXT	gotolabel(SB), $-4

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

TEXT	gotopc(SB), $8

	MOVW	R1, 0(FP)		/* save arguments for later */
	MOVW	$(64*1024), R7
	MOVW	R7, 8(SP)
	JAL	icflush(SB)
	MOVW	0(FP), R7
	MOVW	_argc(SB), R4
	MOVW	_argv(SB), R5
	MOVW	_env(SB), R6
	MOVW	R0, 4(SP)
	JMP	(R7)

TEXT	puttlb(SB), $0

	MOVW	R1, M(TLBVIRT)
	MOVW	4(FP), R2		/* phys0 */
	MOVW	8(FP), R3		/* phys1 */
	MOVW	R2, M(TLBPHYS0)
	WAIT
	MOVW	$PGSZ4K, R1
	MOVW	R3, M(TLBPHYS1)
	WAIT
	MOVW	R1, M(PAGEMASK)
	OR	R2, R3, R4		/* MTC0 delay slot */
	AND	$PTEVALID, R4		/* MTC0 delay slot */
	NOOP
	TLBP
	NOOP4
	MOVW	M(INDEX), R1
	NOOP4
	BGEZ	R1, index
	BEQ	R4, dont		/* cf. kunmap */
	TLBWR
	NOOP
dont:
	RET
index:
	TLBWI
	NOOP
	RET

TEXT	getwired(SB),$0
	MOVW	M(WIRED), R1
	WAIT
	RET

TEXT	getrandom(SB),$0
	MOVW	M(RANDOM), R1
	WAIT
	RET

TEXT	puttlbx(SB), $0

	MOVW	4(FP), R2
	MOVW	8(FP), R3
	MOVW	12(FP), R4
	MOVW	16(FP), R5
	MOVW	R2, M(TLBVIRT)
	NOOP4
	MOVW	R3, M(TLBPHYS0)
	NOOP4
	MOVW	R4, M(TLBPHYS1)
	NOOP4
	MOVW	R5, M(PAGEMASK)
	NOOP4
	MOVW	R1, M(INDEX)
	NOOP4
	TLBWI
	WAIT
	RET

TEXT	tlbvirt(SB), $0

	NOOP
	MOVW	M(TLBVIRT), R1
	NOOP
	RET

TEXT	gettlbx(SB), $0

	MOVW	4(FP), R5
	MOVW	M(TLBVIRT), R10
	NOOP4
	MOVW	R1, M(INDEX)
	NOOP4
	TLBR
	NOOP4
	MOVW	M(TLBVIRT), R2
	MOVW	M(TLBPHYS0), R3
	MOVW	M(TLBPHYS1), R4
	NOOP4
	MOVW	R2, 0(R5)
	MOVW	R3, 4(R5)
	MOVW	R4, 8(R5)
	MOVW	R10, M(TLBVIRT)
	NOOP4
	RET

TEXT	gettlbp(SB), $0

	MOVW	4(FP), R5
	MOVW	R1, M(TLBVIRT)
	NOOP
	NOOP
	NOOP
	TLBP
	NOOP
	NOOP
	MOVW	M(INDEX), R1
	NOOP
	BLTZ	R1, gettlbp1
	TLBR
	NOOP
	NOOP
	NOOP
	MOVW	M(TLBVIRT), R2
	MOVW	M(TLBPHYS0), R3
	MOVW	M(TLBPHYS1), R4
	MOVW	M(PAGEMASK), R6
	NOOP
	MOVW	R2, 0(R5)
	MOVW	R3, 4(R5)
	MOVW	R4, 8(R5)
	MOVW	R6, 12(R5)
gettlbp1:
	RET

TEXT	gettlbvirt(SB), $0

	MOVW	R1, M(INDEX)
	NOOP
	NOOP
	TLBR
	NOOP
	NOOP
	NOOP
	MOVW	M(TLBVIRT), R1
	NOOP
	RET

TEXT	vector0(SB), $-4

	NOOP4
	NOOP4
	MOVW	$utlbmiss(SB), R26
	JMP	(R26)

TEXT	utlbmiss(SB), $-4

	MOVW	M(TLBVIRT), R27
	WAIT
	MOVW	R27, R26
	SRL	$13, R27
	XOR	R26, R27
	AND	$(STLBSIZE-1), R27
	SLL	$2, R27
	MOVW	R27, R26
	SLL	$1, R27
	ADDU	R26, R27
	/* R27 = ((tlbvirt^(tlbvirt>>13)) & (STLBSIZE-1)) x 12 */

	CONST	(MACHADDR, R26)		/* R26 = m-> */
	MOVW	4(R26), R26		/* R26 = m->stb */
	ADDU	R26, R27		/* R27 = &m->stb[hash] */

	MOVW	M(BADVADDR), R26
	WAIT
	AND	$BY2PG, R26
	BNE	R26, utlbodd

	MOVW	4(R27), R26
	BEQ	R26, stlbm
	MOVW	R26, M(TLBPHYS0)
	WAIT
	MOVW	8(R27), R26
	MOVW	R26, M(TLBPHYS1)
	JMP	utlbcom

utlbodd:
	MOVW	8(R27), R26
	BEQ	R26, stlbm
	MOVW	R26, M(TLBPHYS1)
	WAIT
	MOVW	4(R27), R26
	MOVW	R26, M(TLBPHYS0)

utlbcom:
	WAIT				/* MTC0/MFC0 hazard */
	MOVW	M(TLBVIRT), R26
	WAIT
	MOVW	(R27), R27
	BEQ	R27, stlbm
	BNE	R26, R27, stlbm 

	MOVW	$PGSZ4K, R27
	MOVW	R27, M(PAGEMASK)
	NOOP4
	TLBP
	NOOP4
	MOVW	M(INDEX), R26
	NOOP4
	BGEZ	R26, utlindex
	TLBWR
	NOOP4
	ERET
utlindex:
	MOVW	R0,(R0)
	TLBWI
	NOOP4
	ERET

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

TEXT	vector100(SB), $-4

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

TEXT	vector180(SB), $-4

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

TEXT	exception(SB), $-4
	MOVW	M(STATUS), R26
	WAIT
	AND	$KUSER, R26
	BEQ	R26, waskernel

wasuser:
	CONST	(MACHADDR, R27)		/* R27 = m-> */
	MOVW	8(R27), R26		/* R26 = m->proc */
	MOVW	8(R26), R27		/* R27 = m->proc->kstack */
	MOVW	SP, R26			/* save user sp */
	ADDU	$(KSTACK-UREGSIZE-2*BY2WD), R27, 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	$(EXCMASK<<2), R26
	SUBU	$(CSYS<<2), R26

	JAL	saveregs(SB)

	MOVW	$setR30(SB), R30
	CONST	(MACHADDR, R1)
	ADDU	R1, R(MACH)			/* R(MACH) = m-> */
	MOVW	8(R(MACH)), R(USER)		/* up = m->proc */
	MOVW	4(SP), R1			/* first arg for syscall/trap */
	BNE	R26, notsys

	JAL	syscall(SB)
	MOVW	R0, R2
	MOVW	R0, R3
	MOVW	R0, R4
	MOVW	R0, R5
	MOVW	R0, R6
	MOVW	R0, R7
	MOVW	R0, R8
	MOVW	R0, R9
	MOVW	R0, R10
	MOVW	R0, R11
	MOVW	R0, R12
	MOVW	R0, R13
	MOVW	R0, R14
	MOVW	R0, R15
	MOVW	R0, R16
	MOVW	R0, R17
	MOVW	R0, R18
	MOVW	R0, R19
	MOVW	R0, R20
	MOVW	R0, R21
	MOVW	R0, R22
	MOVW	R0, R23
	MOVW	R0, R24
	MOVW	R0, R25
	MOVW	R0, R27

sysrestore:
	MOVW	0x28(SP), R31
	MOVW	0x08(SP), R26
	MOVW	0x2C(SP), R30
	MOVW	R26, M(STATUS)
	WAIT
	MOVW	0x0C(SP), R26		/* old pc */
	MOVW	0x10(SP), SP
	MOVW	R26, M(EPC)
	NOOP4
	ERET

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
	MOVW	R26, M(EPC)
	NOOP4
	ERET

waskernel:
	MOVW	$1, R26			/* not syscall */
	MOVW	SP, -(UREGSIZE-16)(SP)
	SUBU	$UREGSIZE, SP
	MOVW	R31, 0x28(SP)
	JAL	saveregs(SB)
	MOVW	4(SP), R1		/* first arg for trap */
	JAL	trap(SB)
	JAL	restregs(SB)
	MOVW	0x28(SP), R31
	ADDU	$UREGSIZE, SP
	MOVW	R26, M(EPC)
	NOOP4
	ERET

TEXT	forkret(SB), $0
	MOVW	R0, R1			/* Fake out system call return */
	JMP	sysrestore

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
	WAIT
	MOVW	R1, 0x08(SP)
	MOVW	R2, 0x0C(SP)

	MOVW	$(~KMODEMASK),R2	/* don't let him use R28 */
	AND	R2, R1
	MOVW	R1, M(STATUS)
	WAIT
	BEQ	R26, return		/* sys call, don't save */

	MOVW	M(CAUSE), R1
	MOVW	M(BADVADDR), R2
	NOOP
	MOVW	R1, 0x14(SP)
	MOVW	M(TLBVIRT), R1
	NOOP
	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)
	WAIT
	MOVW	0x9C(SP), R1
	MOVW	0x0C(SP), R26		/* old pc */
	RET

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

TEXT	clrfpintr(SB), $0
	MOVW	M(STATUS), R3
	WAIT
	OR	$CU1, R3
	MOVW	R3, M(STATUS)
	NOOP
	NOOP
	NOOP

	MOVW	FCR31, R1
	FCRNOOP
	MOVW	R1, R2
	AND	$~(0x3F<<12), R2
	MOVW	R2, FCR31

	AND	$~CU1, R3
	MOVW	R3, M(STATUS)
	WAIT
	RET

TEXT	getstatus(SB), $0
	MOVW	M(STATUS), R1
	WAIT
	RET

TEXT	savefpregs(SB), $0
	MOVW	FCR31, R2			/* 3 delays before R2 ok */
	MOVW	M(STATUS), R3
	WAIT
	AND	$~(0x3F<<12), R2, R4
	MOVW	R4, FCR31

	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)
	WAIT
	RET

TEXT	restfpregs(SB), $0

	MOVW	M(STATUS), R3
	WAIT
	OR	$CU1, R3
	MOVW	R3, M(STATUS)
	WAIT
	MOVW	fpstat+4(FP), R2
	NOOP

	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)
	WAIT
	RET

TEXT	fcr31(SB), $0

	MOVW	FCR31, R1		/* 3 delays before using R1 */
	MOVW	M(STATUS), R3
	WAIT
	AND	$~CU1, R3
	MOVW	R3, M(STATUS)
	WAIT

	RET

TEXT	prid(SB), $0

	MOVW	M(PRID), R1
	WAIT
	RET

/*
 * Emulate 68020 test and set: load linked / store conditional
 */

TEXT	tas(SB), $0
	MOVW	R1, R2		/* address of key */
tas1:
	MOVW	$1, R3
	LL(2, 1)
	NOOP
	SC(2, 3)
	NOOP
	BEQ	R3, tas1
	RET

/*
 *  cache manipulation
 */

#define	CACHE	BREAK		/* overloaded op-code */

#define	PI	R((0		/* primary I cache */
#define	PD	R((1		/* primary D cache */
#define	SD	R((3		/* secondary combined I/D cache */

#define	IWBI	(0<<2)))	/* index write-back invalidate */
#define	ILT	(1<<2)))	/* index load tag */
#define	IST	(2<<2)))	/* index store tag */
#define	CDE	(3<<2)))	/* create dirty exclusive */
#define	HI	(4<<2)))	/* hit invalidate */
#define	HWBI	(5<<2)))	/* hit write back invalidate */
#define	HWB	(6<<2)))	/* hit write back */
#define	HSV	(7<<2)))	/* hit set virtual */

/*
 *  we avoid using R4, R5, R6, and R7 so gotopc can call us without saving them
 */
TEXT	icflush(SB), $-4			/* icflush(virtaddr, count) */

	MOVW	M(STATUS), R10
	WAIT
	MOVW	4(FP), R9
	MOVW	$0, M(STATUS)
	WAIT
icflush1:			/* primary cache line size is 16 bytes */
	/*
	 * Due to a challenge bug PD+HWB DOES NOT WORK - philw
	 */
	WAIT
	WAIT
	CACHE	SD+HWBI, (R1)
	WAIT
	WAIT
	SUBU	$128, R9
	ADDU	$128, R1
	BGTZ	R9, icflush1
	MOVW	R10, M(STATUS)
	WAIT
	RET

TEXT	dcinvalidate(SB), $-4	/* dcinvalidate(virtaddr, count) */

	MOVW	M(STATUS), R10
	WAIT
	MOVW	$0, M(STATUS)
	WAIT
	MOVW	4(FP), R9
dcinval:			/* secondary cache line size is 128 bytes */
	CACHE	SD+HWBI, 0x00(R1)
	SUBU	$128, R9
	ADDU	$128, R1
	BGTZ	R9, dcinval
	MOVW	R10, M(STATUS)
	WAIT
	RET

TEXT	cleancache(SB), $-4
	MOVW	$KZERO, R1
	MOVW	M(STATUS), R10
	WAIT
	MOVW	$0, M(STATUS)
	WAIT
	MOVW	$(4*1024*1024), R9
ccache:
	CACHE	SD+IWBI, 0x00(R1)
	SUBU	$128, R9
	ADDU	$128, R1
	BGTZ	R9, ccache
	MOVW	R10, M(STATUS)
	WAIT
	RET
	
TEXT	getcallerpc(SB), $0

	MOVW	0(SP), R1
	RET

TEXT	rdcount(SB), $0

	MOVW	M(COUNT), R1
	NOOP
	RET

TEXT	wrcompare(SB), $0

	MOVW	R1, M(COMPARE)
	RET

TEXT	busprobe(SB), $-4

	NOOP
	MOVW	(R1), R2
	MOVW	$0, R1
	NOOP
	RET

TEXT	uvmove(SB), $-4

	AND	$7, R1, R2
	MOVW	4(FP), R3
	BNE	R2, uvgetuna

	/* alligned load */
	LD	(1,2)
	WAIT
	MOVW	R2, R1
	DSLL	(16,1,1)
	DSLL	(16,1,1)
	DSRA	(16,1,1)
	DSRA	(16,1,1)
uvput:
	AND	$7, R3, R4
	BNE	R4, uvputuna

	/* alligned store */
	STD	(2,3)
	NOP
	RET

	/* unalligned load */
uvgetuna:
	MOVW	0(R1),R2
	MOVW	4(R1),R1
	DSLL	(16,2,2)
	DSLL	(16,2,2)
	OR	R1, R2
	JMP	uvput

	/* unalligned store */
uvputuna:
	DSRA	(16,2,2)
	DSRA	(16,2,2)
	MOVW	R2, 0(R3)
	MOVW	R1, 4(R3)
	RET

TEXT	hack(SB), $-4

	MOVW	M(CONFIG), R1
	NOP
	RET
.
## diffname carrera/l.s 1993/0904
## diff -e /n/fornaxdump/1993/0903/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/0904/sys/src/brazil/carrera/l.s
787,789c
	CACHE	PD+IWBI, 0x00(R1)
	WAIT
	CACHE	PI+IWBI, 0x00(R1)
	WAIT
	SUBU	$16, R9
	ADDU	$16, R1
.
785c
	MOVW	$(32*1024), R9
.
748,757c
	CACHE	PD+HWB, 0x00(R8)
	CACHE	PI+HI, 0x00(R8)
	CACHE	PD+HWB, 0x10(R8)
	CACHE	PI+HI, 0x10(R8)
	CACHE	PD+HWB, 0x20(R8)
	CACHE	PI+HI, 0x20(R8)
	CACHE	PD+HWB, 0x30(R8)
	CACHE	PI+HI, 0x30(R8)
	SUB	$0x40, R9
	ADD	$0x40, R8
.
746a
	ADDU	R1, R9			/* R9 = last address */
	MOVW	$(~0x3f), R8
	AND	R1, R8			/* R8 = first address, rounded down */
	ADD	$0x3f, R9
	AND	$(~0x3f), R9		/* round last address up */
	SUB	R8, R9			/* R9 = revised count */
.
420c
	MOVW	R1, R(MACH)			/* R(MACH) = m-> */
.
## diffname carrera/l.s 1993/0907
## diff -e /n/fornaxdump/1993/0904/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/0907/sys/src/brazil/carrera/l.s
781a
	WAIT
	WAIT
.
776,780c
	MOVW	$0, M(STATUS)
	WAIT
	ADDU	R1, R9			/* R9 = last address */
	MOVW	$(~0x3f), R8
	AND	R1, R8			/* R8 = first address, rounded down */
	ADD	$0x3f, R9
	AND	$(~0x3f), R9		/* round last address up */
	SUB	R8, R9			/* R9 = revised count */
icdirty1:			/* primary cache line size is 16 bytes */
	CACHE	PI+HI, 0x00(R8)
	CACHE	PI+HI, 0x10(R8)
	CACHE	PI+HI, 0x20(R8)
	CACHE	PI+HI, 0x30(R8)
	SUB	$0x40, R9
	ADD	$0x40, R8
	BGTZ	R9, icdirty1
.
774a
	WAIT
.
773d
769c
TEXT	icdirty(SB), $-4			/* icdirty(virtaddr, count) */
.
766a
	WAIT
	WAIT
.
746a
	WAIT
	WAIT
.
741d
## diffname carrera/l.s 1993/0918
## diff -e /n/fornaxdump/1993/0907/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/0918/sys/src/brazil/carrera/l.s
796,797d
794c
	BGTZ	R9, dcflush1
.
791a
	CACHE	PD+HWB, 0x00(R8)
	CACHE	PD+HWB, 0x10(R8)
	CACHE	PD+HWB, 0x20(R8)
	CACHE	PD+HWB, 0x30(R8)
.
787c
dcflush1:			/* primary cache line size is 16 bytes */
.
776,777d
772c
TEXT	dcflush(SB), $-4			/* dcflush(virtaddr, count) */
.
## diffname carrera/l.s 1993/1208
## diff -e /n/fornaxdump/1993/0918/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/1208/sys/src/brazil/carrera/l.s
215c
TEXT	puttlbxx(SB), $0
.
## diffname carrera/l.s 1993/1209
## diff -e /n/fornaxdump/1993/1208/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/1209/sys/src/brazil/carrera/l.s
312a
	CONST	((0xA0090000), R27)
	MOVW	M(EPC), R26
	MOVW	R26, 0(R27)
	MOVW	M(BADVADDR), R26
	MOVW	R26, 4(R27)
	MOVW	M(CAUSE), R26
	MOVW	R26, 8(R27)
	MOVW	M(TLBVIRT), R26
	MOVW	R26, 12(R27)
	MOVW	M(17), R26
	MOVW	R26, 16(R27)

.
## diffname carrera/l.s 1993/1210
## diff -e /n/fornaxdump/1993/1209/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/1210/sys/src/brazil/carrera/l.s
781a
MOVW $0xA0090008, R10
MOVW $2002, R9
MOVW R9, (R10)
.
752a
MOVW $0xA0090008, R10
MOVW $2001, R9
MOVW R9, (R10)
.
215c
TEXT	puttlbx(SB), $0
.
## diffname carrera/l.s 1993/1211
## diff -e /n/fornaxdump/1993/1210/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/1211/sys/src/brazil/carrera/l.s
808,811c
	CACHE	PD+HWBI, 0x00(R8)
	CACHE	PD+HWBI, 0x10(R8)
	CACHE	PD+HWBI, 0x20(R8)
	CACHE	PD+HWBI, 0x30(R8)
.
785,787d
753,755d
401a
	RDBGSV
.
394a
	RDBGSV
.
313,324d
311a
	CONST	(MACHADDR, R26)		/* R26 = m-> */
	MOVW	16(R26), R27
	ADDU	$1, R27
	MOVW	R27, 16(R26)			/* m->tlbfault++ */
.
307a
	RDBGSV
.
14a
#define	RDBGSV		CONST(0x80020000, R26); MOVW R29, 0(R26); MOVW M(EPC), R27; MOVW R27, 4(R26); MOVW R31, 8(R26)

.
## diffname carrera/l.s 1993/1212
## diff -e /n/fornaxdump/1993/1211/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/1212/sys/src/brazil/carrera/l.s
435,459d
## diffname carrera/l.s 1993/1217
## diff -e /n/fornaxdump/1993/1212/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/1217/sys/src/brazil/carrera/l.s
15c
#define	RDBGSV		CONST(0x80020000, R26);	\
			MOVW R29, 0(R26); \
			MOVW M(EPC), R27; \
			MOVW R27, 4(R26); \
			MOVW R31, 8(R26); \
			MOVW M(CAUSE), R27; \
			MOVW R27, 12(R26); \
			MOVW M(STATUS), R27; \
			MOVW R27, 16(R26); \
			MOVW M(BADVADDR), R27; \
			MOVW R27, 20(R26)
.
## diffname carrera/l.s 1993/1220
## diff -e /n/fornaxdump/1993/1217/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/1220/sys/src/brazil/carrera/l.s
25c
			MOVW R27, 20(R26);
.
## diffname carrera/l.s 1993/1231
## diff -e /n/fornaxdump/1993/1220/sys/src/brazil/carrera/l.s /n/fornaxdump/1993/1231/sys/src/brazil/carrera/l.s
788,789c
	SUBU	$0x40, R9
	ADDU	$0x40, R8
.
778c
	SUBU	R8, R9			/* R9 = revised count */
.
776c
	ADDU	$0x3f, R9
.
757,758c
	SUBU	$0x40, R9
	ADDU	$0x40, R8
.
747c
	SUBU	R8, R9			/* R9 = revised count */
.
745c
	ADDU	$0x3f, R9
.
## diffname carrera/l.s 1994/0207
## diff -e /n/fornaxdump/1993/1231/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0207/sys/src/brazil/carrera/l.s
861c
	/* unaligned load */
.
856c
	/* aligned store */
.
844c
	/* aligned load */
.
31c
#define	STD(rt, base)		WORD	$((077<<26)|((base)<<21)|((rt)<<16))
.
## diffname carrera/l.s 1994/0209
## diff -e /n/fornaxdump/1994/0207/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0209/sys/src/brazil/carrera/l.s
857c
	STD	(2, 0,(3))
.
845c
	LD	(0,(1), 2)
.
577a
	/* restore 64-bit R5, R6 */
	ADDU	$(UREGSIZE-16), SP, R1
	MOVW	$~7, R2	/* don't let him use R28 */
	AND		R2, R1
	LD		(0,(1), 5)
	LD		(8,(1), 6)
.
570,571c
	/*
	 * restored below
	 * MOVW	0x88(SP), R6
	 * MOVW	0x8C(SP), R5
	 */
.
493a
	/* save R5, R6 as 64 bits */
	ADDU	$(UREGSIZE-16), SP, R1
	MOVW	$~7, R2	/* don't let him use R28 */
	AND		R2, R1
	STD		(5, 0,(1))
	STD		(6, 8,(1))
.
30,31c
#define	LD(offset, base, rt)		WORD	$((067<<26)|((base)<<21)|((rt)<<16)|((offset)&0xFFFF))
#define	STD(rt, offset, base)		WORD	$((077<<26)|((base)<<21)|((rt)<<16)|((offset)&0xFFFF))
.
7c
#define	FCRNOOP		NOOP; NOOP; NOOP
.
5c
#define	PROM		(KSEG1+0x1C000000)
.
3c
#define	SP		R29
.
## diffname carrera/l.s 1994/0228
## diff -e /n/fornaxdump/1994/0209/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0228/sys/src/brazil/carrera/l.s
891,896d
870d
858d
854d
845,852d
841d
835d
794c
dcflush1:				/* primary cache line is 16 bytes */
.
782d
706,711d
703d
696d
663d
418d
405d
397d
317d
304d
275d
255d
248d
228d
189d
176d
169d
162d
158d
154d
147,152d
139d
127d
117d
111d
94d
30,31c
#define	LD(offset, base, rt)	WORD	$((067<<26)|((base)<<21)|((rt)<<16)|((offset)&0xFFFF))
#define	STD(rt, offset, base)	WORD	$((077<<26)|((base)<<21)|((rt)<<16)|((offset)&0xFFFF))
.
## diffname carrera/l.s 1994/0307
## diff -e /n/fornaxdump/1994/0228/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0307/sys/src/brazil/carrera/l.s
842a

TEXT	uvld(SB), $-4		/* uvld(address, dst) */
	MOVV	0(R1), R5
	MOVW	4(FP), R2
	MOVW	R5, 4(R2)
	DSRA	(16,5,5)
	DSRA	(16,5,5)
	MOVW	R5, 0(R2)
	RET

TEXT	uvst(SB), $-4		/* uvst(address, src) */
	MOVW	4(FP), R2
	MOVW	0(R2), R5
	DSLL	(16,5,5)
	DSLL	(16,5,5)
	MOVW	4(R2), R2
	OR	R2, R5	
	MOVV	R5, 0(R1)
	RET
.
## diffname carrera/l.s 1994/0308
## diff -e /n/fornaxdump/1994/0307/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0308/sys/src/brazil/carrera/l.s
855,859c
	MOVV	0(R2), R5
.
847,850c
	MOVV	0(R1), R5
	MOVV	R5, 0(R2)
.
845d
## diffname carrera/l.s 1994/0309
## diff -e /n/fornaxdump/1994/0308/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0309/sys/src/brazil/carrera/l.s
853a
	RET

TEXT	fwblock(SB), $-4	/* wblock(void*port, void *block, csum) */
	MOVW	4(FP), R2
	MOVW	8(FP), R3

	MOVW	$64, R4
fwloop:
	MOVV	0(R2), R5
	MOVV	R5, 0(R1)
	ADDU	R5, R3
	SRLV	$32, R5
	ADDU	R5, R3

	ADD	$8, R2
	SUB	$1, R4
	BNE	R4, fwloop

	MOVW	R3, R1
.
807,843d
794d
## diffname carrera/l.s 1994/0311
## diff -e /n/fornaxdump/1994/0309/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0311/sys/src/brazil/carrera/l.s
832a

	MOVW	R3, R1
	RET

TEXT	frblock(SB), $-4	/* frblock(void*port, void *block, csum) */
	MOVW	4(FP), R2
	MOVW	8(FP), R3

	MOVW	$64, R4
frloop:
	MOVV	0(R1), R5
	MOVV	R5, 0(R2)
	ADDU	R5, R3
	SRLV	$32, R5
	ADDU	R5, R3

	ADD	$8, R2
	SUB	$1, R4
	BNE	R4, frloop
.
818c
TEXT	fwblock(SB), $-4	/* fwblock(void*port, void *block, csum) */
.
## diffname carrera/l.s 1994/0312
## diff -e /n/fornaxdump/1994/0311/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0312/sys/src/brazil/carrera/l.s
847c
	XOR	R5, R3
.
845c
	XOR	R5, R3
.
828c
	XOR	R5, R3
.
826c
	XOR	R5, R3
.
## diffname carrera/l.s 1994/0322
## diff -e /n/fornaxdump/1994/0312/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0322/sys/src/brazil/carrera/l.s
458d
443d
434c
	RDBGSV
.
429d
366d
361d
106d
11c
#define	ERET		NOOP4;NOOP4;NOOP4;WORD $0x42000018;NOOP4;NOOP4;NOOP4
.
## diffname carrera/l.s 1994/0330
## diff -e /n/fornaxdump/1994/0322/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0330/sys/src/brazil/carrera/l.s
784a
	MOVW	M(CONFIG), R1
	OR	$((1<<4)|(1<<5)), R1
	MOVW	R1, M(CONFIG)
.
## diffname carrera/l.s 1994/0417
## diff -e /n/fornaxdump/1994/0330/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0417/sys/src/brazil/carrera/l.s
839a

	MOVW	$50, R10
xx:	SUB	$1, R10
	BNE	R10, xx

.
## diffname carrera/l.s 1994/0418
## diff -e /n/fornaxdump/1994/0417/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0418/sys/src/brazil/carrera/l.s
855c
	MOVW	R6, R1
	SRLV	$32, R6
	XOR	R6, R1
.
847,852c
	XOR	R5, R6
	MOVV	0(R1), R5
	MOVV	R5, 8(R2)
	XOR	R5, R6
	ADD	$16, R2
	SUB	$2, R4
.
840,844d
836c
	MOVW	8(FP), R6
.
831c
	MOVW	R6, R1
	SRLV	$32, R6
	XOR	R6, R1
.
827,828c
	ADD	$16, R2
	SUB	$2, R4
.
823,825c
	XOR	R5, R6
	MOVV	8(R2), R5
	MOVV	R5, 0(R1)
	XOR	R5, R6
.
817c
	MOVW	8(FP), R6
.
## diffname carrera/l.s 1994/0420
## diff -e /n/fornaxdump/1994/0418/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0420/sys/src/brazil/carrera/l.s
850c
	SUB	$1, R4
.
841c
	MOVW	$32, R4
.
829c
	SUB	$1, R4
.
819c
	MOVW	$32, R4
.
## diffname carrera/l.s 1994/0504
## diff -e /n/fornaxdump/1994/0420/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0504/sys/src/brazil/carrera/l.s
430d
380d
373d
296d
15,26d
12d
10d
## diffname carrera/l.s 1994/0505
## diff -e /n/fornaxdump/1994/0504/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0505/sys/src/brazil/carrera/l.s
539c
	MOVW	$~7, R2			/* don't let him use R28 */
.
446c
	MOVW	$~7, R2			/* don't let him use R28 */
.
347d
## diffname carrera/l.s 1994/0519
## diff -e /n/fornaxdump/1994/0505/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0519/sys/src/brazil/carrera/l.s
837a

TEXT	getprid(SB), $0
	MOVW	M(PRID), R1
	RET
.
## diffname carrera/l.s 1994/0520
## diff -e /n/fornaxdump/1994/0519/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0520/sys/src/brazil/carrera/l.s
838,841d
## diffname carrera/l.s 1994/0522
## diff -e /n/fornaxdump/1994/0520/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0522/sys/src/brazil/carrera/l.s
63a
DBG(0x55aa0004)
.
60a
DBG(0x55aa0011)
.
59a
DBG(0x55aa0010)
MOVW R(MACH),4(R20)
.
55a
DBG(0x55aa0003)
.
34a
DBG(0x55aa0002)
.
31a
DBG(0x55aa0001)
.
29c
	MOVW	$(BEV|DE|CU1|INTR7|INTR6|INTR5|INTR4|INTR3|INTR2|INTR1|INTR0), R1
.
27a
DBG(0x55aa0000)
.
22a
#define DBG(S)	CONST(0xa0001000, R20);CONST(S, R21);MOVW	R21,(R20)

.
## diffname carrera/l.s 1994/0524
## diff -e /n/fornaxdump/1994/0522/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0524/sys/src/brazil/carrera/l.s
32c
	MOVW	$(CU1|INTR7|INTR6|INTR5|INTR4|INTR3|INTR2|INTR1|INTR0), R1
.
## diffname carrera/l.s 1994/0528
## diff -e /n/fornaxdump/1994/0524/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0528/sys/src/brazil/carrera/l.s
105,107c
	MOVW	$0xE000D004, R1
	MOVW	R0, 0(R1)
firm:
	JMP	firm
.
5d
## diffname carrera/l.s 1994/0609
## diff -e /n/fornaxdump/1994/0528/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0609/sys/src/brazil/carrera/l.s
560c
TEXT	rfnote(SB), $-4
.
556,557c
	MOVV	Ureg_r1(SP), R1
	MOVV	Ureg_pc(SP), R26		/* old pc */
.
546,553c

	MOVW	Ureg_status(SP), R1
	MOVV	Ureg_r2(SP), R2
.
518,543c
	MOVV	Ureg_r23(SP), R23
	MOVV	Ureg_r22(SP), R22
	MOVV	Ureg_r21(SP), R21
	MOVV	Ureg_r20(SP), R20
	MOVV	Ureg_r19(SP), R19
	MOVV	Ureg_r18(SP), R18
	MOVV	Ureg_r17(SP), R17
	MOVV	Ureg_r16(SP), R16
	MOVV	Ureg_r15(SP), R15
	MOVV	Ureg_r14(SP), R14
	MOVV	Ureg_r13(SP), R13
	MOVV	Ureg_r12(SP), R12
	MOVV	Ureg_r11(SP), R11
	MOVV	Ureg_r10(SP), R10
	MOVV	Ureg_r9(SP), R9
	MOVV	Ureg_r8(SP), R8
	MOVV	Ureg_r7(SP), R7
	MOVV	Ureg_r6(SP), R6
	MOVV	Ureg_r5(SP), R5
	MOVV	Ureg_r4(SP), R4
	MOVV	Ureg_r3(SP), R3

	MOVV	Ureg_lo(SP), R2
	MOVV	Ureg_hi(SP), R1
.
515c
	MOVV	Ureg_r28(SP), R28
.
489,509c
	MOVV	R23, Ureg_r23(SP)
	MOVV	R22, Ureg_r22(SP)
	MOVV	R21, Ureg_r21(SP)
	MOVV	R20, Ureg_r20(SP)
	MOVV	R19, Ureg_r19(SP)
	MOVV	R18, Ureg_r18(SP)
	MOVV	R17, Ureg_r17(SP)
	MOVV	R16, Ureg_r16(SP)
	MOVV	R15, Ureg_r15(SP)
	MOVV	R14, Ureg_r14(SP)
	MOVV	R13, Ureg_r13(SP)
	MOVV	R12, Ureg_r12(SP)
	MOVV	R11, Ureg_r11(SP)
	MOVV	R10, Ureg_r10(SP)
	MOVV	R9, Ureg_r9(SP)
	MOVV	R8, Ureg_r8(SP)
	MOVV	R7, Ureg_r7(SP)
	MOVV	R6, Ureg_r6(SP)
	MOVV	R5, Ureg_r5(SP)
	MOVV	R4, Ureg_r4(SP)
	MOVV	R3, Ureg_r3(SP)
.
486c
	MOVV	R28, Ureg_r28(SP)
.
483,484c
	MOVV	R1, Ureg_hi(SP)
	MOVV	R2, Ureg_lo(SP)
.
479,480c
	MOVV	R2, Ureg_badvaddr(SP)
	MOVV	R1, Ureg_tlbvirt(SP)
.
476,477c
	MOVW	R1, Ureg_cause(SP)
	MOVV	M(TLBVIRT), R1
.
474c
	MOVV	M(BADVADDR), R2
.
464,465c
	MOVW	R1, Ureg_status(SP)
	MOVV	R2, Ureg_pc(SP)
.
462c
	MOVV	M(EPC), R2
.
451,460c
	MOVV	R1, Ureg_r1(SP)		/* save early to use as temp */
	MOVV	R2, Ureg_r2(SP)

	ADDU	$Uoffset,SP, R1
	MOVW	R1, 4(SP)		/* arg to base of regs */
.
446,447c
TEXT	forkret(SB), $-4
	MOVV	R0, R1			/* Fake out system call return */
.
441,443c
	MOVV	Ureg_r31(SP), R31
	MOVV	Ureg_sp(SP), SP
	MOVV	R26, M(EPC)
.
436c
	OR	$7, SP
	XOR	$7, SP
	MOVV	R26, Ureg_sp(SP)
	MOVV	R31, Ureg_r31(SP)
	MOVW	$1, R26			/* not syscall */
.
433,434c
	MOVV	SP, R26
.
424,429c
	MOVV	Ureg_r31(SP), R31
	MOVV	Ureg_r30(SP), R30
	MOVV	Ureg_r25(SP), R25			/* R(USER), R(MACH) */
	MOVV	Ureg_r24(SP), R24
	MOVV	Ureg_sp(SP), SP
	MOVV	R26, M(EPC)
.
415,417c
	MOVV	Ureg_pc(SP), R26		/* old pc */
	MOVV	Ureg_sp(SP), SP
	MOVV	R26, M(EPC)
.
410,412c
	MOVV	Ureg_r31(SP), R31
	MOVW	Ureg_status(SP), R26
	MOVV	Ureg_r30(SP), R30
.
401,402c
	CONST	(MACHADDR, R(MACH))		/* R(MACH) = m-> */
.
393,394c
	MOVV	R25, Ureg_r25(SP)		/* R(USER), R(MACH) */
	MOVV	R24, Ureg_r24(SP)
.
389,391c
	MOVV	R26, Ureg_sp(SP)		/* user SP */
	MOVV	R31, Ureg_r31(SP)
	MOVV	R30, Ureg_r30(SP)
.
386,387c
	MOVV	SP, R26			/* save user sp */
	ADDU	$(KSTACK-UREGSIZE), R27, SP
.
381a

.
375d
288a
/* also vector80 */
.
100c
	MOVV	R2, M(EPC)
.
96c
	OR	$(KUSER|EXL|IE|UX), R4
.
72d
68d
65,66d
60d
38d
34d
29d
15,18d
## diffname carrera/l.s 1994/0610
## diff -e /n/fornaxdump/1994/0609/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0610/sys/src/brazil/carrera/l.s
539c
TEXT	rfnote(SB), $0
.
535,536c
	MOVW	0x9C(SP), R1
	MOVW	0x0C(SP), R26		/* old pc */
.
530,532c
	/* restore 64-bit R5, R6 */
	ADDU	$(UREGSIZE-16), SP, R1
	MOVW	$~7, R2			/* don't let him use R28 */
	AND		R2, R1
	LD		(0,(1), 5)
	LD		(8,(1), 6)
	MOVW	0x08(SP), R1
	MOVW	0x98(SP), R2
.
504,527c
	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
	/*
	 * restored below
	 * MOVW	0x88(SP), R6
	 * MOVW	0x8C(SP), R5
	 */
	MOVW	0x90(SP), R4
	MOVW	0x94(SP), R3
	MOVW	0x24(SP), R2
	MOVW	0x20(SP), R1
.
501c
	MOVW	0x30(SP), R28
.
475,495c
	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)
.
472c
	MOVW	R28, 0x30(SP)
.
469,470c
	MOVW	R1, 0x20(SP)
	MOVW	R2, 0x24(SP)
.
465,466c
	MOVW	R2, 0x18(SP)
	MOVW	R1, 0x1C(SP)
.
462,463c
	MOVW	R1, 0x14(SP)
	MOVW	M(TLBVIRT), R1
.
460c
	MOVW	M(BADVADDR), R2
.
450,451c
	MOVW	R1, 0x08(SP)
	MOVW	R2, 0x0C(SP)
.
448c
	MOVW	M(EPC), R2
.
442,446c
	MOVW	R1, 0x9C(SP)
	MOVW	R2, 0x98(SP)
	/* save R5, R6 as 64 bits */
	ADDU	$(UREGSIZE-16), SP, R1
	MOVW	$~7, R2			/* don't let him use R28 */
	AND		R2, R1
	STD		(5, 0,(1))
	STD		(6, 8,(1))
	ADDU	$8, SP, R1
	MOVW	R1, 0x04(SP)		/* arg to base of regs */
.
437,438c
TEXT	forkret(SB), $0
	MOVW	R0, R1			/* Fake out system call return */
.
432,434c
	MOVW	0x28(SP), R31
	ADDU	$UREGSIZE, SP
	MOVW	R26, M(EPC)
.
427a
	MOVW	SP, -(UREGSIZE-16)(SP)
	SUBU	$UREGSIZE, SP
	MOVW	R31, 0x28(SP)
.
421,426d
412,417c
	MOVW	0x28(SP), R31
	MOVW	0x2C(SP), R30
	MOVW	0x3C(SP), R(MACH)
	MOVW	0x40(SP), R(USER)
	MOVW	0x10(SP), SP
	MOVW	R26, M(EPC)
.
403,405c
	MOVW	0x0C(SP), R26		/* old pc */
	MOVW	0x10(SP), SP
	MOVW	R26, M(EPC)
.
398,400c
	MOVW	0x28(SP), R31
	MOVW	0x08(SP), R26
	MOVW	0x2C(SP), R30
.
390c
	CONST	(MACHADDR, R1)
	MOVW	R1, R(MACH)			/* R(MACH) = m-> */
.
382,383c
	MOVW	R(MACH), 0x3C(SP)
	MOVW	R(USER), 0x40(SP)
.
378,380c
	MOVW	R26, 0x10(SP)			/* user SP */
	MOVW	R31, 0x28(SP)
	MOVW	R30, 0x2C(SP)
.
375,376c
	MOVW	SP, R26			/* save user sp */
	ADDU	$(KSTACK-UREGSIZE-2*BY2WD), R27, SP
.
370d
363a
	NOP
.
277d
88c
	MOVW	R2, M(EPC)
.
60a
DBG(0x55aa0004)
.
57a
DBG(0x55aa0011)
.
56a
DBG(0x55aa0010)
MOVW R(MACH),4(R20)
.
52a
DBG(0x55aa0003)
.
31a
DBG(0x55aa0002)
.
28a
DBG(0x55aa0001)
.
24a
DBG(0x55aa0000)
.
14a
#define	LD(offset, base, rt)	WORD	$((067<<26)|((base)<<21)|((rt)<<16)|((offset)&0xFFFF))
#define	STD(rt, offset, base)	WORD	$((077<<26)|((base)<<21)|((rt)<<16)|((offset)&0xFFFF))
#define	DSLL(sa, rt, rd)	WORD	$(((rt)<<16)|((rd)<<11)|((sa)<<6)|070)
#define	DSRA(sa, rt, rd)	WORD	$(((rt)<<16)|((rd)<<11)|((sa)<<6)|073)
.
## diffname carrera/l.s 1994/0611
## diff -e /n/fornaxdump/1994/0610/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0611/sys/src/brazil/carrera/l.s
96c
	OR	$(KUSER|EXL|IE), R4
.
## diffname carrera/l.s 1994/0612
## diff -e /n/fornaxdump/1994/0611/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0612/sys/src/brazil/carrera/l.s
556,557c
	MOVV	Ureg_r1(SP), R1
	MOVW	Ureg_pc(SP), R26
.
518,553c
	MOVV	Ureg_r23(SP), R23
	MOVV	Ureg_r22(SP), R22
	MOVV	Ureg_r21(SP), R21
	MOVV	Ureg_r20(SP), R20
	MOVV	Ureg_r19(SP), R19
	MOVV	Ureg_r18(SP), R18
	MOVV	Ureg_r17(SP), R17
	MOVV	Ureg_r16(SP), R16
	MOVV	Ureg_r15(SP), R15
	MOVV	Ureg_r14(SP), R14
	MOVV	Ureg_r13(SP), R13
	MOVV	Ureg_r12(SP), R12
	MOVV	Ureg_r11(SP), R11
	MOVV	Ureg_r10(SP), R10
	MOVV	Ureg_r9(SP), R9
	MOVV	Ureg_r8(SP), R8
	MOVV	Ureg_r7(SP), R7
	MOVV	Ureg_r6(SP), R6
	MOVV	Ureg_r5(SP), R5
	MOVV	Ureg_r4(SP), R4
	MOVV	Ureg_r3(SP), R3
	MOVV	Ureg_lo(SP), R2
	MOVV	Ureg_hi(SP), R1
	MOVV	R2, LO
	MOVV	R1, HI
	MOVW	Ureg_status(SP), R1
	MOVV	Ureg_r2(SP), R2
.
515c
	MOVV	Ureg_r28(SP), R28
.
489,509c
	MOVV	R23, Ureg_r23(SP)
	MOVV	R22, Ureg_r22(SP)
	MOVV	R21, Ureg_r21(SP)
	MOVV	R20, Ureg_r20(SP)
	MOVV	R19, Ureg_r19(SP)
	MOVV	R18, Ureg_r18(SP)
	MOVV	R17, Ureg_r17(SP)
	MOVV	R16, Ureg_r16(SP)
	MOVV	R15, Ureg_r15(SP)
	MOVV	R14, Ureg_r14(SP)
	MOVV	R13, Ureg_r13(SP)
	MOVV	R12, Ureg_r12(SP)
	MOVV	R11, Ureg_r11(SP)
	MOVV	R10, Ureg_r10(SP)
	MOVV	R9, Ureg_r9(SP)
	MOVV	R8, Ureg_r8(SP)
	MOVV	R7, Ureg_r7(SP)
	MOVV	R6, Ureg_r6(SP)
	MOVV	R5, Ureg_r5(SP)
	MOVV	R4, Ureg_r4(SP)
	MOVV	R3, Ureg_r3(SP)
.
486c
	MOVV	R28, Ureg_r28(SP)
.
479,484c
	MOVW	R2, Ureg_badvaddr(SP)
	MOVW	R1, Ureg_tlbvirt(SP)

	MOVV	HI, R1
	MOVV	LO, R2
	MOVV	R1, Ureg_hi(SP)
	MOVV	R2, Ureg_lo(SP)
.
476c
	MOVW	R1, Ureg_cause(SP)
.
464,465c
	MOVW	R1, Ureg_status(SP)
	MOVW	R2, Ureg_pc(SP)
.
451,460c
	MOVV	R1, Ureg_r1(SP)
	MOVV	R2, Ureg_r2(SP)
	MOVV	R5, Ureg_r5(SP)
	MOVV	R6, Ureg_r6(SP)
	ADDU	$Uoffset, SP, R1
	MOVW	R1, 4(SP)		/* arg to base of regs */
.
441,442c
	MOVV	Ureg_r31(SP), R31
	MOVW	Ureg_sp(SP), SP
.
436c
	OR	$7, SP
	XOR	$7, SP
	MOVW	R26, Ureg_sp(SP)
	MOVV	R31, Ureg_r31(SP)
	MOVW	$1, R26			/* not syscall */
.
433,434c
	MOVW	SP, R26
.
424,428c
	MOVV	Ureg_r31(SP), R31
	MOVV	Ureg_r30(SP), R30
	MOVV	Ureg_r25(SP), R(MACH)
	MOVV	Ureg_r24(SP), R(USER)
	MOVW	Ureg_sp(SP), SP
.
415,416c
	MOVW	Ureg_pc(SP), R26		/* old pc */
	MOVW	Ureg_sp(SP), SP
.
410,412c
	MOVV	Ureg_r31(SP), R31
	MOVW	Ureg_status(SP), R26
	MOVV	Ureg_r30(SP), R30
.
393,394c
	MOVV	R(MACH), Ureg_r25(SP)
	MOVV	R(USER), Ureg_r24(SP)
.
389,391c
	MOVW	R26, Ureg_sp(SP)	/* user SP */
	MOVV	R31, Ureg_r31(SP)
	MOVV	R30, Ureg_r30(SP)
.
387c
	ADDU	$(KSTACK-UREGSIZE), R27, SP
.
96c
	OR	$(KUSER|EXL|IE|UX), R4
.
72d
68d
65,66d
60d
38d
34d
29d
22,23d
15,18d
## diffname carrera/l.s 1994/0613
## diff -e /n/fornaxdump/1994/0612/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0613/sys/src/brazil/carrera/l.s
434,437d
405a
TEXT	forkret(SB), $0
	MOVW	R0, R1			/* Fake out system call return */
	JMP	sysrestore

.
## diffname carrera/l.s 1994/0614
## diff -e /n/fornaxdump/1994/0613/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0614/sys/src/brazil/carrera/l.s
533c
	MOVW	Ureg_r1(SP), R1
.
530c
	MOVW	Ureg_r2(SP), R2
.
504,528c
	MOVW	Ureg_r23(SP), R23
	MOVW	Ureg_r22(SP), R22
	MOVW	Ureg_r21(SP), R21
	MOVW	Ureg_r20(SP), R20
	MOVW	Ureg_r19(SP), R19
	MOVW	Ureg_r18(SP), R18
	MOVW	Ureg_r17(SP), R17
	MOVW	Ureg_r16(SP), R16
	MOVW	Ureg_r15(SP), R15
	MOVW	Ureg_r14(SP), R14
	MOVW	Ureg_r13(SP), R13
	MOVW	Ureg_r12(SP), R12
	MOVW	Ureg_r11(SP), R11
	MOVW	Ureg_r10(SP), R10
	MOVW	Ureg_r9(SP), R9
	MOVW	Ureg_r8(SP), R8
	MOVW	Ureg_r7(SP), R7
	/*
	 * restored below
	 * MOVW	Ureg_r6(SP), R6
	 * MOVW	Ureg_r5(SP), R5
	 */
	MOVW	Ureg_r4(SP), R4
	MOVW	Ureg_r3(SP), R3
	MOVW	Ureg_lo(SP), R2
	MOVW	Ureg_hi(SP), R1
	MOVW	R2, LO
	MOVW	R1, HI
	/* restore 64-bit R5, R6 */
	ADDU	$(UREGSIZE-16), SP, R1
	MOVW	$~7, R2			/* don't let him use R28 */
	AND		R2, R1
	LD		(0,(1), 5)
	LD		(8,(1), 6)
.
501c
	MOVW	Ureg_r28(SP), R28
.
475,495c
	MOVW	R23, Ureg_r23(SP)
	MOVW	R22, Ureg_r22(SP)
	MOVW	R21, Ureg_r21(SP)
	MOVW	R20, Ureg_r20(SP)
	MOVW	R19, Ureg_r19(SP)
	MOVW	R18, Ureg_r18(SP)
	MOVW	R17, Ureg_r17(SP)
	MOVW	R16, Ureg_r16(SP)
	MOVW	R15, Ureg_r15(SP)
	MOVW	R14, Ureg_r14(SP)
	MOVW	R13, Ureg_r13(SP)
	MOVW	R12, Ureg_r12(SP)
	MOVW	R11, Ureg_r11(SP)
	MOVW	R10, Ureg_r10(SP)
	MOVW	R9, Ureg_r9(SP)
	MOVW	R8, Ureg_r8(SP)
	MOVW	R7, Ureg_r7(SP)
	MOVW	R6, Ureg_r6(SP)
	MOVW	R5, Ureg_r5(SP)
	MOVW	R4, Ureg_r4(SP)
	MOVW	R3, Ureg_r3(SP)
.
472c
	MOVW	R28, Ureg_r28(SP)
.
466,470c
	MOVW	HI, R1
	MOVW	LO, R2
	MOVW	R1, Ureg_hi(SP)
	MOVW	R2, Ureg_lo(SP)
.
440,443c
	MOVW	R1, Ureg_r1(SP)
	MOVW	R2, Ureg_r2(SP)
	/* save R5, R6 as 64 bits */
	ADDU	$(UREGSIZE-16), SP, R1
	MOVW	$~7, R2			/* don't let him use R28 */
	AND		R2, R1
	STD		(5, 0,(1))
	STD		(6, 8,(1))
.
438a
TEXT	forkret(SB), $0
	MOVW	R0, R1			/* Fake out system call return */
	JMP	sysrestore

.
434c
	MOVW	Ureg_r31(SP), R31
.
428c
	MOVW	R31, Ureg_r31(SP)
.
414,417c
	MOVW	Ureg_r31(SP), R31
	MOVW	Ureg_r30(SP), R30
	MOVW	Ureg_r25(SP), R(MACH)
	MOVW	Ureg_r24(SP), R(USER)
.
406,409d
398c
	MOVW	Ureg_r30(SP), R30
.
396c
	MOVW	Ureg_r31(SP), R31
.
379,380c
	MOVW	R(MACH), Ureg_r25(SP)
	MOVW	R(USER), Ureg_r24(SP)
.
376,377c
	MOVW	R31, Ureg_r31(SP)
	MOVW	R30, Ureg_r30(SP)
.
14a
#define	LD(offset, base, rt)	WORD	$((067<<26)|((base)<<21)|((rt)<<16)|((offset)&0xFFFF))
#define	STD(rt, offset, base)	WORD	$((077<<26)|((base)<<21)|((rt)<<16)|((offset)&0xFFFF))
#define	DSLL(sa, rt, rd)	WORD	$(((rt)<<16)|((rd)<<11)|((sa)<<6)|070)
#define	DSRA(sa, rt, rd)	WORD	$(((rt)<<16)|((rd)<<11)|((sa)<<6)|073)
.
## diffname carrera/l.s 1994/0617
## diff -e /n/fornaxdump/1994/0614/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0617/sys/src/brazil/carrera/l.s
549,550c
	MOVW	0x9C(SP), R1
	MOVW	0x0C(SP), R26		/* old pc */
.
545,546c
	MOVW	0x08(SP), R1
	MOVW	0x98(SP), R2
.
533,536c
	MOVW	0x90(SP), R4
	MOVW	0x94(SP), R3
	MOVW	0x24(SP), R2
	MOVW	0x20(SP), R1
.
530,531c
	 * MOVW	0x88(SP), R6
	 * MOVW	0x8C(SP), R5
.
511,527c
	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
.
508c
	MOVW	0x30(SP), R28
.
482,502c
	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)
.
479c
	MOVW	R28, 0x30(SP)
.
476,477c
	MOVW	R1, 0x20(SP)
	MOVW	R2, 0x24(SP)
.
472,473c
	MOVW	R2, 0x18(SP)
	MOVW	R1, 0x1C(SP)
.
469c
	MOVW	R1, 0x14(SP)
.
457,458c
	MOVW	R1, 0x08(SP)
	MOVW	R2, 0x0C(SP)
.
452,453c
	ADDU	$8, SP, R1
	MOVW	R1, 0x04(SP)		/* arg to base of regs */
.
444,445c
	MOVW	R1, 0x9C(SP)
	MOVW	R2, 0x98(SP)
.
434,435c
	MOVW	0x28(SP), R31
	ADDU	$UREGSIZE, SP
.
429a
	MOVW	SP, -(UREGSIZE-16)(SP)
	SUBU	$UREGSIZE, SP
	MOVW	R31, 0x28(SP)
.
423,428d
414,418c
	MOVW	0x28(SP), R31
	MOVW	0x2C(SP), R30
	MOVW	0x3C(SP), R(MACH)
	MOVW	0x40(SP), R(USER)
	MOVW	0x10(SP), SP
.
405,406c
	MOVW	0x0C(SP), R26		/* old pc */
	MOVW	0x10(SP), SP
.
400,402c
	MOVW	0x28(SP), R31
	MOVW	0x08(SP), R26
	MOVW	0x2C(SP), R30
.
383,384c
	MOVW	R(MACH), 0x3C(SP)
	MOVW	R(USER), 0x40(SP)
.
379,381c
	MOVW	R26, 0x10(SP)			/* user SP */
	MOVW	R31, 0x28(SP)
	MOVW	R30, 0x2C(SP)
.
377c
	ADDU	$(KSTACK-UREGSIZE-2*BY2WD), R27, SP
.
86c
	OR	$(KUSER|EXL|IE), R4
.
62a
DBG(0x55aa0004)
.
59a
DBG(0x55aa0011)
.
58a
DBG(0x55aa0010)
MOVW R(MACH),4(R20)
.
54a
DBG(0x55aa0003)
.
33a
DBG(0x55aa0002)
.
30a
DBG(0x55aa0001)
.
26a
DBG(0x55aa0000)
.
21a
#define DBG(S)	CONST(0xa0001000, R20);CONST(S, R21);MOVW	R21,(R20)

.
## diffname carrera/l.s 1994/0619
## diff -e /n/fornaxdump/1994/0617/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0619/sys/src/brazil/carrera/l.s
556,557c
	MOVV	(Ureg_r1-4)(SP), R1	/* BOTCH */
	MOVW	Ureg_pc(SP), R26
.
518,553c
	MOVV	(Ureg_r23-4)(SP), R23
	MOVV	(Ureg_r22-4)(SP), R22
	MOVV	(Ureg_r21-4)(SP), R21
	MOVV	(Ureg_r20-4)(SP), R20
	MOVV	(Ureg_r19-4)(SP), R19
	MOVV	(Ureg_r18-4)(SP), R18
	MOVV	(Ureg_r17-4)(SP), R17
	MOVV	(Ureg_r16-4)(SP), R16
	MOVV	(Ureg_r15-4)(SP), R15
	MOVV	(Ureg_r14-4)(SP), R14
	MOVV	(Ureg_r13-4)(SP), R13
	MOVV	(Ureg_r12-4)(SP), R12
	MOVV	(Ureg_r11-4)(SP), R11
	MOVV	(Ureg_r10-4)(SP), R10
	MOVV	(Ureg_r9-4)(SP), R9
	MOVV	(Ureg_r8-4)(SP), R8
	MOVV	(Ureg_r7-4)(SP), R7
	MOVV	(Ureg_r6-4)(SP), R6
	MOVV	(Ureg_r5-4)(SP), R5
	MOVV	(Ureg_r4-4)(SP), R4
	MOVV	(Ureg_r3-4)(SP), R3
	MOVV	(Ureg_lo-4)(SP), R2
	MOVV	(Ureg_hi-4)(SP), R1
	MOVV	R2, LO
	MOVV	R1, HI

	MOVW	Ureg_status(SP), R1
	MOVV	(Ureg_r2-4)(SP), R2
.
515c
	MOVV	(Ureg_r28-4)(SP), R28
.
489,509c
	MOVV	R23, (Ureg_r23-4)(SP)
	MOVV	R22, (Ureg_r22-4)(SP)
	MOVV	R21, (Ureg_r21-4)(SP)
	MOVV	R20, (Ureg_r20-4)(SP)
	MOVV	R19, (Ureg_r19-4)(SP)
	MOVV	R18, (Ureg_r18-4)(SP)
	MOVV	R17, (Ureg_r17-4)(SP)
	MOVV	R16, (Ureg_r16-4)(SP)
	MOVV	R15, (Ureg_r15-4)(SP)
	MOVV	R14, (Ureg_r14-4)(SP)
	MOVV	R13, (Ureg_r13-4)(SP)
	MOVV	R12, (Ureg_r12-4)(SP)
	MOVV	R11, (Ureg_r11-4)(SP)
	MOVV	R10, (Ureg_r10-4)(SP)
	MOVV	R9, (Ureg_r9-4)(SP)
	MOVV	R8, (Ureg_r8-4)(SP)
	MOVV	R7, (Ureg_r7-4)(SP)
	MOVV	R4, (Ureg_r4-4)(SP)
	MOVV	R3, (Ureg_r3-4)(SP)
.
486c
	MOVV	R28, (Ureg_r28-4)(SP)
.
479,484c
	MOVW	R2, Ureg_badvaddr(SP)
	MOVW	R1, Ureg_tlbvirt(SP)
	MOVV	HI, R1
	MOVV	LO, R2
	MOVV	R1, (Ureg_hi-4)(SP)
	MOVV	R2, (Ureg_lo-4)(SP)
.
476c
	MOVW	R1, Ureg_cause(SP)
.
464,465c
	MOVW	R1, Ureg_status(SP)
	MOVW	R2, Ureg_pc(SP)
.
451,460c
	MOVV	R1, (Ureg_r1-4)(SP)
	MOVV	R2, (Ureg_r2-4)(SP)

	MOVV	R6, (Ureg_r6-4)(SP)
	MOVV	R5, (Ureg_r5-4)(SP)

	ADDU	$Uoffset, SP, R1
	MOVW	R1, 4(SP)		/* arg to base of regs */
.
441,442c
	MOVV	(Ureg_r31-4)(SP), R31
	MOVW	Ureg_sp(SP), SP
.
436c
	OR	$7, SP
	XOR	$7, SP
	MOVW	R26, Ureg_sp(SP)
	MOVV	R31, (Ureg_r31-4)(SP)
	MOVW	$1, R26			/* not syscall */
.
433,434c
	MOVW	SP, R26
.
424,428c
	MOVV	(Ureg_r31-4)(SP), R31
	MOVV	(Ureg_r30-4)(SP), R30
	MOVV	(Ureg_r25-4)(SP), R(MACH)
	MOVV	(Ureg_r24-4)(SP), R(USER)
	MOVW	Ureg_sp(SP), SP
.
415,416c
	MOVW	Ureg_pc(SP), R26		/* old pc */
	MOVW	Ureg_sp(SP), SP
.
410,412c
	MOVV	(Ureg_r31-4)(SP), R31
	MOVW	Ureg_status(SP), R26
	MOVV	(Ureg_r30-4)(SP), R30
.
393,394c
	MOVV	R(MACH), (Ureg_r25-4)(SP)
	MOVV	R(USER), (Ureg_r24-4)(SP)
.
389,391c
	MOVW	R26, Ureg_sp(SP)	/* user SP */
	MOVV	R31, (Ureg_r31-4)(SP)
	MOVV	R30, (Ureg_r30-4)(SP)
.
387c
	ADDU	$(KSTACK-UREGSIZE), R27, SP
.
96c
	OR	$(KUSER|EXL|IE|UX), R4
.
72d
68d
65,66d
60d
38d
34d
29d
22,23d
15,18d
## diffname carrera/l.s 1994/0729
## diff -e /n/fornaxdump/1994/0619/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0729/sys/src/brazil/carrera/l.s
507a
	RET

TEXT	restreg2(SB), $-4
					/* LINK,SB,SP missing */
	MOVV	(Ureg_r28-4)(SP), R28
					/* R27, R26 not saved */
					/* R25, R24 missing */
					/* R19- R23 restored in rest1 */
.
498,502c
TEXT	restreg1(SB), $-4
.
495d
492a
	MOVV	R6, (Ureg_r6-4)(SP)
	MOVV	R5, (Ureg_r5-4)(SP)
.
476,480c
					/* R23- R19 saved in save1 */
.
463c
	MOVW	R26, Ureg_cause(SP)
.
460c
	MOVV	R23, (Ureg_r23-4)(SP)
	MOVV	R22, (Ureg_r22-4)(SP)
	MOVV	R21, (Ureg_r21-4)(SP)
	MOVV	R20, (Ureg_r20-4)(SP)
	MOVV	R19, (Ureg_r19-4)(SP)
	MOVW	R1, Ureg_pc(SP)
	RET

/*
 * all other registers.
 * called with M(CAUSE) in R26
 */
TEXT	savereg2(SB), $-4
	MOVV	R2, (Ureg_r2-4)(SP)

.
454,458c
	MOVW	M(EPC), R1
	MOVW	M(CAUSE), R26
.
446,452c
	MOVW	R26, Ureg_status(SP)	/* status */
	MOVW	R27, Ureg_sp(SP)	/* user SP */
.
443,444c
	MOVW	$(~KMODEMASK),R1	/* don't use R28 */
	AND	R26, R1
	MOVW	R1, M(STATUS)
.
441d
439c
/*
 * save manditory registers.
 * called with old M(STATUS) in R26.
 * called with old SP in R27
 * returns with M(CAUSE) in R26
 */
TEXT	savereg1(SB), $-4
.
429c

	JAL	restreg1(SB)
	JAL	restreg2(SB)

.
425,427c

	JAL	savereg1(SB)
	JAL	savereg2(SB)

	ADDU	$Uoffset, SP, R1	/* first arg for trap */
.
423d
419c
	MOVW	SP, R27
.
411a
	MOVV	(Ureg_r31-4)(SP), R31
.
409,410c
	JAL	restreg1(SB)
	JAL	restreg2(SB)

.
407a

.
406a
	JAL	savereg2(SB)

	ADDU	$Uoffset, SP, R1	/* first arg for trap */
.
395a
	JAL	restreg1(SB)

.
392a
	AND	$(EXCMASK<<2), R26, R1
	SUBU	$(CSYS<<2), R1
	BNE	R1, notsys

	ADDU	$Uoffset, SP, R1	/* first arg for syscall */
.
390,391d
384,385d
381,382d
378d
376a

	JAL	savereg1(SB)

.
375c
wasuser:
	MOVW	SP, R27
	CONST	(MACHADDR, SP)		/* R27 = m-> */
	MOVW	8(SP), SP		/* R26 = m->proc */
	MOVW	8(SP), SP		/* R27 = m->proc->kstack */
	ADDU	$(KSTACK-UREGSIZE), SP
.
366,373c
	AND	$KUSER, R26, R27
	BEQ	R27, waskernel
.
## diffname carrera/l.s 1994/0810
## diff -e /n/fornaxdump/1994/0729/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0810/sys/src/brazil/carrera/l.s
567d
384,385c
	CONST	(MACHADDR, R(MACH))		/* R(MACH) = m-> */
.
371,373c
	CONST	(MACHADDR, SP)		/*  m-> */
	MOVW	8(SP), SP		/*  m->proc */
	MOVW	8(SP), SP		/*  m->proc->kstack */
	MOVW	M(STATUS), R26		/* redundant test */
.
## diffname carrera/l.s 1994/0824
## diff -e /n/fornaxdump/1994/0810/sys/src/brazil/carrera/l.s /n/fornaxdump/1994/0824/sys/src/brazil/carrera/l.s
831a
	SLLV	$32, R6
	SRLV	$32, R6		/* zero extend */
.
809a
	SLLV	$32, R6
	SRLV	$32, R6		/* zero extend */
.
## diffname carrera/l.s 1995/0113
## diff -e /n/fornaxdump/1994/0824/sys/src/brazil/carrera/l.s /n/fornaxdump/1995/0113/sys/src/brazil/carrera/l.s
842,845c
	MOVV	0(R1), R7
	MOVV	R7, 8(R2)
	XOR	R7, R6
	MOVV	0(R1), R8
	MOVV	R8, 16(R2)
	XOR	R8, R6
	MOVV	0(R1), R9
	MOVV	R9, 24(R2)
	XOR	R9, R6

	ADD	$32, R2
.
837c
	MOVW	$16, R4
.
822c
	ADD	$32, R2
.
818,820c
	MOVV	8(R2), R7
	MOVV	R7, 0(R1)
	XOR	R7, R6
	MOVV	16(R2), R8
	MOVV	R8, 0(R1)
	XOR	R8, R6
	MOVV	24(R2), R9
	MOVV	R9, 0(R1)
	XOR	R9, R6
.
813c
	MOVW	$16, R4
.
## diffname carrera/l.s 1997/0327
## diff -e /n/fornaxdump/1995/0113/sys/src/brazil/carrera/l.s /n/emeliedump/1997/0327/sys/src/brazil/carrera/l.s
793,864d
141,152d
125a
TEXT	islo(SB), $0
	MOVW	M(STATUS), R1
	AND	$IE, R1
	WAIT
	RET

.
## diffname carrera/l.s 1998/0606
## diff -e /n/emeliedump/1997/0327/sys/src/brazil/carrera/l.s /n/emeliedump/1998/0606/sys/src/brazil/carrera/l.s
105a

TEXT	splxpc(SB), $0			/* for iunlock */
.
## diffname carrera/l.s 1998/0610
## diff -e /n/emeliedump/1998/0606/sys/src/brazil/carrera/l.s /n/emeliedump/1998/0610/sys/src/brazil/carrera/l.s
775a
	WAIT
.
774c
	WAIT
	AND	$~0x3f, R1
	OR	$((1<<4)|(1<<5)|(PTECOHERXCLW>>3)), R1
.
772a

	/*
	 * set up 32 byte primary cache line sizes,
	 * kseg0 cache mode,
	 * and store conditional using tlb cache mode
	 */
.
## diffname carrera/l.s 1999/0121
## diff -e /n/emeliedump/1998/0610/sys/src/brazil/carrera/l.s /n/emeliedump/1999/0121/sys/src/brazil/carrera/l.s
105a
	/* fall though */
.
## diffname carrera/l.s 1999/0327
## diff -e /n/emeliedump/1999/0121/sys/src/brazil/carrera/l.s /n/emeliedump/1999/0327/sys/src/brazil/carrera/l.s
799a

TEXT	rdcompare(SB), $0
	MOVW	M(COMPARE), R1
	NOP
	RET
.
## diffname carrera/l.s 1999/0714
## diff -e /n/emeliedump/1999/0327/sys/src/brazil/carrera/l.s /n/emeliedump/1999/0714/sys/src/brazil/carrera/l.s
788,791d
## diffname carrera/l.s 2000/0929
## diff -e /n/emeliedump/1999/0714/sys/src/brazil/carrera/l.s /n/emeliedump/2000/0929/sys/src/9/carrera/l.s
30a
	/* setfcr(FPPDBL|FPRNR|FPINVAL|FPZDIV|FPOVFL) */
	/* bit 24 is R4000-specific; underflow goes to zero */
.
## diffname carrera/l.s 2001/0527 # deleted
## diff -e /n/emeliedump/2000/0929/sys/src/9/carrera/l.s /n/emeliedump/2001/0527/sys/src/9/carrera/l.s
1,802d

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.