summaryrefslogtreecommitdiffstats
path: root/sys/alpha
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-07-24 07:49:45 +0000
committermarcel <marcel@FreeBSD.org>2003-07-24 07:49:45 +0000
commit5db03ff255bd51fa39e5b4ad5c32e7756c0e7a0f (patch)
treecca89d3c90e17786c312e8911ac70069734e8fee /sys/alpha
parentfd57f45daa7a7e971d66d61ce6c75aa7d347c0a0 (diff)
downloadFreeBSD-src-5db03ff255bd51fa39e5b4ad5c32e7756c0e7a0f.zip
FreeBSD-src-5db03ff255bd51fa39e5b4ad5c32e7756c0e7a0f.tar.gz
Implement casuptr().
Diffstat (limited to 'sys/alpha')
-rw-r--r--sys/alpha/alpha/machdep.c6
-rw-r--r--sys/alpha/alpha/support.s30
2 files changed, 29 insertions, 7 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index 1139205..ba40437 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -2373,9 +2373,3 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz)
pcpu->pc_idlepcb.apcb_ptbr = thread0.td_pcb->pcb_hw.apcb_ptbr;
pcpu->pc_current_asngen = 1;
}
-
-intptr_t
-casuptr(intptr_t *p, intptr_t old, intptr_t new)
-{
- return (-1);
-}
diff --git a/sys/alpha/alpha/support.s b/sys/alpha/alpha/support.s
index 53b56f4..a340d75 100644
--- a/sys/alpha/alpha/support.s
+++ b/sys/alpha/alpha/support.s
@@ -59,7 +59,35 @@
.text
/**************************************************************************/
-
+
+/*
+ * intptr_t
+ * casuptr(intptr_t *p, intptr_t old, intptr_t new)
+ */
+ LEAF(casuptr, 3)
+ LDGP(pv)
+
+ ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */
+ cmpult a0, t0, t1
+ beq t1, fusufault
+
+ lda t0, fusufault /* trap faults */
+ ldq t2, PC_CURTHREAD(pcpup)
+ ldq t2, TD_PCB(t2)
+
+ stq t0, PCB_ONFAULT(t2)
+1:
+ ldq_l v0, 0(a0) /* try to load the old value */
+ cmpeq v0, a1, t0 /* compare */
+ beq t0, 2f /* exit if not equal */
+ mov a2, t0 /* setup value to write */
+ stq_c t0, 0(a0) /* write if address still locked */
+ beq t0, 1b /* if it failed, spin */
+2:
+ stq zero, PCB_ONFAULT(t2) /* clean up */
+ RET
+ END(casuptr)
+
/*
* fu{byte,word} : fetch a byte (word) from user memory
*/
OpenPOWER on IntegriCloud