diff --git a/sys/arch/usermode/include/cpu.h b/sys/arch/usermode/include/cpu.h index a5e9f494908f..04d24d991e3f 100644 --- a/sys/arch/usermode/include/cpu.h +++ b/sys/arch/usermode/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.9 2012/01/19 12:14:49 reinoud Exp $ */ +/* $NetBSD: cpu.h,v 1.10 2012/02/08 17:55:21 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -50,10 +50,10 @@ extern void cpu_need_resched(struct cpu_info *ci, int flags); struct cpu_info { - device_t ci_dev; + struct cpu_data ci_data; /* MI per-cpu data */ + device_t ci_dev; /* pointer to our device */ struct cpu_info *ci_self; struct cpu_info *ci_next; - struct cpu_data ci_data; u_int ci_cpuid; int ci_want_resched; int ci_idepth; diff --git a/sys/arch/usermode/include/types.h b/sys/arch/usermode/include/types.h index d1968776a4f0..78aaafe27704 100644 --- a/sys/arch/usermode/include/types.h +++ b/sys/arch/usermode/include/types.h @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.7 2012/01/08 18:06:00 jmcneill Exp $ */ +/* $NetBSD: types.h,v 1.8 2012/02/08 17:55:21 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -62,4 +62,7 @@ typedef volatile unsigned char __cpu_simple_lock_t; #define __HAVE_OLD_DISKLABEL #endif +#define __HAVE_CPU_DATA_FIRST +#define __HAVE_MM_MD_KERNACC + #endif /* !_ARCH_USERMODE_INCLUDE_TYPES_H */ diff --git a/sys/arch/usermode/include/vmparam.h b/sys/arch/usermode/include/vmparam.h index d186876e71fc..cec6ba96de4a 100644 --- a/sys/arch/usermode/include/vmparam.h +++ b/sys/arch/usermode/include/vmparam.h @@ -1,4 +1,4 @@ -/* $NetBSD: vmparam.h,v 1.15 2012/01/10 10:19:38 reinoud Exp $ */ +/* $NetBSD: vmparam.h,v 1.16 2012/02/08 17:55:21 reinoud Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -36,6 +36,7 @@ extern paddr_t kmem_k_start, kmem_k_end; extern paddr_t kmem_kvm_start, kmem_kvm_end; +extern paddr_t kmem_kvm_cur_end; extern paddr_t kmem_user_start, kmem_user_end; #define VM_MIN_ADDRESS kmem_user_start diff --git a/sys/arch/usermode/usermode/machdep.c b/sys/arch/usermode/usermode/machdep.c index cf0d2ca344b0..734db0f38827 100644 --- a/sys/arch/usermode/usermode/machdep.c +++ b/sys/arch/usermode/usermode/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.52 2012/01/15 10:30:21 jmcneill Exp $ */ +/* $NetBSD: machdep.c,v 1.53 2012/02/08 17:55:21 reinoud Exp $ */ /*- * Copyright (c) 2011 Reinoud Zandijk @@ -37,7 +37,7 @@ #include "opt_memsize.h" #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.52 2012/01/15 10:30:21 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.53 2012/02/08 17:55:21 reinoud Exp $"); #include #include @@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.52 2012/01/15 10:30:21 jmcneill Exp $" #include #include +#include #include #include @@ -249,8 +250,30 @@ consinit(void) } int -mm_md_physacc(paddr_t pa, vm_prot_t prog) +mm_md_physacc(paddr_t pa, vm_prot_t prot) { + // printf("%s: pa = %p, acc %d\n", __func__, (void *) pa, prot); + if (pa >= physmem * PAGE_SIZE) + return EFAULT; + return 0; +} + + +int +mm_md_kernacc(void *ptr, vm_prot_t prot, bool *handled) +{ + const vaddr_t va = (vaddr_t)ptr; + extern void *end; + + // printf("%s: ptr %p, acc %d\n", __func__, ptr, prot); + if (va < kmem_kvm_start) + return EFAULT; + if ((va >= kmem_kvm_cur_end) && (va < kmem_k_start)) + return EFAULT; + if (va > (vaddr_t) end) + return EFAULT; + + *handled = true; return 0; }