From ce1a1f42fbe087454bfba032586ca70f370c00e0 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Mon, 18 Jun 2001 19:19:38 +0000 Subject: [PATCH] Initialize mutexes needed early on all in the same place so that the startup routine more closely matches that of alpha and ia64. At some point the common mutexes shared across all platforms probably should move into sys/kern_mutex.c. --- sys/amd64/amd64/machdep.c | 21 ++++++--------------- sys/i386/i386/machdep.c | 21 ++++++--------------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 196b3cc4b9db..a1181f72c67f 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1885,20 +1885,16 @@ init386(first) LIST_INIT(&proc0.p_contested); - mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); -#ifdef SMP /* - * Interrupts can happen very early, so initialize imen_mtx here, rather - * than in init_locks(). - */ - mtx_init(&imen_mtx, "imen", MTX_SPIN); -#endif - - /* - * Giant is used early for at least debugger traps and unexpected traps. + * Initialize mutexes. */ mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); + mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); mtx_init(&proc0.p_mtx, "process lock", MTX_DEF); + mtx_init(&clock_lock, "clk", MTX_SPIN | MTX_RECURSE); +#ifdef SMP + mtx_init(&imen_mtx, "imen", MTX_SPIN); +#endif mtx_lock(&Giant); /* make ldt memory segments */ @@ -1958,11 +1954,6 @@ init386(first) r_idt.rd_base = (int) idt; lidt(&r_idt); - /* - * We need this mutex before the console probe. - */ - mtx_init(&clock_lock, "clk", MTX_SPIN | MTX_RECURSE); - /* * Initialize the console before we print anything out. */ diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 196b3cc4b9db..a1181f72c67f 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1885,20 +1885,16 @@ init386(first) LIST_INIT(&proc0.p_contested); - mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); -#ifdef SMP /* - * Interrupts can happen very early, so initialize imen_mtx here, rather - * than in init_locks(). - */ - mtx_init(&imen_mtx, "imen", MTX_SPIN); -#endif - - /* - * Giant is used early for at least debugger traps and unexpected traps. + * Initialize mutexes. */ mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); + mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); mtx_init(&proc0.p_mtx, "process lock", MTX_DEF); + mtx_init(&clock_lock, "clk", MTX_SPIN | MTX_RECURSE); +#ifdef SMP + mtx_init(&imen_mtx, "imen", MTX_SPIN); +#endif mtx_lock(&Giant); /* make ldt memory segments */ @@ -1958,11 +1954,6 @@ init386(first) r_idt.rd_base = (int) idt; lidt(&r_idt); - /* - * We need this mutex before the console probe. - */ - mtx_init(&clock_lock, "clk", MTX_SPIN | MTX_RECURSE); - /* * Initialize the console before we print anything out. */