From: Kees Jongenburger Date: Fri, 13 Sep 2013 07:40:20 +0000 (+0200) Subject: arm:caching introduce _CACHED defines X-Git-Tag: v3.3.0~781 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/syslog.conf.5.html?a=commitdiff_plain;h=0f2313018019f3441fb687a92dd366272394f5f1;p=minix.git arm:caching introduce _CACHED defines Introduce ARM_VM_SECTION_CACHED and ARM_VM_PTE_CACHED to ensure we are using the correct caching flags everywhere. --- diff --git a/include/arch/earm/include/vm.h b/include/arch/earm/include/vm.h index 2029eb19b..d26399bc5 100644 --- a/include/arch/earm/include/vm.h +++ b/include/arch/earm/include/vm.h @@ -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. */ diff --git a/kernel/arch/earm/pg_utils.c b/kernel/arch/earm/pg_utils.c index b2f383e69..512623df1 100644 --- a/kernel/arch/earm/pg_utils.c +++ b/kernel/arch/earm/pg_utils.c @@ -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) diff --git a/servers/vm/arch/i386/pagetable.c b/servers/vm/arch/i386/pagetable.c index 76d285195..6ee9dba47 100644 --- a/servers/vm/arch/i386/pagetable.c +++ b/servers/vm/arch/i386/pagetable.c @@ -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++; diff --git a/servers/vm/utility.c b/servers/vm/utility.c index bac017b48..dfda7902a 100644 --- a/servers/vm/utility.c +++ b/servers/vm/utility.c @@ -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);