summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2003-03-15 23:59:00 +0000
committerjake <jake@FreeBSD.org>2003-03-15 23:59:00 +0000
commitbfdf0845f229df32dd8ae23b653835a8a3bbb02e (patch)
treee12bbb9dd99db538b74f2a16e22a9b05e672897f
parent5e42320b6c7d29411910e917de7f2fadded44ff3 (diff)
downloadFreeBSD-src-bfdf0845f229df32dd8ae23b653835a8a3bbb02e.zip
FreeBSD-src-bfdf0845f229df32dd8ae23b653835a8a3bbb02e.tar.gz
Implement is_physical_memory. Accessing memory which doesn't exist causes
traps that are difficult to recover from, so we check against the memory map returned by the prom.
-rw-r--r--sys/sparc64/sparc64/vm_machdep.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/sparc64/sparc64/vm_machdep.c b/sys/sparc64/sparc64/vm_machdep.c
index b2b21c8..7258727 100644
--- a/sys/sparc64/sparc64/vm_machdep.c
+++ b/sys/sparc64/sparc64/vm_machdep.c
@@ -75,9 +75,13 @@
#include <machine/frame.h>
#include <machine/md_var.h>
#include <machine/ofw_machdep.h>
+#include <machine/ofw_mem.h>
#include <machine/tlb.h>
#include <machine/tstate.h>
+extern struct ofw_mem_region sparc64_memreg[];
+extern int sparc64_nmemreg;
+
PMAP_STATS_VAR(uma_nsmall_alloc);
PMAP_STATS_VAR(uma_nsmall_alloc_oc);
PMAP_STATS_VAR(uma_nsmall_free);
@@ -295,9 +299,12 @@ cpu_wait(struct proc *p)
int
is_physical_memory(vm_offset_t addr)
{
+ struct ofw_mem_region *mr;
- /* There is no device memory in the midst of the normal RAM. */
- return (1);
+ for (mr = sparc64_memreg; mr < sparc64_memreg + sparc64_nmemreg; mr++)
+ if (addr >= mr->mr_start && addr < mr->mr_start + mr->mr_size)
+ return (1);
+ return (0);
}
void
@@ -367,4 +374,3 @@ uma_small_free(void *mem, int size, u_int8_t flags)
vm_page_free(m);
vm_page_unlock_queues();
}
-
OpenPOWER on IntegriCloud