memory: LOG_ERROR when falling off end of page table
This commit is contained in:
parent
6a2197806e
commit
cc368de1a0
|
@ -118,6 +118,11 @@ boost::optional<T> ReadSpecial(VAddr addr);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T Read(const VAddr vaddr) {
|
T Read(const VAddr vaddr) {
|
||||||
|
if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES) {
|
||||||
|
LOG_ERROR(HW_Memory, "Read%lu after page table @ 0x%016" PRIX64, sizeof(T) * 8, vaddr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
|
const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PageType::Unmapped:
|
case PageType::Unmapped:
|
||||||
|
@ -146,6 +151,12 @@ bool WriteSpecial(VAddr addr, const T data);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Write(const VAddr vaddr, const T data) {
|
void Write(const VAddr vaddr, const T data) {
|
||||||
|
if ((vaddr >> PAGE_BITS) >= PAGE_TABLE_NUM_ENTRIES) {
|
||||||
|
LOG_ERROR(HW_Memory, "Write%lu after page table 0x%08X @ 0x%016" PRIX64, sizeof(data) * 8,
|
||||||
|
(u32)data, vaddr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
|
const PageType type = current_page_table->attributes[vaddr >> PAGE_BITS];
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case PageType::Unmapped:
|
case PageType::Unmapped:
|
||||||
|
|
Loading…
Reference in a new issue