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

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


## diffname ss/l.s 1990/1223
## diff -e /dev/null /n/bootesdump/1990/1223/sys/src/9/sparc/l.s
0a
#include "mem.h"

TEXT	start(SB), $-4

	/* get virtual, fast */
	/* we are executing in segment 0, mapped to pmeg 0. stack is there too */
	/* get virtual by mapping segment(KZERO) to pmeg 0. */
	MOVW	$KZERO, R1
	MOVB	R0, (R1, 3)
	/* now mapped correctly.  jmpl to where we want to be */
	MOVW	$setR30(SB), R30
	MOVW	$startvirt(SB), R1
	JMPL	(R1)
	RETURN			/* can't get here */

TEXT	startvirt(SB), $-4

	MOVW	$0x4000, R29
	MOVW	$mach0(SB), R(MACH)
	JMPL	main(SB)
	UNIMP
	RETURN

TEXT	pc(SB), $0
	MOVW	R15, R1
	RETURN

TEXT	setlabel(SB), $0
	MOVW	b+0(FP), R2
	MOVW	R29, (R2)
	MOVW	R15, 4(R2)
	MOVW	$0, R1
	RETURN

TEXT	gotolabel(SB), $0
	MOVW	r+4(FP), R1
	MOVW	b+0(FP), R2
	MOVW	(R2), R29
	MOVW	4(R2), R15
	MOVW	R15, 0(R29)
	RETURN

TEXT	crash(SB), $0

	MOVW	0(FP), R8		/* context */
	MOVW	4(FP), R9		/* segment addr */
	MOVW	8(FP), R10		/* segment value */
	MOVW	$0xFFE80118, R1
	JMPL	(R1)
	RETURN

TEXT	putb2(SB), $0

	MOVW	0(FP), R1
	MOVW	4(FP), R2
	MOVB	R2, (R1, 2)
	RETURN

TEXT	putw3(SB), $0

	MOVW	0(FP), R1
	MOVW	4(FP), R2
	MOVW	R2, (R1, 3)
	RETURN

TEXT	putpmeg(SB), $0

	MOVW	0(FP), R1
	MOVW	4(FP), R2
	MOVW	R2, (R1, 4)
	RETURN

TEXT	putwd(SB), $0

	MOVW	0(FP), R1
	MOVW	4(FP), R2
	MOVW	R2, (R1, 0xD)
	RETURN


GLOBL	mach0+0(SB), $MACHSIZE
.
## diffname ss/l.s 1990/1226
## diff -e /n/bootesdump/1990/1223/sys/src/9/sparc/l.s /n/bootesdump/1990/1226/sys/src/9/sparc/l.s
79d
75,77c
	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVW	R8, (R7, 0xD)
.
68,70c
	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVW	R8, (R7, 4)
.
65a
TEXT	getw2(SB), $0

	MOVW	0(FP), R7
	MOVW	(R7, 2), R7
	RETURN

TEXT	putw2(SB), $0

	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVW	R8, (R7, 2)
	RETURN

TEXT	putwE(SB), $0

	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVW	R8, (R7, 0xE)
	RETURN

TEXT	putsegm(SB), $0

	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVW	R8, (R7, 3)
	RETURN

.
61,63c
	MOVW	0(FP), R7
	MOVB	(R7, 2), R7
.
59c
TEXT	getb2(SB), $0
.
54,56c
	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVB	R8, (R7, 2)
.
51a
TEXT	putcontext(SB), $0

	MOVW	$CONTEXT, R7
	MOVW	0(FP), R8
	MOVB	R8, (R7, 2)
	RETURN

.
48,49c
	MOVW	$0xFFE80118, R7
	JMPL	(R7)
.
43c
TEXT	putcxsegm(SB), $0
.
36,40c

	MOVW	r+4(FP), R7
	MOVW	b+0(FP), R8
	MOVW	(R8), R1
	MOVW	4(R8), R15
	MOVW	R15, 0(R1)
.
29,32c

	MOVW	b+0(FP), R7
	MOVW	R1, (R7)
	MOVW	R15, 4(R7)
	MOVW	$0, R7
.
27a
TEXT	swap1_should_work(SB), $0

	MOVW	keyaddr+0(FP), R8
	MOVW	$1, R7
	SWAP	(R8), R7
	RETURN

TEXT	swap1(SB), $0

	MOVW	keyaddr+0(FP), R8
	MOVW	PSR, R9
	MOVW	R9, R10
	AND	$~PSRET, R10		/* BUG: book says this is buggy */
	MOVW	R10, PSR
	OR	R0, R0
	OR	R0, R0
	OR	R0, R0
	MOVW	(R8), R7
	CMP	R7, R0
	BNE	was1
	MOVW	$1, R10
	MOVW	R10, (R8)
was1:
	MOVW	R9, PSR
	RETURN

TEXT	spllo(SB), $0

	MOVW	PSR, R7
	MOVW	R7, R10
	OR	$PSRET, R10
	MOVW	R10, PSR
	OR	R0, R0
	OR	R0, R0
	OR	R0, R0
	RETURN

TEXT	splhi(SB), $0

	MOVW	PSR, R7
	MOVW	R7, R10
	AND	$~PSRET, R10	/* BUG: book says this is buggy */
	MOVW	R10, PSR
	OR	R0, R0
	OR	R0, R0
	OR	R0, R0
	RETURN

TEXT	splx(SB), $0

	MOVW	psr+0(FP), R7
	MOVW	R7, PSR		/* BUG: book says this is buggy */
	OR	R0, R0
	OR	R0, R0
	OR	R0, R0
	RETURN

TEXT	touser(SB), $-4

	MOVW	$SYSPSR, R7	/* BUG SPL(0xF) for now */
	MOVW	R7, PSR

	OR	R0, R0
	OR	R0, R0
	OR	R0, R0
	MOVW	sp+0(FP), R1
	SAVE	R0, R0			/* RETT is implicit RESTORE */
	MOVW	$(UTZERO+32), R7	/* PC; header appears in text */
	MOVW	$(UTZERO+32+4), R8	/* nPC */
	RETT	R7, R8

TEXT	traplink(SB), $-4

	/* R8 to R23 are free to play with */
	/* R17 contains PC, R18 contains nPC */
	/* R19 has PSR loaded from vector code */
	ANDCC	$PSRPSUPER, R19, R0
	BE	usertrap

kerneltrap:
	/*
	 * Interrupt or fault from kernel
	 */
	MOVW	R1, (0-(4*(32+5))+(4*1))(R1)	/* save R1=SP */
	/* really clumsy: store these in Ureg so can be restored below */
	MOVW	R2, (0-(4*(32+5))+(4*2))(R1)	/* SB */
	MOVW	R5, (0-(4*(32+5))+(4*5))(R1)	/* USER */
	MOVW	R6, (0-(4*(32+5))+(4*6))(R1)	/* MACH */
trap1:
	SUB	$(4*(32+5)), R1
	MOVW	Y, R20
	MOVW	R20, (4*(32+0))(R1)		/* Y */
	MOVW	TBR, R20
	MOVW	R20, (4*(32+1))(R1)		/* TBR */
	AND	$~0x1F, R19			/* force CWP=0 */
	MOVW	R19, (4*(32+2))(R1)		/* PSR */
	MOVW	R18, (4*(32+3))(R1)		/* nPC */
	MOVW	R17, (4*(32+4))(R1)		/* PC */
	MOVW	R0, (4*0)(R1)
	MOVW	R3, (4*3)(R1)
	MOVW	R4, (4*4)(R1)
	MOVW	R7, (4*7)(R1)
	RESTORE	R0, R0
	/* now our registers R8-R31 are same as before trap */
	MOVW	R8, (4*8)(R1)
	MOVW	R9, (4*9)(R1)
	MOVW	R10, (4*10)(R1)
	MOVW	R11, (4*11)(R1)
	MOVW	R12, (4*12)(R1)
	MOVW	R13, (4*13)(R1)
	MOVW	R14, (4*14)(R1)
	MOVW	R15, (4*15)(R1)
	MOVW	R16, (4*16)(R1)
	MOVW	R17, (4*17)(R1)
	MOVW	R18, (4*18)(R1)
	MOVW	R19, (4*19)(R1)
	MOVW	R20, (4*20)(R1)
	MOVW	R21, (4*21)(R1)
	MOVW	R22, (4*22)(R1)
	MOVW	R23, (4*23)(R1)
	MOVW	R24, (4*24)(R1)
	MOVW	R25, (4*25)(R1)
	MOVW	R26, (4*26)(R1)
	MOVW	R27, (4*27)(R1)
	MOVW	R28, (4*28)(R1)
	MOVW	R29, (4*29)(R1)
	MOVW	R30, (4*30)(R1)
	MOVW	R31, (4*31)(R1)
	/* SP and SB and u and m are already set; away we go */
	MOVW	R1, -4(R1)		/* pointer to Ureg */
	SUB	$8, R1
	MOVW	$SYSPSR, R7
	MOVW	R7, PSR
	OR	R0, R0
	OR	R0, R0
	OR	R0, R0
	JMPL	faultsparc(SB)

	ADD	$8, R1
	MOVW	(4*(32+2))(R1), R7		/* PSR */
	MOVW	R7, PSR
	OR	R0, R0
	OR	R0, R0
	OR	R0, R0

	MOVW	(4*31)(R1), R31
	MOVW	(4*30)(R1), R30
	MOVW	(4*29)(R1), R29
	MOVW	(4*28)(R1), R28
	MOVW	(4*27)(R1), R27
	MOVW	(4*26)(R1), R26
	MOVW	(4*25)(R1), R25
	MOVW	(4*24)(R1), R24
	MOVW	(4*23)(R1), R23
	MOVW	(4*22)(R1), R22
	MOVW	(4*21)(R1), R21
	MOVW	(4*20)(R1), R20
	MOVW	(4*19)(R1), R19
	MOVW	(4*18)(R1), R18
	MOVW	(4*17)(R1), R17
	MOVW	(4*16)(R1), R16
	MOVW	(4*15)(R1), R15
	MOVW	(4*14)(R1), R14
	MOVW	(4*13)(R1), R13
	MOVW	(4*12)(R1), R12
	MOVW	(4*11)(R1), R11
	MOVW	(4*10)(R1), R10
	MOVW	(4*9)(R1), R9
	MOVW	(4*8)(R1), R8
	SAVE	R0, R0
	MOVW	(4*7)(R1), R7
	MOVW	(4*6)(R1), R6
	MOVW	(4*5)(R1), R5
	MOVW	(4*4)(R1), R4
	MOVW	(4*3)(R1), R3
	MOVW	(4*2)(R1), R2
	MOVW	(4*(32+0))(R1), R20		/* Y */
	MOVW	R20, Y
	MOVW	(4*(32+4))(R1), R17		/* PC */
	MOVW	(4*(32+3))(R1), R18		/* nPC */
	MOVW	(4*1)(R1), R1	/* restore R1=SP */
	RETT	R17, R18
	
usertrap:
	/*
	 * Interrupt or fault from user
	 */
	MOVW	R1, R8
	MOVW	R2, R9
	MOVW	$setSB(SB), R2
	MOVW	$(USERADDR+BY2PG), R1
	MOVW	R8, (0-(4*(32+5))+(4*1))(R1)	/* save R1=SP */
	MOVW	R9, (0-(4*(32+5))+(4*2))(R1)	/* save R2=SB */
	MOVW	R5, (0-(4*(32+5))+(4*5))(R1)	/* save R5=USER */
	MOVW	R6, (0-(4*(32+5))+(4*6))(R1)	/* save R6=MACH */
	MOVW	$USERADDR, R(USER)
	MOVW	$mach0(SB), R(MACH)
	JMP	trap1

TEXT	syslink(SB), $-4

	/* R8 to R23 are free to play with */
	/* R17 contains PC, R18 contains nPC */
	/* R19 has PSR loaded from vector code */
	/* assume user did it; syscall checks */
	MOVW	R1, R8
	MOVW	R2, R9
	MOVW	$setSB(SB), R2
	MOVW	$(USERADDR+BY2PG), R1
	MOVW	R8, (0-(4*(32+5))+4)(R1)	/* save R1=SP */
	SUB	$(4*(32+5)), R1
	MOVW	R9, (4*2)(R1)			/* save R2=SB */
	MOVW	R3, (4*3)(R1)			/* global register */
	MOVW	R4, (4*4)(R1)			/* global register */
	MOVW	R5, (4*5)(R1)			/* save R5=USER */
	MOVW	R6, (4*6)(R1)			/* save R6=MACH */
	MOVW	R7, (4*7)(R1)			/* system call number */
	MOVW	$USERADDR, R(USER)
	MOVW	$mach0(SB), R(MACH)
	MOVW	TBR, R20
	MOVW	R20, (4*(32+1))(R1)		/* TBR */
	AND	$~0x1F, R19
	MOVW	R19, (4*(32+2))(R1)		/* PSR */
	MOVW	R18, (4*(32+3))(R1)		/* nPC */
	MOVW	R17, (4*(32+4))(R1)		/* PC */
	RESTORE	R0, R0
	/* now our registers R8-R31 are same as before trap */
	MOVW	R15, (4*15)(R1)
	/* SP and SB and u and m are already set; away we go */
	MOVW	R1, -4(R1)		/* pointer to Ureg */
	SUB	$8, R1
	MOVW	$SYSPSR, R7
	MOVW	R7, PSR
	JMPL	syscall(SB)
	/* R7 contains return value from syscall */

	ADD	$8, R1
	MOVW	(4*(32+2))(R1), R8		/* PSR */
	MOVW	R8, PSR
	OR	R0, R0
	OR	R0, R0
	OR	R0, R0

	MOVW	(4*15)(R1), R15
	SAVE	R0, R0
	MOVW	(4*6)(R1), R6
	MOVW	(4*5)(R1), R5
	MOVW	(4*4)(R1), R4
	MOVW	(4*3)(R1), R3
	MOVW	(4*2)(R1), R2
	MOVW	(4*(32+4))(R1), R17		/* PC */
	MOVW	(4*(32+3))(R1), R18		/* nPC */
	MOVW	(4*1)(R1), R1	/* restore R1=SP */
	RETT	R17, R18

TEXT	puttbr(SB), $0

	MOVW	tbr+0(FP), R7
	MOVW	R7, TBR
	OR	R0, R0
	OR	R0, R0
	OR	R0, R0
	RETURN

TEXT	gettbr(SB), $0

	MOVW	TBR, R7
	RETURN

TEXT	r1(SB), $0

	MOVW	R1, R7
	RETURN

TEXT	getwim(SB), $0

	MOVW	WIM, R7
	RETURN

.
24,25c
TEXT	getpsr(SB), $0

	MOVW	PSR, R7
.
19a
	MOVW	$0x8, R7
	MOVW	R7, WIM
.
18c
	MOVW	$BOOTSTACK, R1
.
11,13c
	MOVW	$setSB(SB), R2
	MOVW	$startvirt(SB), R7
	JMPL	(R7)
.
8,9c
	MOVW	$KZERO, R7
	MOVB	R0, (R7, 3)
.
2a
#define	SYSPSR	(PSREF|SPL(0xF)|PSRSUPER)

.
## diffname ss/l.s 1990/1227
## diff -e /n/bootesdump/1990/1226/sys/src/9/sparc/l.s /n/bootesdump/1990/1227/sys/src/9/sparc/l.s
396c
	MOVW	R8, (R7, 0xE)
	RETURN

TEXT	putsegm(SB), $0

	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVW	R8, (R7, 3)
.
392c
TEXT	putwE(SB), $0
.
389c
	MOVW	R8, (R7, 0xD)
.
385c
TEXT	putwD(SB), $0
.
382c
	MOVW	R8, (R7, 0xC)
.
378c
TEXT	putwC(SB), $0
.
375c
	MOVW	R8, (R7, 4)
.
371c
TEXT	putw4(SB), $0
.
326a
	MOVW	$1, R7
.
322d
3c
#define	SYSPSR	(PSREF|SPL(0x0)|PSRSUPER)
.
## diffname ss/l.s 1990/1231
## diff -e /n/bootesdump/1990/1227/sys/src/9/sparc/l.s /n/bootesdump/1990/1231/sys/src/9/sparc/l.s
338c
TEXT	putcxreg(SB), $0
.
11a
	MOVW	$(KZERO+BY2SEGM), R7
	MOVW	$1, R8
	MOVB	R8, (R7, 3)
.
9c
	/* get virtual by mapping segment(KZERO) to pmeg 0., and next to 1 */
.
## diffname ss/l.s 1991/0109
## diff -e /n/bootesdump/1990/1231/sys/src/9/sparc/l.s /n/bootesdump/1991/0109/sys/src/9/sparc/l.s
35a
/*
TEXT	swap1_please(SB), $0

	MOVW	keyaddr+0(FP), R8
	LDSTUB	(R8), R7
	RETURN
*/

.
## diffname ss/l.s 1991/0110
## diff -e /n/bootesdump/1991/0109/sys/src/9/sparc/l.s /n/bootesdump/1991/0110/sys/src/9/sparc/l.s
406a
	MOVW	R8, (R7, 0xE)
	RETURN

TEXT	putwE16(SB), $0

	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xE)
	ADD	$(1<<4), R7
.
402a
TEXT	putwD16(SB), $0

	MOVW	0(FP), R7
	MOVW	4(FP), R8
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	ADD	$(1<<4), R7
	MOVW	R8, (R7, 0xD)
	RETURN

.
103c
	MOVW	$SYSPSR, R7
.
51c
TEXT	swap1x(SB), $0
.
42d
40c
	TAS	(R8), R7
.
36,37c
TEXT	swap1(SB), $0
.
3c
#define	SYSPSR	(SPL(0xF)|PSRSUPER)
.
## diffname ss/l.s 1991/0111
## diff -e /n/bootesdump/1991/0110/sys/src/9/sparc/l.s /n/bootesdump/1991/0111/sys/src/9/sparc/l.s
3c
#define	SYSPSR	(SPL(0x0)|PSRSUPER)
.
## diffname ss/l.s 1991/0112
## diff -e /n/bootesdump/1991/0111/sys/src/9/sparc/l.s /n/bootesdump/1991/0112/sys/src/9/sparc/l.s
288,291c
	MOVD	(4*4)(R1), R4
	MOVD	(4*2)(R1), R2
.
255,258c
	MOVD	R4, (4*4)(R1)			/* global register, R5=USER */
	MOVD	R6, (4*6)(R1)			/* save R6=MACH, R7=syscall# */
.
251,252c
	MOVW	R8, (0-(4*(32+6))+4)(R1)	/* save R1=SP */
	SUB	$(4*(32+6)), R1
.
238a
	SUB	$(4*(32+6)), R1
.
233,236c
	MOVW	R8, (0-(4*(32+6))+(4*1))(R1)	/* save R1=SP */
	MOVW	R9, (0-(4*(32+6))+(4*2))(R1)	/* save R2=SB */
	MOVW	R5, (0-(4*(32+6))+(4*5))(R1)	/* save R5=USER */
	MOVW	R6, (0-(4*(32+6))+(4*6))(R1)	/* save R6=MACH */
.
212,217c
	MOVD	(4*6)(R1), R6
	MOVD	(4*4)(R1), R4
	MOVD	(4*2)(R1), R2
.
187,210c
	MOVD	(4*30)(R1), R30
	MOVD	(4*28)(R1), R28
	MOVD	(4*26)(R1), R26
	MOVD	(4*24)(R1), R24
	MOVD	(4*22)(R1), R22
	MOVD	(4*20)(R1), R20
	MOVD	(4*18)(R1), R18
	MOVD	(4*16)(R1), R16
	MOVD	(4*14)(R1), R14
	MOVD	(4*12)(R1), R12
	MOVD	(4*10)(R1), R10
	MOVD	(4*8)(R1), R8
.
181,182c
restore:
	MOVW	(4*(32+2))(R1), R8		/* PSR */
	MOVW	R8, PSR
.
146,169c
	/* save registers two at a time */
	MOVD	R8, (4*8)(R1)
	MOVD	R10, (4*10)(R1)
	MOVD	R12, (4*12)(R1)
	MOVD	R14, (4*14)(R1)
	MOVD	R16, (4*16)(R1)
	MOVD	R18, (4*18)(R1)
	MOVD	R20, (4*20)(R1)
	MOVD	R22, (4*22)(R1)
	MOVD	R24, (4*24)(R1)
	MOVD	R26, (4*26)(R1)
	MOVD	R28, (4*28)(R1)
	MOVD	R30, (4*30)(R1)
.
131d
127,129c
	MOVW	R2, (0-(4*(32+6))+(4*2))(R20)	/* SB */
	MOVW	R5, (0-(4*(32+6))+(4*5))(R20)	/* USER */
	MOVW	R6, (0-(4*(32+6))+(4*6))(R20)	/* MACH */
	SUB	$(4*(32+6)), R20, R1

.
125c
	ANDN	$7, R1, R20			/* dbl aligned */
	MOVW	R1, (0-(4*(32+6))+(4*1))(R20)	/* save R1=SP */
.
112a
TEXT	rfnote(SB), $0

	MOVW	0(FP), R1		/* 1st arg is &uregpointer */
	ADD	$4, R1			/* point at ureg */
	JMP	restore

.
39c
	TAS	(R8), R7		/* LDSTUB, thank you ken */
.
31,35d
3c
#define	SYSPSR	(SPL(0x0)|PSREF|PSRSUPER)
.
## diffname ss/l.s 1991/0115
## diff -e /n/bootesdump/1991/0112/sys/src/9/sparc/l.s /n/bootesdump/1991/0115/sys/src/9/sparc/l.s
464a
GLOBL	fpq+0(SB), $(3*BY2WD)
GLOBL	fpr+0(SB), $BY2WD
.
463a
TEXT	clearfpintr(SB), $0
	MOVW	$fpq+BY2WD(SB), R7
	ANDN	$0x7, R7		/* must be D aligned */
	MOVW	$fpr+0(SB), R9
clrq:
	MOVD	FQ, (R7)
	MOVW	FSR, (R9)
	MOVW	(R9), R8
	AND	$(1<<13), R8		/* queue not empty? */
	BNE	clrq
	RETURN

TEXT	getfsr(SB), $0
	MOVW	$fpr+0(SB), R7
	MOVW	FSR, (R7)
	MOVW	(R7), R7
	RETURN

.
28c
	MOVW	(R0), R0
.
## diffname ss/l.s 1991/01151
## diff -e /n/bootesdump/1991/0115/sys/src/9/sparc/l.s /n/bootesdump/1991/01151/sys/src/9/sparc/l.s
484c
GLOBL	fsr+0(SB), $BY2WD
.
477c
	MOVW	$fsr+0(SB), R7
.
467c
	MOVW	$fsr+0(SB), R9
.
463a
TEXT	savefpregs(SB), $0

	MOVW	0(FP), R7
	MOVW	FSR, 0(R7)

	ADD	$(4+7), R7		/* double-align so can MOVD */
	ANDN	$7, R7

	MOVD	F0, (0*4)(R7)
	MOVD	F2, (2*4)(R7)
	MOVD	F4, (4*4)(R7)
	MOVD	F6, (6*4)(R7)
	MOVD	F8, (8*4)(R7)
	MOVD	F10, (10*4)(R7)
	MOVD	F12, (12*4)(R7)
	MOVD	F14, (14*4)(R7)
	MOVD	F16, (16*4)(R7)
	MOVD	F18, (18*4)(R7)
	MOVD	F20, (20*4)(R7)
	MOVD	F22, (22*4)(R7)
	MOVD	F24, (24*4)(R7)
	MOVD	F26, (26*4)(R7)
	MOVD	F28, (28*4)(R7)
	MOVD	F30, (30*4)(R7)

	MOVW	PSR, R8
	ANDN	$PSREF, R8
	MOVW	R8, PSR
	RETURN

TEXT	restfpregs(SB), $0

	MOVW	PSR, R8
	OR	$PSREF, R8
	MOVW	R8, PSR

	MOVW	0(FP), R7
	MOVW	(R7), FSR

	ADD	$(4+7), R7		/* double-align so can MOVD */
	ANDN	$7, R7

	MOVD	(0*4)(R7), F0
	MOVD	(2*4)(R7), F2
	MOVD	(4*4)(R7), F4
	MOVD	(6*4)(R7), F6
	MOVD	(8*4)(R7), F8
	MOVD	(10*4)(R7), F10
	MOVD	(12*4)(R7), F12
	MOVD	(14*4)(R7), F14
	MOVD	(16*4)(R7), F16
	MOVD	(18*4)(R7), F18
	MOVD	(20*4)(R7), F20
	MOVD	(22*4)(R7), F22
	MOVD	(24*4)(R7), F24
	MOVD	(26*4)(R7), F26
	MOVD	(28*4)(R7), F28
	MOVD	(30*4)(R7), F30

	ANDN	$PSREF, R8
	MOVW	R8, PSR
	RETURN

.
170c
	JMPL	trap(SB)
.
96c
	MOVW	$(SYSPSR&~PSREF), R7
.
23a

	MOVW	$(SPL(0xF)|PSREF|PSRSUPER), R7
	MOVW	R7, PSR

	MOVW	$(0x35<<22), R7		/* NVM OFM DZM AU */
	MOVW	R7, fsr+0(SB)
	MOVW	fsr+0(SB), FSR
	FMOVD	$0.5, F26		/* 0.5 -> F26 */
	FSUBD	F26, F26, F24		/* 0.0 -> F24 */
	FADDD	F26, F26, F28		/* 1.0 -> F28 */
	FADDD	F28, F28, F30		/* 2.0 -> F30 */

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

.
## diffname ss/l.s 1991/0712
## diff -e /n/bootesdump/1991/0201/sys/src/9/sparc/l.s /n/bootesdump/1991/0712/sys/src/9/slc/l.s
334d
126a

.
123d
120d
## diffname ss/l.s 1991/1006
## diff -e /n/bootesdump/1991/0712/sys/src/9/slc/l.s /n/bootesdump/1991/1006/sys/src/9/slc/l.s
116a
	RETURN

TEXT	spldone(SB), $0

.
111a
	MOVW	R15, 4(R(MACH))	/* save PC in m->splpc */
.
100a
	MOVW	R15, 4(R(MACH))	/* save PC in m->splpc */
.
## diffname ss/l.s 1991/1105
## diff -e /n/bootesdump/1991/1006/sys/src/9/slc/l.s /n/bootesdump/1991/1105/sys/src/9/slc/l.s
556a

.
529d
495d
488d
451d
444d
407d
400d
393d
386d
379d
373d
367d
360d
353,355c
	MOVW	$CONTEXT, R8
	MOVB	R7, (R8, 2)
.
344c
	MOVW	R7, R8			/* context */
.
336,338c
	MOVW	(R7), R1
	MOVW	4(R7), R15
.
328d
304d
140c
	MOVW	R7, R1			/* 1st arg is &uregpointer */
.
132c
	MOVW	R7, R1
.
126,127c
	MOVW	$(SYSPSR&~PSREF), R8
	MOVW	R8, PSR
.
114d
79c
	MOVW	(R7), R7
.
71d
64c
	MOVW	R7, R8
.
58,59c
	TAS	(R7), R7		/* LDSTUB, thank you ken */
.
## diffname ss/l.s 1991/1106
## diff -e /n/bootesdump/1991/1105/sys/src/9/slc/l.s /n/bootesdump/1991/1106/sys/src/9/slc/l.s
277,278c
	MOVW	$SYSPSR, R8
	MOVW	R8, PSR
.
275c
	MOVW	R1, R7			/* pointer to Ureg */
.
192,193c
	MOVW	$SYSPSR, R8
	MOVW	R8, PSR
.
190c
	MOVW	R1, R7		/* pointer to Ureg */
.
122c
TEXT	touser(SB), $0
.
## diffname ss/l.s 1991/1113
## diff -e /n/bootesdump/1991/1106/sys/src/9/slc/l.s /n/bootesdump/1991/1113/sys/src/9/slc/l.s
512,513c
	MOVW	(R7), FSR
	ADD	$4, R7		/* assumes R7 is now MOVD-aligned */
.
510c
	NOOP
.
479,481d
477a
	ADD	$4, R7		/* assumes R7 is now MOVD-aligned */
.
378a
TEXT	getw4(SB), $0

	MOVW	(R7, 4), R7
	RETURN

.
344a
TEXT	getpsr(SB), $0

	MOVW	PSR, R7
	RETURN

.
302,304c
	NOOP
.
285,287c
	NOOP
.
252a

.
203,205c
	NOOP
.
194,196c
	NOOP
.
145a

.
125,127c
	NOOP
.
113,115c
	NOOP
.
104,106c
	NOOP
.
92,94c
	NOOP
.
74,76c
	NOOP
.
50,51c
/*	MOVW	$0x8, R7 /**/
	MOVW	R0, WIM
.
18a
	MOVW	$_mul(SB), R0	/* touch _mul etc.; doesn't need to execute */
.
3c
#define	SYSPSR	(SPL(0x0)|PSREF|PSRSUPER|0)
#define	NOOP	OR R0, R0; OR R0, R0; OR R0, R0
.
## diffname ss/l.s 1991/1115
## diff -e /n/bootesdump/1991/1113/sys/src/9/slc/l.s /n/bootesdump/1991/1115/sys/src/9/slc/l.s
506,507c
	MOVW	-4(R7), FSR
.
504c
	ADD	$8, R7
	ANDN	$7, R7		/* now MOVD-aligned */
	OR	R0, R0
.
473,474c
	ADD	$8, R7
	ANDN	$7, R7		/* now MOVD-aligned */
	MOVW	FSR, -4(R7)
.
470a
/*
 * in savefpregs and restfpregs, incoming R7 points to doubleword
 * below where F0 will go; doubleword align in and backfill FSR
 */
.
## diffname ss/l.s 1992/0222
## diff -e /n/bootesdump/1991/1115/sys/src/9/slc/l.s /n/bootesdump/1992/0222/sys/src/9/slc/l.s
58c
TEXT	tas(SB), $0
.
## diffname ss/l.s 1992/0722
## diff -e /n/bootesdump/1992/0222/sys/src/9/slc/l.s /n/bootesdump/1992/0722/sys/src/9/slc/l.s
419c
	ADD	$VACLINESZ, R7
.
417c
	ADD	$VACLINESZ, R7
.
415c
	ADD	$VACLINESZ, R7
.
413c
	ADD	$VACLINESZ, R7
.
411c
	ADD	$VACLINESZ, R7
.
409c
	ADD	$VACLINESZ, R7
.
407c
	ADD	$VACLINESZ, R7
.
405c
	ADD	$VACLINESZ, R7
.
403c
	ADD	$VACLINESZ, R7
.
401c
	ADD	$VACLINESZ, R7
.
399c
	ADD	$VACLINESZ, R7
.
397c
	ADD	$VACLINESZ, R7
.
395c
	ADD	$VACLINESZ, R7
.
393c
	ADD	$VACLINESZ, R7
.
391c
	ADD	$VACLINESZ, R7
.
327c
	MOVW	$PUTCXSEGM, R7
.
## diffname ss/l.s 1992/0724
## diff -e /n/bootesdump/1992/0722/sys/src/9/slc/l.s /n/bootesdump/1992/0724/sys/src/9/slc/l.s
461c
	ADD	$VACLINESZ, R7
.
459c
	ADD	$VACLINESZ, R7
.
457c
	ADD	$VACLINESZ, R7
.
455c
	ADD	$VACLINESZ, R7
.
453c
	ADD	$VACLINESZ, R7
.
451c
	ADD	$VACLINESZ, R7
.
449c
	ADD	$VACLINESZ, R7
.
447c
	ADD	$VACLINESZ, R7
.
445c
	ADD	$VACLINESZ, R7
.
443c
	ADD	$VACLINESZ, R7
.
441c
	ADD	$VACLINESZ, R7
.
439c
	ADD	$VACLINESZ, R7
.
437c
	ADD	$VACLINESZ, R7
.
435c
	ADD	$VACLINESZ, R7
.
433c
	ADD	$VACLINESZ, R7
.
## diffname ss/l.s 1992/0726
## diff -e /n/bootesdump/1992/0724/sys/src/9/slc/l.s /n/bootesdump/1992/0726/sys/src/9/slc/l.s
556d
554a
TEXT	clearftt(SB), $0
	MOVW	R7, fsr+0(SB)
	MOVW	$fsr+0(SB), R7
	MOVW	(R7), FSR
	FMOVF	F0, F0
	RETURN

.
544,546c
	MOVW	(R9), R10
	ANDCC	$(1<<13), R10		/* queue not empty? */
	BE	getfpq2
	MOVD	FQ, (R8)
	ADD	$1, R7
	ADD	$8, R8
	BA	getfpq1
getfpq2:
.
541,542c
	MOVW	$0, R7
getfpq1:
.
538,539c
	MOVW	R7, R8	/* must be D aligned */
.
536c
TEXT	getfpq(SB), $0
.
502a
TEXT	enabfp(SB), $0

	MOVW	PSR, R8
	OR	$PSREF, R8
	MOVW	R8, PSR
	RETURN

TEXT	disabfp(SB), $0

	MOVW	PSR, R8
	ANDN	$PSREF, R8
	MOVW	R8, PSR
	RETURN

.
## diffname ss/l.s 1992/0727
## diff -e /n/bootesdump/1992/0726/sys/src/9/slc/l.s /n/bootesdump/1992/0727/sys/src/9/slc/l.s
523,527c
	NOOP			/* wait for PSR to quiesce */
	MOVW	0(R7), FSR
	ADD	$4, R7
.
477,479c
	MOVW	FSR, 0(R7)
	ADD	$4, R7
.
471,474d
## diffname ss/l.s 1992/0728
## diff -e /n/bootesdump/1992/0727/sys/src/9/slc/l.s /n/bootesdump/1992/0728/sys/src/9/slc/l.s
4c
#define	NOOP	ORN R0, R0; ORN R0, R0; ORN R0, R0
.
## diffname ss/l.s 1992/0801
## diff -e /n/bootesdump/1992/0728/sys/src/9/slc/l.s /n/bootesdump/1992/0801/sys/src/9/slc/l.s
384a
	RETURN

TEXT	putw716(SB), $0

	MOVW	4(FP), R8
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
	ADD	$BY2PG, R7
	MOVW	R8, (R7, 0x7)
.
369a
TEXT	putw6(SB), $0

	MOVW	4(FP), R8
	MOVW	R8, (R7, 6)
	RETURN

TEXT	putw8(SB), $0

	MOVW	4(FP), R8
	MOVW	R8, (R7, 8)
	RETURN

.
## diffname ss/l.s 1992/0802
## diff -e /n/bootesdump/1992/0801/sys/src/9/slc/l.s /n/bootesdump/1992/0802/sys/src/9/slc/l.s
600a
	MOVW	(R8), R0		/* SS2 bug fix */
.
## diffname ss/l.s 1992/0803
## diff -e /n/bootesdump/1992/0802/sys/src/9/slc/l.s /n/bootesdump/1992/0803/sys/src/9/slc/l.s
30c
	MOVW	$(0x35<<22), R7		/* NVM OFM DZM NS */
.
## diffname ss/l.s 1992/0804
## diff -e /n/bootesdump/1992/0803/sys/src/9/slc/l.s /n/bootesdump/1992/0804/sys/src/9/slc/l.s
567c
	MOVW	fsr+4(FP), FSR
.
## diffname ss/l.s 1992/0806
## diff -e /n/bootesdump/1992/0804/sys/src/9/slc/l.s /n/bootesdump/1992/0806/sys/src/9/slc/l.s
334,510d
14,15c
	MOVW	$1, R9
	MOVB	R9, (R7, 3)
.
## diffname ss/l.s 1992/0807
## diff -e /n/bootesdump/1992/0807/sys/src/9/slc/l.s /n/bootesdump/1992/0807/sys/src/9/ss/l.s
328a
	RETURN

TEXT	putw4(SB), $0
	MOVW	4(FP), R8
	MOVW	R8, (R7, 4)
.
327c
	MOVW	$romputcxsegm(SB), R7
	MOVW	(R7), R7
.
24a
	MOVW	$romvec(SB), R7
	MOVW	R8, (R7)	/* romvec passed in %i0==R8 */

.
## diffname ss/l.s 1992/0808
## diff -e /n/bootesdump/1992/0807/sys/src/9/ss/l.s /n/bootesdump/1992/0808/sys/src/9/ss/l.s
455a

/*
 * Interface to ROM.  Must save and restore state because
 * of different calling conventions.
 */

TEXT	call(SB), $16
	MOVW	R1, R14		/* save my SP in their SP */
	MOVW	R2, sb-4(SP)
	MOVW	R(MACH), mach-8(SP)
	MOVW	R(USER), user-12(SP)
	MOVW	param1+4(FP), R8
	MOVW	param2+8(FP), R9
	MOVW	param3+12(FP), R10
	MOVW	param4+16(FP), R11
	JMPL	(R7)
	MOVW	R14, R1		/* restore my SP */
	MOVW	user-12(SP), R(USER)
	MOVW	mach-8(SP), R(MACH)
	MOVW	sb-4(SP), R2
	MOVW	R8, R7		/* move their return value into mine */
	RETURN
.
25c
	MOVW	$rom(SB), R7
.
## diffname ss/l.s 1992/0810
## diff -e /n/bootesdump/1992/0808/sys/src/9/ss/l.s /n/bootesdump/1992/0810/sys/src/9/ss/l.s
344a
TEXT	setpsr(SB), $0

	MOVW	R7, PSR
	NOOP
	RETURN

.
## diffname ss/l.s 1992/0811
## diff -e /n/bootesdump/1992/0810/sys/src/9/ss/l.s /n/bootesdump/1992/0811/sys/src/9/ss/l.s
120c
	MOVW	$(SYSPSR&~(PSREF|PSRET|SPL(15))), R8
.
103c
	OR	$SPL(15), R10
.
93c
	ANDN	$SPL(15), R10
.
3c
#define	SYSPSR	(SPL(0x0)|PSREF|PSRET|PSRSUPER|SPL(15)|0)
.
## diffname ss/l.s 1992/0812
## diff -e /n/bootesdump/1992/0811/sys/src/9/ss/l.s /n/bootesdump/1992/0812/sys/src/9/ss/l.s
464,465c
 * Interface to OPEN BOOT ROM.  Must save and restore state because
 * of different calling conventions.  We don't use it, but it's here
 * for reference..
.
27a
	/* turn off the cache */
	MOVW	$ENAB, R7
	MOVB	(R7, 2), R8
	ANDN	$ENABCACHE, R8
	MOVB	R8, (R7, 2)

.
17a

.
## diffname ss/l.s 1992/0904
## diff -e /n/bootesdump/1992/0812/sys/src/9/ss/l.s /n/bootesdump/1992/0904/sys/src/9/ss/l.s
42c
	MOVW	$fsr+0(SB), R8
	MOVW	(R8), FSR
.
## diffname ss/l.s 1992/0912
## diff -e /n/bootesdump/1992/0904/sys/src/9/ss/l.s /n/bootesdump/1992/0912/sys/src/9/ss/l.s
465a
	RETURN

TEXT	_getcallerpc(SB), $0
	MOVW	0(R1), R7
.
94a
	NOOP
	TAS	(R7), R7		/* LDSTUB, thank you ken */
	MOVW	R8, PSR
	NOOP
.
76,93c
	MOVW	PSR, R8
	MOVW	$SYSPSR, R9
.
74c
TEXT	tas(SB), $0			/* it seems we must be splhi */
.
69c
TEXT	oldtas(SB), $0
.
3c
#define	SYSPSR	(PSREF|PSRET|PSRSUPER|SPL(15))
.
## diffname ss/l.s 1992/0913
## diff -e /n/bootesdump/1992/0912/sys/src/9/ss/l.s /n/bootesdump/1992/0913/sys/src/9/ss/l.s
84a
TEXT	softtas(SB), $0			/* all software; avoid LDSTUB */

	MOVW	PSR, R8
	MOVW	$SYSPSR, R9
	MOVW	R9, PSR
	NOOP
	MOVB	(R7), R10
	CMP	R10, R0
	BE	gotit
#ifdef asdf
	ANDN	$31, R7			/* flush cache line */
	MOVW	$0, (R7, 0xD)
#endif
	MOVW	$0xFF, R7
	MOVW	R8, PSR
	NOOP
	RETURN

gotit:
	MOVW	$0xFF, R10
	MOVB	R10, (R7)
#ifdef asdf
	ANDN	$31, R7			/* flush cache line */
	MOVW	$0, (R7, 0xD)
#endif
	MOVW	$0, R7
	MOVW	R8, PSR
	NOOP
	RETURN

.
## diffname ss/l.s 1993/0123
## diff -e /n/bootesdump/1992/0913/sys/src/9/ss/l.s /n/bootesdump/1993/0123/sys/src/9/ss/l.s
14a
	MOVB	R9, (R7, 3)
	ADD	$(BY2SEGM), R7
	MOVW	$2, R9
	MOVB	R9, (R7, 3)
	ADD	$(BY2SEGM), R7
	MOVW	$3, R9
.
13c
	ADD	$(BY2SEGM), R7
.
10c
	/* get virtual by mapping segment(KZERO) to pmeg 0, and next to 1, etc. */
.
## diffname ss/l.s 1993/0501 # deleted
## diff -e /n/bootesdump/1993/0123/sys/src/9/ss/l.s /n/fornaxdump/1993/0501/sys/src/brazil/ss/l.s
1,520d

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].