mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fixed descriptors not being reset by SysExit.
Indirectly, this fixes the snake; snake; panic bug.
This commit is contained in:
parent
e234e0a2d4
commit
b15763b2de
3 changed files with 12 additions and 11 deletions
|
@ -42,15 +42,22 @@ namespace Sortix
|
|||
}
|
||||
|
||||
DescriptorTable::~DescriptorTable()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void DescriptorTable::Reset()
|
||||
{
|
||||
for ( int i = 0; i < numdevices; i++ )
|
||||
{
|
||||
if ( devices[i] == NULL || devices[i] == reserveddevideptr ) { continue; }
|
||||
|
||||
// TODO: unref any device here!
|
||||
devices[i]->Unref();
|
||||
}
|
||||
|
||||
delete[] devices;
|
||||
devices = NULL;
|
||||
numdevices = 0;
|
||||
}
|
||||
|
||||
int DescriptorTable::Allocate(Device* object)
|
||||
|
|
|
@ -45,10 +45,12 @@ namespace Sortix
|
|||
void Free(int index);
|
||||
void UseReservation(int index, Device* object);
|
||||
bool Fork(DescriptorTable* forkinto);
|
||||
void Reset();
|
||||
|
||||
public:
|
||||
inline Device* Get(int index)
|
||||
{
|
||||
if ( !devices ) { return NULL; }
|
||||
if ( index < 0 || numdevices <= index ) { return NULL; }
|
||||
return devices[index];
|
||||
}
|
||||
|
|
|
@ -256,15 +256,6 @@ namespace Sortix
|
|||
// TODO: Delete all threads and their stacks.
|
||||
|
||||
ResetAddressSpace();
|
||||
|
||||
// HACK: Don't let VGA buffers survive executes.
|
||||
// Real Solution: Don't use VGA buffers in this manner.
|
||||
for ( int i = 0; i < 32; i++ )
|
||||
{
|
||||
Device* dev = descriptors.Get(i);
|
||||
if ( !dev ) { continue; }
|
||||
if ( dev->IsType(Device::VGABUFFER) ) { descriptors.Free(i); }
|
||||
}
|
||||
}
|
||||
|
||||
int Process::Execute(const char* programname, const byte* program, size_t programsize, int argc, const char* const* argv, CPU::InterruptRegisters* regs)
|
||||
|
@ -572,7 +563,8 @@ namespace Sortix
|
|||
nextsibling->prevsibling = prevsibling;
|
||||
}
|
||||
|
||||
// TODO: Close all the file descriptors!
|
||||
// Close all the file descriptors.
|
||||
descriptors.Reset();
|
||||
|
||||
// Make all threads belonging to process unrunnable.
|
||||
for ( Thread* t = firstthread; t; t = t->nextsibling )
|
||||
|
|
Loading…
Add table
Reference in a new issue