Implement casuptr().

This commit is contained in:
marcel 2003-07-24 07:49:45 +00:00
parent 4d889b6d9a
commit 9be4bca790
2 changed files with 29 additions and 7 deletions

View File

@ -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);
}

View File

@ -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
*/