From owner-p4-projects@FreeBSD.ORG Wed Jan 16 00:48:51 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A965516A46D; Wed, 16 Jan 2008 00:48:51 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EAA316A469 for ; Wed, 16 Jan 2008 00:48:51 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 5208713C4DB for ; Wed, 16 Jan 2008 00:48:51 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0G0mpbV043606 for ; Wed, 16 Jan 2008 00:48:51 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0G0mpqX043603 for perforce@freebsd.org; Wed, 16 Jan 2008 00:48:51 GMT (envelope-from imp@freebsd.org) Date: Wed, 16 Jan 2008 00:48:51 GMT Message-Id: <200801160048.m0G0mpqX043603@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 133376 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Jan 2008 00:48:51 -0000 http://perforce.freebsd.org/chv.cgi?CH=133376 Change 133376 by imp@imp_lighthouse on 2008/01/16 00:48:25 Create a mips_proc0_init() (name stole from Juniper code) to encapsulate the 8 lines of code that were being cut and paste. We may be able to have a routine that's from init_param2() through the kdb_init too that would save another 8 lines of code from all the init functions, but one step at a time. Affected files ... .. //depot/projects/mips2/src/sys/mips/include/md_var.h#5 edit .. //depot/projects/mips2/src/sys/mips/mips/machdep.c#35 edit .. //depot/projects/mips2/src/sys/mips/mips32/adm5120/adm5120_machdep.c#5 edit .. //depot/projects/mips2/src/sys/mips/mips32/idt/idt_machdep.c#7 edit .. //depot/projects/mips2/src/sys/mips/mips32/malta/malta_machdep.c#8 edit .. //depot/projects/mips2/src/sys/mips/mips32/sentry5/s5_machdep.c#6 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/include/md_var.h#5 (text+ko) ==== @@ -41,6 +41,7 @@ void cpu_identify(void); void mips_cpu_init(void); +void mips_proc0_init(void); /* Platform call-downs. */ void platform_identify(void); ==== //depot/projects/mips2/src/sys/mips/mips/machdep.c#35 (text+ko) ==== @@ -468,4 +468,18 @@ } - +void +mips_proc0_init(void) +{ + proc_linkup(&proc0, &thread0); + thread0.td_kstack = kstack0; + /* Initialize pcpu info of cpu-zero */ +#ifdef SMP + pcpu_init(&__pcpu[0], 0, sizeof(struct pcpu)); +#else + pcpu_init(pcpup, 0, sizeof(struct pcpu)); +#endif + pcpup->pc_curthread = &thread0; + cpu_thread_alloc(curthread); + pcpup->pc_curpcb = curthread->td_pcb; +} ==== //depot/projects/mips2/src/sys/mips/mips32/adm5120/adm5120_machdep.c#5 (text+ko) ==== @@ -94,19 +94,10 @@ init_param1(); init_param2(physmem); - mips_cpu_init(); pmap_bootstrap(); - - proc_linkup(&proc0, &thread0); - thread0.td_kstack = kstack0; - pcpu_init(pcpup, 0, sizeof(struct pcpu)); - pcpup->pc_curthread = &thread0; - cpu_thread_alloc(curthread); - pcpup->pc_curpcb = curthread->td_pcb; - + mips_proc0_init(); mutex_init(); - #ifdef DDB kdb_init(); #endif ==== //depot/projects/mips2/src/sys/mips/mips32/idt/idt_machdep.c#7 (text+ko) ==== @@ -145,19 +145,10 @@ cninit(); init_param2(physmem); - mips_cpu_init(); pmap_bootstrap(); - - proc_linkup(&proc0, &thread0); - thread0.td_kstack = kstack0; - pcpu_init(pcpup, 0, sizeof(struct pcpu)); - pcpup->pc_curthread = &thread0; - cpu_thread_alloc(curthread); - pcpup->pc_curpcb = curthread->td_pcb; - + mips_proc0_init(); mutex_init(); - #ifdef DDB kdb_init(); #endif ==== //depot/projects/mips2/src/sys/mips/mips32/malta/malta_machdep.c#8 (text+ko) ==== @@ -181,16 +181,8 @@ mips_cpu_init(); pmap_bootstrap(); - - proc_linkup(&proc0, &thread0); - thread0.td_kstack = kstack0; - pcpu_init(pcpup, 0, sizeof(struct pcpu)); - pcpup->pc_curthread = &thread0; - cpu_thread_alloc(curthread); - pcpup->pc_curpcb = curthread->td_pcb; - + mips_proc0_init(); mutex_init(); - #ifdef DDB kdb_init(); #endif ==== //depot/projects/mips2/src/sys/mips/mips32/sentry5/s5_machdep.c#6 (text+ko) ==== @@ -132,19 +132,10 @@ init_param1(); init_param2(physmem); - mips_cpu_init(); pmap_bootstrap(); - - proc_linkup(&proc0, &thread0); - thread0.td_kstack = kstack0; - pcpu_init(pcpup, 0, sizeof(struct pcpu)); - pcpup->pc_curthread = &thread0; - cpu_thread_alloc(curthread); - pcpup->pc_curpcb = curthread->td_pcb; - + mips_proc0_init(); mutex_init(); - #ifdef DDB kdb_init(); #endif