aim_machdep.c (87546) | aim_machdep.c (87702) |
---|---|
1/* 2 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 3 * Copyright (C) 1995, 1996 TooLs GmbH. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 42 unchanged lines hidden (view full) --- 51 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 52 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 53 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 * $NetBSD: machdep.c,v 1.74.2.1 2000/11/01 16:13:48 tv Exp $ 55 */ 56 57#ifndef lint 58static const char rcsid[] = | 1/* 2 * Copyright (C) 1995, 1996 Wolfgang Solfrank. 3 * Copyright (C) 1995, 1996 TooLs GmbH. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 42 unchanged lines hidden (view full) --- 51 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 52 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 53 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 * $NetBSD: machdep.c,v 1.74.2.1 2000/11/01 16:13:48 tv Exp $ 55 */ 56 57#ifndef lint 58static const char rcsid[] = |
59 "$FreeBSD: head/sys/powerpc/aim/machdep.c 87546 2001-12-09 01:57:09Z dillon $"; | 59 "$FreeBSD: head/sys/powerpc/aim/machdep.c 87702 2001-12-11 23:33:44Z jhb $"; |
60#endif /* not lint */ 61 62#include "opt_ddb.h" 63#include "opt_compat.h" 64#include "opt_msgbuf.h" 65 66#include <sys/param.h> 67#include <sys/systm.h> --- 28 unchanged lines hidden (view full) --- 96#include <vm/vm_pager.h> 97#include <sys/user.h> 98#include <sys/ptrace.h> 99#include <machine/bat.h> 100#include <machine/clock.h> 101#include <machine/md_var.h> 102#include <machine/reg.h> 103#include <machine/fpu.h> | 60#endif /* not lint */ 61 62#include "opt_ddb.h" 63#include "opt_compat.h" 64#include "opt_msgbuf.h" 65 66#include <sys/param.h> 67#include <sys/systm.h> --- 28 unchanged lines hidden (view full) --- 96#include <vm/vm_pager.h> 97#include <sys/user.h> 98#include <sys/ptrace.h> 99#include <machine/bat.h> 100#include <machine/clock.h> 101#include <machine/md_var.h> 102#include <machine/reg.h> 103#include <machine/fpu.h> |
104#include <machine/globaldata.h> | |
105#include <machine/vmparam.h> 106#include <machine/elf.h> 107#include <machine/trap.h> 108#include <machine/powerpc.h> 109#include <dev/ofw/openfirm.h> 110#include <ddb/ddb.h> 111#include <sys/vnode.h> 112#include <machine/sigframe.h> --- 234 unchanged lines hidden (view full) --- 347extern ipkdblow, ipkdbsize; 348#endif 349 350void 351powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) 352{ 353 unsigned int exc, scratch; 354 struct mem_region *allmem, *availmem, *mp; | 104#include <machine/vmparam.h> 105#include <machine/elf.h> 106#include <machine/trap.h> 107#include <machine/powerpc.h> 108#include <dev/ofw/openfirm.h> 109#include <ddb/ddb.h> 110#include <sys/vnode.h> 111#include <machine/sigframe.h> --- 234 unchanged lines hidden (view full) --- 346extern ipkdblow, ipkdbsize; 347#endif 348 349void 350powerpc_init(u_int startkernel, u_int endkernel, u_int basekernel, char *args) 351{ 352 unsigned int exc, scratch; 353 struct mem_region *allmem, *availmem, *mp; |
355 struct globaldata *globalp; | 354 struct pcpu *pcpup; |
356 357 /* 358 * Set up BAT0 to only map the lowest 256 MB area 359 */ 360 battable[0].batl = BATL(0x00000000, BAT_M, BAT_PP_RW); 361 battable[0].batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs); 362 363 /* --- 57 unchanged lines hidden (view full) --- 421 proc0uarea = (struct user *)pmap_steal_memory(UAREA_PAGES * PAGE_SIZE); 422 proc0kstack = pmap_steal_memory(KSTACK_PAGES * PAGE_SIZE); 423 proc0.p_uarea = proc0uarea; 424 thread0 = &proc0.p_thread; 425 thread0->td_kstack = proc0kstack; 426 thread0->td_pcb = (struct pcb *) 427 (thread0->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; 428 | 355 356 /* 357 * Set up BAT0 to only map the lowest 256 MB area 358 */ 359 battable[0].batl = BATL(0x00000000, BAT_M, BAT_PP_RW); 360 battable[0].batu = BATU(0x00000000, BAT_BL_256M, BAT_Vs); 361 362 /* --- 57 unchanged lines hidden (view full) --- 420 proc0uarea = (struct user *)pmap_steal_memory(UAREA_PAGES * PAGE_SIZE); 421 proc0kstack = pmap_steal_memory(KSTACK_PAGES * PAGE_SIZE); 422 proc0.p_uarea = proc0uarea; 423 thread0 = &proc0.p_thread; 424 thread0->td_kstack = proc0kstack; 425 thread0->td_pcb = (struct pcb *) 426 (thread0->td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; 427 |
429 globalp = pmap_steal_memory(round_page(sizeof(struct globaldata))); | 428 pcpup = pmap_steal_memory(round_page(sizeof(struct pcpu))); |
430 431 /* 432 * XXX: Pass 0 as CPU id. This is bad. We need to work out 433 * XXX: which CPU we are somehow. 434 */ | 429 430 /* 431 * XXX: Pass 0 as CPU id. This is bad. We need to work out 432 * XXX: which CPU we are somehow. 433 */ |
435 globaldata_init(globalp, 0, sizeof(struct globaldata)); 436 __asm ("mtsprg 0, %0" :: "r"(globalp)); | 434 pcpu_init(pcpup, 0, sizeof(struct pcpu)); 435 __asm ("mtsprg 0, %0" :: "r"(pcpup)); |
437 438 /* Init basic tunables, hz etc */ 439 init_param1(); 440 init_param2(physmem); 441 442 /* setup curproc so the mutexes work */ 443 444 PCPU_SET(curthread, thread0); | 436 437 /* Init basic tunables, hz etc */ 438 init_param1(); 439 init_param2(physmem); 440 441 /* setup curproc so the mutexes work */ 442 443 PCPU_SET(curthread, thread0); |
445 PCPU_SET(spinlocks, NULL); | |
446 447 LIST_INIT(&thread0->td_contested); 448 449/* XXX: NetBSDism I _think_. Not sure yet. */ 450#if 0 451 curpm = PCPU_GET(curpcb)->pcb_pmreal = PCPU_GET(curpcb)->pcb_pm = kernel_pmap; 452#endif 453 454 /* 455 * Initialise some mutexes. 456 */ 457 mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); 458 mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); 459 mtx_init(&proc0.p_mtx, "process lock", MTX_DEF); | 444 445 LIST_INIT(&thread0->td_contested); 446 447/* XXX: NetBSDism I _think_. Not sure yet. */ 448#if 0 449 curpm = PCPU_GET(curpcb)->pcb_pmreal = PCPU_GET(curpcb)->pcb_pm = kernel_pmap; 450#endif 451 452 /* 453 * Initialise some mutexes. 454 */ 455 mtx_init(&Giant, "Giant", MTX_DEF | MTX_RECURSE); 456 mtx_init(&sched_lock, "sched lock", MTX_SPIN | MTX_RECURSE); 457 mtx_init(&proc0.p_mtx, "process lock", MTX_DEF); |
458 mtx_lock(&Giant); |
|
460 461 /* 462 * Initialise console. 463 */ 464 cninit(); 465 | 459 460 /* 461 * Initialise console. 462 */ 463 cninit(); 464 |
466 mtx_lock(&Giant); 467 | |
468#ifdef __notyet__ /* Needs some rethinking regarding real/virtual OFW */ 469 OF_set_callback(callback); 470#endif 471 472 /* 473 * Set up trap vectors 474 */ 475 for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100) { --- 427 unchanged lines hidden (view full) --- 903ptrace_clear_single_step(struct thread *td) 904{ 905 906 /* XXX: coming soon... */ 907 return (ENOSYS); 908} 909 910/* | 465#ifdef __notyet__ /* Needs some rethinking regarding real/virtual OFW */ 466 OF_set_callback(callback); 467#endif 468 469 /* 470 * Set up trap vectors 471 */ 472 for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100) { --- 427 unchanged lines hidden (view full) --- 900ptrace_clear_single_step(struct thread *td) 901{ 902 903 /* XXX: coming soon... */ 904 return (ENOSYS); 905} 906 907/* |
911 * Initialise a struct globaldata. | 908 * Initialise a struct pcpu. |
912 */ 913void | 909 */ 910void |
914globaldata_init(struct globaldata *globaldata, int cpuid, size_t sz) 915{ | 911cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz) 912{ |
916 | 913 |
917 bzero(globaldata, sz); 918 globaldata->gd_cpuid = cpuid; 919 globaldata->gd_next_asn = 0; 920 globaldata->gd_current_asngen = 1; | 914 pcpu->pc_current_asngen = 1; |
921} 922 923void 924enable_fpu(pcb) 925 struct pcb *pcb; 926{ 927 int msr, scratch; 928 --- 85 unchanged lines hidden --- | 915} 916 917void 918enable_fpu(pcb) 919 struct pcb *pcb; 920{ 921 int msr, scratch; 922 --- 85 unchanged lines hidden --- |