| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mem.c,v 1.35.38.9 2012/01/10 18:34:03 matt Exp $ */ | | 1 | /* $NetBSD: mem.c,v 1.35.38.10 2012/01/10 18:36:58 matt Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1988 University of Utah. | | 4 | * Copyright (c) 1988 University of Utah. |
5 | * Copyright (c) 1982, 1986, 1990, 1993 | | 5 | * Copyright (c) 1982, 1986, 1990, 1993 |
6 | * The Regents of the University of California. All rights reserved. | | 6 | * The Regents of the University of California. All rights reserved. |
7 | * | | 7 | * |
8 | * This code is derived from software contributed to Berkeley by | | 8 | * This code is derived from software contributed to Berkeley by |
9 | * the Systems Programming Group of the University of Utah Computer | | 9 | * the Systems Programming Group of the University of Utah Computer |
10 | * Science Department and Ralph Campbell. | | 10 | * Science Department and Ralph Campbell. |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
| @@ -34,27 +34,27 @@ | | | @@ -34,27 +34,27 @@ |
34 | * SUCH DAMAGE. | | 34 | * SUCH DAMAGE. |
35 | * | | 35 | * |
36 | * @(#)mem.c 8.3 (Berkeley) 1/12/94 | | 36 | * @(#)mem.c 8.3 (Berkeley) 1/12/94 |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | /* | | 39 | /* |
40 | * Memory special file | | 40 | * Memory special file |
41 | */ | | 41 | */ |
42 | | | 42 | |
43 | #include "opt_cputype.h" | | 43 | #include "opt_cputype.h" |
44 | #include "opt_mips_cache.h" | | 44 | #include "opt_mips_cache.h" |
45 | | | 45 | |
46 | #include <sys/cdefs.h> | | 46 | #include <sys/cdefs.h> |
47 | __KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.35.38.9 2012/01/10 18:34:03 matt Exp $"); | | 47 | __KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.35.38.10 2012/01/10 18:36:58 matt Exp $"); |
48 | | | 48 | |
49 | #include <sys/param.h> | | 49 | #include <sys/param.h> |
50 | #include <sys/conf.h> | | 50 | #include <sys/conf.h> |
51 | #include <sys/buf.h> | | 51 | #include <sys/buf.h> |
52 | #include <sys/systm.h> | | 52 | #include <sys/systm.h> |
53 | #include <sys/uio.h> | | 53 | #include <sys/uio.h> |
54 | #include <sys/malloc.h> | | 54 | #include <sys/malloc.h> |
55 | #include <sys/msgbuf.h> | | 55 | #include <sys/msgbuf.h> |
56 | #include <sys/event.h> | | 56 | #include <sys/event.h> |
57 | | | 57 | |
58 | #include <machine/cpu.h> | | 58 | #include <machine/cpu.h> |
59 | | | 59 | |
60 | #include <mips/cache.h> | | 60 | #include <mips/cache.h> |
| @@ -142,28 +142,28 @@ mmrw(dev_t dev, struct uio *uio, int fla | | | @@ -142,28 +142,28 @@ mmrw(dev_t dev, struct uio *uio, int fla |
142 | } else if (MIPS_XKSEG_P(v) | | 142 | } else if (MIPS_XKSEG_P(v) |
143 | && v < MIPS_KSEG0_START | | 143 | && v < MIPS_KSEG0_START |
144 | && !uvm_kernacc((void *)v, c, | | 144 | && !uvm_kernacc((void *)v, c, |
145 | uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) { | | 145 | uio->uio_rw == UIO_READ ? B_READ : B_WRITE)) { |
146 | return (EFAULT); | | 146 | return (EFAULT); |
147 | } else if (MIPS_KSEG1_P(v) || MIPS_KSEG2_P(v)) { | | 147 | } else if (MIPS_KSEG1_P(v) || MIPS_KSEG2_P(v)) { |
148 | return (EFAULT); | | 148 | return (EFAULT); |
149 | } | | 149 | } |
150 | #else | | 150 | #else |
151 | if (v < MIPS_KSEG0_START) | | 151 | if (v < MIPS_KSEG0_START) |
152 | return (EFAULT); | | 152 | return (EFAULT); |
153 | if (MIPS_KSEG0_P(v + c - 1)) { | | 153 | if (MIPS_KSEG0_P(v + c - 1)) { |
154 | /* | | 154 | /* |
155 | * If all of memory is in KSEG0, make sure | | 155 | * If all of memory is in KSEG0, make sure we |
156 | * we don't beyond its limit. (mips_avail_end | | 156 | * don't go beyond its limit. (mips_avail_end |
157 | * may be beyond the end of KSEG0). | | 157 | * may be beyond the end of KSEG0). |
158 | */ | | 158 | */ |
159 | if (MIPS_KSEG0_TO_PHYS(v) >= mips_avail_end | | 159 | if (MIPS_KSEG0_TO_PHYS(v) >= mips_avail_end |
160 | + mips_round_page(MSGBUFSIZE) - c) | | 160 | + mips_round_page(MSGBUFSIZE) - c) |
161 | return (EFAULT); | | 161 | return (EFAULT); |
162 | #ifdef ENABLE_MIPS_KSEGX | | 162 | #ifdef ENABLE_MIPS_KSEGX |
163 | } else if (VM_KSEGX_ADDRESS <= v | | 163 | } else if (VM_KSEGX_ADDRESS <= v |
164 | && v + c <= VM_KSEGX_ADDRESS + VM_KSEGX_SIZE) { | | 164 | && v + c <= VM_KSEGX_ADDRESS + VM_KSEGX_SIZE) { |
165 | /* nothing */ | | 165 | /* nothing */ |
166 | #endif | | 166 | #endif |
167 | } else if (v < MIPS_KSEG2_START | | 167 | } else if (v < MIPS_KSEG2_START |
168 | || !uvm_kernacc((void *)v, c, | | 168 | || !uvm_kernacc((void *)v, c, |
169 | uio->uio_rw == UIO_READ | | 169 | uio->uio_rw == UIO_READ |