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.
This commit is contained in:
parent
b82f01ea69
commit
0f23130180
4 changed files with 18 additions and 9 deletions
|
@ -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. */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue