Merge pull request #4358 from wwylele/kernel-global-2
kernel: Eliminate global state in process and handle_table
This commit is contained in:
commit
f3ee5feb02
29 changed files with 312 additions and 230 deletions
|
@ -258,7 +258,7 @@ ResultVal<AppletManager::InitializeResult> AppletManager::Initialize(AppletId ap
|
|||
slot_data->applet_id = static_cast<AppletId>(app_id);
|
||||
// Note: In the real console the title id of a given applet slot is set by the APT module when
|
||||
// calling StartApplication.
|
||||
slot_data->title_id = Kernel::g_current_process->codeset->program_id;
|
||||
slot_data->title_id = system.Kernel().GetCurrentProcess()->codeset->program_id;
|
||||
slot_data->attributes.raw = attributes.raw;
|
||||
|
||||
if (slot_data->applet_id == AppletId::Application ||
|
||||
|
|
|
@ -97,7 +97,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
if (path_type == CecDataPathType::MboxProgramId) {
|
||||
std::vector<u8> program_id(8);
|
||||
u64_le le_program_id = Kernel::g_current_process->codeset->program_id;
|
||||
u64_le le_program_id = cecd->system.Kernel().GetCurrentProcess()->codeset->program_id;
|
||||
std::memcpy(program_id.data(), &le_program_id, sizeof(u64));
|
||||
session_data->file->Write(0, sizeof(u64), true, program_id.data());
|
||||
session_data->file->Close();
|
||||
|
@ -1351,7 +1351,7 @@ Module::SessionData::~SessionData() {
|
|||
Module::Interface::Interface(std::shared_ptr<Module> cecd, const char* name, u32 max_session)
|
||||
: ServiceFramework(name, max_session), cecd(std::move(cecd)) {}
|
||||
|
||||
Module::Module(Core::System& system) {
|
||||
Module::Module(Core::System& system) : system(system) {
|
||||
using namespace Kernel;
|
||||
cecinfo_event = system.Kernel().CreateEvent(Kernel::ResetType::OneShot, "CECD::cecinfo_event");
|
||||
change_state_event =
|
||||
|
|
|
@ -610,6 +610,8 @@ private:
|
|||
|
||||
Kernel::SharedPtr<Kernel::Event> cecinfo_event;
|
||||
Kernel::SharedPtr<Kernel::Event> change_state_event;
|
||||
|
||||
Core::System& system;
|
||||
};
|
||||
|
||||
/// Initialize CECD service(s)
|
||||
|
|
|
@ -619,7 +619,7 @@ void FS_USER::GetProgramLaunchInfo(Kernel::HLERequestContext& ctx) {
|
|||
|
||||
// TODO(Subv): The real FS service manages its own process list and only checks the processes
|
||||
// that were registered with the 'fs:REG' service.
|
||||
auto process = Kernel::GetProcessById(process_id);
|
||||
auto process = system.Kernel().GetProcessById(process_id);
|
||||
|
||||
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
||||
|
||||
|
|
|
@ -188,11 +188,13 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
|
|||
return ReportUnimplementedFunction(cmd_buf, info);
|
||||
}
|
||||
|
||||
Kernel::SharedPtr<Kernel::Process> current_process =
|
||||
Core::System::GetInstance().Kernel().GetCurrentProcess();
|
||||
|
||||
// TODO(yuriks): The kernel should be the one handling this as part of translation after
|
||||
// everything else is migrated
|
||||
Kernel::HLERequestContext context(std::move(server_session));
|
||||
context.PopulateFromIncomingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
||||
Kernel::g_handle_table);
|
||||
context.PopulateFromIncomingCommandBuffer(cmd_buf, *current_process);
|
||||
|
||||
LOG_TRACE(Service, "{}", MakeFunctionString(info->name, GetServiceName().c_str(), cmd_buf));
|
||||
handler_invoker(this, info->handler_callback, context);
|
||||
|
@ -204,8 +206,7 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
|
|||
// the thread to sleep then the writing of the command buffer will be deferred to the wakeup
|
||||
// callback.
|
||||
if (thread->status == Kernel::ThreadStatus::Running) {
|
||||
context.WriteToOutgoingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
||||
Kernel::g_handle_table);
|
||||
context.WriteToOutgoingCommandBuffer(cmd_buf, *current_process);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue