summaryrefslogtreecommitdiff
path: root/src/core/memory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/memory.cpp')
-rw-r--r--src/core/memory.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/core/memory.cpp b/src/core/memory.cpp
index ce62666d7..4e34d8334 100644
--- a/src/core/memory.cpp
+++ b/src/core/memory.cpp
@@ -109,7 +109,7 @@ static std::set<MemoryHookPointer> GetSpecialHandlers(const PageTable& page_tabl
109} 109}
110 110
111static std::set<MemoryHookPointer> GetSpecialHandlers(VAddr vaddr, u64 size) { 111static std::set<MemoryHookPointer> GetSpecialHandlers(VAddr vaddr, u64 size) {
112 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 112 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
113 return GetSpecialHandlers(page_table, vaddr, size); 113 return GetSpecialHandlers(page_table, vaddr, size);
114} 114}
115 115
@@ -202,7 +202,7 @@ bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr) {
202} 202}
203 203
204bool IsValidVirtualAddress(const VAddr vaddr) { 204bool IsValidVirtualAddress(const VAddr vaddr) {
205 return IsValidVirtualAddress(*Kernel::g_current_process, vaddr); 205 return IsValidVirtualAddress(*Core::CurrentProcess(), vaddr);
206} 206}
207 207
208bool IsValidPhysicalAddress(const PAddr paddr) { 208bool IsValidPhysicalAddress(const PAddr paddr) {
@@ -364,7 +364,7 @@ void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_
364} 364}
365 365
366void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) { 366void ReadBlock(const VAddr src_addr, void* dest_buffer, const size_t size) {
367 ReadBlock(*Kernel::g_current_process, src_addr, dest_buffer, size); 367 ReadBlock(*Core::CurrentProcess(), src_addr, dest_buffer, size);
368} 368}
369 369
370void Write8(const VAddr addr, const u8 data) { 370void Write8(const VAddr addr, const u8 data) {
@@ -435,11 +435,11 @@ void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const voi
435} 435}
436 436
437void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size) { 437void WriteBlock(const VAddr dest_addr, const void* src_buffer, const size_t size) {
438 WriteBlock(*Kernel::g_current_process, dest_addr, src_buffer, size); 438 WriteBlock(*Core::CurrentProcess(), dest_addr, src_buffer, size);
439} 439}
440 440
441void ZeroBlock(const VAddr dest_addr, const size_t size) { 441void ZeroBlock(const VAddr dest_addr, const size_t size) {
442 const auto& process = *Kernel::g_current_process; 442 const auto& process = *Core::CurrentProcess();
443 443
444 size_t remaining_size = size; 444 size_t remaining_size = size;
445 size_t page_index = dest_addr >> PAGE_BITS; 445 size_t page_index = dest_addr >> PAGE_BITS;
@@ -480,7 +480,7 @@ void ZeroBlock(const VAddr dest_addr, const size_t size) {
480} 480}
481 481
482void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) { 482void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
483 const auto& process = *Kernel::g_current_process; 483 const auto& process = *Core::CurrentProcess();
484 484
485 size_t remaining_size = size; 485 size_t remaining_size = size;
486 size_t page_index = src_addr >> PAGE_BITS; 486 size_t page_index = src_addr >> PAGE_BITS;
@@ -526,7 +526,7 @@ void CopyBlock(VAddr dest_addr, VAddr src_addr, const size_t size) {
526 526
527template <> 527template <>
528boost::optional<u8> ReadSpecial<u8>(VAddr addr) { 528boost::optional<u8> ReadSpecial<u8>(VAddr addr) {
529 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 529 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
530 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u8))) 530 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u8)))
531 if (auto result = handler->Read8(addr)) 531 if (auto result = handler->Read8(addr))
532 return *result; 532 return *result;
@@ -535,7 +535,7 @@ boost::optional<u8> ReadSpecial<u8>(VAddr addr) {
535 535
536template <> 536template <>
537boost::optional<u16> ReadSpecial<u16>(VAddr addr) { 537boost::optional<u16> ReadSpecial<u16>(VAddr addr) {
538 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 538 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
539 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u16))) 539 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u16)))
540 if (auto result = handler->Read16(addr)) 540 if (auto result = handler->Read16(addr))
541 return *result; 541 return *result;
@@ -544,7 +544,7 @@ boost::optional<u16> ReadSpecial<u16>(VAddr addr) {
544 544
545template <> 545template <>
546boost::optional<u32> ReadSpecial<u32>(VAddr addr) { 546boost::optional<u32> ReadSpecial<u32>(VAddr addr) {
547 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 547 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
548 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u32))) 548 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u32)))
549 if (auto result = handler->Read32(addr)) 549 if (auto result = handler->Read32(addr))
550 return *result; 550 return *result;
@@ -553,7 +553,7 @@ boost::optional<u32> ReadSpecial<u32>(VAddr addr) {
553 553
554template <> 554template <>
555boost::optional<u64> ReadSpecial<u64>(VAddr addr) { 555boost::optional<u64> ReadSpecial<u64>(VAddr addr) {
556 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 556 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
557 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u64))) 557 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u64)))
558 if (auto result = handler->Read64(addr)) 558 if (auto result = handler->Read64(addr))
559 return *result; 559 return *result;
@@ -562,7 +562,7 @@ boost::optional<u64> ReadSpecial<u64>(VAddr addr) {
562 562
563template <> 563template <>
564bool WriteSpecial<u8>(VAddr addr, const u8 data) { 564bool WriteSpecial<u8>(VAddr addr, const u8 data) {
565 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 565 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
566 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u8))) 566 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u8)))
567 if (handler->Write8(addr, data)) 567 if (handler->Write8(addr, data))
568 return true; 568 return true;
@@ -571,7 +571,7 @@ bool WriteSpecial<u8>(VAddr addr, const u8 data) {
571 571
572template <> 572template <>
573bool WriteSpecial<u16>(VAddr addr, const u16 data) { 573bool WriteSpecial<u16>(VAddr addr, const u16 data) {
574 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 574 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
575 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u16))) 575 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u16)))
576 if (handler->Write16(addr, data)) 576 if (handler->Write16(addr, data))
577 return true; 577 return true;
@@ -580,7 +580,7 @@ bool WriteSpecial<u16>(VAddr addr, const u16 data) {
580 580
581template <> 581template <>
582bool WriteSpecial<u32>(VAddr addr, const u32 data) { 582bool WriteSpecial<u32>(VAddr addr, const u32 data) {
583 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 583 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
584 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u32))) 584 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u32)))
585 if (handler->Write32(addr, data)) 585 if (handler->Write32(addr, data))
586 return true; 586 return true;
@@ -589,7 +589,7 @@ bool WriteSpecial<u32>(VAddr addr, const u32 data) {
589 589
590template <> 590template <>
591bool WriteSpecial<u64>(VAddr addr, const u64 data) { 591bool WriteSpecial<u64>(VAddr addr, const u64 data) {
592 const PageTable& page_table = Kernel::g_current_process->vm_manager.page_table; 592 const PageTable& page_table = Core::CurrentProcess()->vm_manager.page_table;
593 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u64))) 593 for (const auto& handler : GetSpecialHandlers(page_table, addr, sizeof(u64)))
594 if (handler->Write64(addr, data)) 594 if (handler->Write64(addr, data))
595 return true; 595 return true;
@@ -632,7 +632,7 @@ boost::optional<VAddr> PhysicalToVirtualAddress(const PAddr addr) {
632 } else if (addr >= VRAM_PADDR && addr < VRAM_PADDR_END) { 632 } else if (addr >= VRAM_PADDR && addr < VRAM_PADDR_END) {
633 return addr - VRAM_PADDR + VRAM_VADDR; 633 return addr - VRAM_PADDR + VRAM_VADDR;
634 } else if (addr >= FCRAM_PADDR && addr < FCRAM_PADDR_END) { 634 } else if (addr >= FCRAM_PADDR && addr < FCRAM_PADDR_END) {
635 return addr - FCRAM_PADDR + Kernel::g_current_process->GetLinearHeapAreaAddress(); 635 return addr - FCRAM_PADDR + Core::CurrentProcess()->GetLinearHeapAreaAddress();
636 } else if (addr >= DSP_RAM_PADDR && addr < DSP_RAM_PADDR_END) { 636 } else if (addr >= DSP_RAM_PADDR && addr < DSP_RAM_PADDR_END) {
637 return addr - DSP_RAM_PADDR + DSP_RAM_VADDR; 637 return addr - DSP_RAM_PADDR + DSP_RAM_VADDR;
638 } else if (addr >= IO_AREA_PADDR && addr < IO_AREA_PADDR_END) { 638 } else if (addr >= IO_AREA_PADDR && addr < IO_AREA_PADDR_END) {