From owner-freebsd-ppc Fri Oct 12 18:51:59 2001 Delivered-To: freebsd-ppc@freebsd.org Received: from alpo.whistle.com (s206m1.whistle.com [207.76.206.1]) by hub.freebsd.org (Postfix) with ESMTP id 3A2E937B409 for ; Fri, 12 Oct 2001 18:51:55 -0700 (PDT) Received: from [207.76.207.129] ([10.1.10.118]) by alpo.whistle.com (8.9.1a/8.9.1) with ESMTP id SAA96233 for ; Fri, 12 Oct 2001 18:51:54 -0700 (PDT) Mime-Version: 1.0 X-Sender: mark@207.76.206.1 Message-Id: Date: Fri, 12 Oct 2001 18:51:49 -0700 To: From: Mark Peek Subject: FreeBSD PowerPC kernel running under PSIM Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-ppc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG With some urging at BAFUG last night (thanks David, John and Peter), I pulled together the port for the PowerPC simulator and associated kernel patches. The HOW-TO is below along with a sample run. It executes up to cpu_switch() and then goes out to lunch. I'm giving it a quick rewrite to take into account the differences between the current NetBSD version and the kind FreeBSD requires. There's still a lot to do but having the simulator operational will make it *much* easier to track down bugs and let more people work on it. Thanks to David O'Brien for reviewing, embellishing and checking in the simulator port. Mark ------ http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/emulators/psim-freebsd/files/HOW-TO Instructions for building and running the FreeBSD kernel under PSIM: 1. On a FreeBSD system, check out a new source tree and run: # cd src/sys/powerpc/conf # config -g GENERIC 2. On a NetBSD PPC system with the source NFS mounted, apply the Makefile.patch to add the proper CWARN flags and remove the "-elf" flag. Compile the kernel (your mount point may vary): # make -m /mnt/share/mk MACHINE_ARCH=powerpc 3. On the FreeBSD system, grap /usr/src/release/write_mfs_in_kernel.c and run it using to add the md image: # ./write_mfs_in_kernel kernel.debug ppcdisk 5. Run the simulator. The following .gdbinit is available as /usr/local/share/examples/psim-freebsd/dot.gdbinit: display/i $pc define pglobal print *(struct globaldata *)$sprg0 end target sim -e chirp -r 33554432 set architecture powerpc:604 load # psim-freebsd kernel.debug GNU gdb 20011012 (MI_OUT) Copyright 2001 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i386-portbld-freebsd5.0 --target=powerpc-freebsd-elf"... Connected to the simulator. The target architecture is assumed to be powerpc:604 chirp: note descriptor missing load-base (gdb) b cpu_switch Breakpoint 1 at 0x1d8d58 (gdb) run Starting program: /usr/vsrc/sys/powerpc/compile/GENERIC/kernel.debug Copyright (c) 1992-2001 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.0-CURRENT #0: Fri Oct 12 12:47:40 PDT 2001 root@netppc:/mnt/vsrc/sys/powerpc/compile/GENERIC CPU: PowerPC Version 0 (Revision 0) real memory = 33554432 (32768K bytes) avail memory = 29794304 (29096K bytes) Timecounter "powerpc" frequency 16666666 Hz rn_init: radix functions require max_keylen be set Mounting root from ufs:/dev/md0c Breakpoint 1, 0x001d8d58 in cpu_switch () 1: x/i $pc 0x1d8d58 : mfsprg r3,0 (gdb) where #0 0x001d8d58 in cpu_switch () #1 0x0014baa4 in mi_switch () at ../../../kern/kern_synch.c:765 #2 0x0014af0c in msleep (ident=0x308cf8, mtx=0x0, priority=68, wmesg=0x1e27f8 "sched", timo=1000) at ../../../kern/kern_synch.c:484 #3 0x001c0e58 in scheduler (dummy=0xcda) at ../../../vm/vm_glue.c:439 #4 0x0011d720 in mi_startup () at ../../../kern/init_main.c:209 #5 0x00114880 in kernel_text () (gdb) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ppc" in the body of the message