Adjust padding for C descriptor size parsing

This commit is contained in:
Michael Scire 2018-04-20 21:03:26 -06:00
parent 7a2cfa4d60
commit a127233e41
2 changed files with 5 additions and 10 deletions

View file

@ -278,7 +278,7 @@ struct Validator<std::tuple<Args...>> {
size_t a_index = 0, b_index = num_inbuffers_in_arguments<Args ...>::value, x_index = 0, c_index = 0, h_index = 0; size_t a_index = 0, b_index = num_inbuffers_in_arguments<Args ...>::value, x_index = 0, c_index = 0, h_index = 0;
size_t cur_rawdata_index = 4; size_t cur_rawdata_index = 4;
size_t cur_c_size_offset = 8 + size_in_raw_data_for_arguments<Args... >::value; size_t cur_c_size_offset = 8 + size_in_raw_data_for_arguments<Args... >::value + (0x10 - ((uintptr_t)r.Raw - (uintptr_t)r.RawWithoutPadding));
size_t total_c_size = 0; size_t total_c_size = 0;
if (!(ValidateIpcParsedCommandArgument<Args>(r, cur_rawdata_index, cur_c_size_offset, a_index, b_index, x_index, c_index, h_index, total_c_size) && ...)) { if (!(ValidateIpcParsedCommandArgument<Args>(r, cur_rawdata_index, cur_c_size_offset, a_index, b_index, x_index, c_index, h_index, total_c_size) && ...)) {
@ -303,7 +303,7 @@ struct Decoder<OutTuple, std::tuple<Args...>> {
static std::tuple<Args...> Decode(IpcParsedCommand& r, IpcCommand &out_c, u8 *pointer_buffer) { static std::tuple<Args...> Decode(IpcParsedCommand& r, IpcCommand &out_c, u8 *pointer_buffer) {
size_t a_index = 0, b_index = num_inbuffers_in_arguments<Args ...>::value, x_index = 0, c_index = 0, h_index = 0; size_t a_index = 0, b_index = num_inbuffers_in_arguments<Args ...>::value, x_index = 0, c_index = 0, h_index = 0;
size_t cur_rawdata_index = 4; size_t cur_rawdata_index = 4;
size_t cur_c_size_offset = 8 + size_in_raw_data_for_arguments<Args... >::value; size_t cur_c_size_offset = 8 + size_in_raw_data_for_arguments<Args... >::value + (0x10 - ((uintptr_t)r.Raw - (uintptr_t)r.RawWithoutPadding));
size_t pointer_buffer_offset = 0; size_t pointer_buffer_offset = 0;
return std::tuple<Args... > { return std::tuple<Args... > {
GetValueFromIpcParsedCommand<Args>(r, out_c, pointer_buffer, pointer_buffer_offset, cur_rawdata_index, cur_c_size_offset, a_index, b_index, x_index, c_index, h_index) GetValueFromIpcParsedCommand<Args>(r, out_c, pointer_buffer, pointer_buffer_offset, cur_rawdata_index, cur_c_size_offset, a_index, b_index, x_index, c_index, h_index)

View file

@ -6,11 +6,6 @@
#include "ldr_launch_queue.hpp" #include "ldr_launch_queue.hpp"
#include "ldr_registration.hpp" #include "ldr_registration.hpp"
std::tuple<Result> fake_clear_launch_queue() {
LaunchQueue::clear();
return std::make_tuple(0);
}
Result DebugMonitorService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) { Result DebugMonitorService::dispatch(IpcParsedCommand &r, IpcCommand &out_c, u64 cmd_id, u8 *pointer_buffer, size_t pointer_buffer_size) {
Result rc = 0xF601; Result rc = 0xF601;
@ -44,7 +39,7 @@ std::tuple<Result> DebugMonitorService::clear_launch_queue(u64 dat) {
std::tuple<Result, u32> DebugMonitorService::get_nso_info(u64 pid, OutPointerWithClientSize<Registration::NsoInfo> out) { std::tuple<Result, u32> DebugMonitorService::get_nso_info(u64 pid, OutPointerWithClientSize<Registration::NsoInfo> out) {
u32 out_num_nsos = 0; u32 out_num_nsos = 0;
//std::fill(out.pointer, out.pointer + out.num_elements, (const Registration::NsoInfo){0}); std::fill(out.pointer, out.pointer + out.num_elements, (const Registration::NsoInfo){0});
Result rc = Registration::get_nso_infos_for_process_id(out.pointer, out.num_elements, pid, &out_num_nsos); Result rc = Registration::get_nso_infos_for_process_id(out.pointer, out.num_elements, pid, &out_num_nsos);