From owner-freebsd-sparc Mon Dec 24 4:37:16 2001 Delivered-To: freebsd-sparc@freebsd.org Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by hub.freebsd.org (Postfix) with SMTP id 994CC37B417 for ; Mon, 24 Dec 2001 04:37:02 -0800 (PST) Received: (qmail 12755 invoked by uid 0); 24 Dec 2001 12:36:59 -0000 Received: from pd9e16ead.dip.t-dialin.net (HELO forge.local) (217.225.110.173) by mail.gmx.net (mp020-rz3) with SMTP; 24 Dec 2001 12:36:59 -0000 Received: from tmm by forge.local with local (Exim 3.30 #1) id 16IULy-0000Ls-00; Mon, 24 Dec 2001 13:37:14 +0100 Date: Mon, 24 Dec 2001 13:37:14 +0100 From: Thomas Moestl To: Jamey Wood Cc: freebsd-sparc@freebsd.org Subject: Re: compiling a sparc64 kernel? Message-ID: <20011224133714.A451@crow.dom2ip.de> References: <1513fe0e8.e0e81513f@smi.sun.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <1513fe0e8.e0e81513f@smi.sun.com>; from Jamey.Wood@Sun.COM on Sun, Dec 23, 2001 at 12:43:01PM -0800 Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Sun, 2001/12/23 at 12:43:01 -0800, Jamey Wood wrote: > I'm new at a lot of this, so I hope this is the trace info you guys > need (from Thomas's kernel): > > /kernel data=0x202fb8+0xdfdc0 syms=[0x8+0x36210+0x8+0x2887c] > Hit [Enter] to boot immediately, or any other key for command prompt. > Booting [/kernel]... > calling autoload > nothing to autoload yet. > post autoload > jumping to kernel entry at 0xc0030000. > sparc64_init: mdp=0xc0344000 kmdp=0xc0344000 boothowto=0 > envp=0xc0342000 end=0x0 > panic: trap_dmmu_miss: vmspace NULL > Debugger("panic") > Stopped at 0xc018479c: ta %xcc, 1 > db> trace > (null)() at 0xc00ca80c > (null)() at 0xc018a2e8 > (null)() at 0xc0189e78 > (null)() at 0xc00310d4 > (null)() at 0xc0031300 > (null)() at 0xc0183ffc > (null)() at 0xc0030034 Hmmm, this looks like an interrupt has happened in a window of time where interrupts are enabled, but the interrupt table is not yet initialized. The attached patch (against the code in CVS) should help. With it applied, you should get a message warning about a stray interrupt. > After adding defice ofw_console, I do get a little output from my custom > kernel on boot: > > /kernel data=0x1352b8+0x4d2f8 syms=[0x8+0x257e8+0x8+0x1b762] > Hit [Enter] to boot immediately, or any other key for command prompt. > Booting [/kernel]... > calling autoload > nothing to autoload yet. > post autoload > jumping to kernel entry at 0xc0028000. > sparc64_init: mdp=0xc01c6000 kmdp=0xc01c6000 boothowto=0 > envp=0xc01c4000 end=0x0 > Copyrigh > > It just hangs right there, however. I tried sening a break, hoping to > get to the ok or db prompt to do a trace, but even that didn't work. I > had to power-cycle the U1 to get out of that wedged state. And trying > it all again gives the same result. Hmmm. This could be a consequence of the bug above. Does it still happen this way with the patch applied? - thomas Index: sparc64/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/sparc64/machdep.c,v retrieving revision 1.25 diff -u -r1.25 machdep.c --- sparc64/machdep.c 23 Dec 2001 07:02:23 -0000 1.25 +++ sparc64/machdep.c 24 Dec 2001 11:47:17 -0000 @@ -178,7 +178,6 @@ bufinit(); vm_pager_bufferinit(); - intr_init(); tick_start(clock, tick_hardclock); EVENTHANDLER_REGISTER(shutdown_final, sparc64_shutdown_final, NULL, @@ -277,13 +276,35 @@ */ tick_stop(); + /* Initialize the interrupt tables. */ + intr_init(); + /* * Force trap level 1 and take over the trap table. */ + ps = rdpr(pstate); + wrpr(pstate, ps, PSTATE_IE); wrpr(tl, 0, 1); wrpr(tba, tl0_base, 0); /* + * Put the pcpu pointer in the alternate and interrupt %g7 also. + * pcpu is tied to %g7. We could therefore also use assignments to + * pcpu here. + * The alternate %g6 additionally points to a small per-cpu stack that + * is used to temporarily store global registers in special spill + * handlers. + */ + wrpr(pstate, ps, PSTATE_AG | PSTATE_IE); + __asm __volatile("mov %0, %%g6" : : "r" + (&__pcpu.pc_alt_stack[ALT_STACK_SIZE - 1])); + __asm __volatile("mov %0, %%g7" : : "r" (&__pcpu)); + wrpr(pstate, ps, PSTATE_IG | PSTATE_IE); + __asm __volatile("mov %0, %%g6" : : "r" (&__pcpu.pc_iq)); + __asm __volatile("mov %0, %%g7" : : "r" (&intr_vectors)); + wrpr(pstate, ps, 0); + + /* * Map and initialize the message buffer (after setting trap table). */ for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) @@ -310,24 +331,6 @@ * Initialize the per-cpu pointer so we can set curproc. */ pcpup = &__pcpu; - - /* - * Put the pcpu pointer in the alternate and interrupt %g7 also. - * pcpu is tied to %g7. We could therefore also use assignments to - * pcpu here. - * The alternate %g6 additionally points to a small per-cpu stack that - * is used to temporarily store global registers in special spill - * handlers. - */ - ps = rdpr(pstate); - wrpr(pstate, ps, PSTATE_AG); - __asm __volatile("mov %0, %%g6" : : "r" - (&__pcpu.pc_alt_stack[ALT_STACK_SIZE - 1])); - __asm __volatile("mov %0, %%g7" : : "r" (&__pcpu)); - wrpr(pstate, ps, PSTATE_IG); - __asm __volatile("mov %0, %%g6" : : "r" (&__pcpu.pc_iq)); - __asm __volatile("mov %0, %%g7" : : "r" (&intr_vectors)); - wrpr(pstate, ps, 0); /* * Initialize curproc so that mutexes work. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message