[Kernel] Fix DuplicateHandle, fix typo, panic on FS::OpenFileDirectly

This commit is contained in:
wheremyfoodat 2022-10-03 21:05:41 +03:00
parent fca54b99a7
commit 88c93645e3
4 changed files with 21 additions and 4 deletions

View file

@ -173,10 +173,11 @@ void Kernel::duplicateHandle() {
logSVC("DuplicateHandle(handle = %X)\n", original);
if (original == KernelHandles::CurrentThread) {
printf("[Warning] Duplicated current thread. This might be horribly broken!\n");
const auto& t = threads[currentThreadIndex];
regs[0] = SVCResult::Success;
regs[1] = makeThread(t.entrypoint, t.initialSP, t.priority, t.processorID, t.arg, t.status);
Handle ret = makeObject(KernelObjectType::Thread);
objects[ret].data = &threads[currentThreadIndex];
regs[1] = ret;
} else {
Helpers::panic("DuplicateHandle: unimplemented handle type");
}