svc: SharedMemory size should be 64-bits and cleanup.
This commit is contained in:
parent
f9c9ce2005
commit
647364db8f
|
@ -14,7 +14,7 @@ namespace Kernel {
|
||||||
SharedMemory::SharedMemory() {}
|
SharedMemory::SharedMemory() {}
|
||||||
SharedMemory::~SharedMemory() {}
|
SharedMemory::~SharedMemory() {}
|
||||||
|
|
||||||
SharedPtr<SharedMemory> SharedMemory::Create(SharedPtr<Process> owner_process, u32 size,
|
SharedPtr<SharedMemory> SharedMemory::Create(SharedPtr<Process> owner_process, u64 size,
|
||||||
MemoryPermission permissions,
|
MemoryPermission permissions,
|
||||||
MemoryPermission other_permissions, VAddr address,
|
MemoryPermission other_permissions, VAddr address,
|
||||||
MemoryRegion region, std::string name) {
|
MemoryRegion region, std::string name) {
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
* linear heap.
|
* linear heap.
|
||||||
* @param name Optional object name, used for debugging purposes.
|
* @param name Optional object name, used for debugging purposes.
|
||||||
*/
|
*/
|
||||||
static SharedPtr<SharedMemory> Create(SharedPtr<Process> owner_process, u32 size,
|
static SharedPtr<SharedMemory> Create(SharedPtr<Process> owner_process, u64 size,
|
||||||
MemoryPermission permissions,
|
MemoryPermission permissions,
|
||||||
MemoryPermission other_permissions, VAddr address = 0,
|
MemoryPermission other_permissions, VAddr address = 0,
|
||||||
MemoryRegion region = MemoryRegion::BASE,
|
MemoryRegion region = MemoryRegion::BASE,
|
||||||
|
@ -116,7 +116,7 @@ public:
|
||||||
/// Offset into the backing block for this shared memory.
|
/// Offset into the backing block for this shared memory.
|
||||||
size_t backing_block_offset;
|
size_t backing_block_offset;
|
||||||
/// Size of the memory block. Page-aligned.
|
/// Size of the memory block. Page-aligned.
|
||||||
u32 size;
|
u64 size;
|
||||||
/// Permission restrictions applied to the process which created the block.
|
/// Permission restrictions applied to the process which created the block.
|
||||||
MemoryPermission permissions;
|
MemoryPermission permissions;
|
||||||
/// Permission restrictions applied to other processes mapping the block.
|
/// Permission restrictions applied to other processes mapping the block.
|
||||||
|
|
|
@ -416,8 +416,7 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s
|
||||||
"called, shared_memory_handle=0x%08X, addr=0x%llx, size=0x%llx, permissions=0x%08X",
|
"called, shared_memory_handle=0x%08X, addr=0x%llx, size=0x%llx, permissions=0x%08X",
|
||||||
shared_memory_handle, addr, size, permissions);
|
shared_memory_handle, addr, size, permissions);
|
||||||
|
|
||||||
SharedPtr<SharedMemory> shared_memory =
|
SharedPtr<SharedMemory> shared_memory = g_handle_table.Get<SharedMemory>(shared_memory_handle);
|
||||||
Kernel::g_handle_table.Get<SharedMemory>(shared_memory_handle);
|
|
||||||
if (!shared_memory) {
|
if (!shared_memory) {
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
@ -432,7 +431,7 @@ static ResultCode MapSharedMemory(Handle shared_memory_handle, VAddr addr, u64 s
|
||||||
case MemoryPermission::WriteExecute:
|
case MemoryPermission::WriteExecute:
|
||||||
case MemoryPermission::ReadWriteExecute:
|
case MemoryPermission::ReadWriteExecute:
|
||||||
case MemoryPermission::DontCare:
|
case MemoryPermission::DontCare:
|
||||||
return shared_memory->Map(Kernel::g_current_process.get(), addr, permissions_type,
|
return shared_memory->Map(g_current_process.get(), addr, permissions_type,
|
||||||
MemoryPermission::DontCare);
|
MemoryPermission::DontCare);
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions);
|
LOG_ERROR(Kernel_SVC, "unknown permissions=0x%08X", permissions);
|
||||||
|
@ -739,13 +738,14 @@ static ResultCode SetThreadCoreMask(u64, u64, u64) {
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ResultCode CreateSharedMemory(Handle* handle, u64 sz, u32 local_permissions,
|
static ResultCode CreateSharedMemory(Handle* handle, u64 size, u32 local_permissions,
|
||||||
u32 remote_permissions) {
|
u32 remote_permissions) {
|
||||||
LOG_TRACE(Kernel_SVC, "called, sz=0x%llx, localPerms=0x%08x, remotePerms=0x%08x", sz,
|
LOG_TRACE(Kernel_SVC, "called, size=0x%llx, localPerms=0x%08x, remotePerms=0x%08x", size,
|
||||||
local_permissions, remote_permissions);
|
local_permissions, remote_permissions);
|
||||||
auto sharedMemHandle = SharedMemory::Create(
|
auto sharedMemHandle =
|
||||||
g_handle_table.Get<Process>(KernelHandle::CurrentProcess), sz,
|
SharedMemory::Create(g_handle_table.Get<Process>(KernelHandle::CurrentProcess), size,
|
||||||
(Kernel::MemoryPermission)local_permissions, (Kernel::MemoryPermission)remote_permissions);
|
static_cast<MemoryPermission>(local_permissions),
|
||||||
|
static_cast<MemoryPermission>(remote_permissions));
|
||||||
|
|
||||||
CASCADE_RESULT(*handle, g_handle_table.Create(sharedMemHandle));
|
CASCADE_RESULT(*handle, g_handle_table.Create(sharedMemHandle));
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
|
|
Reference in New Issue