@ -28,6 +28,16 @@ SharedPtr<SharedMemory> SharedMemory::Create(SharedPtr<Process> owner_process, u
shared_memory - > permissions = permissions ;
shared_memory - > permissions = permissions ;
shared_memory - > other_permissions = other_permissions ;
shared_memory - > other_permissions = other_permissions ;
if ( address = = 0 ) {
shared_memory - > backing_block = std : : make_shared < std : : vector < u8 > > ( size ) ;
shared_memory - > backing_block_offset = 0 ;
// Refresh the address mappings for the current process.
if ( Core : : CurrentProcess ( ) ! = nullptr ) {
Core : : CurrentProcess ( ) - > vm_manager . RefreshMemoryBlockMappings (
shared_memory - > backing_block . get ( ) ) ;
}
} else {
auto & vm_manager = shared_memory - > owner_process - > vm_manager ;
auto & vm_manager = shared_memory - > owner_process - > vm_manager ;
// The memory is already available and mapped in the owner process.
// The memory is already available and mapped in the owner process.
@ -42,6 +52,8 @@ SharedPtr<SharedMemory> SharedMemory::Create(SharedPtr<Process> owner_process, u
shared_memory - > backing_block = vma - > second . backing_block ;
shared_memory - > backing_block = vma - > second . backing_block ;
shared_memory - > backing_block_offset = vma - > second . offset + vma_offset ;
shared_memory - > backing_block_offset = vma - > second . offset + vma_offset ;
}
shared_memory - > base_address = address ;
shared_memory - > base_address = address ;
return shared_memory ;
return shared_memory ;