diff options
| author | 2018-11-27 12:29:06 +1100 | |
|---|---|---|
| committer | 2018-11-27 12:29:06 +1100 | |
| commit | f271316822c8887b1b6dfeff0803077f5ec2c0a8 (patch) | |
| tree | e8144d94031332ca7439edb80ee2823774bd8a99 /src | |
| parent | Fixed hwopus compile error (diff) | |
| download | yuzu-f271316822c8887b1b6dfeff0803077f5ec2c0a8.tar.gz yuzu-f271316822c8887b1b6dfeff0803077f5ec2c0a8.tar.xz yuzu-f271316822c8887b1b6dfeff0803077f5ec2c0a8.zip | |
Reworked svcs slightly, improved error messages in AM and fsp_srv
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 32 | ||||
| -rw-r--r-- | src/core/hle/service/am/am.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/filesystem/fsp_srv.cpp | 12 |
3 files changed, 30 insertions, 20 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 7f5640adb..16e9704ff 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -63,6 +63,8 @@ bool IsInsideNewMapRegion(const VMManager& vm, VAddr address, u64 size) { | |||
| 63 | vm.GetNewMapRegionEndAddress()); | 63 | vm.GetNewMapRegionEndAddress()); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | const u64 SZ_8GB = 0x200000000; | ||
| 67 | |||
| 66 | // Helper function that performs the common sanity checks for svcMapMemory | 68 | // Helper function that performs the common sanity checks for svcMapMemory |
| 67 | // and svcUnmapMemory. This is doable, as both functions perform their sanitizing | 69 | // and svcUnmapMemory. This is doable, as both functions perform their sanitizing |
| 68 | // in the same order. | 70 | // in the same order. |
| @@ -75,6 +77,7 @@ ResultCode MapUnmapMemorySanityChecks(const VMManager& vm_manager, VAddr dst_add | |||
| 75 | 77 | ||
| 76 | if (!Common::Is4KBAligned(src_addr)) { | 78 | if (!Common::Is4KBAligned(src_addr)) { |
| 77 | LOG_ERROR(Kernel_SVC, "Source address is not aligned to 4KB, 0x{:016X}", src_addr); | 79 | LOG_ERROR(Kernel_SVC, "Source address is not aligned to 4KB, 0x{:016X}", src_addr); |
| 80 | return ERR_INVALID_SIZE; | ||
| 78 | } | 81 | } |
| 79 | 82 | ||
| 80 | if (size == 0) { | 83 | if (size == 0) { |
| @@ -141,12 +144,15 @@ ResultCode MapUnmapMemorySanityChecks(const VMManager& vm_manager, VAddr dst_add | |||
| 141 | static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { | 144 | static ResultCode SetHeapSize(VAddr* heap_addr, u64 heap_size) { |
| 142 | LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); | 145 | LOG_TRACE(Kernel_SVC, "called, heap_size=0x{:X}", heap_size); |
| 143 | 146 | ||
| 144 | // Size must be a multiple of 0x200000 (2MB) and be equal to or less than 4GB. | 147 | // Size must be a multiple of 0x200000 (2MB) and be equal to or less than 8GB. |
| 145 | if ((heap_size & 0xFFFFFFFE001FFFFF) != 0) { | 148 | if ((heap_size & 0x1FFFFF) != 0) { |
| 146 | LOG_ERROR( | 149 | LOG_ERROR(Kernel_SVC, "The heap size is not a multiple of 2MB, heap_size=0x{:016X}", |
| 147 | Kernel_SVC, | 150 | heap_size); |
| 148 | "The heap size is not a multiple of 2mb or is greater than 4GB, heap_size=0x{:016X}", | 151 | return ERR_INVALID_SIZE; |
| 149 | heap_size); | 152 | } |
| 153 | |||
| 154 | if (heap_size >= SZ_8GB) { | ||
| 155 | LOG_ERROR(Kernel_SVC, "The heap size is not less than 8GB, heap_size=0x{:016X}", heap_size); | ||
| 150 | return ERR_INVALID_SIZE; | 156 | return ERR_INVALID_SIZE; |
| 151 | } | 157 | } |
| 152 | 158 | ||
| @@ -1438,15 +1444,17 @@ static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permiss | |||
| 1438 | u32 remote_permissions) { | 1444 | u32 remote_permissions) { |
| 1439 | LOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size, | 1445 | LOG_TRACE(Kernel_SVC, "called, size=0x{:X}, localPerms=0x{:08X}, remotePerms=0x{:08X}", size, |
| 1440 | local_permissions, remote_permissions); | 1446 | local_permissions, remote_permissions); |
| 1441 | |||
| 1442 | // Size must be a multiple of 4KB and be less than or equal to | ||
| 1443 | // approx. 8 GB (actually (1GB - 512B) * 8) | ||
| 1444 | if (size == 0) { | 1447 | if (size == 0) { |
| 1445 | LOG_ERROR(Kernel_SVC, "Size is 0"); | 1448 | LOG_ERROR(Kernel_SVC, "Size is 0"); |
| 1449 | return ERR_INVALID_SIZE; | ||
| 1446 | } | 1450 | } |
| 1447 | if ((size & 0xFFFFFFFE00000FFF) != 0) { | 1451 | if (!Common::Is4KBAligned(size)) { |
| 1448 | LOG_ERROR(Kernel_SVC, "Size is not a multiple of 4KB or is greater than 8GB, size={:016X}", | 1452 | LOG_ERROR(Kernel_SVC, "Size is not aligned to 4KB, 0x{:016X}", size); |
| 1449 | size); | 1453 | return ERR_INVALID_SIZE; |
| 1454 | } | ||
| 1455 | |||
| 1456 | if (size >= SZ_8GB) { | ||
| 1457 | LOG_ERROR(Kernel_SVC, "Size is not less than 8GB, 0x{:016X}", size); | ||
| 1450 | return ERR_INVALID_SIZE; | 1458 | return ERR_INVALID_SIZE; |
| 1451 | } | 1459 | } |
| 1452 | 1460 | ||
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index f6757adab..d595c37b0 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp | |||
| @@ -616,7 +616,8 @@ private: | |||
| 616 | 616 | ||
| 617 | const auto storage = applet->GetBroker().PopNormalDataToGame(); | 617 | const auto storage = applet->GetBroker().PopNormalDataToGame(); |
| 618 | if (storage == nullptr) { | 618 | if (storage == nullptr) { |
| 619 | LOG_ERROR(Service_AM, "storage is a nullptr. There is no data in the current channel"); | 619 | LOG_ERROR(Service_AM, |
| 620 | "storage is a nullptr. There is no data in the current normal channel"); | ||
| 620 | 621 | ||
| 621 | rb.Push(ERR_NO_DATA_IN_CHANNEL); | 622 | rb.Push(ERR_NO_DATA_IN_CHANNEL); |
| 622 | return; | 623 | return; |
| @@ -647,7 +648,8 @@ private: | |||
| 647 | 648 | ||
| 648 | const auto storage = applet->GetBroker().PopInteractiveDataToGame(); | 649 | const auto storage = applet->GetBroker().PopInteractiveDataToGame(); |
| 649 | if (storage == nullptr) { | 650 | if (storage == nullptr) { |
| 650 | LOG_ERROR(Service_AM, "storage is a nullptr. There is no data in the current channel"); | 651 | LOG_ERROR(Service_AM, |
| 652 | "storage is a nullptr. There is no data in the current interactive channel"); | ||
| 651 | 653 | ||
| 652 | rb.Push(ERR_NO_DATA_IN_CHANNEL); | 654 | rb.Push(ERR_NO_DATA_IN_CHANNEL); |
| 653 | return; | 655 | return; |
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 233cb302f..99d9ebc39 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp | |||
| @@ -62,13 +62,13 @@ private: | |||
| 62 | 62 | ||
| 63 | // Error checking | 63 | // Error checking |
| 64 | if (length < 0) { | 64 | if (length < 0) { |
| 65 | LOG_ERROR(Service_FS, "Invalid length provided"); | 65 | LOG_ERROR(Service_FS, "Length is less than 0, length={}", length); |
| 66 | IPC::ResponseBuilder rb{ctx, 2}; | 66 | IPC::ResponseBuilder rb{ctx, 2}; |
| 67 | rb.Push(FileSys::ERROR_INVALID_SIZE); | 67 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 68 | return; | 68 | return; |
| 69 | } | 69 | } |
| 70 | if (offset < 0) { | 70 | if (offset < 0) { |
| 71 | LOG_ERROR(Service_FS, "Invalid offset provided"); | 71 | LOG_ERROR(Service_FS, "Offset is less than 0, offset={}", offset); |
| 72 | IPC::ResponseBuilder rb{ctx, 2}; | 72 | IPC::ResponseBuilder rb{ctx, 2}; |
| 73 | rb.Push(FileSys::ERROR_INVALID_OFFSET); | 73 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 74 | return; | 74 | return; |
| @@ -109,13 +109,13 @@ private: | |||
| 109 | 109 | ||
| 110 | // Error checking | 110 | // Error checking |
| 111 | if (length < 0) { | 111 | if (length < 0) { |
| 112 | LOG_ERROR(Service_FS, "Invalid length provided"); | 112 | LOG_ERROR(Service_FS, "Length is less than 0, length={}", length); |
| 113 | IPC::ResponseBuilder rb{ctx, 2}; | 113 | IPC::ResponseBuilder rb{ctx, 2}; |
| 114 | rb.Push(FileSys::ERROR_INVALID_SIZE); | 114 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 115 | return; | 115 | return; |
| 116 | } | 116 | } |
| 117 | if (offset < 0) { | 117 | if (offset < 0) { |
| 118 | LOG_ERROR(Service_FS, "Invalid offset provided"); | 118 | LOG_ERROR(Service_FS, "Offset is less than 0, offset={}", offset); |
| 119 | IPC::ResponseBuilder rb{ctx, 2}; | 119 | IPC::ResponseBuilder rb{ctx, 2}; |
| 120 | rb.Push(FileSys::ERROR_INVALID_OFFSET); | 120 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 121 | return; | 121 | return; |
| @@ -142,13 +142,13 @@ private: | |||
| 142 | 142 | ||
| 143 | // Error checking | 143 | // Error checking |
| 144 | if (length < 0) { | 144 | if (length < 0) { |
| 145 | LOG_ERROR(Service_FS, "Invalid length provided"); | 145 | LOG_ERROR(Service_FS, "Length is less than 0, length={}", length); |
| 146 | IPC::ResponseBuilder rb{ctx, 2}; | 146 | IPC::ResponseBuilder rb{ctx, 2}; |
| 147 | rb.Push(FileSys::ERROR_INVALID_SIZE); | 147 | rb.Push(FileSys::ERROR_INVALID_SIZE); |
| 148 | return; | 148 | return; |
| 149 | } | 149 | } |
| 150 | if (offset < 0) { | 150 | if (offset < 0) { |
| 151 | LOG_ERROR(Service_FS, "Invalid offset provided"); | 151 | LOG_ERROR(Service_FS, "Offset is less than 0, offset={}", offset); |
| 152 | IPC::ResponseBuilder rb{ctx, 2}; | 152 | IPC::ResponseBuilder rb{ctx, 2}; |
| 153 | rb.Push(FileSys::ERROR_INVALID_OFFSET); | 153 | rb.Push(FileSys::ERROR_INVALID_OFFSET); |
| 154 | return; | 154 | return; |