summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar gdkchan2018-01-18 16:54:34 -0300
committerGravatar bunnei2018-01-18 14:54:34 -0500
commit59575d5cae573b57eb9e1e611e2c25ceb935ec0a (patch)
treeec98ab8ec825b0001face3a4e7c9b821bd67e0b2 /src/core/hle/kernel
parentStart to implement/stub BSD:U and SFDNSRES services (#78) (diff)
downloadyuzu-59575d5cae573b57eb9e1e611e2c25ceb935ec0a.tar.gz
yuzu-59575d5cae573b57eb9e1e611e2c25ceb935ec0a.tar.xz
yuzu-59575d5cae573b57eb9e1e611e2c25ceb935ec0a.zip
Stub PopLaunchParameter and implement Buffer C Descriptors reading on hle_ipc (#96)
* Stub PopLaunchParameter and implement Buffer C Descriptors reading * Address PR feedback * Ensure we push a u64 not a size_t * Fix formatting
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp34
-rw-r--r--src/core/hle/kernel/hle_ipc.h6
2 files changed, 33 insertions, 7 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index ac62a0d5a..73bb6a8be 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -81,13 +81,8 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
81 for (unsigned i = 0; i < command_header->num_buf_w_descriptors; ++i) { 81 for (unsigned i = 0; i < command_header->num_buf_w_descriptors; ++i) {
82 buffer_w_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorABW>()); 82 buffer_w_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorABW>());
83 } 83 }
84 if (command_header->buf_c_descriptor_flags != 84
85 IPC::CommandHeader::BufferDescriptorCFlag::Disabled) { 85 buffer_c_offset = rp.GetCurrentOffset() + command_header->data_size;
86 if (command_header->buf_c_descriptor_flags !=
87 IPC::CommandHeader::BufferDescriptorCFlag::OneDescriptor) {
88 UNIMPLEMENTED();
89 }
90 }
91 86
92 // Padding to align to 16 bytes 87 // Padding to align to 16 bytes
93 rp.AlignWithPadding(); 88 rp.AlignWithPadding();
@@ -117,6 +112,31 @@ void HLERequestContext::ParseCommandBuffer(u32_le* src_cmdbuf, bool incoming) {
117 ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O')); 112 ASSERT(data_payload_header->magic == Common::MakeMagic('S', 'F', 'C', 'O'));
118 } 113 }
119 114
115 rp.SetCurrentOffset(buffer_c_offset);
116
117 // For Inline buffers, the response data is written directly to buffer_c_offset
118 // and in this case we don't have any BufferDescriptorC on the request.
119 if (command_header->buf_c_descriptor_flags >
120 IPC::CommandHeader::BufferDescriptorCFlag::InlineDescriptor) {
121 if (command_header->buf_c_descriptor_flags ==
122 IPC::CommandHeader::BufferDescriptorCFlag::OneDescriptor) {
123 buffer_c_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorC>());
124 } else {
125 unsigned num_buf_c_descriptors =
126 static_cast<unsigned>(command_header->buf_c_descriptor_flags.Value()) - 2;
127
128 // This is used to detect possible underflows, in case something is broken
129 // with the two ifs above and the flags value is == 0 || == 1.
130 ASSERT(num_buf_c_descriptors < 14);
131
132 for (unsigned i = 0; i < num_buf_c_descriptors; ++i) {
133 buffer_c_desciptors.push_back(rp.PopRaw<IPC::BufferDescriptorC>());
134 }
135 }
136 }
137
138 rp.SetCurrentOffset(data_payload_offset);
139
120 command = rp.Pop<u32_le>(); 140 command = rp.Pop<u32_le>();
121 rp.Skip(1, false); // The command is actually an u64, but we don't use the high part. 141 rp.Skip(1, false); // The command is actually an u64, but we don't use the high part.
122} 142}
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 6dceb766d..80fa48d7f 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -143,6 +143,10 @@ public:
143 return buffer_b_desciptors; 143 return buffer_b_desciptors;
144 } 144 }
145 145
146 const std::vector<IPC::BufferDescriptorC>& BufferDescriptorC() const {
147 return buffer_c_desciptors;
148 }
149
146 const std::unique_ptr<IPC::DomainMessageHeader>& GetDomainMessageHeader() const { 150 const std::unique_ptr<IPC::DomainMessageHeader>& GetDomainMessageHeader() const {
147 return domain_message_header; 151 return domain_message_header;
148 } 152 }
@@ -200,8 +204,10 @@ private:
200 std::vector<IPC::BufferDescriptorABW> buffer_a_desciptors; 204 std::vector<IPC::BufferDescriptorABW> buffer_a_desciptors;
201 std::vector<IPC::BufferDescriptorABW> buffer_b_desciptors; 205 std::vector<IPC::BufferDescriptorABW> buffer_b_desciptors;
202 std::vector<IPC::BufferDescriptorABW> buffer_w_desciptors; 206 std::vector<IPC::BufferDescriptorABW> buffer_w_desciptors;
207 std::vector<IPC::BufferDescriptorC> buffer_c_desciptors;
203 208
204 unsigned data_payload_offset{}; 209 unsigned data_payload_offset{};
210 unsigned buffer_c_offset{};
205 u32_le command{}; 211 u32_le command{};
206}; 212};
207 213