diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/kernel/vm_manager.cpp | 45 | ||||
| -rw-r--r-- | src/core/hle/kernel/vm_manager.h | 20 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 26 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.h | 1 | ||||
| -rw-r--r-- | src/core/memory.cpp | 2 | ||||
| -rw-r--r-- | src/core/memory.h | 4 |
7 files changed, 68 insertions, 50 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 3df5ccb7f..501544090 100644 --- a/src/core/hle/kernel/vm_manager.cpp +++ b/src/core/hle/kernel/vm_manager.cpp | |||
| @@ -625,9 +625,11 @@ void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) { | |||
| 625 | void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType type) { | 625 | void 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; | ||
| 632 | |||
| 631 | switch (type) { | 633 | switch (type) { |
| 632 | case FileSys::ProgramAddressSpaceType::Is32Bit: | 634 | case FileSys::ProgramAddressSpaceType::Is32Bit: |
| 633 | case FileSys::ProgramAddressSpaceType::Is32BitNoMap: | 635 | case FileSys::ProgramAddressSpaceType::Is32BitNoMap: |
| @@ -643,6 +645,7 @@ void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType ty | |||
| 643 | map_region_size = 0; | 645 | map_region_size = 0; |
| 644 | heap_region_size = 0x80000000; | 646 | heap_region_size = 0x80000000; |
| 645 | } | 647 | } |
| 648 | stack_and_tls_io_end = 0x40000000; | ||
| 646 | break; | 649 | break; |
| 647 | case FileSys::ProgramAddressSpaceType::Is36Bit: | 650 | case FileSys::ProgramAddressSpaceType::Is36Bit: |
| 648 | address_space_width = 36; | 651 | address_space_width = 36; |
| @@ -652,6 +655,7 @@ void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType ty | |||
| 652 | aslr_region_end = aslr_region_base + 0xFF8000000; | 655 | aslr_region_end = aslr_region_base + 0xFF8000000; |
| 653 | map_region_size = 0x180000000; | 656 | map_region_size = 0x180000000; |
| 654 | heap_region_size = 0x180000000; | 657 | heap_region_size = 0x180000000; |
| 658 | stack_and_tls_io_end = 0x80000000; | ||
| 655 | break; | 659 | break; |
| 656 | case FileSys::ProgramAddressSpaceType::Is39Bit: | 660 | case FileSys::ProgramAddressSpaceType::Is39Bit: |
| 657 | address_space_width = 39; | 661 | address_space_width = 39; |
| @@ -661,7 +665,7 @@ void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType ty | |||
| 661 | aslr_region_end = aslr_region_base + 0x7FF8000000; | 665 | aslr_region_end = aslr_region_base + 0x7FF8000000; |
| 662 | map_region_size = 0x1000000000; | 666 | map_region_size = 0x1000000000; |
| 663 | heap_region_size = 0x180000000; | 667 | heap_region_size = 0x180000000; |
| 664 | new_map_region_size = 0x80000000; | 668 | stack_region_size = 0x80000000; |
| 665 | tls_io_region_size = 0x1000000000; | 669 | tls_io_region_size = 0x1000000000; |
| 666 | break; | 670 | break; |
| 667 | default: | 671 | default: |
| @@ -669,6 +673,8 @@ void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType ty | |||
| 669 | return; | 673 | return; |
| 670 | } | 674 | } |
| 671 | 675 | ||
| 676 | const u64 stack_and_tls_io_begin = aslr_region_base; | ||
| 677 | |||
| 672 | address_space_base = 0; | 678 | address_space_base = 0; |
| 673 | address_space_end = 1ULL << address_space_width; | 679 | address_space_end = 1ULL << address_space_width; |
| 674 | 680 | ||
| @@ -679,15 +685,20 @@ void VMManager::InitializeMemoryRegionRanges(FileSys::ProgramAddressSpaceType ty | |||
| 679 | heap_region_end = heap_region_base + heap_region_size; | 685 | heap_region_end = heap_region_base + heap_region_size; |
| 680 | heap_end = heap_region_base; | 686 | heap_end = heap_region_base; |
| 681 | 687 | ||
| 682 | new_map_region_base = heap_region_end; | 688 | stack_region_base = heap_region_end; |
| 683 | new_map_region_end = new_map_region_base + new_map_region_size; | 689 | stack_region_end = stack_region_base + stack_region_size; |
| 684 | 690 | ||
| 685 | tls_io_region_base = new_map_region_end; | 691 | tls_io_region_base = stack_region_end; |
| 686 | 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; |
| 687 | 693 | ||
| 688 | if (new_map_region_size == 0) { | 694 | if (stack_region_size == 0) { |
| 689 | new_map_region_base = address_space_base; | 695 | stack_region_base = stack_and_tls_io_begin; |
| 690 | new_map_region_end = address_space_end; | 696 | stack_region_end = stack_and_tls_io_end; |
| 697 | } | ||
| 698 | |||
| 699 | if (tls_io_region_size == 0) { | ||
| 700 | tls_io_region_base = stack_and_tls_io_begin; | ||
| 701 | tls_io_region_end = stack_and_tls_io_end; | ||
| 691 | } | 702 | } |
| 692 | } | 703 | } |
| 693 | 704 | ||
| @@ -879,21 +890,21 @@ bool VMManager::IsWithinMapRegion(VAddr address, u64 size) const { | |||
| 879 | return IsInsideAddressRange(address, size, GetMapRegionBaseAddress(), GetMapRegionEndAddress()); | 890 | return IsInsideAddressRange(address, size, GetMapRegionBaseAddress(), GetMapRegionEndAddress()); |
| 880 | } | 891 | } |
| 881 | 892 | ||
| 882 | VAddr VMManager::GetNewMapRegionBaseAddress() const { | 893 | VAddr VMManager::GetStackRegionBaseAddress() const { |
| 883 | return new_map_region_base; | 894 | return stack_region_base; |
| 884 | } | 895 | } |
| 885 | 896 | ||
| 886 | VAddr VMManager::GetNewMapRegionEndAddress() const { | 897 | VAddr VMManager::GetStackRegionEndAddress() const { |
| 887 | return new_map_region_end; | 898 | return stack_region_end; |
| 888 | } | 899 | } |
| 889 | 900 | ||
| 890 | u64 VMManager::GetNewMapRegionSize() const { | 901 | u64 VMManager::GetStackRegionSize() const { |
| 891 | return new_map_region_end - new_map_region_base; | 902 | return stack_region_end - stack_region_base; |
| 892 | } | 903 | } |
| 893 | 904 | ||
| 894 | bool VMManager::IsWithinNewMapRegion(VAddr address, u64 size) const { | 905 | bool VMManager::IsWithinStackRegion(VAddr address, u64 size) const { |
| 895 | return IsInsideAddressRange(address, size, GetNewMapRegionBaseAddress(), | 906 | return IsInsideAddressRange(address, size, GetStackRegionBaseAddress(), |
| 896 | GetNewMapRegionEndAddress()); | 907 | GetStackRegionEndAddress()); |
| 897 | } | 908 | } |
| 898 | 909 | ||
| 899 | VAddr VMManager::GetTLSIORegionBaseAddress() const { | 910 | VAddr 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; |
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index 33cebb48b..eced38001 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -270,7 +270,7 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger | |||
| 270 | {70, nullptr, "ReportMultimediaError"}, | 270 | {70, nullptr, "ReportMultimediaError"}, |
| 271 | {71, nullptr, "GetCurrentIlluminanceEx"}, | 271 | {71, nullptr, "GetCurrentIlluminanceEx"}, |
| 272 | {80, nullptr, "SetWirelessPriorityMode"}, | 272 | {80, nullptr, "SetWirelessPriorityMode"}, |
| 273 | {90, nullptr, "GetAccumulatedSuspendedTickValue"}, | 273 | {90, &ISelfController::GetAccumulatedSuspendedTickValue, "GetAccumulatedSuspendedTickValue"}, |
| 274 | {91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"}, | 274 | {91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"}, |
| 275 | {100, nullptr, "SetAlbumImageTakenNotificationEnabled"}, | 275 | {100, nullptr, "SetAlbumImageTakenNotificationEnabled"}, |
| 276 | {1000, nullptr, "GetDebugStorageChannel"}, | 276 | {1000, nullptr, "GetDebugStorageChannel"}, |
| @@ -283,10 +283,14 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger | |||
| 283 | launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, | 283 | launchable_event = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Manual, |
| 284 | "ISelfController:LaunchableEvent"); | 284 | "ISelfController:LaunchableEvent"); |
| 285 | 285 | ||
| 286 | // TODO(ogniK): Figure out where, when and why this event gets signalled | 286 | // This event is created by AM on the first time GetAccumulatedSuspendedTickChangedEvent() is |
| 287 | // called. Yuzu can just create it unconditionally, since it doesn't need to support multiple | ||
| 288 | // ISelfControllers. The event is signaled on creation, and on transition from suspended -> not | ||
| 289 | // suspended if the event has previously been created by a call to | ||
| 290 | // GetAccumulatedSuspendedTickChangedEvent. | ||
| 287 | accumulated_suspended_tick_changed_event = Kernel::WritableEvent::CreateEventPair( | 291 | accumulated_suspended_tick_changed_event = Kernel::WritableEvent::CreateEventPair( |
| 288 | kernel, Kernel::ResetType::Manual, "ISelfController:AccumulatedSuspendedTickChangedEvent"); | 292 | kernel, Kernel::ResetType::Manual, "ISelfController:AccumulatedSuspendedTickChangedEvent"); |
| 289 | accumulated_suspended_tick_changed_event.writable->Signal(); // Is signalled on creation | 293 | accumulated_suspended_tick_changed_event.writable->Signal(); |
| 290 | } | 294 | } |
| 291 | 295 | ||
| 292 | ISelfController::~ISelfController() = default; | 296 | ISelfController::~ISelfController() = default; |
| @@ -449,11 +453,19 @@ void ISelfController::GetIdleTimeDetectionExtension(Kernel::HLERequestContext& c | |||
| 449 | rb.Push<u32>(idle_time_detection_extension); | 453 | rb.Push<u32>(idle_time_detection_extension); |
| 450 | } | 454 | } |
| 451 | 455 | ||
| 456 | void ISelfController::GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx) { | ||
| 457 | LOG_DEBUG(Service_AM, "called."); | ||
| 458 | |||
| 459 | // This command returns the total number of system ticks since ISelfController creation | ||
| 460 | // where the game was suspended. Since Yuzu doesn't implement game suspension, this command | ||
| 461 | // can just always return 0 ticks. | ||
| 462 | IPC::ResponseBuilder rb{ctx, 4}; | ||
| 463 | rb.Push(RESULT_SUCCESS); | ||
| 464 | rb.Push<u64>(0); | ||
| 465 | } | ||
| 466 | |||
| 452 | void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx) { | 467 | void ISelfController::GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx) { |
| 453 | // The implementation of this function is fine as is, the reason we're labelling it as stubbed | 468 | LOG_DEBUG(Service_AM, "called."); |
| 454 | // is because we're currently unsure when and where accumulated_suspended_tick_changed_event is | ||
| 455 | // actually signalled for the time being. | ||
| 456 | LOG_WARNING(Service_AM, "(STUBBED) called"); | ||
| 457 | 469 | ||
| 458 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 470 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 459 | rb.Push(RESULT_SUCCESS); | 471 | rb.Push(RESULT_SUCCESS); |
diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 4ea609d23..49ff20959 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h | |||
| @@ -133,6 +133,7 @@ private: | |||
| 133 | void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); | 133 | void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx); |
| 134 | void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); | 134 | void SetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); |
| 135 | void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); | 135 | void GetIdleTimeDetectionExtension(Kernel::HLERequestContext& ctx); |
| 136 | void GetAccumulatedSuspendedTickValue(Kernel::HLERequestContext& ctx); | ||
| 136 | void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx); | 137 | void GetAccumulatedSuspendedTickChangedEvent(Kernel::HLERequestContext& ctx); |
| 137 | 138 | ||
| 138 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger; | 139 | std::shared_ptr<NVFlinger::NVFlinger> nvflinger; |
diff --git a/src/core/memory.cpp b/src/core/memory.cpp index f18f6226b..8555691c0 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp | |||
| @@ -16,11 +16,9 @@ | |||
| 16 | #include "core/core.h" | 16 | #include "core/core.h" |
| 17 | #include "core/hle/kernel/process.h" | 17 | #include "core/hle/kernel/process.h" |
| 18 | #include "core/hle/kernel/vm_manager.h" | 18 | #include "core/hle/kernel/vm_manager.h" |
| 19 | #include "core/hle/lock.h" | ||
| 20 | #include "core/memory.h" | 19 | #include "core/memory.h" |
| 21 | #include "core/memory_setup.h" | 20 | #include "core/memory_setup.h" |
| 22 | #include "video_core/gpu.h" | 21 | #include "video_core/gpu.h" |
| 23 | #include "video_core/renderer_base.h" | ||
| 24 | 22 | ||
| 25 | namespace Memory { | 23 | namespace Memory { |
| 26 | 24 | ||
diff --git a/src/core/memory.h b/src/core/memory.h index 04e2c5f1d..09008e1dd 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -8,10 +8,6 @@ | |||
| 8 | #include <string> | 8 | #include <string> |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | namespace Common { | ||
| 12 | struct PageTable; | ||
| 13 | } | ||
| 14 | |||
| 15 | namespace Kernel { | 11 | namespace Kernel { |
| 16 | class Process; | 12 | class Process; |
| 17 | } | 13 | } |