Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips Add



details:   https://anonhg.NetBSD.org/src/rev/07bb0f0c0f39
branches:  trunk
changeset: 766993:07bb0f0c0f39
user:      matt <matt%NetBSD.org@localhost>
date:      Wed Jul 06 09:27:35 2011 +0000

description:
Add

        uint32_t kfetch_32(volatile uint32_t *, uint32_t);

which fetches a 32-bit value from a provided addess or returns
an user supplied value on error.

diffstat:

 sys/arch/mips/include/cpu.h |   3 ++-
 sys/arch/mips/mips/copy.S   |  35 ++++++++++++++++++++++++++++++++---
 2 files changed, 34 insertions(+), 4 deletions(-)

diffs (80 lines):

diff -r 7d69c633551e -r 07bb0f0c0f39 sys/arch/mips/include/cpu.h
--- a/sys/arch/mips/include/cpu.h       Wed Jul 06 09:02:54 2011 +0000
+++ b/sys/arch/mips/include/cpu.h       Wed Jul 06 09:27:35 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.102 2011/05/02 00:29:54 rmind Exp $  */
+/*     $NetBSD: cpu.h,v 1.103 2011/07/06 09:27:35 matt Exp $   */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -539,6 +539,7 @@
 #endif
 
 /* copy.S */
+int32_t kfetch_32(volatile uint32_t *, uint32_t);
 int8_t ufetch_int8(void *);
 int16_t        ufetch_int16(void *);
 int32_t ufetch_int32(void *);
diff -r 7d69c633551e -r 07bb0f0c0f39 sys/arch/mips/mips/copy.S
--- a/sys/arch/mips/mips/copy.S Wed Jul 06 09:02:54 2011 +0000
+++ b/sys/arch/mips/mips/copy.S Wed Jul 06 09:27:35 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: copy.S,v 1.13 2011/07/05 08:07:53 matt Exp $   */
+/*     $NetBSD: copy.S,v 1.14 2011/07/06 09:27:35 matt Exp $   */
 
 /*
  * Copyright (c) 1992, 1993
@@ -278,6 +278,23 @@
         li     v0, EFAULT
 END(copyefault)
 
+LEAF(kfetch_32)
+       PTR_L   v1, L_PCB(MIPS_CURLWP)
+       PTR_LA  v0, _C_LABEL(kfetcherr)
+       bgez    a0, _C_LABEL(kfetcherr)
+        PTR_S  v0, PCB_ONFAULT(v1)
+       INT_L   v0, 0(a0)                       # fetch int
+       /*
+        * Normally a sync instructions would be used but this has to work on
+        * MIPS1 which doesn't have a sync.
+        */
+       nop                                     # load delay for mips1
+       move    t0, v0                          # dependent instruction
+       xor     t0, v0                          # make t0 zero
+       j       ra
+        PTR_S  t0, PCB_ONFAULT(v1)
+END(kfetch_32)
+
 /*
  * int fuswintr(void *)
  * Fetches a short word of data from the user-space address.
@@ -578,8 +595,14 @@
 4:
        INT_L   v0, (a0)
 5:
-       sync
-       PTR_S   zero, PCB_ONFAULT(v1)
+       /*
+        * Normally a sync instructions would be used but this has to work on
+        * MIPS1 which doesn't have a sync.
+        */
+       nop
+       move    t0, v0                  # dependent instruction
+       xor     t0, t0                  # zero t0
+       PTR_S   t0, PCB_ONFAULT(v1)     # clear onfault
        j       ra
         move   v0, zero                # made it w/o errors
 END(badaddr)
@@ -597,6 +620,12 @@
         li     v0, -1
 END(fswintrberr)
 
+LEAF(kfetcherr)
+       PTR_S   zero, PCB_ONFAULT(v1)
+       j       ra
+        move   v0, a1
+END(kfetcherr)
+
 LEAF(fswberr)
 XLEAF(baderr)
        PTR_S   zero, PCB_ONFAULT(v1)



Home | Main Index | Thread Index | Old Index