diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-08-26 22:34:38 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2019-08-26 22:34:38 +0200 |
commit | 128ea44a89c7905612ad2fa5a61a9325ddfb5e1e (patch) | |
tree | c8d115acc86fb2e50e38af952741b725bd4366ae /sys/src/9/sgi | |
parent | 91a8d03040a3533e27f51d33bbbfed33d84b5043 (diff) |
kernel: expose no execute bit to portable mmu code as SG_NOEXEC / PTENOEXEC, add PTECACHED bits
a portable SG_NOEXEC segment attribute was added to allow
non-executable (physical) segments. which will set the
PTENOEXEC bits for putmmu().
in the future, this can be used to make non-executable
stack / bss segments.
the SG_DEVICE attribute was added to distinguish between
mmio regions and uncached memory. only matterns on arm64.
on arm, theres the issue that PTEUNCACHED would have
no bits set when using the hardware bit definitions.
this is the reason bcm, kw, teg2 and omap kernels use
arteficial PTE constants. on zynq, the XN bit was used
as a hack to give PTEUNCACHED a non-zero value and when
the bit is clear then cache attributes where added to
the pte.
to fix this, PTECACHED constant was added.
the portable mmu code in fault.c will now explicitely set
PTECACHED bits for cached memory and PTEUNCACHED for
uncached memory. that way the hardware bit definitions
can be used everywhere.
Diffstat (limited to 'sys/src/9/sgi')
-rw-r--r-- | sys/src/9/sgi/mem.h | 4 | ||||
-rw-r--r-- | sys/src/9/sgi/mmu.c | 11 |
2 files changed, 5 insertions, 10 deletions
diff --git a/sys/src/9/sgi/mem.h b/sys/src/9/sgi/mem.h index 11f34b423..d1dec7334 100644 --- a/sys/src/9/sgi/mem.h +++ b/sys/src/9/sgi/mem.h @@ -241,8 +241,8 @@ #define PTECOHERUPDW (6<<3) /* how much faster is it? mflops goes from about .206 (WT) to .37 (WB) */ -// #define PTECACHABILITY PTENONCOHERWT /* 24k erratum 48 disallows WB */ -#define PTECACHABILITY PTENONCOHERWB +// #define PTECACHED PTENONCOHERWT /* 24k erratum 48 disallows WB */ +#define PTECACHED PTENONCOHERWB #define PTEPID(n) (n) #define PTEMAPMEM (1024*1024) diff --git a/sys/src/9/sgi/mmu.c b/sys/src/9/sgi/mmu.c index 3d7e9f569..84330f9c3 100644 --- a/sys/src/9/sgi/mmu.c +++ b/sys/src/9/sgi/mmu.c @@ -180,14 +180,14 @@ retry: virt |= KMAPADDR | ((k-kpte)<<KMAPSHIFT); k->virt = virt; - pte = PPN(pg->pa)|PTECACHABILITY|PTEGLOBL|PTEWRITE|PTEVALID; + pte = PPN(pg->pa)|PTECACHED|PTEGLOBL|PTEWRITE|PTEVALID; if(virt & BY2PG) { - k->phys0 = PTEGLOBL | PTECACHABILITY; + k->phys0 = PTEGLOBL | PTECACHED; k->phys1 = pte; } else { k->phys0 = pte; - k->phys1 = PTEGLOBL | PTECACHABILITY; + k->phys1 = PTEGLOBL | PTECACHED; } putktlb(k); @@ -385,11 +385,6 @@ putmmu(ulong tlbvirt, ulong tlbphys, Page *pg) tp = newtlbpid(up); tlbvirt |= PTEPID(tp); - if((tlbphys & PTEALGMASK) != PTEUNCACHED) { - tlbphys &= ~PTEALGMASK; - tlbphys |= PTECACHABILITY; - } - entry = putstlb(tlbvirt, tlbphys); x = gettlbp(tlbvirt, tlbent); if(x < 0) x = getrandom(); |