diff options
author | jhb <jhb@FreeBSD.org> | 2002-04-02 22:19:16 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-04-02 22:19:16 +0000 |
commit | 9d3d63fcbcfccaf091b15608a262de78b5912c8a (patch) | |
tree | a511bf3088c2455af875faa67fac4fc49ade8493 /sys/powerpc | |
parent | 26f5df0f6761c5fad4b517e8c0c4b46da408361b (diff) | |
download | FreeBSD-src-9d3d63fcbcfccaf091b15608a262de78b5912c8a.zip FreeBSD-src-9d3d63fcbcfccaf091b15608a262de78b5912c8a.tar.gz |
- Move the MI mutexes sched_lock and Giant from being declared in the
various machdep.c's to being declared in kern_mutex.c.
- Add a new function mutex_init() used to perform early initialization
needed for mutexes such as setting up thread0's contested lock list
and initializing MI mutexes. Change the various MD startup routines
to call this function instead of duplicating all the code themselves.
Tested on: alpha, i386
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/aim/machdep.c | 26 | ||||
-rw-r--r-- | sys/powerpc/powerpc/machdep.c | 26 |
2 files changed, 6 insertions, 46 deletions
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index e078d12..6007f15 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -114,9 +114,6 @@ static const char rcsid[] = int physmem = 0; int cold = 1; -struct mtx sched_lock; -struct mtx Giant; - char pcpu0[PAGE_SIZE]; char uarea0[UAREA_PAGES * PAGE_SIZE]; struct trapframe frame0; @@ -373,7 +370,6 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) proc0.p_uarea = (struct user *)uarea0; proc0.p_stats = &proc0.p_uarea->u_stats; thread0.td_frame = &frame0; - LIST_INIT(&thread0.td_contested); /* * Set up per-cpu data. @@ -387,13 +383,7 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) __asm __volatile("mtsprg 0, %0" :: "r"(pc)); - /* - * Initialize mutexes. - */ - mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); - mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); - mtx_init(&proc0.p_mtx, "process lock", MTX_DEF|MTX_DUPOK); - mtx_lock(&Giant); + mutex_init(); /* * Initialise virtual memory. @@ -514,24 +504,14 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) init_param1(); init_param2(physmem); - /* setup curproc so the mutexes work */ - PCPU_SET(curthread, &thread0); - LIST_INIT(&thread0.td_contested); - /* XXX: NetBSDism I _think_. Not sure yet. */ #if 0 curpm = PCPU_GET(curpcb)->pcb_pmreal = PCPU_GET(curpcb)->pcb_pm = kernel_pmap; #endif - - /* - * Initialise some 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_lock(&Giant); + + mutex_init(); /* * Initialise console. diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index e078d12..6007f15 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -114,9 +114,6 @@ static const char rcsid[] = int physmem = 0; int cold = 1; -struct mtx sched_lock; -struct mtx Giant; - char pcpu0[PAGE_SIZE]; char uarea0[UAREA_PAGES * PAGE_SIZE]; struct trapframe frame0; @@ -373,7 +370,6 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) proc0.p_uarea = (struct user *)uarea0; proc0.p_stats = &proc0.p_uarea->u_stats; thread0.td_frame = &frame0; - LIST_INIT(&thread0.td_contested); /* * Set up per-cpu data. @@ -387,13 +383,7 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) __asm __volatile("mtsprg 0, %0" :: "r"(pc)); - /* - * Initialize mutexes. - */ - mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); - mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); - mtx_init(&proc0.p_mtx, "process lock", MTX_DEF|MTX_DUPOK); - mtx_lock(&Giant); + mutex_init(); /* * Initialise virtual memory. @@ -514,24 +504,14 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) init_param1(); init_param2(physmem); - /* setup curproc so the mutexes work */ - PCPU_SET(curthread, &thread0); - LIST_INIT(&thread0.td_contested); - /* XXX: NetBSDism I _think_. Not sure yet. */ #if 0 curpm = PCPU_GET(curpcb)->pcb_pmreal = PCPU_GET(curpcb)->pcb_pm = kernel_pmap; #endif - - /* - * Initialise some 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_lock(&Giant); + + mutex_init(); /* * Initialise console. |