diff options
| author | 2014-12-14 03:30:11 -0200 | |
|---|---|---|
| committer | 2014-12-15 18:26:17 -0200 | |
| commit | e321decf98a6b0041e4d6b30ca79f24308bbb82c (patch) | |
| tree | 5d458d4768cd95942154f1b2c9298fac04882700 /src/core/hle/service | |
| parent | Merge pull request #276 from lioncash/decrappify (diff) | |
| download | yuzu-e321decf98a6b0041e4d6b30ca79f24308bbb82c.tar.gz yuzu-e321decf98a6b0041e4d6b30ca79f24308bbb82c.tar.xz yuzu-e321decf98a6b0041e4d6b30ca79f24308bbb82c.zip | |
Remove SyncRequest from K::Object and create a new K::Session type
This is a first step at fixing the conceptual insanity that is our
handling of service and IPC calls. For now, interfaces still directly
derived from Session because we don't have the infrastructure to do it
properly. (That is, Processes and scheduling them.)
Diffstat (limited to 'src/core/hle/service')
| -rw-r--r-- | src/core/hle/service/ac_u.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/apt_u.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/service/cfg_u.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/dsp_dsp.cpp | 12 | ||||
| -rw-r--r-- | src/core/hle/service/fs_user.cpp | 22 | ||||
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/hid_user.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ptm_u.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/service.h | 26 | ||||
| -rw-r--r-- | src/core/hle/service/srv.cpp | 6 |
10 files changed, 49 insertions, 59 deletions
diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp index 4130feb9d..311682abf 100644 --- a/src/core/hle/service/ac_u.cpp +++ b/src/core/hle/service/ac_u.cpp | |||
| @@ -18,7 +18,7 @@ namespace AC_U { | |||
| 18 | * 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet. | 18 | * 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet. |
| 19 | */ | 19 | */ |
| 20 | void GetWifiStatus(Service::Interface* self) { | 20 | void GetWifiStatus(Service::Interface* self) { |
| 21 | u32* cmd_buff = Service::GetCommandBuffer(); | 21 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 22 | 22 | ||
| 23 | // TODO(purpasmart96): This function is only a stub, | 23 | // TODO(purpasmart96): This function is only a stub, |
| 24 | // it returns a valid result without implementing full functionality. | 24 | // it returns a valid result without implementing full functionality. |
diff --git a/src/core/hle/service/apt_u.cpp b/src/core/hle/service/apt_u.cpp index b6d5d101f..ebfba4d8d 100644 --- a/src/core/hle/service/apt_u.cpp +++ b/src/core/hle/service/apt_u.cpp | |||
| @@ -40,7 +40,7 @@ enum class SignalType : u32 { | |||
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | void Initialize(Service::Interface* self) { | 42 | void Initialize(Service::Interface* self) { |
| 43 | u32* cmd_buff = Service::GetCommandBuffer(); | 43 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 44 | 44 | ||
| 45 | cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Menu"); // APT menu event handle | 45 | cmd_buff[3] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Menu"); // APT menu event handle |
| 46 | cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Pause"); // APT pause event handle | 46 | cmd_buff[4] = Kernel::CreateEvent(RESETTYPE_ONESHOT, "APT_U:Pause"); // APT pause event handle |
| @@ -57,7 +57,7 @@ void Initialize(Service::Interface* self) { | |||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | void GetLockHandle(Service::Interface* self) { | 59 | void GetLockHandle(Service::Interface* self) { |
| 60 | u32* cmd_buff = Service::GetCommandBuffer(); | 60 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 61 | u32 flags = cmd_buff[1]; // TODO(bunnei): Figure out the purpose of the flag field | 61 | u32 flags = cmd_buff[1]; // TODO(bunnei): Figure out the purpose of the flag field |
| 62 | 62 | ||
| 63 | if (0 == lock_handle) { | 63 | if (0 == lock_handle) { |
| @@ -78,14 +78,14 @@ void GetLockHandle(Service::Interface* self) { | |||
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void Enable(Service::Interface* self) { | 80 | void Enable(Service::Interface* self) { |
| 81 | u32* cmd_buff = Service::GetCommandBuffer(); | 81 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 82 | u32 unk = cmd_buff[1]; // TODO(bunnei): What is this field used for? | 82 | u32 unk = cmd_buff[1]; // TODO(bunnei): What is this field used for? |
| 83 | cmd_buff[1] = 0; // No error | 83 | cmd_buff[1] = 0; // No error |
| 84 | LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X", unk); | 84 | LOG_WARNING(Service_APT, "(STUBBED) called unk=0x%08X", unk); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | void InquireNotification(Service::Interface* self) { | 87 | void InquireNotification(Service::Interface* self) { |
| 88 | u32* cmd_buff = Service::GetCommandBuffer(); | 88 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 89 | u32 app_id = cmd_buff[2]; | 89 | u32 app_id = cmd_buff[2]; |
| 90 | cmd_buff[1] = 0; // No error | 90 | cmd_buff[1] = 0; // No error |
| 91 | cmd_buff[2] = static_cast<u32>(SignalType::None); // Signal type | 91 | cmd_buff[2] = static_cast<u32>(SignalType::None); // Signal type |
| @@ -112,7 +112,7 @@ void InquireNotification(Service::Interface* self) { | |||
| 112 | * 8 : Output parameter buffer ptr | 112 | * 8 : Output parameter buffer ptr |
| 113 | */ | 113 | */ |
| 114 | void ReceiveParameter(Service::Interface* self) { | 114 | void ReceiveParameter(Service::Interface* self) { |
| 115 | u32* cmd_buff = Service::GetCommandBuffer(); | 115 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 116 | u32 app_id = cmd_buff[1]; | 116 | u32 app_id = cmd_buff[1]; |
| 117 | u32 buffer_size = cmd_buff[2]; | 117 | u32 buffer_size = cmd_buff[2]; |
| 118 | cmd_buff[1] = 0; // No error | 118 | cmd_buff[1] = 0; // No error |
| @@ -143,7 +143,7 @@ void ReceiveParameter(Service::Interface* self) { | |||
| 143 | * 8 : Output parameter buffer ptr | 143 | * 8 : Output parameter buffer ptr |
| 144 | */ | 144 | */ |
| 145 | void GlanceParameter(Service::Interface* self) { | 145 | void GlanceParameter(Service::Interface* self) { |
| 146 | u32* cmd_buff = Service::GetCommandBuffer(); | 146 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 147 | u32 app_id = cmd_buff[1]; | 147 | u32 app_id = cmd_buff[1]; |
| 148 | u32 buffer_size = cmd_buff[2]; | 148 | u32 buffer_size = cmd_buff[2]; |
| 149 | 149 | ||
| @@ -170,7 +170,7 @@ void GlanceParameter(Service::Interface* self) { | |||
| 170 | * 1 : Result of function, 0 on success, otherwise error code | 170 | * 1 : Result of function, 0 on success, otherwise error code |
| 171 | */ | 171 | */ |
| 172 | void AppletUtility(Service::Interface* self) { | 172 | void AppletUtility(Service::Interface* self) { |
| 173 | u32* cmd_buff = Service::GetCommandBuffer(); | 173 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 174 | 174 | ||
| 175 | // These are from 3dbrew - I'm not really sure what they're used for. | 175 | // These are from 3dbrew - I'm not really sure what they're used for. |
| 176 | u32 unk = cmd_buff[1]; | 176 | u32 unk = cmd_buff[1]; |
| @@ -196,7 +196,7 @@ void AppletUtility(Service::Interface* self) { | |||
| 196 | void GetSharedFont(Service::Interface* self) { | 196 | void GetSharedFont(Service::Interface* self) { |
| 197 | LOG_TRACE(Kernel_SVC, "called"); | 197 | LOG_TRACE(Kernel_SVC, "called"); |
| 198 | 198 | ||
| 199 | u32* cmd_buff = Service::GetCommandBuffer(); | 199 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 200 | 200 | ||
| 201 | if (!shared_font.empty()) { | 201 | if (!shared_font.empty()) { |
| 202 | // TODO(bunnei): This function shouldn't copy the shared font every time it's called. | 202 | // TODO(bunnei): This function shouldn't copy the shared font every time it's called. |
diff --git a/src/core/hle/service/cfg_u.cpp b/src/core/hle/service/cfg_u.cpp index 972cc0534..2e9d7bf21 100644 --- a/src/core/hle/service/cfg_u.cpp +++ b/src/core/hle/service/cfg_u.cpp | |||
| @@ -52,7 +52,7 @@ static const std::array<u16, 187> country_codes = { | |||
| 52 | * 2 : Country's 2-char string | 52 | * 2 : Country's 2-char string |
| 53 | */ | 53 | */ |
| 54 | static void GetCountryCodeString(Service::Interface* self) { | 54 | static void GetCountryCodeString(Service::Interface* self) { |
| 55 | u32* cmd_buffer = Service::GetCommandBuffer(); | 55 | u32* cmd_buffer = Kernel::GetCommandBuffer(); |
| 56 | u32 country_code_id = cmd_buffer[1]; | 56 | u32 country_code_id = cmd_buffer[1]; |
| 57 | 57 | ||
| 58 | if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) { | 58 | if (country_code_id >= country_codes.size() || 0 == country_codes[country_code_id]) { |
| @@ -74,7 +74,7 @@ static void GetCountryCodeString(Service::Interface* self) { | |||
| 74 | * 2 : Country Code ID | 74 | * 2 : Country Code ID |
| 75 | */ | 75 | */ |
| 76 | static void GetCountryCodeID(Service::Interface* self) { | 76 | static void GetCountryCodeID(Service::Interface* self) { |
| 77 | u32* cmd_buffer = Service::GetCommandBuffer(); | 77 | u32* cmd_buffer = Kernel::GetCommandBuffer(); |
| 78 | u16 country_code = cmd_buffer[1]; | 78 | u16 country_code = cmd_buffer[1]; |
| 79 | u16 country_code_id = 0; | 79 | u16 country_code_id = 0; |
| 80 | 80 | ||
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index ce1c9938d..bd82063c6 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -25,7 +25,7 @@ static Handle interrupt_event; | |||
| 25 | * 2 : (inaddr << 1) + 0x1FF40000 (where 0x1FF00000 is the DSP RAM address) | 25 | * 2 : (inaddr << 1) + 0x1FF40000 (where 0x1FF00000 is the DSP RAM address) |
| 26 | */ | 26 | */ |
| 27 | void ConvertProcessAddressFromDspDram(Service::Interface* self) { | 27 | void ConvertProcessAddressFromDspDram(Service::Interface* self) { |
| 28 | u32* cmd_buff = Service::GetCommandBuffer(); | 28 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 29 | 29 | ||
| 30 | u32 addr = cmd_buff[1]; | 30 | u32 addr = cmd_buff[1]; |
| 31 | 31 | ||
| @@ -48,7 +48,7 @@ void ConvertProcessAddressFromDspDram(Service::Interface* self) { | |||
| 48 | * 2 : Component loaded, 0 on not loaded, 1 on loaded | 48 | * 2 : Component loaded, 0 on not loaded, 1 on loaded |
| 49 | */ | 49 | */ |
| 50 | void LoadComponent(Service::Interface* self) { | 50 | void LoadComponent(Service::Interface* self) { |
| 51 | u32* cmd_buff = Service::GetCommandBuffer(); | 51 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 52 | 52 | ||
| 53 | cmd_buff[1] = 0; // No error | 53 | cmd_buff[1] = 0; // No error |
| 54 | cmd_buff[2] = 1; // Pretend that we actually loaded the DSP firmware | 54 | cmd_buff[2] = 1; // Pretend that we actually loaded the DSP firmware |
| @@ -65,7 +65,7 @@ void LoadComponent(Service::Interface* self) { | |||
| 65 | * 3 : Semaphore event handle | 65 | * 3 : Semaphore event handle |
| 66 | */ | 66 | */ |
| 67 | void GetSemaphoreEventHandle(Service::Interface* self) { | 67 | void GetSemaphoreEventHandle(Service::Interface* self) { |
| 68 | u32* cmd_buff = Service::GetCommandBuffer(); | 68 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 69 | 69 | ||
| 70 | cmd_buff[1] = 0; // No error | 70 | cmd_buff[1] = 0; // No error |
| 71 | cmd_buff[3] = semaphore_event; // Event handle | 71 | cmd_buff[3] = semaphore_event; // Event handle |
| @@ -83,7 +83,7 @@ void GetSemaphoreEventHandle(Service::Interface* self) { | |||
| 83 | * 1 : Result of function, 0 on success, otherwise error code | 83 | * 1 : Result of function, 0 on success, otherwise error code |
| 84 | */ | 84 | */ |
| 85 | void RegisterInterruptEvents(Service::Interface* self) { | 85 | void RegisterInterruptEvents(Service::Interface* self) { |
| 86 | u32* cmd_buff = Service::GetCommandBuffer(); | 86 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 87 | 87 | ||
| 88 | interrupt_event = static_cast<Handle>(cmd_buff[4]); | 88 | interrupt_event = static_cast<Handle>(cmd_buff[4]); |
| 89 | 89 | ||
| @@ -100,7 +100,7 @@ void RegisterInterruptEvents(Service::Interface* self) { | |||
| 100 | * 1 : Result of function, 0 on success, otherwise error code | 100 | * 1 : Result of function, 0 on success, otherwise error code |
| 101 | */ | 101 | */ |
| 102 | void WriteReg0x10(Service::Interface* self) { | 102 | void WriteReg0x10(Service::Interface* self) { |
| 103 | u32* cmd_buff = Service::GetCommandBuffer(); | 103 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 104 | 104 | ||
| 105 | Kernel::SignalEvent(interrupt_event); | 105 | Kernel::SignalEvent(interrupt_event); |
| 106 | 106 | ||
| @@ -121,7 +121,7 @@ void WriteReg0x10(Service::Interface* self) { | |||
| 121 | * 2 : Number of bytes read from pipe | 121 | * 2 : Number of bytes read from pipe |
| 122 | */ | 122 | */ |
| 123 | void ReadPipeIfPossible(Service::Interface* self) { | 123 | void ReadPipeIfPossible(Service::Interface* self) { |
| 124 | u32* cmd_buff = Service::GetCommandBuffer(); | 124 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 125 | 125 | ||
| 126 | u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size | 126 | u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size |
| 127 | VAddr addr = cmd_buff[0x41]; | 127 | VAddr addr = cmd_buff[0x41]; |
diff --git a/src/core/hle/service/fs_user.cpp b/src/core/hle/service/fs_user.cpp index 9bda4fe8a..672ba2475 100644 --- a/src/core/hle/service/fs_user.cpp +++ b/src/core/hle/service/fs_user.cpp | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | namespace FS_User { | 17 | namespace FS_User { |
| 18 | 18 | ||
| 19 | static void Initialize(Service::Interface* self) { | 19 | static void Initialize(Service::Interface* self) { |
| 20 | u32* cmd_buff = Service::GetCommandBuffer(); | 20 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 21 | 21 | ||
| 22 | // TODO(Link Mauve): check the behavior when cmd_buff[1] isn't 32, as per | 22 | // TODO(Link Mauve): check the behavior when cmd_buff[1] isn't 32, as per |
| 23 | // http://3dbrew.org/wiki/FS:Initialize#Request | 23 | // http://3dbrew.org/wiki/FS:Initialize#Request |
| @@ -43,7 +43,7 @@ static void Initialize(Service::Interface* self) { | |||
| 43 | * 3 : File handle | 43 | * 3 : File handle |
| 44 | */ | 44 | */ |
| 45 | static void OpenFile(Service::Interface* self) { | 45 | static void OpenFile(Service::Interface* self) { |
| 46 | u32* cmd_buff = Service::GetCommandBuffer(); | 46 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 47 | 47 | ||
| 48 | // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to | 48 | // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to |
| 49 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. | 49 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. |
| @@ -86,7 +86,7 @@ static void OpenFile(Service::Interface* self) { | |||
| 86 | * 3 : File handle | 86 | * 3 : File handle |
| 87 | */ | 87 | */ |
| 88 | static void OpenFileDirectly(Service::Interface* self) { | 88 | static void OpenFileDirectly(Service::Interface* self) { |
| 89 | u32* cmd_buff = Service::GetCommandBuffer(); | 89 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 90 | 90 | ||
| 91 | auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[2]); | 91 | auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[2]); |
| 92 | auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[3]); | 92 | auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[3]); |
| @@ -141,7 +141,7 @@ static void OpenFileDirectly(Service::Interface* self) { | |||
| 141 | * 1 : Result of function, 0 on success, otherwise error code | 141 | * 1 : Result of function, 0 on success, otherwise error code |
| 142 | */ | 142 | */ |
| 143 | void DeleteFile(Service::Interface* self) { | 143 | void DeleteFile(Service::Interface* self) { |
| 144 | u32* cmd_buff = Service::GetCommandBuffer(); | 144 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 145 | 145 | ||
| 146 | // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to | 146 | // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to |
| 147 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. | 147 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. |
| @@ -175,7 +175,7 @@ void DeleteFile(Service::Interface* self) { | |||
| 175 | * 1 : Result of function, 0 on success, otherwise error code | 175 | * 1 : Result of function, 0 on success, otherwise error code |
| 176 | */ | 176 | */ |
| 177 | void RenameFile(Service::Interface* self) { | 177 | void RenameFile(Service::Interface* self) { |
| 178 | u32* cmd_buff = Service::GetCommandBuffer(); | 178 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 179 | 179 | ||
| 180 | // TODO(Link Mauve): cmd_buff[2] and cmd_buff[6], aka archive handle lower word, aren't used according to | 180 | // TODO(Link Mauve): cmd_buff[2] and cmd_buff[6], aka archive handle lower word, aren't used according to |
| 181 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. | 181 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. |
| @@ -210,7 +210,7 @@ void RenameFile(Service::Interface* self) { | |||
| 210 | * 1 : Result of function, 0 on success, otherwise error code | 210 | * 1 : Result of function, 0 on success, otherwise error code |
| 211 | */ | 211 | */ |
| 212 | void DeleteDirectory(Service::Interface* self) { | 212 | void DeleteDirectory(Service::Interface* self) { |
| 213 | u32* cmd_buff = Service::GetCommandBuffer(); | 213 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 214 | 214 | ||
| 215 | // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to | 215 | // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to |
| 216 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. | 216 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. |
| @@ -239,7 +239,7 @@ void DeleteDirectory(Service::Interface* self) { | |||
| 239 | * 1 : Result of function, 0 on success, otherwise error code | 239 | * 1 : Result of function, 0 on success, otherwise error code |
| 240 | */ | 240 | */ |
| 241 | static void CreateDirectory(Service::Interface* self) { | 241 | static void CreateDirectory(Service::Interface* self) { |
| 242 | u32* cmd_buff = Service::GetCommandBuffer(); | 242 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 243 | 243 | ||
| 244 | // TODO: cmd_buff[2], aka archive handle lower word, isn't used according to | 244 | // TODO: cmd_buff[2], aka archive handle lower word, isn't used according to |
| 245 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. | 245 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. |
| @@ -272,7 +272,7 @@ static void CreateDirectory(Service::Interface* self) { | |||
| 272 | * 1 : Result of function, 0 on success, otherwise error code | 272 | * 1 : Result of function, 0 on success, otherwise error code |
| 273 | */ | 273 | */ |
| 274 | void RenameDirectory(Service::Interface* self) { | 274 | void RenameDirectory(Service::Interface* self) { |
| 275 | u32* cmd_buff = Service::GetCommandBuffer(); | 275 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 276 | 276 | ||
| 277 | // TODO(Link Mauve): cmd_buff[2] and cmd_buff[6], aka archive handle lower word, aren't used according to | 277 | // TODO(Link Mauve): cmd_buff[2] and cmd_buff[6], aka archive handle lower word, aren't used according to |
| 278 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. | 278 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. |
| @@ -296,7 +296,7 @@ void RenameDirectory(Service::Interface* self) { | |||
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | static void OpenDirectory(Service::Interface* self) { | 298 | static void OpenDirectory(Service::Interface* self) { |
| 299 | u32* cmd_buff = Service::GetCommandBuffer(); | 299 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 300 | 300 | ||
| 301 | // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to | 301 | // TODO(Link Mauve): cmd_buff[2], aka archive handle lower word, isn't used according to |
| 302 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. | 302 | // 3dmoo's or ctrulib's implementations. Triple check if it's really the case. |
| @@ -332,7 +332,7 @@ static void OpenDirectory(Service::Interface* self) { | |||
| 332 | * 3 : Archive handle upper word (same as file handle) | 332 | * 3 : Archive handle upper word (same as file handle) |
| 333 | */ | 333 | */ |
| 334 | static void OpenArchive(Service::Interface* self) { | 334 | static void OpenArchive(Service::Interface* self) { |
| 335 | u32* cmd_buff = Service::GetCommandBuffer(); | 335 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 336 | 336 | ||
| 337 | auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[1]); | 337 | auto archive_id = static_cast<FileSys::Archive::IdCode>(cmd_buff[1]); |
| 338 | auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[2]); | 338 | auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[2]); |
| @@ -365,7 +365,7 @@ static void OpenArchive(Service::Interface* self) { | |||
| 365 | * 2 : Whether the Sdmc could be detected | 365 | * 2 : Whether the Sdmc could be detected |
| 366 | */ | 366 | */ |
| 367 | static void IsSdmcDetected(Service::Interface* self) { | 367 | static void IsSdmcDetected(Service::Interface* self) { |
| 368 | u32* cmd_buff = Service::GetCommandBuffer(); | 368 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 369 | 369 | ||
| 370 | cmd_buff[1] = 0; | 370 | cmd_buff[1] = 0; |
| 371 | cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; | 371 | cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0; |
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 223800560..db8027142 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -72,7 +72,7 @@ static void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) { | |||
| 72 | 72 | ||
| 73 | /// Write a GSP GPU hardware register | 73 | /// Write a GSP GPU hardware register |
| 74 | static void WriteHWRegs(Service::Interface* self) { | 74 | static void WriteHWRegs(Service::Interface* self) { |
| 75 | u32* cmd_buff = Service::GetCommandBuffer(); | 75 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 76 | u32 reg_addr = cmd_buff[1]; | 76 | u32 reg_addr = cmd_buff[1]; |
| 77 | u32 size = cmd_buff[2]; | 77 | u32 size = cmd_buff[2]; |
| 78 | 78 | ||
| @@ -83,7 +83,7 @@ static void WriteHWRegs(Service::Interface* self) { | |||
| 83 | 83 | ||
| 84 | /// Read a GSP GPU hardware register | 84 | /// Read a GSP GPU hardware register |
| 85 | static void ReadHWRegs(Service::Interface* self) { | 85 | static void ReadHWRegs(Service::Interface* self) { |
| 86 | u32* cmd_buff = Service::GetCommandBuffer(); | 86 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 87 | u32 reg_addr = cmd_buff[1]; | 87 | u32 reg_addr = cmd_buff[1]; |
| 88 | u32 size = cmd_buff[2]; | 88 | u32 size = cmd_buff[2]; |
| 89 | 89 | ||
| @@ -136,7 +136,7 @@ static void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) { | |||
| 136 | * 1: Result code | 136 | * 1: Result code |
| 137 | */ | 137 | */ |
| 138 | static void SetBufferSwap(Service::Interface* self) { | 138 | static void SetBufferSwap(Service::Interface* self) { |
| 139 | u32* cmd_buff = Service::GetCommandBuffer(); | 139 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 140 | u32 screen_id = cmd_buff[1]; | 140 | u32 screen_id = cmd_buff[1]; |
| 141 | FrameBufferInfo* fb_info = (FrameBufferInfo*)&cmd_buff[2]; | 141 | FrameBufferInfo* fb_info = (FrameBufferInfo*)&cmd_buff[2]; |
| 142 | SetBufferSwap(screen_id, *fb_info); | 142 | SetBufferSwap(screen_id, *fb_info); |
| @@ -155,7 +155,7 @@ static void SetBufferSwap(Service::Interface* self) { | |||
| 155 | * 4 : Handle to GSP shared memory | 155 | * 4 : Handle to GSP shared memory |
| 156 | */ | 156 | */ |
| 157 | static void RegisterInterruptRelayQueue(Service::Interface* self) { | 157 | static void RegisterInterruptRelayQueue(Service::Interface* self) { |
| 158 | u32* cmd_buff = Service::GetCommandBuffer(); | 158 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 159 | u32 flags = cmd_buff[1]; | 159 | u32 flags = cmd_buff[1]; |
| 160 | g_interrupt_event = cmd_buff[3]; | 160 | g_interrupt_event = cmd_buff[3]; |
| 161 | g_shared_memory = Kernel::CreateSharedMemory("GSPSharedMem"); | 161 | g_shared_memory = Kernel::CreateSharedMemory("GSPSharedMem"); |
| @@ -323,7 +323,7 @@ static void TriggerCmdReqQueue(Service::Interface* self) { | |||
| 323 | } | 323 | } |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | u32* cmd_buff = Service::GetCommandBuffer(); | 326 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 327 | cmd_buff[1] = 0; // No error | 327 | cmd_buff[1] = 0; // No error |
| 328 | } | 328 | } |
| 329 | 329 | ||
diff --git a/src/core/hle/service/hid_user.cpp b/src/core/hle/service/hid_user.cpp index 5772199d4..eb2d35964 100644 --- a/src/core/hle/service/hid_user.cpp +++ b/src/core/hle/service/hid_user.cpp | |||
| @@ -153,7 +153,7 @@ void PadUpdateComplete() { | |||
| 153 | * 8 : Event signaled by HID_User | 153 | * 8 : Event signaled by HID_User |
| 154 | */ | 154 | */ |
| 155 | static void GetIPCHandles(Service::Interface* self) { | 155 | static void GetIPCHandles(Service::Interface* self) { |
| 156 | u32* cmd_buff = Service::GetCommandBuffer(); | 156 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 157 | 157 | ||
| 158 | cmd_buff[1] = 0; // No error | 158 | cmd_buff[1] = 0; // No error |
| 159 | cmd_buff[3] = shared_mem; | 159 | cmd_buff[3] = shared_mem; |
diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp index 559f148dd..b8c0f6da8 100644 --- a/src/core/hle/service/ptm_u.cpp +++ b/src/core/hle/service/ptm_u.cpp | |||
| @@ -34,7 +34,7 @@ static bool battery_is_charging = true; | |||
| 34 | * 2 : Output of function, 0 = not charging, 1 = charging. | 34 | * 2 : Output of function, 0 = not charging, 1 = charging. |
| 35 | */ | 35 | */ |
| 36 | static void GetAdapterState(Service::Interface* self) { | 36 | static void GetAdapterState(Service::Interface* self) { |
| 37 | u32* cmd_buff = Service::GetCommandBuffer(); | 37 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 38 | 38 | ||
| 39 | // TODO(purpasmart96): This function is only a stub, | 39 | // TODO(purpasmart96): This function is only a stub, |
| 40 | // it returns a valid result without implementing full functionality. | 40 | // it returns a valid result without implementing full functionality. |
| @@ -52,7 +52,7 @@ static void GetAdapterState(Service::Interface* self) { | |||
| 52 | * 2 : Whether the 3DS's physical shell casing is open (1) or closed (0) | 52 | * 2 : Whether the 3DS's physical shell casing is open (1) or closed (0) |
| 53 | */ | 53 | */ |
| 54 | static void GetShellState(Service::Interface* self) { | 54 | static void GetShellState(Service::Interface* self) { |
| 55 | u32* cmd_buff = Service::GetCommandBuffer(); | 55 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 56 | 56 | ||
| 57 | cmd_buff[1] = 0; | 57 | cmd_buff[1] = 0; |
| 58 | cmd_buff[2] = shell_open ? 1 : 0; | 58 | cmd_buff[2] = shell_open ? 1 : 0; |
| @@ -68,7 +68,7 @@ static void GetShellState(Service::Interface* self) { | |||
| 68 | * 3 = half full battery, 2 = low battery, 1 = critical battery. | 68 | * 3 = half full battery, 2 = low battery, 1 = critical battery. |
| 69 | */ | 69 | */ |
| 70 | static void GetBatteryLevel(Service::Interface* self) { | 70 | static void GetBatteryLevel(Service::Interface* self) { |
| 71 | u32* cmd_buff = Service::GetCommandBuffer(); | 71 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 72 | 72 | ||
| 73 | // TODO(purpasmart96): This function is only a stub, | 73 | // TODO(purpasmart96): This function is only a stub, |
| 74 | // it returns a valid result without implementing full functionality. | 74 | // it returns a valid result without implementing full functionality. |
| @@ -86,7 +86,7 @@ static void GetBatteryLevel(Service::Interface* self) { | |||
| 86 | * 2 : Output of function, 0 = not charging, 1 = charging. | 86 | * 2 : Output of function, 0 = not charging, 1 = charging. |
| 87 | */ | 87 | */ |
| 88 | static void GetBatteryChargeState(Service::Interface* self) { | 88 | static void GetBatteryChargeState(Service::Interface* self) { |
| 89 | u32* cmd_buff = Service::GetCommandBuffer(); | 89 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 90 | 90 | ||
| 91 | // TODO(purpasmart96): This function is only a stub, | 91 | // TODO(purpasmart96): This function is only a stub, |
| 92 | // it returns a valid result without implementing full functionality. | 92 | // it returns a valid result without implementing full functionality. |
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h index baae910a1..9cd906150 100644 --- a/src/core/hle/service/service.h +++ b/src/core/hle/service/service.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include "core/mem_map.h" | 14 | #include "core/mem_map.h" |
| 15 | 15 | ||
| 16 | #include "core/hle/kernel/kernel.h" | 16 | #include "core/hle/kernel/kernel.h" |
| 17 | #include "core/hle/kernel/session.h" | ||
| 17 | #include "core/hle/svc.h" | 18 | #include "core/hle/svc.h" |
| 18 | 19 | ||
| 19 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 20 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -21,30 +22,19 @@ | |||
| 21 | 22 | ||
| 22 | namespace Service { | 23 | namespace Service { |
| 23 | 24 | ||
| 24 | static const int kMaxPortSize = 0x08; ///< Maximum size of a port name (8 characters) | 25 | static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters) |
| 25 | static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header | ||
| 26 | |||
| 27 | /** | ||
| 28 | * Returns a pointer to the command buffer in kernel memory | ||
| 29 | * @param offset Optional offset into command buffer | ||
| 30 | * @return Pointer to command buffer | ||
| 31 | */ | ||
| 32 | inline static u32* GetCommandBuffer(const int offset=0) { | ||
| 33 | return (u32*)Memory::GetPointer(Memory::KERNEL_MEMORY_VADDR + kCommandHeaderOffset + offset); | ||
| 34 | } | ||
| 35 | 26 | ||
| 36 | class Manager; | 27 | class Manager; |
| 37 | 28 | ||
| 38 | /// Interface to a CTROS service | 29 | /// Interface to a CTROS service |
| 39 | class Interface : public Kernel::Object { | 30 | class Interface : public Kernel::Session { |
| 31 | // TODO(yuriks): An "Interface" being a Kernel::Object is mostly non-sense. Interface should be | ||
| 32 | // just something that encapsulates a session and acts as a helper to implement service | ||
| 33 | // processes. | ||
| 34 | |||
| 40 | friend class Manager; | 35 | friend class Manager; |
| 41 | public: | 36 | public: |
| 42 | |||
| 43 | std::string GetName() const override { return GetPortName(); } | 37 | std::string GetName() const override { return GetPortName(); } |
| 44 | std::string GetTypeName() const override { return GetPortName(); } | ||
| 45 | |||
| 46 | static Kernel::HandleType GetStaticHandleType() { return Kernel::HandleType::Service; } | ||
| 47 | Kernel::HandleType GetHandleType() const override { return Kernel::HandleType::Service; } | ||
| 48 | 38 | ||
| 49 | typedef void (*Function)(Interface*); | 39 | typedef void (*Function)(Interface*); |
| 50 | 40 | ||
| @@ -77,7 +67,7 @@ public: | |||
| 77 | } | 67 | } |
| 78 | 68 | ||
| 79 | ResultVal<bool> SyncRequest() override { | 69 | ResultVal<bool> SyncRequest() override { |
| 80 | u32* cmd_buff = GetCommandBuffer(); | 70 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 81 | auto itr = m_functions.find(cmd_buff[0]); | 71 | auto itr = m_functions.find(cmd_buff[0]); |
| 82 | 72 | ||
| 83 | if (itr == m_functions.end() || itr->second.func == nullptr) { | 73 | if (itr == m_functions.end() || itr->second.func == nullptr) { |
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 24a846533..165fd7aac 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp | |||
| @@ -16,7 +16,7 @@ static Handle g_event_handle = 0; | |||
| 16 | static void Initialize(Service::Interface* self) { | 16 | static void Initialize(Service::Interface* self) { |
| 17 | LOG_DEBUG(Service_SRV, "called"); | 17 | LOG_DEBUG(Service_SRV, "called"); |
| 18 | 18 | ||
| 19 | u32* cmd_buff = Service::GetCommandBuffer(); | 19 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 20 | 20 | ||
| 21 | cmd_buff[1] = 0; // No error | 21 | cmd_buff[1] = 0; // No error |
| 22 | } | 22 | } |
| @@ -24,7 +24,7 @@ static void Initialize(Service::Interface* self) { | |||
| 24 | static void GetProcSemaphore(Service::Interface* self) { | 24 | static void GetProcSemaphore(Service::Interface* self) { |
| 25 | LOG_TRACE(Service_SRV, "called"); | 25 | LOG_TRACE(Service_SRV, "called"); |
| 26 | 26 | ||
| 27 | u32* cmd_buff = Service::GetCommandBuffer(); | 27 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 28 | 28 | ||
| 29 | // TODO(bunnei): Change to a semaphore once these have been implemented | 29 | // TODO(bunnei): Change to a semaphore once these have been implemented |
| 30 | g_event_handle = Kernel::CreateEvent(RESETTYPE_ONESHOT, "SRV:Event"); | 30 | g_event_handle = Kernel::CreateEvent(RESETTYPE_ONESHOT, "SRV:Event"); |
| @@ -36,7 +36,7 @@ static void GetProcSemaphore(Service::Interface* self) { | |||
| 36 | 36 | ||
| 37 | static void GetServiceHandle(Service::Interface* self) { | 37 | static void GetServiceHandle(Service::Interface* self) { |
| 38 | ResultCode res = RESULT_SUCCESS; | 38 | ResultCode res = RESULT_SUCCESS; |
| 39 | u32* cmd_buff = Service::GetCommandBuffer(); | 39 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 40 | 40 | ||
| 41 | std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); | 41 | std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); |
| 42 | Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); | 42 | Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); |