#include <VirtualMemory.h>
Onikiri::EmulatorUtility::PageTableのコラボレーション図
Public メソッド | |
void | AddMap (u64 targetAddr, u8 *hostAddr, VIRTUAL_MEMORY_ATTR_TYPE attr) |
void | CopyMap (u64 dstTargetAddr, u64 srcTargetAddr, VIRTUAL_MEMORY_ATTR_TYPE dstAttr) |
bool | GetMap (u64 targetAddr, PageTableEntry *page) |
int | GetOffsetBits () const |
u64 | GetOffsetMask () const |
int | GetPageReferenceCount (u64 targetAddr) |
size_t | GetPageSize () const |
bool | IsMapped (u64 targetAddr) const |
PageTable (int offsetBits) | |
int | RemoveMap (u64 targetAddr) |
bool | SetMap (u64 targetAddr, const PageTableEntry &page) |
void * | TargetToHost (u64 addr) |
~PageTable () | |
構成 | |
class | AddrHash |
VirtualMemory.h の 85 行で定義されています。
PageTable::PageTable | ( | int | offsetBits | ) | [explicit] |
VirtualMemory.cpp の 104 行で定義されています。
00104 : 00105 m_map( 00106 PAGE_TABLE_MAP_INITIAL_BUCKET_COUNT, 00107 AddrHash(offsetBits) 00108 ), 00109 m_offsetBits(offsetBits), 00110 m_offsetMask(~(u64)0 << offsetBits), 00111 m_tlb(offsetBits), 00112 m_phyPagePool( sizeof(PhysicalMemoryPage) ) 00113 { 00114 }
PageTable::~PageTable | ( | ) |
VirtualMemory.cpp の 116 行で定義されています。
00117 { 00118 // Release PhysicalMemoryPage instances. 00119 for( map_type::iterator i = m_map.begin(); i != m_map.end(); ++i ){ 00120 PageTableEntry& logPage = i->second; 00121 PhysicalMemoryPage* phyPage = logPage.phyPage; 00122 phyPage->refCount--; 00123 if( phyPage->refCount == 0 ){ 00124 m_phyPagePool.free( phyPage ); 00125 } 00126 } 00127 m_map.clear(); 00128 }
void PageTable::AddMap | ( | u64 | targetAddr, | |
u8 * | hostAddr, | |||
VIRTUAL_MEMORY_ATTR_TYPE | attr | |||
) |
VirtualMemory.cpp の 168 行で定義されています。
参照先 Onikiri::EmulatorUtility::PageTableEntry::attr・Onikiri::EmulatorUtility::TLB::Flush()・Onikiri::EmulatorUtility::PageTableEntry::phyPage・Onikiri::EmulatorUtility::PhysicalMemoryPage::ptr・Onikiri::EmulatorUtility::PhysicalMemoryPage::refCount.
参照元 Onikiri::EmulatorUtility::VirtualMemory::AssignPhysicalMemory().
00169 { 00170 PageTableEntry logPage; 00171 PhysicalMemoryPage* phyPage = (PhysicalMemoryPage*)m_phyPagePool.malloc(); 00172 00173 phyPage->ptr = hostAddr; 00174 phyPage->refCount = 1; 00175 00176 logPage.phyPage = phyPage; 00177 logPage.attr = attr; 00178 00179 m_map[ targetAddr & m_offsetMask ] = logPage; 00180 m_tlb.Flush(); 00181 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
void PageTable::CopyMap | ( | u64 | dstTargetAddr, | |
u64 | srcTargetAddr, | |||
VIRTUAL_MEMORY_ATTR_TYPE | dstAttr | |||
) |
VirtualMemory.cpp の 184 行で定義されています。
参照先 Onikiri::EmulatorUtility::PageTableEntry::attr・Onikiri::EmulatorUtility::TLB::Flush()・IsMapped()・Onikiri::EmulatorUtility::PageTableEntry::phyPage・THROW_RUNTIME_ERROR.
参照元 Onikiri::EmulatorUtility::VirtualMemory::SetPhysicalMemoryMapping().
00185 { 00186 if( !IsMapped( srcTargetAddr ) ){ 00187 THROW_RUNTIME_ERROR("An unassigned page is copied."); 00188 } 00189 00190 map_type::iterator e = m_map.find( srcTargetAddr & m_offsetMask ); 00191 e->second.phyPage->refCount++; 00192 00193 PageTableEntry newEntry; 00194 newEntry.phyPage = e->second.phyPage; 00195 newEntry.attr = dstAttr; // Set new attribute. 00196 m_map[ dstTargetAddr & m_offsetMask ] = newEntry; 00197 00198 m_tlb.Flush(); 00199 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
bool PageTable::GetMap | ( | u64 | targetAddr, | |
PageTableEntry * | page | |||
) |
VirtualMemory.cpp の 201 行で定義されています。
参照先 Onikiri::EmulatorUtility::TLB::Lookup()・Onikiri::EmulatorUtility::TLB::Write().
参照元 Onikiri::EmulatorUtility::VirtualMemory::AssignAndCopyPhysicalMemory()・Onikiri::EmulatorUtility::VirtualMemory::CopyPageOnWrite()・Onikiri::EmulatorUtility::VirtualMemory::FreePhysicalMemory()・GetPageReferenceCount()・Onikiri::EmulatorUtility::VirtualMemory::ReadMemory()・Onikiri::EmulatorUtility::VirtualMemory::SetPageAttribute()・Onikiri::EmulatorUtility::VirtualMemory::WriteMemory().
00202 { 00203 if( m_tlb.Lookup( targetAddr, page ) ){ 00204 return true; 00205 } 00206 00207 map_type::const_iterator e = m_map.find(targetAddr & m_offsetMask); 00208 if (e == m_map.end()){ 00209 return false; 00210 } 00211 else{ 00212 m_tlb.Write( targetAddr, e->second ); 00213 *page = e->second; 00214 return true; 00215 } 00216 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
int PageTable::GetOffsetBits | ( | ) | const |
u64 PageTable::GetOffsetMask | ( | ) | const |
VirtualMemory.cpp の 137 行で定義されています。
参照元 Onikiri::EmulatorUtility::VirtualMemory::AssignAndCopyPhysicalMemory().
Here is the caller graph for this function:
int PageTable::GetPageReferenceCount | ( | u64 | targetAddr | ) |
VirtualMemory.cpp の 232 行で定義されています。
参照先 GetMap()・Onikiri::EmulatorUtility::PageTableEntry::phyPage・Onikiri::EmulatorUtility::PhysicalMemoryPage::refCount.
00233 { 00234 PageTableEntry page; 00235 if( GetMap( targetAddr, &page ) ){ 00236 return page.phyPage->refCount; 00237 } 00238 else{ 00239 return 0; 00240 } 00241 }
関数の呼び出しグラフ:
size_t PageTable::GetPageSize | ( | ) | const |
VirtualMemory.cpp の 142 行で定義されています。
参照元 Onikiri::EmulatorUtility::VirtualMemory::GetPageSize().
Here is the caller graph for this function:
bool PageTable::IsMapped | ( | u64 | targetAddr | ) | const |
VirtualMemory.cpp の 262 行で定義されています。
参照先 Onikiri::EmulatorUtility::TLB::Lookup().
参照元 Onikiri::EmulatorUtility::VirtualMemory::AssignPhysicalMemory()・CopyMap()・Onikiri::EmulatorUtility::VirtualMemory::FreePhysicalMemory()・Onikiri::EmulatorUtility::VirtualMemory::SetPhysicalMemoryMapping().
00263 { 00264 PageTableEntry entry; 00265 if( m_tlb.Lookup( targetAddr, &entry ) ){ 00266 return true; 00267 } 00268 00269 return (m_map.find(targetAddr & m_offsetMask) != m_map.end()); 00270 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
int PageTable::RemoveMap | ( | u64 | targetAddr | ) |
VirtualMemory.cpp の 243 行で定義されています。
参照先 Onikiri::EmulatorUtility::TLB::Flush().
参照元 Onikiri::EmulatorUtility::VirtualMemory::AssignAndCopyPhysicalMemory()・Onikiri::EmulatorUtility::VirtualMemory::FreePhysicalMemory().
00244 { 00245 map_type::iterator e = m_map.find(targetAddr & m_offsetMask); 00246 00247 int refCount = 0; 00248 if( e != m_map.end() ){ 00249 PhysicalMemoryPage* phyPage = e->second.phyPage; 00250 phyPage->refCount--; 00251 refCount = phyPage->refCount; 00252 if( refCount == 0 ){ 00253 m_phyPagePool.free( phyPage ); 00254 } 00255 m_map.erase(e); 00256 m_tlb.Flush(); 00257 return refCount; 00258 } 00259 return -1; 00260 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
bool PageTable::SetMap | ( | u64 | targetAddr, | |
const PageTableEntry & | page | |||
) |
VirtualMemory.cpp の 218 行で定義されています。
参照先 Onikiri::EmulatorUtility::TLB::Write().
参照元 Onikiri::EmulatorUtility::VirtualMemory::SetPageAttribute().
00219 { 00220 map_type::iterator e = m_map.find(targetAddr & m_offsetMask); 00221 if (e == m_map.end()){ 00222 return false; 00223 } 00224 else{ 00225 m_tlb.Write( targetAddr, page ); 00226 e->second = page; 00227 return true; 00228 } 00229 }
関数の呼び出しグラフ:
Here is the caller graph for this function:
void * PageTable::TargetToHost | ( | u64 | addr | ) |
VirtualMemory.cpp の 147 行で定義されています。
参照先 Onikiri::EmulatorUtility::TLB::Lookup()・Onikiri::EmulatorUtility::PageTableEntry::phyPage・Onikiri::EmulatorUtility::PhysicalMemoryPage::ptr・THROW_RUNTIME_ERROR・Onikiri::EmulatorUtility::TLB::Write().
参照元 Onikiri::EmulatorUtility::VirtualMemory::MemCopyToHost()・Onikiri::EmulatorUtility::VirtualMemory::MemCopyToTarget()・Onikiri::EmulatorUtility::VirtualMemory::ReadMemory()・Onikiri::EmulatorUtility::VirtualMemory::TargetMemset()・Onikiri::EmulatorUtility::VirtualMemory::WriteMemory().
00148 { 00149 PageTableEntry entry; 00150 if( m_tlb.Lookup( targetAddr, &entry ) ){ 00151 return static_cast<u8*>(entry.phyPage->ptr) + (targetAddr & ~m_offsetMask); 00152 } 00153 00154 map_type::const_iterator e = m_map.find(targetAddr & m_offsetMask); 00155 00156 if (e == m_map.end()) { 00157 THROW_RUNTIME_ERROR("unassigned page referred."); 00158 return 0; 00159 } 00160 else{ 00161 // Update TLB 00162 entry = e->second; 00163 m_tlb.Write( targetAddr, entry ); 00164 return static_cast<u8*>(entry.phyPage->ptr) + (targetAddr & ~m_offsetMask); 00165 } 00166 }
関数の呼び出しグラフ:
Here is the caller graph for this function: