Loader: Fix argument passing.

This commit is contained in:
Michael Scire 2018-06-24 21:39:05 -06:00
parent 9687218fbc
commit bcf81fe957
6 changed files with 10 additions and 9 deletions

View file

@ -25,9 +25,9 @@ Result DebugMonitorService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64
return rc; return rc;
} }
std::tuple<Result> DebugMonitorService::add_title_to_launch_queue(u64 tid, InPointer<char> args) { std::tuple<Result> DebugMonitorService::add_title_to_launch_queue(u64 args_size, u64 tid, InPointer<char> args) {
fprintf(stderr, "Add to launch queue: %p, %zX\n", args.pointer, args.num_elements); fprintf(stderr, "Add to launch queue: %p, %zX\n", args.pointer, std::min(args_size, args.num_elements));
return {LaunchQueue::add(tid, args.pointer, args.num_elements)}; return {LaunchQueue::add(tid, args.pointer, std::min(args_size, args.num_elements))};
} }
std::tuple<Result> DebugMonitorService::clear_launch_queue(u64 dat) { std::tuple<Result> DebugMonitorService::clear_launch_queue(u64 dat) {

View file

@ -24,7 +24,7 @@ class DebugMonitorService final : public IServiceObject {
private: private:
/* Actual commands. */ /* Actual commands. */
std::tuple<Result> add_title_to_launch_queue(u64 tid, InPointer<char> args); std::tuple<Result> add_title_to_launch_queue(u64 args_size, u64 tid, InPointer<char> args);
std::tuple<Result> clear_launch_queue(u64 dat); std::tuple<Result> clear_launch_queue(u64 dat);
std::tuple<Result, u32> get_nso_info(u64 pid, OutPointerWithClientSize<Registration::NsoInfo> out); std::tuple<Result, u32> get_nso_info(u64 pid, OutPointerWithClientSize<Registration::NsoInfo> out);
}; };

View file

@ -141,6 +141,7 @@ Result NsoUtils::CalculateNsoLoadExtents(u32 addspace_type, u32 args_size, NsoLo
/* What the fuck? Where does 0x9007 come from? */ /* What the fuck? Where does 0x9007 come from? */
extents->args_size = (2 * args_size + 0x9007); extents->args_size = (2 * args_size + 0x9007);
extents->args_size &= ~0xFFFULL; extents->args_size &= ~0xFFFULL;
extents->total_size += extents->args_size;
} }
} }
} }

View file

@ -142,7 +142,7 @@ Result ProcessCreation::CreateProcess(Handle *out_process_h, u64 index, char *nc
if (R_FAILED(rc)) { if (R_FAILED(rc)) {
goto CREATE_PROCESS_END; goto CREATE_PROCESS_END;
} }
/* Figure out where NSOs will be mapped, and how much space they (and arguments) will take up. */ /* Figure out where NSOs will be mapped, and how much space they (and arguments) will take up. */
rc = NsoUtils::CalculateNsoLoadExtents(process_info.process_flags, launch_item != NULL ? launch_item->arg_size : 0, &nso_extents); rc = NsoUtils::CalculateNsoLoadExtents(process_info.process_flags, launch_item != NULL ? launch_item->arg_size : 0, &nso_extents);
if (R_FAILED(rc)) { if (R_FAILED(rc)) {

View file

@ -20,9 +20,9 @@ Result ShellService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id
return rc; return rc;
} }
std::tuple<Result> ShellService::add_title_to_launch_queue(u64 tid, InPointer<char> args) { std::tuple<Result> ShellService::add_title_to_launch_queue(u64 args_size, u64 tid, InPointer<char> args) {
fprintf(stderr, "Add to launch queue: %p, %zX\n", args.pointer, args.num_elements); fprintf(stderr, "Add to launch queue: %p, %zX\n", args.pointer, std::min(args_size, args.num_elements));
return {LaunchQueue::add(tid, args.pointer, args.num_elements)}; return {LaunchQueue::add(tid, args.pointer, std::min(args_size, args.num_elements))};
} }
std::tuple<Result> ShellService::clear_launch_queue(u64 dat) { std::tuple<Result> ShellService::clear_launch_queue(u64 dat) {

View file

@ -21,6 +21,6 @@ class ShellService final : public IServiceObject {
private: private:
/* Actual commands. */ /* Actual commands. */
std::tuple<Result> add_title_to_launch_queue(u64 tid, InPointer<char> args); std::tuple<Result> add_title_to_launch_queue(u64 args_size, u64 tid, InPointer<char> args);
std::tuple<Result> clear_launch_queue(u64 dat); std::tuple<Result> clear_launch_queue(u64 dat);
}; };