]> Zhao Yanbai Git Server - minix.git/commitdiff
arm:caching introduce _CACHED defines 58/858/1
authorKees Jongenburger <kees.jongenburger@gmail.com>
Fri, 13 Sep 2013 07:40:20 +0000 (09:40 +0200)
committerKees Jongenburger <kees.jongenburger@gmail.com>
Thu, 26 Sep 2013 09:54:36 +0000 (11:54 +0200)
Introduce ARM_VM_SECTION_CACHED and ARM_VM_PTE_CACHED to ensure we
are using the correct caching flags everywhere.

include/arch/earm/include/vm.h
kernel/arch/earm/pg_utils.c
servers/vm/arch/i386/pagetable.c
servers/vm/utility.c

index 2029eb19bab3d878c1d5d1943ab2c5ca2dfccb94..d26399bc5165869766e428ce9b51d0a13ba5f532 100644 (file)
@@ -48,6 +48,8 @@ arm/vm.h
 #define ARM_VM_PTE_WB          (ARM_VM_PTE_TEX2 | ARM_VM_PTE_TEX0 | ARM_VM_PTE_B)
 /* inner and outer write-through, no write-allocate */
 #define ARM_VM_PTE_WT          (ARM_VM_PTE_TEX2 | ARM_VM_PTE_TEX1 | ARM_VM_PTE_C)
+
+#define ARM_VM_PTE_CACHED ARM_VM_PTE_WT
 /* shareable device */
 #define ARM_VM_PTE_DEVICE      (ARM_VM_PTE_B)
 
@@ -75,6 +77,8 @@ arm/vm.h
 /* inner and outer write-through, no write-allocate */
 #define ARM_VM_SECTION_WT      (ARM_VM_SECTION_TEX2 | ARM_VM_SECTION_TEX1 | ARM_VM_SECTION_C)
 /* shareable device */
+
+#define ARM_VM_SECTION_CACHED ARM_VM_SECTION_WT
 #define ARM_VM_SECTION_DEVICE  (ARM_VM_SECTION_B)
 
 /* Page directory specific flags. */
index b2f383e695e5b7b0c91f8d922f8c35e96d31f0c8..512623df1697f7334cd0639db53fe0bb85c8c063 100644 (file)
@@ -176,7 +176,7 @@ int pg_mapkernel(void)
                pagedir[pde] = (kern_phys & ARM_VM_SECTION_MASK) | ARM_VM_SECTION
                        | ARM_VM_SECTION_SUPER
                        | ARM_VM_SECTION_DOMAIN
-                       | ARM_VM_SECTION_WT;
+                       | ARM_VM_SECTION_CACHED;
                mapped += ARM_SECTION_SIZE;
                kern_phys += ARM_SECTION_SIZE;
                pde++;
@@ -270,7 +270,7 @@ void pg_map(phys_bytes phys, vir_bytes vaddr, vir_bytes vaddr_end,
                assert(pt);
                pt[pte] = (source & ARM_VM_PTE_MASK)
                        | ARM_VM_PAGETABLE
-                       | ARM_VM_PTE_WT
+                       | ARM_VM_PTE_CACHED
                        | ARM_VM_PTE_USER;
                vaddr += ARM_PAGE_SIZE;
                if(phys != PG_ALLOCATEME)
index 76d285195e3bad39b0e71169b3aa471fc0db519e..6ee9dba478183a36d92a2358a83f18e7ad13811d 100644 (file)
@@ -301,7 +301,7 @@ void *vm_mappages(phys_bytes p, int pages)
        if((r=pt_writemap(vmprocess, pt, loc, p, VM_PAGE_SIZE*pages,
                ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER | ARCH_VM_PTE_RW
 #if defined(__arm__)
-               | ARM_VM_PTE_WT
+               | ARM_VM_PTE_CACHED
 #endif
                , 0)) != OK) {
                printf("vm_mappages writemap failed\n");
@@ -409,7 +409,8 @@ void vm_pagelock(void *vir, int lockflag)
 #if defined(__arm__)
        else
                flags |= ARCH_VM_PTE_RO;
-       flags |= ARM_VM_PTE_WT ;
+
+       flags |= ARM_VM_PTE_CACHED ;
 #endif
 
        /* Update flags. */
@@ -689,7 +690,7 @@ int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
 #elif defined(__arm__)
        if((r=pt_writemap(dst_vmp, &dst_vmp->vm_pt, viraddr, physaddr, ARCH_PAGEDIR_SIZE,
                ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER |
-               ARM_VM_PTE_WT ,
+               ARM_VM_PTE_CACHED ,
 #endif
                WMF_OVERWRITE)) != OK) {
                return r;
@@ -715,7 +716,7 @@ int pt_ptmap(struct vmproc *src_vmp, struct vmproc *dst_vmp)
                if((r=pt_writemap(dst_vmp, &dst_vmp->vm_pt, viraddr, physaddr, VM_PAGE_SIZE,
                        ARCH_VM_PTE_PRESENT | ARCH_VM_PTE_USER | ARCH_VM_PTE_RW
 #ifdef __arm__
-                       | ARM_VM_PTE_WT
+                       | ARM_VM_PTE_CACHED
 #endif
                        ,
                        WMF_OVERWRITE)) != OK) {
@@ -1193,6 +1194,7 @@ void pt_init(void)
 #elif defined(__arm__)
                        pdm->val = (ph & ARCH_VM_PDE_MASK)
                                | ARCH_VM_PDE_PRESENT
+                               | ARM_VM_PTE_CACHED
                                | ARM_VM_PDE_DOMAIN; //LSC FIXME
 #endif
                }
@@ -1216,6 +1218,7 @@ void pt_init(void)
 #elif defined(__arm__)
        if(sys_vmctl_get_pdbr(SELF, &myttbr) != OK)
 #endif
+
                panic("VM: sys_vmctl_get_pdbr failed");
 #if defined(__i386__)
        if(sys_vircopy(NONE, mypdbr, SELF,
@@ -1334,7 +1337,7 @@ int pt_bind(pt_t *pt, struct vmproc *who)
 #endif
 
        /* Tell kernel about new page table root. */
-       return sys_vmctl_set_addrspace(who->vm_endpoint, pt->pt_dir_phys, pdes);
+       return sys_vmctl_set_addrspace(who->vm_endpoint, pt->pt_dir_phys , pdes);
 }
 
 /*===========================================================================*
@@ -1377,7 +1380,7 @@ int pt_mapkernel(pt_t *pt)
                pt->pt_dir[kern_pde] = (addr & ARM_VM_SECTION_MASK)
                        | ARM_VM_SECTION
                        | ARM_VM_SECTION_DOMAIN
-                       | ARM_VM_SECTION_WT
+                       | ARM_VM_SECTION_CACHED
                        | ARM_VM_SECTION_SUPER;
 #endif
                kern_pde++;
index bac017b48d09246a8816aeeb7b29dae75c106f48..dfda7902a8bb28434215e0637c2362d4d51fd68a 100644 (file)
@@ -295,6 +295,8 @@ int minix_munmap(void * addr, size_t len)
 
 int brk(void *addr)
 {
+       /* brk is a special case function to allow vm itself to
+          allocate memory in it's own (cacheable) HEAP */
        vir_bytes target = roundup((vir_bytes)addr, VM_PAGE_SIZE), v;
        extern char _end;
        extern char *_brksize;
@@ -312,7 +314,7 @@ int brk(void *addr)
                        | ARCH_VM_PTE_USER
                        | ARCH_VM_PTE_RW
 #if defined(__arm__)
-                       | ARM_VM_PTE_WB
+                       | ARM_VM_PTE_CACHED
 #endif
                        , 0) != OK) {
                        free_mem(newpage, 1);