am/jit: reference memory instance from context

This commit is contained in:
Liam 2023-12-24 19:30:16 -05:00
parent cf8c7d4ed3
commit 47e44a6693
3 changed files with 7 additions and 5 deletions

View File

@ -1523,8 +1523,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(HLERequestContext& ctx)
} }
std::vector<u8> memory(transfer_mem->GetSize()); std::vector<u8> memory(transfer_mem->GetSize());
system.ApplicationMemory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), ctx.GetMemory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), memory.size());
memory.size());
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
@ -1556,8 +1555,7 @@ void ILibraryAppletCreator::CreateHandleStorage(HLERequestContext& ctx) {
} }
std::vector<u8> memory(transfer_mem->GetSize()); std::vector<u8> memory(transfer_mem->GetSize());
system.ApplicationMemory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), ctx.GetMemory().ReadBlock(transfer_mem->GetSourceAddress(), memory.data(), memory.size());
memory.size());
IPC::ResponseBuilder rb{ctx, 2, 0, 1}; IPC::ResponseBuilder rb{ctx, 2, 0, 1};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);

View File

@ -360,6 +360,10 @@ public:
return *thread; return *thread;
} }
[[nodiscard]] Core::Memory::Memory& GetMemory() const {
return memory;
}
template <typename T> template <typename T>
Kernel::KScopedAutoObject<T> GetObjectFromHandle(u32 handle) { Kernel::KScopedAutoObject<T> GetObjectFromHandle(u32 handle) {
auto obj = client_handle_table->GetObjectForIpc(handle, thread); auto obj = client_handle_table->GetObjectForIpc(handle, thread);

View File

@ -26,7 +26,7 @@ public:
explicit IJitEnvironment(Core::System& system_, Kernel::KProcess& process_, CodeRange user_rx, explicit IJitEnvironment(Core::System& system_, Kernel::KProcess& process_, CodeRange user_rx,
CodeRange user_ro) CodeRange user_ro)
: ServiceFramework{system_, "IJitEnvironment"}, process{&process_}, : ServiceFramework{system_, "IJitEnvironment"}, process{&process_},
context{system_.ApplicationMemory()} { context{process->GetMemory()} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, &IJitEnvironment::GenerateCode, "GenerateCode"}, {0, &IJitEnvironment::GenerateCode, "GenerateCode"},