summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2002-01-22 16:55:19 +0000
committermrg <mrg@NetBSD.org>2002-01-22 16:55:19 +0000
commit47d0b44e4f53400513f30f2bb34f2c8cc63d5477 (patch)
tree13129dff9a60b1c0f191a5ec3de729efc19e0d9f /gnu
parent43a1bb37fd8a18eef17ccab785883ad30c24327c (diff)
add PSIM support to gdb and install the stand alone in /usr/bin/psim. this
fixes the rest of port-powerpc/14307.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gdb/arch/powerpc/defs.mk1
-rw-r--r--gnu/usr.bin/gdb/gdb.new/Makefile11
-rw-r--r--gnu/usr.bin/sim/Makefile14
-rw-r--r--gnu/usr.bin/sim/Makefile.inc5
-rw-r--r--gnu/usr.bin/sim/arch/powerpc/config.h363
-rw-r--r--gnu/usr.bin/sim/arch/powerpc/subdir.mk1
-rw-r--r--gnu/usr.bin/sim/ppc/Makefile249
-rw-r--r--gnu/usr.bin/sim/ppc/Makefile.inc5
-rw-r--r--gnu/usr.bin/sim/ppc/psim/Makefile29
9 files changed, 676 insertions, 2 deletions
diff --git a/gnu/usr.bin/gdb/arch/powerpc/defs.mk b/gnu/usr.bin/gdb/arch/powerpc/defs.mk
index ffadd46e8c7..7e2ce2d50dd 100644
--- a/gnu/usr.bin/gdb/arch/powerpc/defs.mk
+++ b/gnu/usr.bin/gdb/arch/powerpc/defs.mk
@@ -3,5 +3,6 @@
#
G_INTERNAL_CFLAGS=-g -O2 -I. -I${DIST}/gdb -I${DIST}/gdb/config -DHAVE_CONFIG_H -I${DIST}/gdb/../include/opcode -I${DIST}/gdb/../readline/.. -I../bfd -I${DIST}/gdb/../bfd -I${DIST}/gdb/../include -I../intl -I${DIST}/gdb/../intl -I${DIST}/gdb/tui -DUSE_INCLUDED_REGEX
G_LIBGDB_OBS=version.o blockframe.o breakpoint.o findvar.o stack.o thread.o source.o values.o eval.o valops.o valarith.o valprint.o printcmd.o symtab.o symfile.o symmisc.o infcmd.o infrun.o command.o expprint.o environ.o event-loop.o event-top.o inf-loop.o gdbarch.o arch-utils.o gdbtypes.o copying.o rs6000-tdep.o solib.o ser-tcp.o ser-unix.o ser-pipe.o infptrace.o inftarg.o fork-child.o corelow.o kcore-nbsd.o ppcnbsd-nat.o remote.o dcache.o remote-utils.o tracepoint.o ax-general.o ax-gdb.o mem-break.o target.o parse.o language.o c-exp.tab.o jv-exp.tab.o f-exp.tab.o m2-exp.tab.o buildsym.o kod.o kod-cisco.o gdb-events.o exec.o bcache.o objfiles.o minsyms.o maint.o demangle.o dbxread.o coffread.o elfread.o dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o c-lang.o ch-exp.o ch-lang.o f-lang.o ui-out.o cli-out.o varobj.o wrapper.o jv-lang.o jv-valprint.o jv-typeprint.o m2-lang.o scm-exp.o scm-lang.o scm-valprint.o complaints.o typeprint.o c-typeprint.o ch-typeprint.o f-typeprint.o m2-typeprint.o c-valprint.o cp-valprint.o ch-valprint.o f-valprint.o m2-valprint.o nlmread.o serial.o mdebugread.o os9kread.o top.o utils.o ui-file.o tui-file.o annotate.o inflow.o gnu-regex.o init.o
+G_SIM_OBS = remote-sim.o
G_CCFLAGS=-DHAVE_CONFIG_H -I. -I${DIST}/readline -I/usr/local/include -DRL_LIBRARY_VERSION='"4.0"' -g -O2
G_OBJECTS=readline.o vi_mode.o funmap.o keymaps.o parens.o search.o rltty.o complete.o bind.o isearch.o display.o signals.o util.o kill.o undo.o macro.o input.o callback.o terminal.o nls.o xmalloc.o history.o histexpand.o histfile.o histsearch.o shell.o tilde.o
diff --git a/gnu/usr.bin/gdb/gdb.new/Makefile b/gnu/usr.bin/gdb/gdb.new/Makefile
index 6c14a164be2..6a568a9bff5 100644
--- a/gnu/usr.bin/gdb/gdb.new/Makefile
+++ b/gnu/usr.bin/gdb/gdb.new/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2001/12/31 23:04:12 thorpej Exp $
+# $NetBSD: Makefile,v 1.7 2002/01/22 16:55:21 mrg Exp $
# XXX - This gdb.new directory should be renamed to "gdb" after all platforms
# have been migrated to the new toolchain.
@@ -14,7 +14,7 @@ DIST= ${TOP}/dist/toolchain
PROG= gdb
-SRCS= ${G_LIBGDB_OBS:.o=.c} ${G_OBJECTS:Nxmalloc.o:.o=.c} main.c
+SRCS= ${G_LIBGDB_OBS:.o=.c} ${G_OBJECTS:Nxmalloc.o:.o=.c} ${G_SIM_OBS:.o=.c} main.c
CPPFLAGS= -I${.CURDIR}/../arch/${MACHINE_ARCH} \
${G_INTERNAL_CFLAGS:M-[ID]*:N*readline*:N*intl*:N-I.*} \
${G_CCFLAGS:M-DRL_*} \
@@ -41,5 +41,12 @@ IBERTYOBJ!= cd ${TOP}/lib/libiberty && ${PRINTOBJDIR}
LDADD+= -L${IBERTYOBJ} -liberty
DPADD+= ${IBERTYOBJ}/libiberty.a
+# PSIM support for PowerPC.
+.if ${MACHINE_ARCH} == powerpc || ${MACHINE_ARCH} == powerpcle
+PSIMOBJ!= cd ${TOP}/usr.bin/sim/ppc && ${PRINTOBJDIR}
+LDADD+= -L${PSIMOBJ} -lsim
+DPADD+= ${PSIMOBJ}/libsim.a
+.endif
+
.PATH: ${DIST}/gdb ${DIST}/gdb/tui ${DIST}/gdb/doc \
${DIST}/readline ${.CURDIR}/../arch/${MACHINE_ARCH}
diff --git a/gnu/usr.bin/sim/Makefile b/gnu/usr.bin/sim/Makefile
new file mode 100644
index 00000000000..36248b30935
--- /dev/null
+++ b/gnu/usr.bin/sim/Makefile
@@ -0,0 +1,14 @@
+# $NetBSD: Makefile,v 1.1 2002/01/22 16:55:20 mrg Exp $
+
+.include <bsd.own.mk>
+
+.if defined(USE_NEW_TOOLCHAIN)
+
+# PSIM support for PowerPC.
+.if ${MACHINE_ARCH} == powerpc || ${MACHINE_ARCH} == powerpcle
+SUBDIR+= ppc .WAIT ppc/psim
+.endif
+
+.include <bsd.subdir.mk>
+
+.endif
diff --git a/gnu/usr.bin/sim/Makefile.inc b/gnu/usr.bin/sim/Makefile.inc
new file mode 100644
index 00000000000..8d56a80a228
--- /dev/null
+++ b/gnu/usr.bin/sim/Makefile.inc
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile.inc,v 1.1 2002/01/22 16:55:20 mrg Exp $
+
+DIST= ${TOP}/dist/toolchain
+
+.include "../../Makefile.inc"
diff --git a/gnu/usr.bin/sim/arch/powerpc/config.h b/gnu/usr.bin/sim/arch/powerpc/config.h
new file mode 100644
index 00000000000..2e950e9a1d3
--- /dev/null
+++ b/gnu/usr.bin/sim/arch/powerpc/config.h
@@ -0,0 +1,363 @@
+/* config.h. Generated automatically by configure. */
+/* config.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if using alloca.c. */
+/* #undef C_ALLOCA */
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define to the type of elements in the array set by `getgroups'.
+ Usually this is either `int' or `gid_t'. */
+#define GETGROUPS_T gid_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef gid_t */
+
+/* Define if you have alloca, as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define if you have a working `mmap' system call. */
+#define HAVE_MMAP 1
+
+/* Define if your struct stat has st_blksize. */
+#define HAVE_ST_BLKSIZE 1
+
+/* Define if your struct stat has st_blocks. */
+#define HAVE_ST_BLOCKS 1
+
+/* Define if your struct stat has st_rdev. */
+#define HAVE_ST_RDEV 1
+
+/* Define if your struct tm has tm_zone. */
+#define HAVE_TM_ZONE 1
+
+/* Define if you don't have tm_zone but do have the external array
+ tzname. */
+/* #undef HAVE_TZNAME */
+
+/* Define as __inline if that's what the C compiler calls it. */
+/* #undef inline */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef mode_t */
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef pid_t */
+
+/* Define if you need to in order for stat and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define as the return type of signal handlers (int or void). */
+#define RETSIGTYPE void
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+/* #undef STACK_DIRECTION */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if your <sys/time.h> declares struct tm. */
+/* #undef TM_IN_SYS_TIME */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef uid_t */
+
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to 1 if NLS is requested. */
+#define ENABLE_NLS 1
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext. */
+/* #undef HAVE_GETTEXT */
+
+/* Define as 1 if you have the stpcpy function. */
+/* #undef HAVE_STPCPY */
+
+/* Define if your locale.h file contains LC_MESSAGES. */
+#define HAVE_LC_MESSAGES 1
+
+/* Define if you have the __argz_count function. */
+/* #undef HAVE___ARGZ_COUNT */
+
+/* Define if you have the __argz_next function. */
+/* #undef HAVE___ARGZ_NEXT */
+
+/* Define if you have the __argz_stringify function. */
+/* #undef HAVE___ARGZ_STRINGIFY */
+
+/* Define if you have the access function. */
+#define HAVE_ACCESS 1
+
+/* Define if you have the cfgetispeed function. */
+#define HAVE_CFGETISPEED 1
+
+/* Define if you have the cfgetospeed function. */
+#define HAVE_CFGETOSPEED 1
+
+/* Define if you have the cfsetispeed function. */
+#define HAVE_CFSETISPEED 1
+
+/* Define if you have the cfsetospeed function. */
+#define HAVE_CFSETOSPEED 1
+
+/* Define if you have the chdir function. */
+#define HAVE_CHDIR 1
+
+/* Define if you have the chmod function. */
+#define HAVE_CHMOD 1
+
+/* Define if you have the chown function. */
+#define HAVE_CHOWN 1
+
+/* Define if you have the dcgettext function. */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define if you have the dup function. */
+#define HAVE_DUP 1
+
+/* Define if you have the dup2 function. */
+#define HAVE_DUP2 1
+
+/* Define if you have the fchmod function. */
+#define HAVE_FCHMOD 1
+
+/* Define if you have the fchown function. */
+#define HAVE_FCHOWN 1
+
+/* Define if you have the fcntl function. */
+#define HAVE_FCNTL 1
+
+/* Define if you have the fstat function. */
+#define HAVE_FSTAT 1
+
+/* Define if you have the fstatfs function. */
+#define HAVE_FSTATFS 1
+
+/* Define if you have the getcwd function. */
+#define HAVE_GETCWD 1
+
+/* Define if you have the getdirentries function. */
+#define HAVE_GETDIRENTRIES 1
+
+/* Define if you have the getegid function. */
+#define HAVE_GETEGID 1
+
+/* Define if you have the geteuid function. */
+#define HAVE_GETEUID 1
+
+/* Define if you have the getgid function. */
+#define HAVE_GETGID 1
+
+/* Define if you have the getpagesize function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define if you have the getpid function. */
+#define HAVE_GETPID 1
+
+/* Define if you have the getppid function. */
+#define HAVE_GETPPID 1
+
+/* Define if you have the getrusage function. */
+#define HAVE_GETRUSAGE 1
+
+/* Define if you have the gettimeofday function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define if you have the getuid function. */
+#define HAVE_GETUID 1
+
+/* Define if you have the ioctl function. */
+#define HAVE_IOCTL 1
+
+/* Define if you have the kill function. */
+#define HAVE_KILL 1
+
+/* Define if you have the link function. */
+#define HAVE_LINK 1
+
+/* Define if you have the lseek function. */
+#define HAVE_LSEEK 1
+
+/* Define if you have the lstat function. */
+#define HAVE_LSTAT 1
+
+/* Define if you have the mkdir function. */
+#define HAVE_MKDIR 1
+
+/* Define if you have the munmap function. */
+#define HAVE_MUNMAP 1
+
+/* Define if you have the pipe function. */
+#define HAVE_PIPE 1
+
+/* Define if you have the putenv function. */
+#define HAVE_PUTENV 1
+
+/* Define if you have the readlink function. */
+#define HAVE_READLINK 1
+
+/* Define if you have the rmdir function. */
+#define HAVE_RMDIR 1
+
+/* Define if you have the setenv function. */
+#define HAVE_SETENV 1
+
+/* Define if you have the setlocale function. */
+#define HAVE_SETLOCALE 1
+
+/* Define if you have the setregid function. */
+#define HAVE_SETREGID 1
+
+/* Define if you have the setreuid function. */
+#define HAVE_SETREUID 1
+
+/* Define if you have the sigprocmask function. */
+#define HAVE_SIGPROCMASK 1
+
+/* Define if you have the stat function. */
+#define HAVE_STAT 1
+
+/* Define if you have the stpcpy function. */
+/* #undef HAVE_STPCPY */
+
+/* Define if you have the strcasecmp function. */
+#define HAVE_STRCASECMP 1
+
+/* Define if you have the strchr function. */
+#define HAVE_STRCHR 1
+
+/* Define if you have the symlink function. */
+#define HAVE_SYMLINK 1
+
+/* Define if you have the tcdrain function. */
+#define HAVE_TCDRAIN 1
+
+/* Define if you have the tcflow function. */
+#define HAVE_TCFLOW 1
+
+/* Define if you have the tcflush function. */
+#define HAVE_TCFLUSH 1
+
+/* Define if you have the tcgetattr function. */
+#define HAVE_TCGETATTR 1
+
+/* Define if you have the tcgetpgrp function. */
+#define HAVE_TCGETPGRP 1
+
+/* Define if you have the tcsendbreak function. */
+#define HAVE_TCSENDBREAK 1
+
+/* Define if you have the tcsetattr function. */
+#define HAVE_TCSETATTR 1
+
+/* Define if you have the tcsetpgrp function. */
+#define HAVE_TCSETPGRP 1
+
+/* Define if you have the time function. */
+#define HAVE_TIME 1
+
+/* Define if you have the umask function. */
+#define HAVE_UMASK 1
+
+/* Define if you have the unlink function. */
+#define HAVE_UNLINK 1
+
+/* Define if you have the <argz.h> header file. */
+/* #undef HAVE_ARGZ_H */
+
+/* Define if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define if you have the <ndir.h> header file. */
+/* #undef HAVE_NDIR_H */
+
+/* Define if you have the <nl_types.h> header file. */
+#define HAVE_NL_TYPES_H 1
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define if you have the <sys/dir.h> header file. */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define if you have the <sys/mount.h> header file. */
+/* #undef HAVE_SYS_MOUNT_H */
+
+/* Define if you have the <sys/ndir.h> header file. */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define if you have the <sys/termio.h> header file. */
+/* #undef HAVE_SYS_TERMIO_H */
+
+/* Define if you have the <sys/termios.h> header file. */
+#define HAVE_SYS_TERMIOS_H 1
+
+/* Define if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define if you have the <sys/times.h> header file. */
+#define HAVE_SYS_TIMES_H 1
+
+/* Define if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the <values.h> header file. */
+/* #undef HAVE_VALUES_H */
diff --git a/gnu/usr.bin/sim/arch/powerpc/subdir.mk b/gnu/usr.bin/sim/arch/powerpc/subdir.mk
new file mode 100644
index 00000000000..258aaedde3b
--- /dev/null
+++ b/gnu/usr.bin/sim/arch/powerpc/subdir.mk
@@ -0,0 +1 @@
+SUBDIRS=ppc
diff --git a/gnu/usr.bin/sim/ppc/Makefile b/gnu/usr.bin/sim/ppc/Makefile
new file mode 100644
index 00000000000..56066138465
--- /dev/null
+++ b/gnu/usr.bin/sim/ppc/Makefile
@@ -0,0 +1,249 @@
+# $NetBSD: Makefile,v 1.1 2002/01/22 16:55:20 mrg Exp $
+
+TOP= ${.CURDIR}/../../..
+
+LIB= sim
+SRCS= debug.c filter_filename.o bits.c sim-endian.c os_emul.c emul_generic.c \
+ emul_bugapi.c emul_chirp.c emul_netbsd.c emul_unix.c registers.c vm.c \
+ corefile.c model.c spreg.c cpu.c interrupts.c events.c cap.c device.c \
+ tree.c device_table.c itable.c mon.c icache.c semantics.c idecode.c \
+ support.c psim.c pk_disklabel.c hw_cpu.c hw_memory.c hw_nvram.c \
+ hw_iobus.c hw_htab.c hw_disk.c hw_trace.c hw_register.c hw_vm.c \
+ hw_init.c hw_core.c hw_pal.c hw_com.c hw_eeprom.c hw_opic.c hw_glue.c \
+ hw_phb.c hw_ide.c options.c sim_calls.c callback.o targ-map.c
+NOPIC=1
+NOPROFILE=1
+NOLINT=1
+
+all: libsim.a
+
+libinstall:
+
+.include <bsd.lib.mk>
+
+MIC= ${DIST}/move-if-change
+
+HOST_CPPFLAGS+= -I${DIST}/sim/ppc -I${DIST}/sim/ppc/../../include \
+ -I${DIST}/sim/ppc/../../bfd -I../../gdb \
+ -I${DIST}/sim/ppc/../../gdb \
+ -I${DIST}/sim/ppc/../../gdb/config \
+ -I${DIST}/sim/ppc/../../mmalloc \
+ -I${.CURDIR}/../arch/powerpc \
+ -I${.CURDIR}/../../../usr.bin/gdb/arch/powerpc \
+ -I${.CURDIR}/../../../lib/libbfd/arch/powerpc -I.
+PSIM_DEFINES= -DHAVE_CONFIG_H \
+ -DDEFAULT_INLINE=INLINE_LOCALS \
+ -DWITH_HOST_BYTE_ORDER=BYTE_ORDER \
+ -DWITH_SMP=5 \
+ -DHAVE_TERMIOS_STRUCTURE \
+ -DHAVE_DEVZERO
+
+# we need the same -I flags for host / target.
+CPPFLAGS+= ${HOST_CPPFLAGS} ${PSIM_DEFINES}
+
+#
+# These portions run several programs to generate more code to compile.
+#
+
+# igen portion
+IGEN_FLAGS= -E -F 32,f,o -CSRI 1024 -N 5 \
+ -o ${DIST}/sim/ppc/dc-complex \
+ -k ${DIST}/sim/ppc/ppc-cache-rules \
+ -i ${DIST}/sim/ppc/ppc-instructions \
+ -n icache.h -hc tmp-icache.h \
+ -n icache.c -c tmp-icache.c \
+ -n semantics.h -hs tmp-semantics.h \
+ -n semantics.c -s tmp-semantics.c \
+ -n idecode.h -hd tmp-idecode.h \
+ -n idecode.c -d tmp-idecode.c \
+ -n itable.h -ht tmp-itable.h \
+ -n itable.c -t tmp-itable.c \
+ -n model.h -hm tmp-model.h \
+ -n model.c -m tmp-model.c \
+ -n support.h -hf tmp-support.h \
+ -n support.c -f tmp-support.c
+IGENED_FILES= icache.h icache.c idecode.h idecode.c semantics.h semantics.c \
+ itable.h itable.c model.h model.c support.h support.c
+IGENSRCS= igen.c table.c lf.c misc.c filter_host.c ld-decode.c ld-cache.c filter.c ld-insn.c gen-model.c gen-itable.c gen-icache.c gen-semantics.c gen-idecode.c gen-support.c
+IGENOBJS= ${IGENSRCS:S/.c/.lo/}
+
+${IGENED_FILES}: run-igen
+run-igen: igen ppc-instructions ppc-cache-rules
+ ./igen ${IGEN_FLAGS}
+ ${MIC} tmp-icache.h icache.h
+ ${MIC} tmp-icache.c icache.c
+ ${MIC} tmp-idecode.h idecode.h
+ ${MIC} tmp-idecode.c idecode.c
+ ${MIC} tmp-semantics.h semantics.h
+ ${MIC} tmp-semantics.c semantics.c
+ ${MIC} tmp-itable.h itable.h
+ ${MIC} tmp-itable.c itable.c
+ ${MIC} tmp-model.h model.h
+ ${MIC} tmp-model.c model.c
+ ${MIC} tmp-support.h support.h
+ ${MIC} tmp-support.c support.c
+ touch run-igen
+
+igen: ${IGENOBJS}
+ ${HOST_LINK.c} ${IGENOBJS} -o ${.TARGET}
+
+# dgen portion
+DGEN_FLAGS= -r ${DIST}/sim/ppc/ppc-spr-table \
+ -n spreg.h -hp tmp-spreg.h \
+ -n spreg.c -p tmp-spreg.c
+DGENED_FILES= spreg.h spreg.c
+DGENSRCS= dgen.c table.c lf.c misc.c filter_host.c
+DGENOBJS= ${DGENSRCS:S/.c/.lo/}
+
+${DGENED_FILES}: run-dgen
+run-dgen: dgen
+ ./dgen ${DGEN_FLAGS}
+ ${MIC} tmp-spreg.h spreg.h
+ ${MIC} tmp-spreg.c spreg.c
+ touch run-dgen
+
+dgen: ${DGENOBJS}
+ ${HOST_LINK.c} ${DGENOBJS} -o ${.TARGET}
+
+# gentmap portion
+GENTMAPSRCS= gentmap.c
+GENTMAPOBJS= ${GENTMAPSRCS:S/.c/.lo/}
+
+gentmap: ${GENTMAPOBJS}
+ ${HOST_LINK.c} ${GENTMAPOBJS} -o ${.TARGET}
+
+gentmap.c: targ-vals.def
+
+callback.o: targ-vals.h targ-vals.def
+
+targ-vals.def: ${DIST}/sim/ppc/../common/nltvals.def
+ rm -f targ-vals.def tmp-def
+ cat ${DIST}/sim/ppc/../common/nltvals.def > tmp-vals.def
+ ${MIC} tmp-vals.def targ-vals.def
+
+targ-vals.h: gentmap targ-vals.def
+ rm -f tmp-vals.h
+ ./gentmap -h > tmp-vals.h
+ ${MIC} tmp-vals.h targ-vals.h
+
+targ-map.c: gentmap targ-vals.def
+ rm -f tmp-map.c
+ ./gentmap -c > tmp-map.c
+ ${MIC} tmp-map.c targ-map.c
+
+# hw.c / hw.h portion
+HWSRCS= hw_cpu.c hw_memory.c hw_nvram.c hw_iobus.c hw_htab.c hw_disk.c \
+ hw_trace.c hw_register.c hw_vm.c hw_init.c hw_core.c hw_pal.c \
+ hw_com.c hw_eeprom.c hw_opic.c hw_glue.c hw_phb.c hw_ide.c
+HWOBJS= ${HWSRCS:S/.c/.o/}
+
+${HWSRCS}: hw.h
+${HWOBJS}: ${HWSRCS}
+
+hw.h hw.c: run-hw
+run-hw: Makefile
+ f=""; \
+ for i in ${HWSRCS}; do \
+ case " $$f " in \
+ *" $$i "*) ;; \
+ *) f="$$f $$i" ;; \
+ esac ; \
+ done ; \
+ for hw in $$f; do \
+ echo $$hw; \
+ done | sed -e 's/^.*\(hw_.*\)\.c/\1/' \
+ -e 's/^/extern const device_descriptor /' \
+ -e 's/$$/_device_descriptor\[\];/' \
+ > tmp-hw.h
+ f=""; \
+ for i in ${HWSRCS}; do \
+ case " $$f " in \
+ *" $$i "*) ;; \
+ *) f="$$f $$i" ;; \
+ esac ; \
+ done ; \
+ for hw in $$f; do \
+ echo $$hw; \
+ done | sed -e 's/^.*\(hw_.*\)\.c/\1/' \
+ -e 's/^/ /' \
+ -e 's/$$/_device_descriptor,/' > tmp-hw.c
+ ${MIC} tmp-hw.h hw.h
+ ${MIC} tmp-hw.c hw.c
+ touch run-hw
+
+# package portion
+PACKAGE_SRC = pk_disklabel.c
+PK_H = pk.h
+
+${PK_H}: run-pk
+run-pk: $(PACKAGE_SRC)
+ f=""; \
+ for i in $(PACKAGE_SRC) ; do \
+ case " $$f " in \
+ *" $$i "*) ;; \
+ *) f="$$f $$i" ;; \
+ esac ; \
+ done ; \
+ for pk in $$f; do \
+ echo $$pk; \
+ done | sed -e 's/^.*pk_\(.*\)\.c/\1/' \
+ -e 's/^/extern package_create_instance_callback pk_/' \
+ -e 's/$$/_create_instance;/' > tmp-pk.h
+ ${MIC} tmp-pk.h pk.h
+ touch run-pk
+
+hw_disk.c: ${PK_H}
+
+# defines portion
+DEFINES_H= defines.h
+${DEFINES_H}: run-defines
+run-defines:
+ sed -n -e '/^#define HAVE_/s/ 1$$/",/' \
+ -e '/^#define HAVE_/s//"HAVE_/p' \
+ < ${.CURDIR}/../arch/${MACHINE_ARCH}/config.h > tmp-defines.h
+ ${MIC} tmp-defines.h defines.h
+ touch run-defines
+
+options.c: ${DEFINES_H}
+
+# misc. dependancies.
+corefile.o: device_table.h
+device_table.h: hw.h
+
+filter_host.lo filter_filename.o debug.c: ppc-config.h
+
+os_emul.c: ${IGENED_FILES}
+
+filter_host.c: ${DIST}/sim/ppc/filter_filename.c
+ cp ${.ALLSRC} ${.TARGET}
+
+ppc-config.h: ${DIST}/sim/ppc/std-config.h
+ cp ${.ALLSRC} ${.TARGET}
+
+CLEANFILES+= igen dgen gentmap *.lo \
+ ppc-config.h filter_host.c \
+ tmp-icache.h icache.h \
+ tmp-icache.c icache.c \
+ tmp-idecode.h idecode.h \
+ tmp-idecode.c idecode.c \
+ tmp-semantics.h semantics.h \
+ tmp-semantics.c semantics.c \
+ tmp-itable.h itable.h \
+ tmp-itable.c itable.c \
+ tmp-model.h model.h \
+ tmp-model.c model.c \
+ tmp-support.h support.h \
+ tmp-support.c support.c \
+ tmp-spreg.h spreg.h \
+ tmp-spreg.c spreg.c \
+ tmp-vals.h targ-vals.h \
+ hw.c hw.h \
+ defines.h pk.h \
+ targ-map.c targ-vals.def \
+ run-defines run-dgen run-hw run-igen run-pk
+
+.SUFFIXES: .lo
+.c.lo:
+ ${HOST_COMPILE.c} -o ${.TARGET} $<
+
+.PATH: ${DIST}/sim/ppc ${DIST}/sim/common
diff --git a/gnu/usr.bin/sim/ppc/Makefile.inc b/gnu/usr.bin/sim/ppc/Makefile.inc
new file mode 100644
index 00000000000..8b130f96113
--- /dev/null
+++ b/gnu/usr.bin/sim/ppc/Makefile.inc
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile.inc,v 1.1 2002/01/22 16:55:20 mrg Exp $
+
+DIST= ${TOP}/dist/toolchain
+
+.include "../../../Makefile.inc"
diff --git a/gnu/usr.bin/sim/ppc/psim/Makefile b/gnu/usr.bin/sim/ppc/psim/Makefile
new file mode 100644
index 00000000000..76ed7c4887c
--- /dev/null
+++ b/gnu/usr.bin/sim/ppc/psim/Makefile
@@ -0,0 +1,29 @@
+# $NetBSD: Makefile,v 1.1 2002/01/22 16:55:20 mrg Exp $
+
+TOP= ${.CURDIR}/../../../..
+
+PROG= psim
+SRCS= main.c
+CPPFLAGS+= -I${SIMDIR} -I${.CURDIR}/../../arch/powerpc
+NOMAN=
+
+LDADD+= -lintl
+DPADD+= ${LIBINTL}
+
+.include <bsd.prog.mk>
+
+SIMDIR!= cd ${TOP}/usr.bin/sim/ppc && ${PRINTOBJDIR}
+
+BFDOBJ!= cd ${TOP}/lib/libbfd && ${PRINTOBJDIR}
+LDADD+= -L${BFDOBJ} -lbfd
+DPADD+= ${BFDOBJ}/libbfd_pic.a
+
+IBERTYOBJ!= cd ${TOP}/lib/libiberty && ${PRINTOBJDIR}
+LDADD+= -L${IBERTYOBJ} -liberty
+DPADD+= ${IBERTYOBJ}/libiberty.a
+
+PSIMOBJ!= cd ${TOP}/usr.bin/sim/ppc && ${PRINTOBJDIR}
+LDADD+= -L${PSIMOBJ} -lsim
+DPADD+= ${PSIMOBJ}/libsim.a
+
+.PATH: ${DIST}/sim/ppc