mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
Use a freelist for GDT entries.
Tweak the kmalloc space layout a bit. Get the spawn stress test up and running again.
This commit is contained in:
parent
9da4864a9a
commit
c70afd045e
6 changed files with 40 additions and 21 deletions
|
@ -20,15 +20,20 @@ static Descriptor* s_gdt;
|
|||
|
||||
static IRQHandler** s_irqHandler;
|
||||
|
||||
static Vector<word, KmallocEternalAllocator>* s_gdt_freelist;
|
||||
|
||||
static WORD s_gdtLength;
|
||||
|
||||
WORD allocateGDTEntry()
|
||||
word gdt_alloc_entry()
|
||||
{
|
||||
// FIXME: This should not grow indefinitely.
|
||||
ASSERT(s_gdtLength < 256);
|
||||
WORD newGDTEntry = s_gdtLength * 8;
|
||||
s_gdtLength++;
|
||||
return newGDTEntry;
|
||||
ASSERT(s_gdt_freelist);
|
||||
ASSERT(!s_gdt_freelist->isEmpty());
|
||||
return s_gdt_freelist->takeLast();
|
||||
}
|
||||
|
||||
void gdt_free_entry(word entry)
|
||||
{
|
||||
s_gdt_freelist->append(entry);
|
||||
}
|
||||
|
||||
extern "C" void handleIRQ();
|
||||
|
@ -310,6 +315,12 @@ void gdt_init()
|
|||
s_gdt = static_cast<Descriptor*>(kmalloc_eternal(sizeof(Descriptor) * 256));
|
||||
s_gdtLength = 5;
|
||||
|
||||
s_gdt_freelist = new Vector<word, KmallocEternalAllocator>();
|
||||
s_gdt_freelist->ensureCapacity(256);
|
||||
for (size_t i = s_gdtLength; i < 256; ++i)
|
||||
s_gdt_freelist->uncheckedAppend(i * 8);
|
||||
|
||||
s_gdtLength = 256;
|
||||
s_gdtr.address = s_gdt;
|
||||
s_gdtr.size = (s_gdtLength * 8) - 1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue