summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-07-06 02:02:01 -0400
committerGravatar Lioncash2019-07-06 02:24:30 -0400
commit2a9e3882906f722af2ff1375a776fa1980abac26 (patch)
treec96b21482702192a206c2e7471c683cf56212fb6 /src
parentkernel/vm_manager: Handle stack/TLS IO region placement better (diff)
downloadyuzu-2a9e3882906f722af2ff1375a776fa1980abac26.tar.gz
yuzu-2a9e3882906f722af2ff1375a776fa1980abac26.tar.xz
yuzu-2a9e3882906f722af2ff1375a776fa1980abac26.zip
kernel/vm_manager: Rename 'new map' to 'stack'
Provides a more accurate name for the memory region and also disambiguates between the map and new map regions of memory, making it easier to understand.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/svc.cpp20
-rw-r--r--src/core/hle/kernel/vm_manager.cpp34
-rw-r--r--src/core/hle/kernel/vm_manager.h20
3 files changed, 37 insertions, 37 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index de6363ff2..332573a95 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -98,9 +98,9 @@ ResultCode MapUnmapMemorySanityChecks(const VMManager& vm_manager, VAddr dst_add
98 return ERR_INVALID_ADDRESS_STATE; 98 return ERR_INVALID_ADDRESS_STATE;
99 } 99 }
100 100
101 if (!vm_manager.IsWithinNewMapRegion(dst_addr, size)) { 101 if (!vm_manager.IsWithinStackRegion(dst_addr, size)) {
102 LOG_ERROR(Kernel_SVC, 102 LOG_ERROR(Kernel_SVC,
103 "Destination is not within the new map region, addr=0x{:016X}, size=0x{:016X}", 103 "Destination is not within the stack region, addr=0x{:016X}, size=0x{:016X}",
104 dst_addr, size); 104 dst_addr, size);
105 return ERR_INVALID_MEMORY_RANGE; 105 return ERR_INVALID_MEMORY_RANGE;
106 } 106 }
@@ -726,8 +726,8 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
726 // 2.0.0+ 726 // 2.0.0+
727 ASLRRegionBaseAddr = 12, 727 ASLRRegionBaseAddr = 12,
728 ASLRRegionSize = 13, 728 ASLRRegionSize = 13,
729 NewMapRegionBaseAddr = 14, 729 StackRegionBaseAddr = 14,
730 NewMapRegionSize = 15, 730 StackRegionSize = 15,
731 // 3.0.0+ 731 // 3.0.0+
732 IsVirtualAddressMemoryEnabled = 16, 732 IsVirtualAddressMemoryEnabled = 16,
733 PersonalMmHeapUsage = 17, 733 PersonalMmHeapUsage = 17,
@@ -752,8 +752,8 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
752 case GetInfoType::HeapRegionSize: 752 case GetInfoType::HeapRegionSize:
753 case GetInfoType::ASLRRegionBaseAddr: 753 case GetInfoType::ASLRRegionBaseAddr:
754 case GetInfoType::ASLRRegionSize: 754 case GetInfoType::ASLRRegionSize:
755 case GetInfoType::NewMapRegionBaseAddr: 755 case GetInfoType::StackRegionBaseAddr:
756 case GetInfoType::NewMapRegionSize: 756 case GetInfoType::StackRegionSize:
757 case GetInfoType::TotalPhysicalMemoryAvailable: 757 case GetInfoType::TotalPhysicalMemoryAvailable:
758 case GetInfoType::TotalPhysicalMemoryUsed: 758 case GetInfoType::TotalPhysicalMemoryUsed:
759 case GetInfoType::IsVirtualAddressMemoryEnabled: 759 case GetInfoType::IsVirtualAddressMemoryEnabled:
@@ -806,12 +806,12 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, u64 ha
806 *result = process->VMManager().GetASLRRegionSize(); 806 *result = process->VMManager().GetASLRRegionSize();
807 return RESULT_SUCCESS; 807 return RESULT_SUCCESS;
808 808
809 case GetInfoType::NewMapRegionBaseAddr: 809 case GetInfoType::StackRegionBaseAddr:
810 *result = process->VMManager().GetNewMapRegionBaseAddress(); 810 *result = process->VMManager().GetStackRegionBaseAddress();
811 return RESULT_SUCCESS; 811 return RESULT_SUCCESS;
812 812
813 case GetInfoType::NewMapRegionSize: 813 case GetInfoType::StackRegionSize:
814 *result = process->VMManager().GetNewMapRegionSize(); 814 *result = process->VMManager().GetStackRegionSize();
815 return RESULT_SUCCESS; 815 return RESULT_SUCCESS;
816 816
817 case GetInfoType::TotalPhysicalMemoryAvailable: 817 case GetInfoType::TotalPhysicalMemoryAvailable:
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp
index 568f49c3f..501544090 100644
--- a/src/core/hle/kernel/vm_manager.cpp
+++ b/src/core/hle/kernel/vm_manager.cpp
@@ -625,7 +625,7 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) {
625void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType type) { 625void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType type) {
626 u64 map_region_size = 0; 626 u64 map_region_size = 0;
627 u64 heap_region_size = 0; 627 u64 heap_region_size = 0;
628 u64 new_map_region_size = 0; 628 u64 stack_region_size = 0;
629 u64 tls_io_region_size = 0; 629 u64 tls_io_region_size = 0;
630 630
631 u64 stack_and_tls_io_end = 0; 631 u64 stack_and_tls_io_end = 0;
@@ -665,7 +665,7 @@ void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType ty
665 aslr_region_end = aslr_region_base + 0x7FF8000000; 665 aslr_region_end = aslr_region_base + 0x7FF8000000;
666 map_region_size = 0x1000000000; 666 map_region_size = 0x1000000000;
667 heap_region_size = 0x180000000; 667 heap_region_size = 0x180000000;
668 new_map_region_size = 0x80000000; 668 stack_region_size = 0x80000000;
669 tls_io_region_size = 0x1000000000; 669 tls_io_region_size = 0x1000000000;
670 break; 670 break;
671 default: 671 default:
@@ -685,15 +685,15 @@ void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType ty
685 heap_region_end = heap_region_base + heap_region_size; 685 heap_region_end = heap_region_base + heap_region_size;
686 heap_end = heap_region_base; 686 heap_end = heap_region_base;
687 687
688 new_map_region_base = heap_region_end; 688 stack_region_base = heap_region_end;
689 new_map_region_end = new_map_region_base + new_map_region_size; 689 stack_region_end = stack_region_base + stack_region_size;
690 690
691 tls_io_region_base = new_map_region_end; 691 tls_io_region_base = stack_region_end;
692 tls_io_region_end = tls_io_region_base + tls_io_region_size; 692 tls_io_region_end = tls_io_region_base + tls_io_region_size;
693 693
694 if (new_map_region_size == 0) { 694 if (stack_region_size == 0) {
695 new_map_region_base = stack_and_tls_io_begin; 695 stack_region_base = stack_and_tls_io_begin;
696 new_map_region_end = stack_and_tls_io_end; 696 stack_region_end = stack_and_tls_io_end;
697 } 697 }
698 698
699 if (tls_io_region_size == 0) { 699 if (tls_io_region_size == 0) {
@@ -890,21 +890,21 @@ bool VMManager::IsWithinMapRegion(VAddr address, u64 size) const {
890 return IsInsideAddressRange(address, size, GetMapRegionBaseAddress(), GetMapRegionEndAddress()); 890 return IsInsideAddressRange(address, size, GetMapRegionBaseAddress(), GetMapRegionEndAddress());
891} 891}
892 892
893VAddr VMManager::GetNewMapRegionBaseAddress() const { 893VAddr VMManager::GetStackRegionBaseAddress() const {
894 return new_map_region_base; 894 return stack_region_base;
895} 895}
896 896
897VAddr VMManager::GetNewMapRegionEndAddress() const { 897VAddr VMManager::GetStackRegionEndAddress() const {
898 return new_map_region_end; 898 return stack_region_end;
899} 899}
900 900
901u64 VMManager::GetNewMapRegionSize() const { 901u64 VMManager::GetStackRegionSize() const {
902 return new_map_region_end - new_map_region_base; 902 return stack_region_end - stack_region_base;
903} 903}
904 904
905bool VMManager::IsWithinNewMapRegion(VAddr address, u64 size) const { 905bool VMManager::IsWithinStackRegion(VAddr address, u64 size) const {
906 return IsInsideAddressRange(address, size, GetNewMapRegionBaseAddress(), 906 return IsInsideAddressRange(address, size, GetStackRegionBaseAddress(),
907 GetNewMapRegionEndAddress()); 907 GetStackRegionEndAddress());
908} 908}
909 909
910VAddr VMManager::GetTLSIORegionBaseAddress() const { 910VAddr VMManager::GetTLSIORegionBaseAddress() const {
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h
index 752ae62f9..9fe6ac3f4 100644
--- a/src/core/hle/kernel/vm_manager.h
+++ b/src/core/hle/kernel/vm_manager.h
@@ -596,17 +596,17 @@ public:
596 /// Determines whether or not the specified range is within the map region. 596 /// Determines whether or not the specified range is within the map region.
597 bool IsWithinMapRegion(VAddr address, u64 size) const; 597 bool IsWithinMapRegion(VAddr address, u64 size) const;
598 598
599 /// Gets the base address of the new map region. 599 /// Gets the base address of the stack region.
600 VAddr GetNewMapRegionBaseAddress() const; 600 VAddr GetStackRegionBaseAddress() const;
601 601
602 /// Gets the end address of the new map region. 602 /// Gets the end address of the stack region.
603 VAddr GetNewMapRegionEndAddress() const; 603 VAddr GetStackRegionEndAddress() const;
604 604
605 /// Gets the total size of the new map region in bytes. 605 /// Gets the total size of the stack region in bytes.
606 u64 GetNewMapRegionSize() const; 606 u64 GetStackRegionSize() const;
607 607
608 /// Determines whether or not the given address range is within the new map region 608 /// Determines whether or not the given address range is within the stack region
609 bool IsWithinNewMapRegion(VAddr address, u64 size) const; 609 bool IsWithinStackRegion(VAddr address, u64 size) const;
610 610
611 /// Gets the base address of the TLS IO region. 611 /// Gets the base address of the TLS IO region.
612 VAddr GetTLSIORegionBaseAddress() const; 612 VAddr GetTLSIORegionBaseAddress() const;
@@ -726,8 +726,8 @@ private:
726 VAddr map_region_base = 0; 726 VAddr map_region_base = 0;
727 VAddr map_region_end = 0; 727 VAddr map_region_end = 0;
728 728
729 VAddr new_map_region_base = 0; 729 VAddr stack_region_base = 0;
730 VAddr new_map_region_end = 0; 730 VAddr stack_region_end = 0;
731 731
732 VAddr tls_io_region_base = 0; 732 VAddr tls_io_region_base = 0;
733 VAddr tls_io_region_end = 0; 733 VAddr tls_io_region_end = 0;