summaryrefslogtreecommitdiff
path: root/src/core/hle/service/service.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2021-05-10 16:08:06 -0700
committerGravatar bunnei2021-05-10 20:34:38 -0700
commit21671d05a362f98cd24dcc520a3da163e349fe07 (patch)
tree904d17169565cb12c4dd7ac8c640d136803ae686 /src/core/hle/service/service.cpp
parenthle: service: Implement IPC::CommandType::Close. (diff)
downloadyuzu-21671d05a362f98cd24dcc520a3da163e349fe07.tar.gz
yuzu-21671d05a362f98cd24dcc520a3da163e349fe07.tar.xz
yuzu-21671d05a362f98cd24dcc520a3da163e349fe07.zip
hle: service: Add support for dispatching TIPC requests.
Diffstat (limited to 'src/core/hle/service/service.cpp')
-rw-r--r--src/core/hle/service/service.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index e36c35a86..2c9b2ce6d 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -133,6 +133,16 @@ void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* function
133 } 133 }
134} 134}
135 135
136void ServiceFrameworkBase::RegisterHandlersBaseTipc(const FunctionInfoBase* functions,
137 std::size_t n) {
138 handlers_tipc.reserve(handlers_tipc.size() + n);
139 for (std::size_t i = 0; i < n; ++i) {
140 // Usually this array is sorted by id already, so hint to insert at the end
141 handlers_tipc.emplace_hint(handlers_tipc.cend(), functions[i].expected_header,
142 functions[i]);
143 }
144}
145
136void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext& ctx, 146void ServiceFrameworkBase::ReportUnimplementedFunction(Kernel::HLERequestContext& ctx,
137 const FunctionInfoBase* info) { 147 const FunctionInfoBase* info) {
138 auto cmd_buf = ctx.CommandBuffer(); 148 auto cmd_buf = ctx.CommandBuffer();
@@ -167,6 +177,20 @@ void ServiceFrameworkBase::InvokeRequest(Kernel::HLERequestContext& ctx) {
167 handler_invoker(this, info->handler_callback, ctx); 177 handler_invoker(this, info->handler_callback, ctx);
168} 178}
169 179
180void ServiceFrameworkBase::InvokeRequestTipc(Kernel::HLERequestContext& ctx) {
181 boost::container::flat_map<u32, FunctionInfoBase>::iterator itr;
182
183 itr = handlers_tipc.find(ctx.GetCommand());
184
185 const FunctionInfoBase* info = itr == handlers_tipc.end() ? nullptr : &itr->second;
186 if (info == nullptr || info->handler_callback == nullptr) {
187 return ReportUnimplementedFunction(ctx, info);
188 }
189
190 LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName(), ctx.CommandBuffer()));
191 handler_invoker(this, info->handler_callback, ctx);
192}
193
170ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session, 194ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
171 Kernel::HLERequestContext& ctx) { 195 Kernel::HLERequestContext& ctx) {
172 const auto guard = LockService(); 196 const auto guard = LockService();
@@ -190,6 +214,11 @@ ResultCode ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& sessi
190 break; 214 break;
191 } 215 }
192 default: 216 default:
217 if (ctx.IsTipc()) {
218 InvokeRequestTipc(ctx);
219 break;
220 }
221
193 UNIMPLEMENTED_MSG("command_type={}", ctx.GetCommandType()); 222 UNIMPLEMENTED_MSG("command_type={}", ctx.GetCommandType());
194 } 223 }
195 224