Module Name: src Committed By: matt Date: Wed Jul 6 09:27:35 UTC 2011
Modified Files: src/sys/arch/mips/include: cpu.h src/sys/arch/mips/mips: copy.S Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/arch/mips/include/cpu.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/mips/copy.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/include/cpu.h diff -u src/sys/arch/mips/include/cpu.h:1.102 src/sys/arch/mips/include/cpu.h:1.103 --- src/sys/arch/mips/include/cpu.h:1.102 Mon May 2 00:29:54 2011 +++ src/sys/arch/mips/include/cpu.h Wed Jul 6 09:27:35 2011 @@ -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 *); Index: src/sys/arch/mips/mips/copy.S diff -u src/sys/arch/mips/mips/copy.S:1.13 src/sys/arch/mips/mips/copy.S:1.14 --- src/sys/arch/mips/mips/copy.S:1.13 Tue Jul 5 08:07:53 2011 +++ src/sys/arch/mips/mips/copy.S Wed Jul 6 09:27:35 2011 @@ -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)