Remove SyncRequest from K::Object and create a new K::Session type

This is a first step at fixing the conceptual insanity that is our
handling of service and IPC calls. For now, interfaces still directly
derived from Session because we don't have the infrastructure to do it
properly. (That is, Processes and scheduling them.)
This commit is contained in:
Yuri Kunde Schlesner 2014-12-14 03:30:11 -02:00
parent 1ee740898a
commit e321decf98
15 changed files with 129 additions and 104 deletions

View file

@ -88,17 +88,14 @@ static Result ConnectToPort(Handle* out, const char* port_name) {
/// Synchronize to an OS service
static Result SendSyncRequest(Handle handle) {
// TODO(yuriks): ObjectPool::Get tries to check the Object type, which fails since this is a generic base Object,
// so we are forced to use GetFast and manually verify the handle.
if (!Kernel::g_object_pool.IsValid(handle)) {
Kernel::Session* session = Kernel::g_object_pool.Get<Kernel::Session>(handle);
if (session == nullptr) {
return InvalidHandle(ErrorModule::Kernel).raw;
}
Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handle);
_assert_msg_(KERNEL, (object != nullptr), "called, but kernel object is nullptr!");
LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName().c_str());
LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str());
ResultVal<bool> wait = object->SyncRequest();
ResultVal<bool> wait = session->SyncRequest();
if (wait.Succeeded() && *wait) {
Kernel::WaitCurrentThread(WAITTYPE_SYNCH); // TODO(bunnei): Is this correct?
}