diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 2001-10-12 21:42:54 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 2001-10-12 21:42:54 +0000 |
commit | 7f3526b91897d9b4cb79c2ad540ff7b2fcf5db69 (patch) | |
tree | 87a5341607b07161415b288cec64d81098865f78 /emulators/psim-freebsd/files | |
parent | 10b84eefce333975503e01b4fae082af1c5c3ff2 (diff) |
Notes
Diffstat (limited to 'emulators/psim-freebsd/files')
-rw-r--r-- | emulators/psim-freebsd/files/HOW-TO | 69 | ||||
-rw-r--r-- | emulators/psim-freebsd/files/README.patches | 22 | ||||
-rw-r--r-- | emulators/psim-freebsd/files/dot.gdbinit | 7 | ||||
-rw-r--r-- | emulators/psim-freebsd/files/patch-emul_chirp.c | 15 | ||||
-rw-r--r-- | emulators/psim-freebsd/files/patch-hw_cpu.c | 63 | ||||
-rw-r--r-- | emulators/psim-freebsd/files/patch-hw_init.c | 13 | ||||
-rw-r--r-- | emulators/psim-freebsd/files/patch-hw_tab.c | 16 | ||||
-rw-r--r-- | emulators/psim-freebsd/files/patch-ppc-spr-table | 17 |
8 files changed, 222 insertions, 0 deletions
diff --git a/emulators/psim-freebsd/files/HOW-TO b/emulators/psim-freebsd/files/HOW-TO new file mode 100644 index 000000000000..1522bb9baaf9 --- /dev/null +++ b/emulators/psim-freebsd/files/HOW-TO @@ -0,0 +1,69 @@ +$FreeBSD$ + +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) diff --git a/emulators/psim-freebsd/files/README.patches b/emulators/psim-freebsd/files/README.patches new file mode 100644 index 000000000000..cb5ea275581b --- /dev/null +++ b/emulators/psim-freebsd/files/README.patches @@ -0,0 +1,22 @@ +$FreeBSD$ + +Patch comments: + +sim/ppc/emul_chirp.c: +Add a mapping for the kernel to obtain the mapping for the +OpenFirmware callback. + +sim/ppc/hw_cpu.c: +Add the device type and timebase-frequency to the cpu device. +Add code to create an instance of the cpu for the translation of the +OpenFirmware callback. + +sim/ppc/hw_init.c: +Allow the simulator to load a dynamically linked OEA environment. + +sim/ppc/hw_tab.c: +Ignore warnings for the improper alignment of the htab. A better fix would be +to properly align the htab when the memory is allocated in the first place. + +sim/ppc/ppc-spr-table: +Correct 2 of the SPR entries to allow "info all-registers" to work when the diff --git a/emulators/psim-freebsd/files/dot.gdbinit b/emulators/psim-freebsd/files/dot.gdbinit new file mode 100644 index 000000000000..b4e6b167420d --- /dev/null +++ b/emulators/psim-freebsd/files/dot.gdbinit @@ -0,0 +1,7 @@ +display/i $pc +define pglobal + print *(struct globaldata *)$sprg0 +end +target sim -e chirp -r 33554432 +set architecture powerpc:604 +load diff --git a/emulators/psim-freebsd/files/patch-emul_chirp.c b/emulators/psim-freebsd/files/patch-emul_chirp.c new file mode 100644 index 000000000000..06b6ec622ed8 --- /dev/null +++ b/emulators/psim-freebsd/files/patch-emul_chirp.c @@ -0,0 +1,15 @@ +diff -r -u sim/ppc/emul_chirp.c /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/emul_chirp.c +--- sim/ppc/emul_chirp.c Thu Apr 15 18:35:09 1999 ++++ /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/emul_chirp.c Sun Oct 7 16:16:57 2001 +@@ -1884,6 +1884,11 @@ + (unsigned long)chirp->sizeof_code); + tree_parse(node, "./wimg %d", 0x7); + tree_parse(node, "./pp %d", 0x2); ++ node = tree_parse(root, "/cpus/cpu@0"); ++ tree_parse(node, "./translations 0x%lx 0x%lx 0x%0lx 0x%0lx 0x%0lx", ++ (unsigned long)chirp->code_va, (unsigned long)chirp->sizeof_code, ++ (unsigned long)chirp->code_ra, 0); ++ node = tree_parse(root, "/chosen/mmu */cpus/cpu@0"); + } + + /* map in the program to run */ diff --git a/emulators/psim-freebsd/files/patch-hw_cpu.c b/emulators/psim-freebsd/files/patch-hw_cpu.c new file mode 100644 index 000000000000..dedb2c753633 --- /dev/null +++ b/emulators/psim-freebsd/files/patch-hw_cpu.c @@ -0,0 +1,63 @@ +diff -r -u sim/ppc/hw_cpu.c /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/hw_cpu.c +--- sim/ppc/hw_cpu.c Thu Apr 15 18:35:09 1999 ++++ /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/hw_cpu.c Sun Oct 7 16:16:57 2001 +@@ -110,6 +110,8 @@ + { + hw_cpu_device *hw_cpu = (hw_cpu_device*)device_data(me); + /* populate the node with properties */ ++ device_add_string_property(me, "device_type", "cpu"); ++ device_add_integer_property(me, "timebase-frequency", 0x00fe502a); + /* clear our data */ + memset(hw_cpu, 0x0, sizeof(hw_cpu_device)); + hw_cpu->cpu_nr = device_find_integer_property(me, "cpu-nr"); +@@ -148,6 +150,42 @@ + } + } + ++/* An instance of the cpu */ ++ ++typedef struct _hw_cpu_instance { ++ unsigned_word pos; ++ hw_cpu_device *cpu; ++ device *me; ++} hw_cpu_instance; ++ ++static void ++hw_cpu_instance_delete(device_instance *instance) ++{ ++ hw_cpu_instance *data = device_instance_data(instance); ++ zfree(data); ++} ++ ++static const device_instance_callbacks hw_cpu_instance_callbacks = { ++ hw_cpu_instance_delete, ++ NULL, ++ NULL, ++ NULL, ++}; ++ ++static device_instance * ++hw_cpu_create_instance(device *me, ++ const char *path, ++ const char *args) ++{ ++ hw_cpu_device *cpu = device_data(me); ++ hw_cpu_instance *data = ZALLOC(hw_cpu_instance); ++ data->cpu = cpu; ++ data->me = me; ++ return device_create_instance_from(me, NULL, ++ data, ++ path, args, ++ &hw_cpu_instance_callbacks); ++} + + static device_callbacks const hw_cpu_callbacks = { + { hw_cpu_init_address, }, /* init */ +@@ -156,6 +194,7 @@ + { NULL, }, /* DMA */ + { hw_cpu_interrupt_event, NULL, hw_cpu_interrupt_ports }, /* interrupts */ + { NULL, NULL, }, ++ hw_cpu_create_instance, + }; + + const device_descriptor hw_cpu_device_descriptor[] = { diff --git a/emulators/psim-freebsd/files/patch-hw_init.c b/emulators/psim-freebsd/files/patch-hw_init.c new file mode 100644 index 000000000000..e6481a876f8f --- /dev/null +++ b/emulators/psim-freebsd/files/patch-hw_init.c @@ -0,0 +1,13 @@ +diff -r -u sim/ppc/hw_init.c /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/hw_init.c +--- sim/ppc/hw_init.c Thu May 10 10:48:10 2001 ++++ /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/hw_init.c Fri Oct 12 11:31:51 2001 +@@ -350,7 +350,8 @@ + )); + + /* If there is an .interp section, it means it needs a shared library interpreter. */ +- if (strcmp(".interp", bfd_get_section_name(abfd, the_section)) == 0) ++ if (current_environment != OPERATING_ENVIRONMENT ++ && strcmp(".interp", bfd_get_section_name(abfd, the_section)) == 0) + error("Shared libraries are not yet supported.\n"); + + /* determine the devices access */ diff --git a/emulators/psim-freebsd/files/patch-hw_tab.c b/emulators/psim-freebsd/files/patch-hw_tab.c new file mode 100644 index 000000000000..d188e6d87963 --- /dev/null +++ b/emulators/psim-freebsd/files/patch-hw_tab.c @@ -0,0 +1,16 @@ +diff -r -u sim/ppc/hw_htab.c /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/hw_htab.c +--- sim/ppc/hw_htab.c Thu Apr 15 18:35:09 1999 ++++ /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/hw_htab.c Sun Oct 7 16:16:57 2001 +@@ -224,10 +224,12 @@ + } + *htaborg = htab_ra; + *htabmask = MASKED32(htab_nr_bytes - 1, 7, 31-6); ++#if 0 + if ((htab_ra & INSERTED32(*htabmask, 7, 15)) != 0) { + device_error(parent, "htaborg 0x%lx not aligned to htabmask 0x%lx", + (unsigned long)*htaborg, (unsigned long)*htabmask); + } ++#endif + DTRACE(htab, ("htab - htaborg=0x%lx htabmask=0x%lx\n", + (unsigned long)*htaborg, (unsigned long)*htabmask)); + } diff --git a/emulators/psim-freebsd/files/patch-ppc-spr-table b/emulators/psim-freebsd/files/patch-ppc-spr-table new file mode 100644 index 000000000000..bfde32193fbb --- /dev/null +++ b/emulators/psim-freebsd/files/patch-ppc-spr-table @@ -0,0 +1,17 @@ +diff -r -u sim/ppc/ppc-spr-table /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/ppc-spr-table +--- sim/ppc/ppc-spr-table Thu Apr 15 18:35:11 1999 ++++ /local2/gcc/ppc/gdb+dejagnu-20011007/sim/ppc/ppc-spr-table Fri Oct 12 11:05:25 2001 +@@ -69,6 +69,7 @@ + MMCR1:956:0:0 + PMC3:957:0:0 + PMC4:958:0:0 ++SDA:959:0:0 + DMISS:976:0:0 + DCMP:977:0:0 + HASH1:978:0:0 +@@ -85,4 +86,4 @@ + THRM1:1020:0:0 + THRM2:1021:0:0 + THRM3:1022:0:0 +-HID15:1023:0:0 ++PIR:1023:0:0 |