pc, pc64: use 64-bit physical addresses for vmap() and upaalloc()
This commit is contained in:
parent
5f3e72eb84
commit
21e4d88a51
5 changed files with 23 additions and 21 deletions
|
@ -192,10 +192,10 @@ int tas(void*);
|
|||
uvlong tscticks(uvlong*);
|
||||
ulong umballoc(ulong, ulong, ulong);
|
||||
void umbfree(ulong, ulong);
|
||||
ulong upaalloc(ulong, ulong, ulong);
|
||||
void upafree(ulong, ulong);
|
||||
uvlong upaalloc(uvlong, ulong, ulong);
|
||||
void upafree(uvlong, ulong);
|
||||
void vectortable(void);
|
||||
void* vmap(ulong, int);
|
||||
void* vmap(uvlong, int);
|
||||
int vmapsync(ulong);
|
||||
void vmxprocrestore(Proc *);
|
||||
void vmxshutdown(void);
|
||||
|
|
|
@ -244,14 +244,14 @@ rsdsearch(void)
|
|||
* does not map the physical address into virtual memory.
|
||||
* Call vmap to do that.
|
||||
*/
|
||||
ulong
|
||||
upaalloc(ulong pa, ulong size, ulong align)
|
||||
uvlong
|
||||
upaalloc(uvlong pa, ulong size, ulong align)
|
||||
{
|
||||
return (ulong)memmapalloc(pa == -1UL ? -1ULL : (uvlong)pa, size, align, MemUPA);
|
||||
return memmapalloc(pa, size, align, MemUPA);
|
||||
}
|
||||
|
||||
void
|
||||
upafree(ulong pa, ulong size)
|
||||
upafree(uvlong pa, ulong size)
|
||||
{
|
||||
memmapfree(pa, size, MemUPA);
|
||||
}
|
||||
|
|
|
@ -71,7 +71,6 @@ mmuinit(void)
|
|||
{
|
||||
ulong x, *p;
|
||||
ushort ptr[3];
|
||||
vlong v;
|
||||
|
||||
if(0) print("vpt=%#.8ux vpd=%#p kmap=%#.8ux\n",
|
||||
VPT, vpd, KMAP);
|
||||
|
@ -537,11 +536,16 @@ static void pdbunmap(ulong*, ulong, int);
|
|||
* Add a device mapping to the vmap range.
|
||||
*/
|
||||
void*
|
||||
vmap(ulong pa, int size)
|
||||
vmap(uvlong pa, int size)
|
||||
{
|
||||
int osize;
|
||||
ulong o, va;
|
||||
|
||||
if(pa < BY2PG || size <= 0 || ((pa+size) >> 32) != 0 || size > VMAPSIZE){
|
||||
print("vmap pa=%llux size=%d pc=%#p\n", pa, size, getcallerpc(&pa));
|
||||
return nil;
|
||||
}
|
||||
|
||||
/*
|
||||
* might be asking for less than a page.
|
||||
*/
|
||||
|
@ -549,17 +553,12 @@ vmap(ulong pa, int size)
|
|||
o = pa & (BY2PG-1);
|
||||
pa -= o;
|
||||
size += o;
|
||||
|
||||
size = ROUND(size, BY2PG);
|
||||
if(pa == 0){
|
||||
print("vmap pa=0 pc=%#p\n", getcallerpc(&pa));
|
||||
return nil;
|
||||
}
|
||||
ilock(&vmaplock);
|
||||
if((va = vmapalloc(size)) == 0
|
||||
|| pdbmap(MACHP(0)->pdb, pa|PTEUNCACHED|PTEWRITE, va, size) < 0){
|
||||
iunlock(&vmaplock);
|
||||
return 0;
|
||||
return nil;
|
||||
}
|
||||
iunlock(&vmaplock);
|
||||
/* avoid trap on local processor
|
||||
|
|
|
@ -191,12 +191,12 @@ int tas(void*);
|
|||
uvlong tscticks(uvlong*);
|
||||
ulong umballoc(ulong, ulong, ulong);
|
||||
void umbfree(ulong, ulong);
|
||||
ulong upaalloc(ulong, ulong, ulong);
|
||||
void upafree(ulong, ulong);
|
||||
uvlong upaalloc(uvlong, ulong, ulong);
|
||||
void upafree(uvlong, ulong);
|
||||
void vectortable(void);
|
||||
void vmxprocrestore(Proc *);
|
||||
void vmxshutdown(void);
|
||||
void* vmap(uintptr, int);
|
||||
void* vmap(uvlong, int);
|
||||
void vunmap(void*, int);
|
||||
void wbinvd(void);
|
||||
void writeconf(void);
|
||||
|
|
|
@ -579,14 +579,17 @@ kunmap(KMap *k)
|
|||
* synchronization is being done.
|
||||
*/
|
||||
void*
|
||||
vmap(uintptr pa, int size)
|
||||
vmap(uvlong pa, int size)
|
||||
{
|
||||
uintptr va;
|
||||
int o;
|
||||
|
||||
if(pa+size > VMAPSIZE)
|
||||
return 0;
|
||||
if(pa < BY2PG || size <= 0 || -pa < size || pa+size > VMAPSIZE){
|
||||
print("vmap pa=%llux size=%d pc=%#p\n", pa, size, getcallerpc(&pa));
|
||||
return nil;
|
||||
}
|
||||
va = pa+VMAP;
|
||||
|
||||
/*
|
||||
* might be asking for less than a page.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue