Merge pull request #4288 from Subv/am_system_mutex

Services/AM: Implement the GetSystemUpdaterMutex function.
This commit is contained in:
bunnei 2018-10-02 11:14:04 -04:00 committed by GitHub
commit 2d116607fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 1 deletions

View File

@ -1291,6 +1291,14 @@ void Module::Interface::DeleteProgram(Kernel::HLERequestContext& ctx) {
LOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed"); LOG_ERROR(Service_AM, "FileUtil::DeleteDirRecursively unexpectedly failed");
} }
void Module::Interface::GetSystemUpdaterMutex(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x412, 0, 0); // 0x04120000
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(am->system_updater_mutex);
}
void Module::Interface::GetMetaSizeFromCia(Kernel::HLERequestContext& ctx) { void Module::Interface::GetMetaSizeFromCia(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0413, 0, 2); // 0x04130002 IPC::RequestParser rp(ctx, 0x0413, 0, 2); // 0x04130002
auto cia = rp.PopObject<Kernel::ClientSession>(); auto cia = rp.PopObject<Kernel::ClientSession>();
@ -1362,6 +1370,7 @@ void Module::Interface::GetMetaDataFromCia(Kernel::HLERequestContext& ctx) {
Module::Module() { Module::Module() {
ScanForAllTitles(); ScanForAllTitles();
system_updater_mutex = Kernel::Mutex::Create(false, "AM::SystemUpdaterMutex");
} }
Module::~Module() = default; Module::~Module() = default;

View File

@ -12,6 +12,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/file_sys/cia_container.h" #include "core/file_sys/cia_container.h"
#include "core/file_sys/file_backend.h" #include "core/file_sys/file_backend.h"
#include "core/hle/kernel/mutex.h"
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
@ -480,6 +481,17 @@ public:
*/ */
void DeleteProgram(Kernel::HLERequestContext& ctx); void DeleteProgram(Kernel::HLERequestContext& ctx);
/**
* AM::GetSystemUpdaterMutex service function
* Inputs:
* 0 : Command header (0x04120000)
* Outputs:
* 1 : Result, 0 on success, otherwise error code
* 2 : Copy handle descriptor
* 3 : System updater mutex
*/
void GetSystemUpdaterMutex(Kernel::HLERequestContext& ctx);
/** /**
* AM::GetMetaSizeFromCia service function * AM::GetMetaSizeFromCia service function
* Returns the size of a given CIA's meta section * Returns the size of a given CIA's meta section
@ -522,6 +534,7 @@ private:
bool cia_installing = false; bool cia_installing = false;
std::array<std::vector<u64_le>, 3> am_title_list; std::array<std::vector<u64_le>, 3> am_title_list;
Kernel::SharedPtr<Kernel::Mutex> system_updater_mutex;
}; };
void InstallInterfaces(SM::ServiceManager& service_manager); void InstallInterfaces(SM::ServiceManager& service_manager);

View File

@ -70,7 +70,7 @@ AM_U::AM_U(std::shared_ptr<Module> am) : Module::Interface(std::move(am), "am:u"
{0x040F0000, nullptr, "UpdateFirmwareAuto"}, {0x040F0000, nullptr, "UpdateFirmwareAuto"},
{0x041000C0, &AM_U::DeleteProgram, "DeleteProgram"}, {0x041000C0, &AM_U::DeleteProgram, "DeleteProgram"},
{0x04110044, nullptr, "GetTwlProgramListForReboot"}, {0x04110044, nullptr, "GetTwlProgramListForReboot"},
{0x04120000, nullptr, "GetSystemUpdaterMutex"}, {0x04120000, &AM_U::GetSystemUpdaterMutex, "GetSystemUpdaterMutex"},
{0x04130002, &AM_U::GetMetaSizeFromCia, "GetMetaSizeFromCia"}, {0x04130002, &AM_U::GetMetaSizeFromCia, "GetMetaSizeFromCia"},
{0x04140044, &AM_U::GetMetaDataFromCia, "GetMetaDataFromCia"}, {0x04140044, &AM_U::GetMetaDataFromCia, "GetMetaDataFromCia"},
{0x04150080, nullptr, "CheckDemoLaunchRights"}, {0x04150080, nullptr, "CheckDemoLaunchRights"},