diff options
| -rw-r--r-- | src/core/arm/skyeye_common/armstate.cpp | 7 | ||||
| -rw-r--r-- | src/core/hle/kernel/session.h | 12 | ||||
| -rw-r--r-- | src/core/hle/service/soc_u.cpp | 13 | ||||
| -rw-r--r-- | src/core/loader/loader.h | 2 |
4 files changed, 15 insertions, 19 deletions
diff --git a/src/core/arm/skyeye_common/armstate.cpp b/src/core/arm/skyeye_common/armstate.cpp index 2d814345a..5550c112e 100644 --- a/src/core/arm/skyeye_common/armstate.cpp +++ b/src/core/arm/skyeye_common/armstate.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | ||
| 5 | #include "common/swap.h" | 6 | #include "common/swap.h" |
| 6 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 7 | #include "core/memory.h" | 8 | #include "core/memory.h" |
| @@ -48,8 +49,7 @@ void ARMul_State::ChangePrivilegeMode(u32 new_mode) | |||
| 48 | Spsr[UNDEFBANK] = Spsr_copy; | 49 | Spsr[UNDEFBANK] = Spsr_copy; |
| 49 | break; | 50 | break; |
| 50 | case FIQ32MODE: | 51 | case FIQ32MODE: |
| 51 | Reg_firq[0] = Reg[13]; | 52 | std::copy(Reg.begin() + 8, Reg.end() - 1, Reg_firq.begin()); |
| 52 | Reg_firq[1] = Reg[14]; | ||
| 53 | Spsr[FIQBANK] = Spsr_copy; | 53 | Spsr[FIQBANK] = Spsr_copy; |
| 54 | break; | 54 | break; |
| 55 | } | 55 | } |
| @@ -85,8 +85,7 @@ void ARMul_State::ChangePrivilegeMode(u32 new_mode) | |||
| 85 | Bank = UNDEFBANK; | 85 | Bank = UNDEFBANK; |
| 86 | break; | 86 | break; |
| 87 | case FIQ32MODE: | 87 | case FIQ32MODE: |
| 88 | Reg[13] = Reg_firq[0]; | 88 | std::copy(Reg_firq.begin(), Reg_firq.end(), Reg.begin() + 8); |
| 89 | Reg[14] = Reg_firq[1]; | ||
| 90 | Spsr_copy = Spsr[FIQBANK]; | 89 | Spsr_copy = Spsr[FIQBANK]; |
| 91 | Bank = FIQBANK; | 90 | Bank = FIQBANK; |
| 92 | break; | 91 | break; |
diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h index adaffcafe..6ddaf970e 100644 --- a/src/core/hle/kernel/session.h +++ b/src/core/hle/kernel/session.h | |||
| @@ -16,23 +16,23 @@ | |||
| 16 | 16 | ||
| 17 | namespace IPC { | 17 | namespace IPC { |
| 18 | 18 | ||
| 19 | inline u32 MakeHeader(u16 command_id, unsigned int regular_params, unsigned int translate_params) { | 19 | constexpr u32 MakeHeader(u16 command_id, unsigned int regular_params, unsigned int translate_params) { |
| 20 | return ((u32)command_id << 16) | (((u32)regular_params & 0x3F) << 6) | (((u32)translate_params & 0x3F) << 0); | 20 | return ((u32)command_id << 16) | (((u32)regular_params & 0x3F) << 6) | (((u32)translate_params & 0x3F) << 0); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | inline u32 MoveHandleDesc(unsigned int num_handles = 1) { | 23 | constexpr u32 MoveHandleDesc(unsigned int num_handles = 1) { |
| 24 | return 0x0 | ((num_handles - 1) << 26); | 24 | return 0x0 | ((num_handles - 1) << 26); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | inline u32 CopyHandleDesc(unsigned int num_handles = 1) { | 27 | constexpr u32 CopyHandleDesc(unsigned int num_handles = 1) { |
| 28 | return 0x10 | ((num_handles - 1) << 26); | 28 | return 0x10 | ((num_handles - 1) << 26); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | inline u32 CallingPidDesc() { | 31 | constexpr u32 CallingPidDesc() { |
| 32 | return 0x20; | 32 | return 0x20; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | inline u32 StaticBufferDesc(u32 size, unsigned int buffer_id) { | 35 | constexpr u32 StaticBufferDesc(u32 size, unsigned int buffer_id) { |
| 36 | return 0x2 | (size << 14) | ((buffer_id & 0xF) << 10); | 36 | return 0x2 | (size << 14) | ((buffer_id & 0xF) << 10); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| @@ -42,7 +42,7 @@ enum MappedBufferPermissions { | |||
| 42 | RW = R | W, | 42 | RW = R | W, |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | inline u32 MappedBufferDesc(u32 size, MappedBufferPermissions perms) { | 45 | constexpr u32 MappedBufferDesc(u32 size, MappedBufferPermissions perms) { |
| 46 | return 0x8 | (size << 4) | (u32)perms; | 46 | return 0x8 | (size << 4) | (u32)perms; |
| 47 | } | 47 | } |
| 48 | 48 | ||
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index b52e52d4a..ff0af8f12 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <algorithm> | 5 | #include <algorithm> |
| 6 | #include <cstring> | 6 | #include <cstring> |
| 7 | #include <unordered_map> | 7 | #include <unordered_map> |
| 8 | #include <vector> | ||
| 8 | 9 | ||
| 9 | #include "common/assert.h" | 10 | #include "common/assert.h" |
| 10 | #include "common/bit_field.h" | 11 | #include "common/bit_field.h" |
| @@ -593,17 +594,13 @@ static void Poll(Service::Interface* self) { | |||
| 593 | 594 | ||
| 594 | // The 3ds_pollfd and the pollfd structures may be different (Windows/Linux have different sizes) | 595 | // The 3ds_pollfd and the pollfd structures may be different (Windows/Linux have different sizes) |
| 595 | // so we have to copy the data | 596 | // so we have to copy the data |
| 596 | pollfd* platform_pollfd = new pollfd[nfds]; | 597 | std::vector<pollfd> platform_pollfd(nfds); |
| 597 | for (unsigned current_fds = 0; current_fds < nfds; ++current_fds) | 598 | std::transform(input_fds, input_fds + nfds, platform_pollfd.begin(), CTRPollFD::ToPlatform); |
| 598 | platform_pollfd[current_fds] = CTRPollFD::ToPlatform(input_fds[current_fds]); | ||
| 599 | 599 | ||
| 600 | int ret = ::poll(platform_pollfd, nfds, timeout); | 600 | const int ret = ::poll(platform_pollfd.data(), nfds, timeout); |
| 601 | 601 | ||
| 602 | // Now update the output pollfd structure | 602 | // Now update the output pollfd structure |
| 603 | for (unsigned current_fds = 0; current_fds < nfds; ++current_fds) | 603 | std::transform(platform_pollfd.begin(), platform_pollfd.end(), output_fds, CTRPollFD::FromPlatform); |
| 604 | output_fds[current_fds] = CTRPollFD::FromPlatform(platform_pollfd[current_fds]); | ||
| 605 | |||
| 606 | delete[] platform_pollfd; | ||
| 607 | 604 | ||
| 608 | int result = 0; | 605 | int result = 0; |
| 609 | if (ret == SOCKET_ERROR_VALUE) | 606 | if (ret == SOCKET_ERROR_VALUE) |
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index a7f2715ba..84a4ce5fc 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h | |||
| @@ -74,7 +74,7 @@ enum class ResultStatus { | |||
| 74 | ErrorEncrypted, | 74 | ErrorEncrypted, |
| 75 | }; | 75 | }; |
| 76 | 76 | ||
| 77 | static inline u32 MakeMagic(char a, char b, char c, char d) { | 77 | constexpr u32 MakeMagic(char a, char b, char c, char d) { |
| 78 | return a | b << 8 | c << 16 | d << 24; | 78 | return a | b << 8 | c << 16 | d << 24; |
| 79 | } | 79 | } |
| 80 | 80 | ||