From bbbb2579b4e853bf101abefcf23f1b61204ae3b0 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Tue, 12 Sep 2000 18:41:56 +0000 Subject: [PATCH] Quick fix for hang on booting with -d. mtx_enter() was called before curproc was initialized. curproc == NULL was interpreted as matching the process holding Giant... Just skip mtx_enter() and mtx_exit() in trap() if (curproc == NULL && cold) (&& cold for safety). --- sys/amd64/amd64/trap.c | 6 ++++-- sys/i386/i386/trap.c | 6 ++++-- sys/kern/subr_trap.c | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index f32dfaeeddc..d49327fa981 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -279,7 +279,8 @@ trap(frame) enable_intr(); } - mtx_enter(&Giant, MTX_DEF); + if (p != NULL || !cold) + mtx_enter(&Giant, MTX_DEF); #if defined(I586_CPU) && !defined(NO_F00F_HACK) restart: @@ -639,7 +640,8 @@ restart: user: userret(p, &frame, sticks, 1); out: - mtx_exit(&Giant, MTX_DEF); + if (p != NULL || !cold) + mtx_exit(&Giant, MTX_DEF); } #ifdef notyet diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index f32dfaeeddc..d49327fa981 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -279,7 +279,8 @@ trap(frame) enable_intr(); } - mtx_enter(&Giant, MTX_DEF); + if (p != NULL || !cold) + mtx_enter(&Giant, MTX_DEF); #if defined(I586_CPU) && !defined(NO_F00F_HACK) restart: @@ -639,7 +640,8 @@ restart: user: userret(p, &frame, sticks, 1); out: - mtx_exit(&Giant, MTX_DEF); + if (p != NULL || !cold) + mtx_exit(&Giant, MTX_DEF); } #ifdef notyet diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index f32dfaeeddc..d49327fa981 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -279,7 +279,8 @@ trap(frame) enable_intr(); } - mtx_enter(&Giant, MTX_DEF); + if (p != NULL || !cold) + mtx_enter(&Giant, MTX_DEF); #if defined(I586_CPU) && !defined(NO_F00F_HACK) restart: @@ -639,7 +640,8 @@ restart: user: userret(p, &frame, sticks, 1); out: - mtx_exit(&Giant, MTX_DEF); + if (p != NULL || !cold) + mtx_exit(&Giant, MTX_DEF); } #ifdef notyet