shithub: riscv

Download patch

ref: b68eeefef34d4a742124d922e2a23613b9bcb1e5
parent: 6fe654f50c536a61c94a43ce2fcb147625da1d09
author: adventuresin9 <adventuresin9@gmail.com>
date: Wed Mar 8 00:14:31 EST 2023

sys/src/libc/mips/tas.s: _tas() for spim

--- /dev/null
+++ b/sys/src/libc/spim/tas.s
@@ -1,0 +1,18 @@
+/*
+ *	4K tas for spim
+ */
+
+#define	LL(base, rt)	WORD	$((060<<26)|((base)<<21)|((rt)<<16))
+#define	SC(base, rt)	WORD	$((070<<26)|((base)<<21)|((rt)<<16))
+#define	NOOP		WORD	$0x27
+
+	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