mirror of https://gitlab.com/nakst/essence
bugfix in ThreadSetTemporaryAddressSpace: open 2 references instead of 1
This commit is contained in:
parent
3ba01fa09d
commit
77586e6561
|
@ -1206,6 +1206,12 @@ bool POSIXSubsystemTest() {
|
||||||
EsFileWriteAll(EsLiteral("0:/test.sh"), EsLiteral("find . | grep Kernel.esx"));
|
EsFileWriteAll(EsLiteral("0:/test.sh"), EsLiteral("find . | grep Kernel.esx"));
|
||||||
CHECK(POSIXSubsystemRunCommandAndCheckOutput(executeEnvironment, argv, executable, "./Essence/Kernel.esx\n"));
|
CHECK(POSIXSubsystemRunCommandAndCheckOutput(executeEnvironment, argv, executable, "./Essence/Kernel.esx\n"));
|
||||||
|
|
||||||
|
EsFileWriteAll(EsLiteral("0:/test.sh"), EsLiteral("exit"));
|
||||||
|
|
||||||
|
for (uintptr_t i = 0; i < 1000; i++) {
|
||||||
|
CHECK(POSIXSubsystemRunCommandAndCheckOutput(executeEnvironment, argv, executable, ""));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1305,7 +1311,7 @@ const Test tests[] = {
|
||||||
TEST(RangeSetTests, 60),
|
TEST(RangeSetTests, 60),
|
||||||
TEST(UTF8Tests, 60),
|
TEST(UTF8Tests, 60),
|
||||||
TEST(PipeTests, 60),
|
TEST(PipeTests, 60),
|
||||||
TEST(POSIXSubsystemTest, 60),
|
TEST(POSIXSubsystemTest, 120),
|
||||||
TEST(RestartTest, 1200),
|
TEST(RestartTest, 1200),
|
||||||
TEST(ResizeFileTest, 600),
|
TEST(ResizeFileTest, 600),
|
||||||
};
|
};
|
||||||
|
|
|
@ -2176,10 +2176,6 @@ void MMSpaceOpenReference(MMSpace *space) {
|
||||||
KernelPanic("MMSpaceOpenReference - Space %x has invalid reference count.\n", space);
|
KernelPanic("MMSpaceOpenReference - Space %x has invalid reference count.\n", space);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (space->referenceCount >= K_MAX_PROCESSORS + 1) {
|
|
||||||
KernelPanic("MMSpaceOpenReference - Space %x has too many references (expected a maximum of %d).\n", K_MAX_PROCESSORS + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
__sync_fetch_and_add(&space->referenceCount, 1);
|
__sync_fetch_and_add(&space->referenceCount, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -934,10 +934,12 @@ void ThreadSetTemporaryAddressSpace(MMSpace *space) {
|
||||||
MMSpace *oldSpace = thread->temporaryAddressSpace ?: kernelMMSpace;
|
MMSpace *oldSpace = thread->temporaryAddressSpace ?: kernelMMSpace;
|
||||||
thread->temporaryAddressSpace = space;
|
thread->temporaryAddressSpace = space;
|
||||||
MMSpace *newSpace = space ?: kernelMMSpace;
|
MMSpace *newSpace = space ?: kernelMMSpace;
|
||||||
MMSpaceOpenReference(newSpace);
|
MMSpaceOpenReference(newSpace); // Open our reference to the space.
|
||||||
|
MMSpaceOpenReference(newSpace); // This reference will be closed in PostContextSwitch, simulating the reference opened in Scheduler::Yield.
|
||||||
ProcessorSetAddressSpace(&newSpace->data);
|
ProcessorSetAddressSpace(&newSpace->data);
|
||||||
KSpinlockRelease(&scheduler.dispatchSpinlock);
|
KSpinlockRelease(&scheduler.dispatchSpinlock);
|
||||||
MMSpaceCloseReference(oldSpace);
|
MMSpaceCloseReference(oldSpace); // Close our reference to the space.
|
||||||
|
MMSpaceCloseReference(oldSpace); // This reference was opened by Scheduler::Yield, and would have been closed in PostContextSwitch.
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsyncTaskThread() {
|
void AsyncTaskThread() {
|
||||||
|
|
Loading…
Reference in New Issue