Kernel: change owner_process in Thread/SharedMemory to raw pointer
Otherwise circular ownership would form in Process->handle_table->thread->owner_process
This commit is contained in:
parent
8d32843d68
commit
e5c5d1ecce
|
@ -102,7 +102,7 @@ public:
|
|||
*/
|
||||
ResultVal<SharedPtr<Thread>> CreateThread(std::string name, VAddr entry_point, u32 priority,
|
||||
u32 arg, s32 processor_id, VAddr stack_top,
|
||||
SharedPtr<Process> owner_process);
|
||||
Process* owner_process);
|
||||
|
||||
/**
|
||||
* Creates a semaphore.
|
||||
|
@ -156,7 +156,7 @@ public:
|
|||
* linear heap.
|
||||
* @param name Optional object name, used for debugging purposes.
|
||||
*/
|
||||
SharedPtr<SharedMemory> CreateSharedMemory(SharedPtr<Process> owner_process, u32 size,
|
||||
SharedPtr<SharedMemory> CreateSharedMemory(Process* owner_process, u32 size,
|
||||
MemoryPermission permissions,
|
||||
MemoryPermission other_permissions,
|
||||
VAddr address = 0,
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Kernel {
|
|||
SharedMemory::SharedMemory(KernelSystem& kernel) : Object(kernel) {}
|
||||
SharedMemory::~SharedMemory() {}
|
||||
|
||||
SharedPtr<SharedMemory> KernelSystem::CreateSharedMemory(SharedPtr<Process> owner_process, u32 size,
|
||||
SharedPtr<SharedMemory> KernelSystem::CreateSharedMemory(Process* owner_process, u32 size,
|
||||
MemoryPermission permissions,
|
||||
MemoryPermission other_permissions,
|
||||
VAddr address, MemoryRegion region,
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
u8* GetPointer(u32 offset = 0);
|
||||
|
||||
/// Process that created this shared memory block.
|
||||
SharedPtr<Process> owner_process;
|
||||
Process* owner_process;
|
||||
/// Address of shared memory block in the owner process if specified.
|
||||
VAddr base_address;
|
||||
/// Physical address of the shared memory block in the linear heap if no address was specified
|
||||
|
|
|
@ -785,9 +785,9 @@ static ResultCode CreateThread(Handle* out_handle, u32 priority, u32 entry_point
|
|||
break;
|
||||
}
|
||||
|
||||
CASCADE_RESULT(SharedPtr<Thread> thread,
|
||||
Core::System::GetInstance().Kernel().CreateThread(
|
||||
name, entry_point, priority, arg, processor_id, stack_top, current_process));
|
||||
CASCADE_RESULT(SharedPtr<Thread> thread, Core::System::GetInstance().Kernel().CreateThread(
|
||||
name, entry_point, priority, arg, processor_id,
|
||||
stack_top, current_process.get()));
|
||||
|
||||
thread->context->SetFpscr(FPSCR_DEFAULT_NAN | FPSCR_FLUSH_TO_ZERO |
|
||||
FPSCR_ROUND_TOZERO); // 0x03C00000
|
||||
|
@ -1157,7 +1157,7 @@ static ResultCode CreateMemoryBlock(Handle* out_handle, u32 addr, u32 size, u32
|
|||
region = current_process->flags.memory_region;
|
||||
|
||||
shared_memory = Core::System::GetInstance().Kernel().CreateSharedMemory(
|
||||
current_process, size, static_cast<MemoryPermission>(my_permission),
|
||||
current_process.get(), size, static_cast<MemoryPermission>(my_permission),
|
||||
static_cast<MemoryPermission>(other_permission), addr, region);
|
||||
CASCADE_RESULT(*out_handle, current_process->handle_table.Create(std::move(shared_memory)));
|
||||
|
||||
|
|
|
@ -320,8 +320,7 @@ static void ResetThreadContext(const std::unique_ptr<ARM_Interface::ThreadContex
|
|||
|
||||
ResultVal<SharedPtr<Thread>> KernelSystem::CreateThread(std::string name, VAddr entry_point,
|
||||
u32 priority, u32 arg, s32 processor_id,
|
||||
VAddr stack_top,
|
||||
SharedPtr<Process> owner_process) {
|
||||
VAddr stack_top, Process* owner_process) {
|
||||
// Check if priority is in ranged. Lowest priority -> highest priority id.
|
||||
if (priority > ThreadPrioLowest) {
|
||||
LOG_ERROR(Kernel_SVC, "Invalid thread priority: {}", priority);
|
||||
|
@ -447,7 +446,7 @@ SharedPtr<Thread> SetupMainThread(KernelSystem& kernel, u32 entry_point, u32 pri
|
|||
// Initialize new "main" thread
|
||||
auto thread_res =
|
||||
kernel.CreateThread("main", entry_point, priority, 0, owner_process->ideal_processor,
|
||||
Memory::HEAP_VADDR_END, owner_process);
|
||||
Memory::HEAP_VADDR_END, owner_process.get());
|
||||
|
||||
SharedPtr<Thread> thread = std::move(thread_res).Unwrap();
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ public:
|
|||
/// Mutexes that this thread is currently waiting for.
|
||||
boost::container::flat_set<SharedPtr<Mutex>> pending_mutexes;
|
||||
|
||||
SharedPtr<Process> owner_process; ///< Process that owns this thread
|
||||
Process* owner_process; ///< Process that owns this thread
|
||||
|
||||
/// Objects that the thread is waiting on, in the same order as they were
|
||||
// passed to WaitSynchronization1/N.
|
||||
|
|
Loading…
Reference in New Issue