ref: 1bf5b4ad4eb7f9f3b65c147777ab43ac2e62f233
parent: 0dab8869adf16f425b0cbd13eef1a8df4d2823f0
author: cinap_lenrek <[email protected]>
date: Thu Jun 18 08:16:54 EDT 2015
zynq: use KADDR() for kmap() if we can avoiding the mapping
--- a/sys/src/9/zynq/mmu.c
+++ b/sys/src/9/zynq/mmu.c
@@ -286,6 +286,8 @@
ulong *e, *v;
int i, s;
+ if(cankaddr(page->pa))
+ return (KMap*)KADDR(page->pa);
if(up == nil)
panic("kmap: up=0 pc=%#.8lux", getcallerpc(&page));
if(up->l1 == nil)
@@ -329,6 +331,8 @@
ulong *e;
va = (uintptr) arg;
+ if(va >= KZERO)
+ return;
if(up->l1 == nil || (up->l1->va[L1X(KMAP)] & 3) == 0)
panic("kunmap: no kmaps");
if(va < KMAP || va >= KMAP + NKMAP * BY2PG)