1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Add suhword() and fuhword() for accessing 32-bit values ("half words") in

userland. All these functions should be renamed to be explicit about the
size of value being read or written.
This commit is contained in:
Doug Rabson 2002-04-10 19:26:49 +00:00
parent 4beaa04bf1
commit b0685df774
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=94377
2 changed files with 110 additions and 0 deletions

View File

@ -220,6 +220,34 @@ ENTRY(suword, 2)
END(suword)
ENTRY(suhword, 2)
movl r14=VM_MAXUSER_ADDRESS;; // make sure address is ok
cmp.geu p6,p0=in0,r14
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
add r15=PC_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
st4.rel [in0]=in1 // try the store
;;
st8 [r15]=r0 // clean up
mov ret0=r0
br.ret.sptk.few rp
END(suhword)
ENTRY(subyte, 2)
movl r14=VM_MAXUSER_ADDRESS;; // make sure address is ok
@ -275,6 +303,33 @@ ENTRY(fuword, 1)
END(fuword)
ENTRY(fuhword, 1)
movl r14=VM_MAXUSER_ADDRESS;; // make sure address is ok
cmp.geu p6,p0=in0,r14
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
add r15=PC_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
ld4.acq ret0=[in0] // try the fetch
;;
st8 [r15]=r0 // clean up
br.ret.sptk.few rp
END(fuhword)
ENTRY(fubyte, 1)
movl r14=VM_MAXUSER_ADDRESS;; // make sure address is ok

View File

@ -220,6 +220,34 @@ ENTRY(suword, 2)
END(suword)
ENTRY(suhword, 2)
movl r14=VM_MAXUSER_ADDRESS;; // make sure address is ok
cmp.geu p6,p0=in0,r14
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
add r15=PC_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
st4.rel [in0]=in1 // try the store
;;
st8 [r15]=r0 // clean up
mov ret0=r0
br.ret.sptk.few rp
END(suhword)
ENTRY(subyte, 2)
movl r14=VM_MAXUSER_ADDRESS;; // make sure address is ok
@ -275,6 +303,33 @@ ENTRY(fuword, 1)
END(fuword)
ENTRY(fuhword, 1)
movl r14=VM_MAXUSER_ADDRESS;; // make sure address is ok
cmp.geu p6,p0=in0,r14
(p6) br.dpnt.few fusufault
movl r14=fusufault // set up fault handler.
add r15=PC_CURTHREAD,r13 // find curthread
;;
ld8 r15=[r15]
;;
add r15=TD_PCB,r15 // find pcb
;;
ld8 r15=[r15]
;;
add r15=PCB_ONFAULT,r15
;;
st8 [r15]=r14
;;
ld4.acq ret0=[in0] // try the fetch
;;
st8 [r15]=r0 // clean up
br.ret.sptk.few rp
END(fuhword)
ENTRY(fubyte, 1)
movl r14=VM_MAXUSER_ADDRESS;; // make sure address is ok