xref: /plan9/sys/src/cmd/unix/drawterm/posix-mips/tas.s (revision ec59a3ddbfceee0efe34584c2c9981a5e5ff1ec4)
1#include <sys/regdef.h>
2#include <sys/asm.h>
3
4.globl tas
5.ent tas 2
6
7tas:
8.set noreorder
91:
10	ori	t1, zero, 12345	/* t1 = 12345 */
11	ll	t0, (a0)		/* t0 = *a0 */
12	sc	t1, (a0)		/* *a0 = t1 if *a0 hasn't changed; t1=success */
13	beq	t1, zero, 1b		/* repeat if *a0 did change */
14	nop
15
16	j $31				/* return */
17	or	v0, t0, zero		/* set return value on way out */
18
19.set reorder
20.end tas
21
22