fix: extract supplemental and shared_files initialisation

This commit is contained in:
2024-12-04 11:17:46 +00:00
parent 10bfffc4b0
commit f2aba977b4
4 changed files with 28 additions and 14 deletions

View File

@@ -31,6 +31,7 @@
#else
#include "tests/threads/tests.h"
#endif
#include "vm/page.h"
#ifdef VM
#include "vm/frame.h"
#include "devices/swap.h"
@@ -121,6 +122,7 @@ main (void)
exception_init ();
syscall_init ();
#endif
shared_files_init ();
/* Start thread scheduler and enable interrupts. */
thread_start ();

View File

@@ -134,10 +134,6 @@ thread_start (void)
t))
PANIC ("Failed to initialise child results table for main thread.");
/* Initialise the shared files table and lock. */
if (!hash_init (&shared_files, shared_file_hash, shared_file_less, NULL))
PANIC ("Failed to initialise shared pages table.");
lock_init (&shared_files_lock);
/* Create the idle thread. */
@@ -272,7 +268,7 @@ thread_create (const char *name, int priority,
if (!hash_init (&t->open_files, fd_hash, fd_less, NULL)
|| !hash_init (&t->child_results, process_result_hash,
process_result_less, t)
|| !hash_init (&t->pages, page_hash, page_less, NULL))
|| !init_pages (t))
{
palloc_free_page (t);
free (t->result);