diff options
author | benno <benno@FreeBSD.org> | 2002-02-28 03:15:49 +0000 |
---|---|---|
committer | benno <benno@FreeBSD.org> | 2002-02-28 03:15:49 +0000 |
commit | 6c392f40bad7efd3244d47e2148bebd18b9d93c1 (patch) | |
tree | 5704c692d1c1b7d70dc31769e58f27a0c68baab4 /sys/powerpc | |
parent | e738ecea20377e2d5fb6a0ef0ff17a7f76e304b2 (diff) | |
download | FreeBSD-src-6c392f40bad7efd3244d47e2148bebd18b9d93c1.zip FreeBSD-src-6c392f40bad7efd3244d47e2148bebd18b9d93c1.tar.gz |
- Rearrange the sequence of events in powerpc_init() somewhat.
- Catch another instance of PSL_EE being cleared without PSL_RI.
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/aim/machdep.c | 45 | ||||
-rw-r--r-- | sys/powerpc/powerpc/machdep.c | 45 |
2 files changed, 48 insertions, 42 deletions
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c index b596cf3..c4bc5dc 100644 --- a/sys/powerpc/aim/machdep.c +++ b/sys/powerpc/aim/machdep.c @@ -86,6 +86,7 @@ static const char rcsid[] = #include <sys/uio.h> #include <sys/linker.h> #include <sys/cons.h> +#include <sys/ucontext.h> #include <net/netisr.h> #include <vm/vm.h> #include <vm/vm_kern.h> @@ -365,27 +366,16 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) init_param2(physmem); /* - * Initialise virtual memory. - */ - ofmsr |= PSL_IR | PSL_DR; - pmap_bootstrap(startkernel, endkernel); - - /* * XXX: Initialize the interrupt tables. */ bcopy(&decrint, (void *)EXC_DECR, (size_t)&decrsize); /* - * Initialize proc0. + * Start initializing proc0 and thread0. */ proc_linkup(&proc0, &proc0.p_ksegrp, &proc0.p_kse, &thread0); - /* proc0.p_md.md_utrap = NULL; */ proc0.p_uarea = (struct user *)uarea0; proc0.p_stats = &proc0.p_uarea->u_stats; - thread0.td_kstack = kstack0; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - /* frame0.tf_tstate = TSTATE_IE | TSTATE_PEF; */ thread0.td_frame = &frame0; LIST_INIT(&thread0.td_contested); @@ -396,25 +386,38 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) pcpu_init(pc, 0, sizeof(struct pcpu)); pc->pc_curthread = &thread0; pc->pc_curpcb = thread0.td_pcb; + pc->pc_cpuid = 0; /* pc->pc_mid = mid; */ __asm __volatile("mtsprg 0, %0" :: "r"(pc)); /* - * Map and initialise the message buffer. - */ - for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) - pmap_kenter((vm_offset_t)msgbufp + off, msgbuf_phys + off); - msgbufinit(msgbufp, MSGBUF_SIZE); - - /* * 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_lock(&Giant); + + /* + * Initialise virtual memory. + */ + ofmsr |= PSL_IR | PSL_DR; + pmap_bootstrap(startkernel, endkernel); + + /* + * Finish setting up thread0. + */ + thread0.td_kstack = kstack0; + thread0.td_pcb = (struct pcb *) + (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; + + /* + * Map and initialise the message buffer. + */ + for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) + pmap_kenter((vm_offset_t)msgbufp + off, msgbuf_phys + off); + msgbufinit(msgbufp, MSGBUF_SIZE); } #if 0 /* XXX: Old powerpc_init */ @@ -892,7 +895,7 @@ install_extint(void (*handler)(void)) #endif msr = mfmsr(); - mtmsr(msr & ~PSL_EE); + mtmsr(msr & ~(PSL_EE|PSL_RI)); extint_call = (extint_call & 0xfc000003) | offset; bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize); diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c index b596cf3..c4bc5dc 100644 --- a/sys/powerpc/powerpc/machdep.c +++ b/sys/powerpc/powerpc/machdep.c @@ -86,6 +86,7 @@ static const char rcsid[] = #include <sys/uio.h> #include <sys/linker.h> #include <sys/cons.h> +#include <sys/ucontext.h> #include <net/netisr.h> #include <vm/vm.h> #include <vm/vm_kern.h> @@ -365,27 +366,16 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) init_param2(physmem); /* - * Initialise virtual memory. - */ - ofmsr |= PSL_IR | PSL_DR; - pmap_bootstrap(startkernel, endkernel); - - /* * XXX: Initialize the interrupt tables. */ bcopy(&decrint, (void *)EXC_DECR, (size_t)&decrsize); /* - * Initialize proc0. + * Start initializing proc0 and thread0. */ proc_linkup(&proc0, &proc0.p_ksegrp, &proc0.p_kse, &thread0); - /* proc0.p_md.md_utrap = NULL; */ proc0.p_uarea = (struct user *)uarea0; proc0.p_stats = &proc0.p_uarea->u_stats; - thread0.td_kstack = kstack0; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - /* frame0.tf_tstate = TSTATE_IE | TSTATE_PEF; */ thread0.td_frame = &frame0; LIST_INIT(&thread0.td_contested); @@ -396,25 +386,38 @@ powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) pcpu_init(pc, 0, sizeof(struct pcpu)); pc->pc_curthread = &thread0; pc->pc_curpcb = thread0.td_pcb; + pc->pc_cpuid = 0; /* pc->pc_mid = mid; */ __asm __volatile("mtsprg 0, %0" :: "r"(pc)); /* - * Map and initialise the message buffer. - */ - for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) - pmap_kenter((vm_offset_t)msgbufp + off, msgbuf_phys + off); - msgbufinit(msgbufp, MSGBUF_SIZE); - - /* * 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_lock(&Giant); + + /* + * Initialise virtual memory. + */ + ofmsr |= PSL_IR | PSL_DR; + pmap_bootstrap(startkernel, endkernel); + + /* + * Finish setting up thread0. + */ + thread0.td_kstack = kstack0; + thread0.td_pcb = (struct pcb *) + (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; + + /* + * Map and initialise the message buffer. + */ + for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) + pmap_kenter((vm_offset_t)msgbufp + off, msgbuf_phys + off); + msgbufinit(msgbufp, MSGBUF_SIZE); } #if 0 /* XXX: Old powerpc_init */ @@ -892,7 +895,7 @@ install_extint(void (*handler)(void)) #endif msr = mfmsr(); - mtmsr(msr & ~PSL_EE); + mtmsr(msr & ~(PSL_EE|PSL_RI)); extint_call = (extint_call & 0xfc000003) | offset; bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize); |