git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
KernelLand - Better node chaching code
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
arch
/
x86
/
mm_virt.c
diff --git
a/KernelLand/Kernel/arch/x86/mm_virt.c
b/KernelLand/Kernel/arch/x86/mm_virt.c
index
868fe86
..
0eb60a1
100644
(file)
--- a/
KernelLand/Kernel/arch/x86/mm_virt.c
+++ b/
KernelLand/Kernel/arch/x86/mm_virt.c
@@
-414,7
+414,7
@@
void MM_Deallocate(tVAddr VAddr)
* \fn tPAddr MM_GetPhysAddr(tVAddr Addr)
* \brief Checks if the passed address is accesable
*/
* \fn tPAddr MM_GetPhysAddr(tVAddr Addr)
* \brief Checks if the passed address is accesable
*/
-tPAddr MM_GetPhysAddr(const void *Addr)
+tPAddr MM_GetPhysAddr(
volatile
const void *Addr)
{
tVAddr addr = (tVAddr)Addr;
if( !(gaPageDir[addr >> 22] & 1) )
{
tVAddr addr = (tVAddr)Addr;
if( !(gaPageDir[addr >> 22] & 1) )
@@
-1027,7
+1027,7
@@
void MM_FreeTemp(void *VAddr)
* \fn tVAddr MM_MapHWPages(tPAddr PAddr, Uint Number)
* \brief Allocates a contigous number of pages
*/
* \fn tVAddr MM_MapHWPages(tPAddr PAddr, Uint Number)
* \brief Allocates a contigous number of pages
*/
-
tVAddr
MM_MapHWPages(tPAddr PAddr, Uint Number)
+
void *
MM_MapHWPages(tPAddr PAddr, Uint Number)
{
int i, j;
{
int i, j;
@@
-1054,7
+1054,7
@@
tVAddr MM_MapHWPages(tPAddr PAddr, Uint Number)
MM_RefPhys( PAddr + (j<<12) );
gaPageTable[ (HW_MAP_ADDR >> 12) + i + j ] = (PAddr + (j<<12)) | 3;
}
MM_RefPhys( PAddr + (j<<12) );
gaPageTable[ (HW_MAP_ADDR >> 12) + i + j ] = (PAddr + (j<<12)) | 3;
}
- return
HW_MAP_ADDR + (i<<12
);
+ return
(void*)(HW_MAP_ADDR + (i<<12)
);
}
}
// If we don't find any, return NULL
}
}
// If we don't find any, return NULL
@@
-1069,10
+1069,10
@@
tVAddr MM_MapHWPages(tPAddr PAddr, Uint Number)
* \param PhysAddr Pointer to the location to place the physical address allocated
* \return Virtual address allocate
*/
* \param PhysAddr Pointer to the location to place the physical address allocated
* \return Virtual address allocate
*/
-
tVAddr
MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
+
void *
MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
{
tPAddr phys;
{
tPAddr phys;
-
tVAddr
ret;
+
void *
ret;
ENTER("iPages iMaxBits pPhysAddr", Pages, MaxBits, PhysAddr);
ENTER("iPages iMaxBits pPhysAddr", Pages, MaxBits, PhysAddr);
@@
-1080,7
+1080,7
@@
tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
MaxBits = PHYS_BITS;
// Sanity Check
MaxBits = PHYS_BITS;
// Sanity Check
- if(MaxBits < 12
|| !PhysAddr
) {
+ if(MaxBits < 12) {
LEAVE('i', 0);
return 0;
}
LEAVE('i', 0);
return 0;
}
@@
-1089,11
+1089,11
@@
tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
if(Pages == 1 && MaxBits >= PHYS_BITS)
{
phys = MM_AllocPhys();
if(Pages == 1 && MaxBits >= PHYS_BITS)
{
phys = MM_AllocPhys();
+ if( PhysAddr )
+ *PhysAddr = phys;
if( !phys ) {
if( !phys ) {
- *PhysAddr = 0;
LEAVE_RET('i', 0);
}
LEAVE_RET('i', 0);
}
- *PhysAddr = phys;
ret = MM_MapHWPages(phys, 1);
if(ret == 0) {
MM_DerefPhys(phys);
ret = MM_MapHWPages(phys, 1);
if(ret == 0) {
MM_DerefPhys(phys);
@@
-1101,7
+1101,7
@@
tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
return 0;
}
LEAVE('x', ret);
return 0;
}
LEAVE('x', ret);
- return ret;
+ return
(void*)
ret;
}
// Slow Allocate
}
// Slow Allocate
@@
-1122,9
+1122,10
@@
tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PhysAddr)
return 0;
}
return 0;
}
- *PhysAddr = phys;
+ if( PhysAddr )
+ *PhysAddr = phys;
LEAVE('x', ret);
LEAVE('x', ret);
- return ret;
+ return
(void*)
ret;
}
/**
}
/**
@@
-1148,6
+1149,7
@@
void MM_UnmapHWPages(tVAddr VAddr, Uint Number)
{
MM_DerefPhys( gaPageTable[ i + j ] & ~0xFFF );
gaPageTable[ i + j ] = 0;
{
MM_DerefPhys( gaPageTable[ i + j ] & ~0xFFF );
gaPageTable[ i + j ] = 0;
+ INVLPG( (tVAddr)(i+j) << 12 );
}
Mutex_Release( &glTempMappings );
}
Mutex_Release( &glTempMappings );
UCC
git Repository :: git.ucc.asn.au