diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index 1139205bff85..ba40437d29fc 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 53b56f4d636f..a340d7514ec6 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 */