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
Both - Merge signal lists
[tpg/acess2.git]
/
KernelLand
/
Kernel
/
include
/
tpl_mm_phys_bitmap.h
diff --git
a/KernelLand/Kernel/include/tpl_mm_phys_bitmap.h
b/KernelLand/Kernel/include/tpl_mm_phys_bitmap.h
index
39444d9
..
106efd7
100644
(file)
--- a/
KernelLand/Kernel/include/tpl_mm_phys_bitmap.h
+++ b/
KernelLand/Kernel/include/tpl_mm_phys_bitmap.h
@@
-27,6
+27,7
@@
int MM_int_GetRangeID( tPAddr Addr );
int MM_int_GetMapEntry( void *Data, int Index, tPAddr *Start, tPAddr *Length );
void MM_Tpl_InitPhys(int MaxRAMPage, void *MemoryMap);
int MM_int_GetRangeID( tPAddr Addr );
int MM_int_GetMapEntry( void *Data, int Index, tPAddr *Start, tPAddr *Length );
void MM_Tpl_InitPhys(int MaxRAMPage, void *MemoryMap);
+void MM_DumpStatistics(void);
// === GLOBALS ===
tMutex glPhysicalPages;
// === GLOBALS ===
tMutex glPhysicalPages;
@@
-82,7
+83,7
@@
void MM_Tpl_InitPhys(int MaxRAMPage, void *MemoryMap)
bitmap_page &= ~(PAGE_SIZE-1);
// Only need to allocate bitmaps
bitmap_page &= ~(PAGE_SIZE-1);
// Only need to allocate bitmaps
- if( !MM_GetPhysAddr( bitmap_page ) ) {
+ if( !MM_GetPhysAddr(
(void*)
bitmap_page ) ) {
if( !MM_Allocate( bitmap_page ) ) {
Log_KernelPanic("PMM", "Out of memory during init, this is bad");
return ;
if( !MM_Allocate( bitmap_page ) ) {
Log_KernelPanic("PMM", "Out of memory during init, this is bad");
return ;
@@
-112,6
+113,11
@@
void MM_Tpl_InitPhys(int MaxRAMPage, void *MemoryMap)
LEAVE('-');
}
LEAVE('-');
}
+void MM_DumpStatistics(void)
+{
+ // TODO: PM Statistics for tpl_mm_phys_bitmap
+}
+
/**
* \brief Allocate a contiguous range of physical pages with a maximum
* bit size of \a MaxBits
/**
* \brief Allocate a contiguous range of physical pages with a maximum
* bit size of \a MaxBits
@@
-214,7
+220,7
@@
tPAddr MM_AllocPhysRange(int Pages, int MaxBits)
LOG("if( MM_GetPhysAddr( %p ) )", &gaiPageReferences[addr]);
// Mark as referenced if the reference count page is valid
LOG("if( MM_GetPhysAddr( %p ) )", &gaiPageReferences[addr]);
// Mark as referenced if the reference count page is valid
- if( MM_GetPhysAddr(
(tVAddr)
&gaiPageReferences[addr] ) ) {
+ if( MM_GetPhysAddr( &gaiPageReferences[addr] ) ) {
gaiPageReferences[addr] = 1;
}
}
gaiPageReferences[addr] = 1;
}
}
@@
-270,7
+276,7
@@
tPAddr MM_AllocPhys(void)
tPAddr ret = 0;
for( ret = 0; ret < giMaxPhysPage; ret ++ )
{
tPAddr ret = 0;
for( ret = 0; ret < giMaxPhysPage; ret ++ )
{
- if( !MM_GetPhysAddr(
(tVAddr)
&gaPageBitmaps[ret/32] ) ) {
+ if( !MM_GetPhysAddr( &gaPageBitmaps[ret/32] ) ) {
ret += PAGE_SIZE*8;
continue ;
}
ret += PAGE_SIZE*8;
continue ;
}
@@
-311,13
+317,13
@@
void MM_RefPhys(tPAddr PAddr)
if( gaPageBitmaps[page / 32] == 0 )
gaSuperBitmap[page / (32*32)] &= ~(1LL << ((page / 32) & 31));
#endif
if( gaPageBitmaps[page / 32] == 0 )
gaSuperBitmap[page / (32*32)] &= ~(1LL << ((page / 32) & 31));
#endif
- if( MM_GetPhysAddr( refpage ) )
+ if( MM_GetPhysAddr(
(void*)
refpage ) )
gaiPageReferences[page] = 1;
}
else
{
// Reference again
gaiPageReferences[page] = 1;
}
else
{
// Reference again
- if( !MM_GetPhysAddr( refpage ) )
+ if( !MM_GetPhysAddr(
(void*)
refpage ) )
{
int pages_per_page, basepage, i;
if( MM_Allocate(refpage) == 0 ) {
{
int pages_per_page, basepage, i;
if( MM_Allocate(refpage) == 0 ) {
@@
-344,11
+350,17
@@
void MM_RefPhys(tPAddr PAddr)
int MM_GetRefCount(tPAddr PAddr)
{
PAddr >>= 12;
int MM_GetRefCount(tPAddr PAddr)
{
PAddr >>= 12;
- if( MM_GetPhysAddr(
(tVAddr)
&gaiPageReferences[PAddr] ) ) {
+ if( MM_GetPhysAddr( &gaiPageReferences[PAddr] ) ) {
return gaiPageReferences[PAddr];
}
return gaiPageReferences[PAddr];
}
- if( gaPageBitmaps[ PAddr / 32 ] & (1LL << (PAddr&31)) ) {
+ Uint32 *bm = &gaPageBitmaps[ PAddr / 32 ];
+ if( !MM_GetPhysAddr(bm) ) {
+ Log_Error("MMPhys", "MM_GetRefCount: bitmap for ppage 0x%x not mapped %p",
+ PAddr, bm);
+ return 0;
+ }
+ if( (*bm) & (1LL << (PAddr&31)) ) {
return 1;
}
return 1;
}
@@
-366,7
+378,7
@@
void MM_DerefPhys(tPAddr PAddr)
ENTER("PPAddr", PAddr);
ENTER("PPAddr", PAddr);
- if( MM_GetPhysAddr(
(tVAddr)
&gaiPageReferences[page] ) )
+ if( MM_GetPhysAddr( &gaiPageReferences[page] ) )
{
if( gaiPageReferences[page] > 0 )
gaiPageReferences[ page ] --;
{
if( gaiPageReferences[page] > 0 )
gaiPageReferences[ page ] --;
@@
-378,7
+390,7
@@
void MM_DerefPhys(tPAddr PAddr)
else
gaPageBitmaps[ page / 32 ] |= 1 << (page&31);
// Clear node if needed
else
gaPageBitmaps[ page / 32 ] |= 1 << (page&31);
// Clear node if needed
- if( MM_GetPhysAddr(
(tVAddr)
&gapPageNodes[page] ) ) {
+ if( MM_GetPhysAddr( &gapPageNodes[page] ) ) {
gapPageNodes[page] = NULL;
// TODO: Catch when all pages in this range are not using nodes
}
gapPageNodes[page] = NULL;
// TODO: Catch when all pages in this range are not using nodes
}
@@
-409,7
+421,7
@@
int MM_SetPageNode(tPAddr PAddr, void *Node)
if( !MM_GetRefCount(PAddr) ) return 1;
if( !MM_GetRefCount(PAddr) ) return 1;
- if( !MM_GetPhysAddr(
node_page
) ) {
+ if( !MM_GetPhysAddr(
(void*)node_page
) ) {
if( !MM_Allocate(node_page) )
return -1;
memset( (void*)node_page, 0, PAGE_SIZE );
if( !MM_Allocate(node_page) )
return -1;
memset( (void*)node_page, 0, PAGE_SIZE );
@@
-424,7
+436,7
@@
int MM_GetPageNode(tPAddr PAddr, void **Node)
if( !MM_GetRefCount(PAddr) ) return 1;
PAddr >>= 12;
if( !MM_GetRefCount(PAddr) ) return 1;
PAddr >>= 12;
- if( !MM_GetPhysAddr(
(tVAddr)
&gapPageNodes[PAddr] ) ) {
+ if( !MM_GetPhysAddr( &gapPageNodes[PAddr] ) ) {
*Node = NULL;
return 0;
}
*Node = NULL;
return 0;
}
UCC
git Repository :: git.ucc.asn.au