bcm64: map framebuffer write-through to allow unaligned access

This commit is contained in:
cinap_lenrek 2019-05-09 02:17:50 +02:00
parent 5a934b56f5
commit 1046d3e30b
2 changed files with 6 additions and 5 deletions

View file

@ -63,7 +63,7 @@
#define MACHADDR(n) (KTZERO-((n)+1)*MACHSIZE)
#define KTZERO (KZERO+0x80000) /* kernel text start */
#define FRAMEBUFFER 0xFFFFFFFFC0000000ULL
#define FRAMEBUFFER (0xFFFFFFFFC0000000ULL | PTEWT)
#define VIRTIO 0xFFFFFFFFE0000000ULL /* i/o registers */
#define ARMLOCAL (VIRTIO+IOSIZE)
#define VGPIO 0 /* virtual gpio for pi3 ACT LED */
@ -125,7 +125,7 @@
#define PTEWT PTEMA(MA_MEM_WT)
#define PTEUNCACHED PTEMA(MA_MEM_UC)
#define PTEDEVICE PTEMA(MA_DEV_nGnRnE)
#define PTEDEVICE PTEMA(MA_DEV_nGnRE)
/*
* Physical machine information from here on.

View file

@ -124,18 +124,19 @@ kunmap(KMap*)
uintptr
mmukmap(uintptr va, uintptr pa, usize size)
{
uintptr a, pe, off;
uintptr a, pe, off, attr;
if(va == 0)
return 0;
assert((va % PGLSZ(1)) == 0);
attr = va & PTEMA(7);
va &= -PGLSZ(1);
off = pa % PGLSZ(1);
a = va + off;
pe = (pa + size + (PGLSZ(1)-1)) & -PGLSZ(1);
while(pa < pe){
((uintptr*)L1)[PTL1X(va, 1)] = pa | PTEVALID | PTEBLOCK | PTEWRITE | PTEAF
| PTEKERNEL | PTESH(SHARE_OUTER) | PTEDEVICE;
| PTEKERNEL | PTESH(SHARE_OUTER) | attr;
pa += PGLSZ(1);
va += PGLSZ(1);
}