summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2003-01-09 22:27:13 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2003-01-09 22:27:13 +0000
commit332a483dedd5c976b45635d3ef8337dfdd377f08 (patch)
treebcd0800a8732b7099fd64ce366155836b0f6e6ce /sys/arch/sparc64
parentc88cb37963768d4ddbf78335478986b31599e25a (diff)
Remove fetch(9) and store(9) functions from the kernel, and replace the few
remaining instances of them with appropriate copy(9) usage. ok art@, tested on all arches unless my memory is non-ECC
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/sparc64/db_interface.c6
-rw-r--r--sys/arch/sparc64/sparc64/locore.s142
-rw-r--r--sys/arch/sparc64/sparc64/mem.c25
-rw-r--r--sys/arch/sparc64/sparc64/openprom.c6
4 files changed, 25 insertions, 154 deletions
diff --git a/sys/arch/sparc64/sparc64/db_interface.c b/sys/arch/sparc64/sparc64/db_interface.c
index b32eea46048..7609736d661 100644
--- a/sys/arch/sparc64/sparc64/db_interface.c
+++ b/sys/arch/sparc64/sparc64/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.12 2002/07/24 00:48:25 art Exp $ */
+/* $OpenBSD: db_interface.c,v 1.13 2003/01/09 22:27:10 miod Exp $ */
/* $NetBSD: db_interface.c,v 1.61 2001/07/31 06:55:47 eeh Exp $ */
/*
@@ -378,7 +378,7 @@ db_read_bytes(addr, size, data)
if (src >= (char *)VM_MIN_KERNEL_ADDRESS)
*data++ = probeget((paddr_t)(u_long)src++, ASI_P, 1);
else
- *data++ = fubyte(src++);
+ copyin(src++, data++, sizeof(u_char));
}
}
@@ -405,7 +405,7 @@ db_write_bytes(addr, size, data)
/* Read Only mapping -- need to do a bypass access */
stba((u_long)dst - ktext + ktextp, ASI_PHYS_CACHED, *data);
else
- subyte(dst, *data);
+ copyout(data, dst, sizeof(char));
dst++, data++;
}
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index 1b93f3b9607..be62b3af491 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.25 2002/09/10 18:29:44 art Exp $ */
+/* $OpenBSD: locore.s,v 1.26 2003/01/09 22:27:10 miod Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -7749,146 +7749,6 @@ ENTRY(proc_trampoline)
ba,a,pt %icc, return_from_trap
nop
-/*
- * {fu,su}{,i}{byte,word}
- */
-ALTENTRY(fuiword)
-ENTRY(fuword)
- btst 3, %o0 ! has low bits set...
- bnz Lfsbadaddr ! go return -1
- EMPTY
- sethi %hi(CPCB), %o2 ! cpcb->pcb_onfault = Lfserr;
- set Lfserr, %o3
- LDPTR [%o2 + %lo(CPCB)], %o2
- membar #LoadStore
- STPTR %o3, [%o2 + PCB_ONFAULT]
- membar #Sync
- LDPTRA [%o0] ASI_AIUS, %o0 ! fetch the word
- membar #Sync
- STPTR %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
- retl ! phew, made it, return the word
- membar #StoreStore|#StoreLoad
-
-Lfserr:
- STPTR %g0, [%o2 + PCB_ONFAULT]! error in r/w, clear pcb_onfault
- membar #StoreStore|#StoreLoad
-Lfsbadaddr:
-#ifndef _LP64
- mov -1, %o1
-#endif
- retl ! and return error indicator
- mov -1, %o0
-
- /*
- * This is just like Lfserr, but it's a global label that allows
- * mem_access_fault() to check to see that we don't want to try to
- * page in the fault. It's used by fuswintr() etc.
- */
- .globl _C_LABEL(Lfsbail)
-_C_LABEL(Lfsbail):
- STPTR %g0, [%o2 + PCB_ONFAULT]! error in r/w, clear pcb_onfault
- membar #StoreStore|#StoreLoad
- retl ! and return error indicator
- mov -1, %o0
-
- /*
- * Like fusword but callable from interrupt context.
- * Fails if data isn't resident.
- */
-ENTRY(fuswintr)
- sethi %hi(CPCB), %o2 ! cpcb->pcb_onfault = _Lfsbail;
- LDPTR [%o2 + %lo(CPCB)], %o2
- set _C_LABEL(Lfsbail), %o3
- STPTR %o3, [%o2 + PCB_ONFAULT]
- membar #Sync
- lduha [%o0] ASI_AIUS, %o0 ! fetch the halfword
- membar #Sync
- STPTR %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
- retl ! made it
- membar #StoreStore|#StoreLoad
-
-ENTRY(fusword)
- sethi %hi(CPCB), %o2 ! cpcb->pcb_onfault = Lfserr;
- LDPTR [%o2 + %lo(CPCB)], %o2
- set Lfserr, %o3
- STPTR %o3, [%o2 + PCB_ONFAULT]
- membar #Sync
- lduha [%o0] ASI_AIUS, %o0 ! fetch the halfword
- membar #Sync
- STPTR %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
- retl ! made it
- membar #StoreStore|#StoreLoad
-
-ALTENTRY(fuibyte)
-ENTRY(fubyte)
- sethi %hi(CPCB), %o2 ! cpcb->pcb_onfault = Lfserr;
- LDPTR [%o2 + %lo(CPCB)], %o2
- set Lfserr, %o3
- STPTR %o3, [%o2 + PCB_ONFAULT]
- membar #Sync
- lduba [%o0] ASI_AIUS, %o0 ! fetch the byte
- membar #Sync
- STPTR %g0, [%o2 + PCB_ONFAULT]! but first clear onfault
- retl ! made it
- membar #StoreStore|#StoreLoad
-
-ALTENTRY(suiword)
-ENTRY(suword)
- btst 3, %o0 ! or has low bits set ...
- bnz Lfsbadaddr ! go return error
- EMPTY
- sethi %hi(CPCB), %o2 ! cpcb->pcb_onfault = Lfserr;
- LDPTR [%o2 + %lo(CPCB)], %o2
- set Lfserr, %o3
- STPTR %o3, [%o2 + PCB_ONFAULT]
- membar #Sync
- STPTRA %o1, [%o0] ASI_AIUS ! store the word
- membar #Sync
- STPTR %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
- membar #StoreStore|#StoreLoad
- retl ! and return 0
- clr %o0
-
-ENTRY(suswintr)
- sethi %hi(CPCB), %o2 ! cpcb->pcb_onfault = _Lfsbail;
- LDPTR [%o2 + %lo(CPCB)], %o2
- set _C_LABEL(Lfsbail), %o3
- STPTR %o3, [%o2 + PCB_ONFAULT]
- membar #Sync
- stha %o1, [%o0] ASI_AIUS ! store the halfword
- membar #Sync
- STPTR %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
- membar #StoreStore|#StoreLoad
- retl ! and return 0
- clr %o0
-
-ENTRY(susword)
- sethi %hi(CPCB), %o2 ! cpcb->pcb_onfault = Lfserr;
- LDPTR [%o2 + %lo(CPCB)], %o2
- set Lfserr, %o3
- STPTR %o3, [%o2 + PCB_ONFAULT]
- membar #Sync
- stha %o1, [%o0] ASI_AIUS ! store the halfword
- membar #Sync
- STPTR %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
- membar #StoreStore|#StoreLoad
- retl ! and return 0
- clr %o0
-
-ALTENTRY(suibyte)
-ENTRY(subyte)
- sethi %hi(CPCB), %o2 ! cpcb->pcb_onfault = Lfserr;
- LDPTR [%o2 + %lo(CPCB)], %o2
- set Lfserr, %o3
- STPTR %o3, [%o2 + PCB_ONFAULT]
- membar #Sync
- stba %o1, [%o0] ASI_AIUS ! store the byte
- membar #Sync
- STPTR %g0, [%o2 + PCB_ONFAULT]! made it, clear onfault
- membar #StoreStore|#StoreLoad
- retl ! and return 0
- clr %o0
-
/* probeget and probeset are meant to be used during autoconfiguration */
/*
* The following probably need to be changed, but to what I don't know.
diff --git a/sys/arch/sparc64/sparc64/mem.c b/sys/arch/sparc64/sparc64/mem.c
index bf25de2132d..5c3884e5087 100644
--- a/sys/arch/sparc64/sparc64/mem.c
+++ b/sys/arch/sparc64/sparc64/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.6 2001/12/04 23:22:42 art Exp $ */
+/* $OpenBSD: mem.c,v 1.7 2003/01/09 22:27:11 miod Exp $ */
/* $NetBSD: mem.c,v 1.18 2001/04/24 04:31:12 thorpej Exp $ */
/*
@@ -180,14 +180,23 @@ mmrw(dev, uio, flags)
case UIO_USERSPACE:
if (uio->uio_rw == UIO_READ)
- while (cnt--)
- if(subyte(d++, lduba(v++, ASI_PHYS_CACHED))) {
- error = EFAULT;
- goto unlock;
- }
+ while (cnt--) {
+ char tmp;
+
+ tmp = lduba(v++, ASI_PHYS_CACHED);
+ error = copyout(&tmp, d++, sizeof(tmp));
+ if (error != 0)
+ break;
+ }
else
- while (cnt--)
- stba(v++, ASI_PHYS_CACHED, fubyte(d++));
+ while (cnt--) {
+ char tmp;
+
+ error = copyin(d++, &tmp, sizeof(tmp));
+ if (error != 0)
+ break;
+ stba(v++, ASI_PHYS_CACHED, tmp);
+ }
if (error)
goto unlock;
break;
diff --git a/sys/arch/sparc64/sparc64/openprom.c b/sys/arch/sparc64/sparc64/openprom.c
index de589afdf98..0d3c4dc0a9e 100644
--- a/sys/arch/sparc64/sparc64/openprom.c
+++ b/sys/arch/sparc64/sparc64/openprom.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: openprom.c,v 1.8 2002/07/31 18:39:22 jason Exp $ */
+/* $OpenBSD: openprom.c,v 1.9 2003/01/09 22:27:11 miod Exp $ */
/* $NetBSD: openprom.c,v 1.4 2002/01/10 06:21:53 briggs Exp $ */
/*
@@ -218,8 +218,10 @@ openpromioctl(dev, cmd, data, flags, p)
error = OF_nextprop(node, name, nextprop);
splx(s);
if (error == 0) {
+ char nul = 0;
+
op->op_buflen = 0;
- error = subyte(op->op_buf, 0);
+ error = copyin(&nul, op->op_buf, sizeof(char));
break;
}
if (error == -1) {