Fix mmap_hints regression test for arm64

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fix mmap_hints regression test for arm64

mbuhl-2

Hi,

the folowing patch fixes the uvm_mmap_hints regression test on arm64:

ot10# make
./mmap_hint
1: Checking hint 0x0 mmap
    -> 0x1d978c9000
2: Checking hint page below VM_MAXUSER_ADDRESS 0x7fffff7000 mmap
    -> 0x7fffff7000
3: Checking hint VM_MIN_ADDRESS 0x1000 mmap
    -> 0x1000
4: Checking hint 0x1000 mmap, which is in use
    -> 0x2000

Previously it was not possible to compile the test, see
http://bluhm.genua.de/regress/results/2019-02-07T16%3A49%3A48Z/logs/sys/uvm/mmap_hint/make.log

I added the ifdefs because they are also there on amd64.

Thanks,
Moritz Buhl

Index: sys//arch/arm64/include/pmap.h
===================================================================
RCS file: /mount/openbsd/cvs/src/sys/arch/arm64/include/pmap.h,v
retrieving revision 1.11
diff -u -p -r1.11 pmap.h
--- sys//arch/arm64/include/pmap.h 16 May 2018 09:07:45 -0000 1.11
+++ sys//arch/arm64/include/pmap.h 12 Feb 2019 16:44:03 -0000
@@ -17,15 +17,12 @@
 #ifndef _ARM64_PMAP_H_
 #define _ARM64_PMAP_H_
 
+#ifndef _LOCORE
 #include <sys/mutex.h>
-
+#include <sys/queue.h>
 #include <machine/pte.h>
+#endif
 
-#define PMAP_PA_MASK ~((paddr_t)PAGE_MASK) /* to remove the flags */
-#define PMAP_NOCACHE 0x1 /* non-cacheable memory */
-#define PMAP_DEVICE 0x2 /* device memory */
-
-typedef struct pmap *pmap_t;
 
 /* V->P mapping data */
 #define VP_IDX0_CNT 512
@@ -41,7 +38,6 @@ typedef struct pmap *pmap_t;
 #define VP_IDX3_MASK (VP_IDX3_CNT-1)
 #define VP_IDX3_POS 12
 
-void pmap_kenter_cache(vaddr_t va, paddr_t pa, vm_prot_t prot, int cacheable);
 /* cache flags */
 #define PMAP_CACHE_CI (PMAP_MD0) /* cache inhibit */
 #define PMAP_CACHE_WT (PMAP_MD1) /* writethru */
@@ -53,20 +49,16 @@ void pmap_kenter_cache(vaddr_t va, paddr
 #define PTED_VA_WIRED_M (PMAP_MD3 << 1)
 #define PTED_VA_EXEC_M (PMAP_MD3 << 2)
 
-#define PG_PMAP_MOD PG_PMAP0
-#define PG_PMAP_REF PG_PMAP1
-#define PG_PMAP_EXE PG_PMAP2
-
-// [NCPUS]
-extern paddr_t zero_page;
-extern paddr_t copy_src_page;
-extern paddr_t copy_dst_page;
-
-void pagezero_cache(vaddr_t);
 
 /*
  * Pmap stuff
  */
+#if defined(_KERNEL) && !defined(_LOCORE)
+
+void pmap_kenter_cache(vaddr_t va, paddr_t pa, vm_prot_t prot, int cacheable);
+
+typedef struct pmap *pmap_t;
+
 struct pmap {
  struct mutex pm_mtx;
  union {
@@ -81,6 +73,20 @@ struct pmap {
  struct pmap_statistics  pm_stats; /* pmap statistics */
 };
 
+#define PMAP_PA_MASK ~((paddr_t)PAGE_MASK) /* to remove the flags */
+#define PMAP_NOCACHE 0x1 /* non-cacheable memory */
+#define PMAP_DEVICE 0x2 /* device memory */
+
+#define PG_PMAP_MOD PG_PMAP0
+#define PG_PMAP_REF PG_PMAP1
+#define PG_PMAP_EXE PG_PMAP2
+
+// [NCPUS]
+extern paddr_t zero_page;
+extern paddr_t copy_src_page;
+extern paddr_t copy_dst_page;
+
+void pagezero_cache(vaddr_t);
 
 extern struct pmap kernel_pmap_;
 #define pmap_kernel()   (&kernel_pmap_)
@@ -105,8 +111,9 @@ int pmap_fault_fixup(pmap_t, vaddr_t, vm
 void pmap_postinit(void);
 void pmap_map_early(paddr_t, psize_t);
 
-#ifndef _LOCORE
+#endif /* _KERNEL && !_LOCORE */
 
+#ifndef _LOCORE
 #define __HAVE_VM_PAGE_MD
 struct vm_page_md {
  struct mutex pv_mtx;