Loader: Implement ldr:ro->Initialize()

This commit is contained in:
Michael Scire 2018-04-26 16:48:57 -06:00
parent 4f09c61bfa
commit fe2f227dfc
2 changed files with 21 additions and 12 deletions

View File

@ -31,27 +31,36 @@ Result RelocatableObjectsService::dispatch(IpcParsedCommand &r, IpcCommand &out_
} }
std::tuple<Result, u64> load_nro(PidDescriptor pid, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size) { std::tuple<Result, u64> RelocatableObjectsService::load_nro(PidDescriptor pid_desc, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size) {
/* TODO */ /* TODO */
return std::make_tuple(0xF601, 0); return std::make_tuple(0xF601, 0);
} }
std::tuple<Result> unload_nro(PidDescriptor pid, u64 nro_address) { std::tuple<Result> RelocatableObjectsService::unload_nro(PidDescriptor pid_desc, u64 nro_address) {
/* TODO */ /* TODO */
return std::make_tuple(0xF601); return std::make_tuple(0xF601);
} }
std::tuple<Result> load_nrr(PidDescriptor pid, u64 nrr_address, u64 nrr_size) { std::tuple<Result> RelocatableObjectsService::load_nrr(PidDescriptor pid_desc, u64 nrr_address, u64 nrr_size) {
/* TODO */ /* TODO */
return std::make_tuple(0xF601); return std::make_tuple(0xF601);
} }
std::tuple<Result> unload_nrr(PidDescriptor pid, u64 nrr_address) { std::tuple<Result> RelocatableObjectsService::unload_nrr(PidDescriptor pid_desc, u64 nrr_address) {
/* TODO */ /* TODO */
return std::make_tuple(0xF601); return std::make_tuple(0xF601);
} }
std::tuple<Result> initialize(PidDescriptor pid, CopiedHandle process_h) { std::tuple<Result> RelocatableObjectsService::initialize(PidDescriptor pid_desc, CopiedHandle process_h) {
/* TODO */ u64 handle_pid;
return std::make_tuple(0xF601); Result rc = 0xAE09;
if (R_SUCCEEDED(svcGetProcessId(&handle_pid, process_h.handle)) && handle_pid == pid_desc.pid) {
if (this->has_initialized) {
svcCloseHandle(this->process_handle);
}
this->process_handle = process_h.handle;
this->has_initialized = true;
rc = 0;
}
return std::make_tuple(rc);
} }

View File

@ -26,9 +26,9 @@ class RelocatableObjectsService : IServiceObject {
private: private:
/* Actual commands. */ /* Actual commands. */
std::tuple<Result, u64> load_nro(PidDescriptor pid, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size); std::tuple<Result, u64> load_nro(PidDescriptor pid_desc, u64 nro_address, u64 nro_size, u64 bss_address, u64 bss_size);
std::tuple<Result> unload_nro(PidDescriptor pid, u64 nro_address); std::tuple<Result> unload_nro(PidDescriptor pid_desc, u64 nro_address);
std::tuple<Result> load_nrr(PidDescriptor pid, u64 nrr_address, u64 nrr_size); std::tuple<Result> load_nrr(PidDescriptor pid_desc, u64 nrr_address, u64 nrr_size);
std::tuple<Result> unload_nrr(PidDescriptor pid, u64 nrr_address); std::tuple<Result> unload_nrr(PidDescriptor pid_desc, u64 nrr_address);
std::tuple<Result> initialize(PidDescriptor pid, CopiedHandle process_h); std::tuple<Result> initialize(PidDescriptor pid_desc, CopiedHandle process_h);
}; };