1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:18:14 +00:00

Fix some paging related bugs exposed by the spawn stress test.

- Process::exec() needs to restore the original paging scope when called
  on a non-current process.
- Add missing InterruptDisabler guards around g_processes access.
- Only flush the TLB when modifying the active page tables.
This commit is contained in:
Andreas Kling 2018-11-09 01:25:31 +01:00
parent 7b96218389
commit e71cb1c56b
13 changed files with 110 additions and 67 deletions

View file

@ -28,7 +28,7 @@ typedef struct
#define RANGE_SIZE 0x100000
PRIVATE BYTE alloc_map[POOL_SIZE / CHUNK_SIZE / 8];
static byte alloc_map[POOL_SIZE / CHUNK_SIZE / 8];
volatile DWORD sum_alloc = 0;
volatile DWORD sum_free = POOL_SIZE;
@ -50,8 +50,7 @@ bool is_kmalloc_address(void* ptr)
return ptr >= (void*)BASE_PHYS && ptr <= ((void*)BASE_PHYS + POOL_SIZE);
}
PUBLIC void
kmalloc_init()
void kmalloc_init()
{
memset( &alloc_map, 0, sizeof(alloc_map) );
memset( (void *)BASE_PHYS, 0, POOL_SIZE );
@ -88,8 +87,7 @@ void* kmalloc_page_aligned(size_t size)
}
PUBLIC void *
kmalloc( DWORD size )
void* kmalloc(dword size)
{
InterruptDisabler disabler;
@ -162,8 +160,7 @@ kmalloc( DWORD size )
return nullptr;
}
PUBLIC void
kfree( void *ptr )
void kfree(void *ptr)
{
if( !ptr )
return;