Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 12 Oct 2001 18:51:49 -0700
From:      Mark Peek <mark@whistle.com>
To:        <freebsd-ppc@FreeBSD.ORG>
Subject:   FreeBSD PowerPC kernel running under PSIM
Message-ID:  <p05101005b7ed4d0f267c@[207.76.207.129]>

next in thread | raw e-mail | index | archive | help
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 <http://people.freebsd.org/~mp/psim/ppcdisk.bz2>; 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 <cpu_switch+24>:   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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05101005b7ed4d0f267c>