From 2e913166b1be63e4a327c9c2f37f0115fece6595 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Tue, 6 Aug 1996 15:55:32 +0000 Subject: [PATCH] 7/30 release from Andrew --- sim/ppc/ChangeLog | 238 ++++++++++++++++++++++++++++++++++++++++ sim/ppc/Makefile.in | 53 +++------ sim/ppc/configure | 230 +++++++++++++++++++++++++++----------- sim/ppc/configure.in | 82 +++++++++++++- sim/ppc/emul_generic.c | 5 +- sim/ppc/main.c | 147 ++++++++++++++++++++++--- sim/ppc/options.c | 75 +++++++++---- sim/ppc/ppc-cache-rules | 4 +- sim/ppc/std-config.h | 37 ++++++- 9 files changed, 719 insertions(+), 152 deletions(-) diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index a4aa13e316d..1185a81e343 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,241 @@ +Tue Aug 6 09:28:22 1996 Michael Meissner + + * configure.in (--enable-sim-{hardware,packages}): Fix typos. + * configure: Regenerate. + + * device.c (device_instance_call_method): Fixup format message in + error case. Return 0 in case of error to shut up compiler + warnings. + +Wed Jul 31 00:02:30 1996 Andrew Cagney + + * device_table.h (device_instance_callbacks): Relace the claim and + release methods with a more general table mapping from method-name + to method-function. + + * device.c (device_instance_call_method): New function. Implement + the OpenBoot call-method client interface. Attempts to locate the + instances method in the callback table. + (device_instance_claim, device_instance_release): Delete. + Replaced with call-method and a lookup table. + + * emul_chirp.c (chirp_emul_call_method): Use the new device + instance call method and let that handle a client claim call. + + * hw_htab.c (claim_memory): Wrapper function to call the memory + devices "claim" method using the new device-instance call-method + interface. Replaces the previous direct calls to claim. + (htab_map_region): Use claim_memory. + (htab_init_data_callback): Ditto. + + * hw_memory.c (hw_memory_instance_claim): Update function + interface so that it is compatible with call-method. + (hw_memory_instance_release): Ditto. + (hw_memory_instance_methods): New table of memory specific + methods claim and release. Add to the hw_memory_callback + table. + +Tue Jul 30 21:26:14 1996 Andrew Cagney + + * psim.c (psim_init): Back out of change to initial value of + system->last_cpu. + +Tue Jul 30 21:12:24 1996 Andrew Cagney + + * sim_callbacks.h (sim_io_printf_filtered): Replace + printf_filtered with a local simulator specific version. Add + #define printf_filtered to simplify updating of existing code. + + * sim_callbacks.h (sim_io_write_stdout, sim_io_read_stdin, + sim_io_write_stderr): New functions. Read / write to the + simulations stdin and stdout and stderr interfaces. Merge in code + from hw_pal that previously handled async I/O. + (sim_io_flush_stdoutput): Rename flush_stdoutput. Add #define + flush_stdoutput to simplify updating of existing code. + + * hw_pal.c (scan_hw_pal, write_hw_pal, + hw_pal_instance_write_callback): Use the new sim_io functions. + + * main.c: Implement standalone versions of the new sim_io + functions. Include support for async I/O. + * sim_calls.c: Ditto. This time using the gdb callback table. + + * std-config.h (CURRENT_STDIO, current_stdio): New macro. Set up + stdio configuration so that it works in the same way as the rest + of the simulation. + * psim.c (psim_create): Initialize current_stdio from the device + tree. + * emul_generic.c (emul_add_tree_options): Enter a default value + for use-stdio in the device tree. + +Fri Jul 26 19:43:03 1996 Andrew Cagney + + * gen-idecode.c (print_jump): Was always generating a jump back to + idecode. Only necessary at tail of semantic code. + (print_jump): Was always setting the processor's cia, even during + startup when the processor was still undefined. + (print_jump): For safety, restart smp loop when cpu_nr >= nr_cpus, + not just equal. + + * options.c (print_options): Add printing of WITH_REGPARM and + WITH_STDCALL. + + * std-config.h (WITH_REGPARM, WITH_STDCALL): Provide default + (disabled) values if not defined. + +Fri Jul 26 00:36:35 1996 Andrew Cagney + + * ppc-cache-rules (cache): Change RS and RB to cache instead of + compute. The block move instructions use them. + + * idecode_expression.h (FPSCR_SET): New macro, set specific FPSCR + register. + (CR_FIELD): New macro, extract specific CR register. + (FPSCR_FIELD): New macro, extract specific FPSCR register. + + * registers.h (GPR): New macro, simplify accesses to GPR[i]. + + * bits.c (INSERTED): Covert INSERTED macro into a function. + (EXTRACTED): Conditionally compile on correct bit size macro. + + * bits.h (BIT8): New macro, set a single bit in an 8 bit byte. + + * ppc-instructions: With hints from Paul Martin, type in missing + some instruction semantics. Leave disabled for the moment. + (Load Multiple Word): Ditto. + (Store Multiple Word): Ditto. + (Load String Word Immediate): Ditto. + (Load String Word Indexed): Ditto. + (Store String Word Immedate): Ditto. + (Store String Word Indexed): Ditto. + (Move to Condition Register from XER): Ditto. + (Move From Condition Register): Ditto. + (Move From FPSCR): Ditto. + (Move to Condition Register from FPSCR): Ditto. + (Move To FPSCR Field Immediate): Ditto. + (Move To FPSCR Fields): Ditto. + (Move To FPSCR Bit 0): Ditto. + (Move To FPSCR Bit 1): Ditto. + +Thu Jul 25 22:10:40 1996 Andrew Cagney + + * std-config.h (SEMANTICS_INLINE): By default, mask out the + inlining of semantic functions from DEFAULT_INLINE. Almost all + configurations call the semantic code via a pointer so there is + little benefit. + + * std-config.h (ICACHE_INLINE): Ditto. + +Thu Jul 25 20:07:30 1996 Andrew Cagney + + * configure.in (sim_regparm): Add configuration option for + enabling GCC's regparm attribute. + * (sim_stdcall): Add configuration option for enabling GCC's + stdcall attribute. + + * Makefile.in (REGPARM_CFLAGS): Pass regparam configuration onto + compilations. + * (STDCALL_CFLAGS): Pass stdcall configuration onto compilations. + + * std-config.h (REGPARM): Extend construction of REGPARM macro so + that it can include __stdcall__ function attribute. + +Wed Jul 24 19:04:20 1996 Andrew Cagney + + * options.c (print_options): Include SUPPORT_INLINE in information + dump. + + * gen-idecode.c (print_run_until_stop_body): Only generate loop + termination test if creating idecode_run_until_stop. Push the + loop termination test back into each alternative branch. + +Wed Jul 24 15:47:09 1996 Andrew Cagney + + * gen-icache.c (print_icache_function): Have the cache function + always update the cache_entries semantic and address fields. + + * gen-idecode.c (print_idecode_switch_illegal): Include a break + when generating illegal instructions. This was commented out + which is a hangover from looking a at switch statements generated + using indirect jumps. + +Tue Jul 23 20:57:01 1996 Andrew Cagney + + * igen.c (print_my_defines): Replaces print_define_my_index. + Print both a definition for MY_INDEX and MY_PREFIX. + * gen-icache.c (print_icache_function): Adjust. + * gen-idecode.c (print_jump_insn): Adjust. + * gen-semantics.c (print_c_semantic): Adjust. + + * gen-support.c (gen_support_h): Add optional include to created + support.h so that, like cpu, it is optionally inlined for all + modules that include it. + * inline.h, inline.c: Adjust so that support.[hc] is handled the + same as cpu.[hc]. + + * idecode_fields.h (LABEL, GOTO): Macro's that create a unique + name for a lable and then branch to it. + + * ppc-instructions (convert_to_integer, Floating Round to + Single-Precision, Floating Convert from Integer Doubleword): Use + LABEL and GOTO instead of the recently added switch statements. + +Wed Jul 24 14:02:42 1996 Andrew Cagney + + * gen-idecode.c (print_run_until_stop_body): Too many rparen in + generated code. + +Tue Jul 23 20:57:01 1996 Andrew Cagney + + * configure.in (--enable-sim-line-nr): Typo - sim_line-nr. + * (--enable-sim-inline): Reorder patern matching of arguments so + that SUPPORT=ALL_INLINE is reconized as *=* and not *_INLINE. + + * configure: rebuild. + +Mon Jul 22 23:25:08 1996 Andrew Cagney + + * configure.in (--enable-sim-hardware, --enable-sim-packages): New + configuration options. Let the user specify the packages or + hardware devices that are to be included in the build. Makes it + possible for user packages to be specified. + + * Makefile.in (tmp-pk, tmp-hw): Just use the list of packages and + hardware instead of checking it using ls. configure.in should + have taken care of any problems. + (HW_SRC, HW_OBJ, PACKAGE_SRC, PACKAGE_OBJ): Set by configure. + +Mon Jul 22 22:38:59 1996 Andrew Cagney + + * psim.c (psim_options): Enter the argument to the memory size + option directly into the device tree. Was using atol() which is + dangerously non portable. + +Mon Jul 22 22:17:08 1996 Andrew Cagney + + * configure.in (icache): Extend icache flag to include an insn + option. If specifyed the insn - aka instruction - is included in + the instruction cache. Make this the default. + * configure: re-generate. + + * igen.c (main), igen.h: Add option -S - inSn - for specifying + that the instruction should be included in the icache. + + * gen-icache.c (print_icache_body): If enabled, output code to put + the instruction into the icache. + (print_icache_struct): If enabled, add insn to the icache struct. + +Mon Jul 22 20:46:12 1996 Andrew Cagney + + * Makefile.in (BUILD_CFLAGS): Include -g when building the + generators. + +Mon Jul 22 20:00:25 1996 Andrew Cagney + + * emul_generic.c (emul_add_tree_options): Was incorrectly setting + the strict-alignment option when hardwired for non-strict + alignment. + Sun Jul 21 21:18:05 1996 Andrew Cagney * gen-semantics.c: Make the my_index variable a macro MY_INDEX. diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index 6e34cedb983..5ab3c221499 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -69,6 +69,8 @@ SIM_CFLAGS = @sim_cflags@ INLINE_CFLAGS = @sim_inline@ BSWAP_CFLAGS = @sim_bswap@ ENDIAN_CFLAGS = @sim_endian@ +REGPARM_CFLAGS = @sim_regparm@ +STDCALL_CFLAGS = @sim_stdcall@ HOSTENDIAN_CFLAGS = @sim_hostendian@ SMP_CFLAGS = @sim_smp@ XOR_ENDIAN_CFLAGS = @sim_xor_endian@ @@ -88,6 +90,8 @@ TERMIO_CFLAGS = @sim_termio@ WARNING_CFLAGS = @sim_warnings@ CONFIG_CFLAGS = $(BSWAP_CFLAGS) \ $(ENDIAN_CFLAGS) \ + $(REGPARM_CFLAGS) \ + $(STDCALL_CFLAGS) \ $(HOSTENDIAN_CFLAGS) \ $(SMP_CFLAGS) \ $(XOR_ENDIAN_CFLAGS) \ @@ -107,7 +111,7 @@ CONFIG_CFLAGS = $(BSWAP_CFLAGS) \ STD_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) NOWARN_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) -BUILD_CFLAGS = -O $(INCLUDES) $(WARNING_CFLAGS) +BUILD_CFLAGS = -g -O $(INCLUDES) $(WARNING_CFLAGS) BUILD_LDFLAGS = @@ -292,39 +296,11 @@ LIB_OBJ = \ GDB_OBJ = sim_calls.o -HW_SRC = \ - 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_OBJ = \ - hw_cpu.o \ - hw_memory.o \ - hw_nvram.o \ - hw_iobus.o \ - hw_htab.o \ - hw_disk.o \ - hw_trace.o \ - hw_register.o \ - hw_vm.o \ - hw_init.o \ - hw_core.o \ - hw_pal.o - -PACKAGE_SRC = \ - pk_disklabel.c - -PACKAGE_OBJ = \ - pk_disklabel.o +HW_SRC = @sim_hw_src@ +HW_OBJ = @sim_hw_obj@ + +PACKAGE_SRC = @sim_pk_src@ +PACKAGE_OBJ = @sim_pk_obj@ psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS) @@ -531,12 +507,14 @@ misc.o: misc.c misc.h filter_filename.h # real hardware tmp-hw: Makefile $(HW_SRC) $(srcdir)/../../move-if-change - (cd $(srcdir); ls $(HW_SRC)) \ + for hw in $(HW_SRC) ; do echo $$hw ; done \ + | sort -u \ | sed -e 's/^.*\(hw_.*\)\.c/\1/' \ -e 's/^/extern const device_descriptor /' \ -e 's/$$/_device_descriptor\[\];/' \ > tmp-hw.h - (cd $(srcdir); ls $(HW_SRC)) \ + for hw in $(HW_SRC) ; do echo $$hw ; done \ + | sort -u \ | sed -e 's/^.*\(hw_.*\)\.c/\1/' \ -e 's/^/ /' \ -e 's/$$/_device_descriptor,/' \ @@ -563,7 +541,8 @@ hw_init.o: hw_init.c $(DEVICE_TABLE_H) # real packages tmp-pk: Makefile $(PACKAGE_SRC) $(srcdir)/../../move-if-change - (cd $(srcdir); ls $(PACKAGE_SRC)) \ + for pk in $(PACKAGE_SRC) ; do echo $$pk ; done \ + | sort -u \ | sed -e 's/^pk_\(.*\)\.c/\1/' \ -e 's/^/extern package_create_instance_callback pk_/' \ -e 's/$$/_create_instance;/' \ diff --git a/sim/ppc/configure b/sim/ppc/configure index ba7712ce0ed..c405a5745a1 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -31,12 +31,20 @@ ac_help="$ac_help --enable-sim-filter=rule Specify filter rules." ac_help="$ac_help --enable-sim-icache=size Specify instruction cache size." +ac_help="$ac_help + --enable-sim-hardware=list Specify the hardware to be included in the build." +ac_help="$ac_help + --enable-sim-packages=list Specify the packages to be included in the build." ac_help="$ac_help --enable-sim-inline=inlines Specify which functions should be inlined." ac_help="$ac_help --enable-sim-bswap Use the BSWAP instruction on Intel 486s and Pentiums." ac_help="$ac_help --enable-sim-endian=endian Specify target byte endian orientation." +ac_help="$ac_help + --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific." +ac_help="$ac_help + --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific." ac_help="$ac_help --enable-sim-hostendain=end Specify host byte endian orientation." ac_help="$ac_help @@ -737,7 +745,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:749: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -785,11 +793,11 @@ else ac_cv_c_cross=yes else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_cross=no else @@ -850,7 +858,7 @@ if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then echo "Setting warning flags = $sim_line_nr" 6>&1 fi else - sim_line-nr="" + sim_line_nr="" fi # Check whether --enable-sim-config or --disable-sim-config was given. @@ -977,7 +985,7 @@ fi if test "${enable_sim_icache+set}" = set; then enableval="$enable_sim_icache" icache="" -case "${enableval}" in + case "${enableval}" in yes) icache="1024"; sim_icache="-I $icache";; no) sim_icache="";; *) icache=1024 @@ -986,6 +994,7 @@ case "${enableval}" in case "$x" in define) sim_icache="${sim_icache}R";; semantic) sim_icache="${sim_icache}C";; + insn) sim_icache="${sim_icache}S";; 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;; *) { echo "configure: error: "Unknown value $x for --enable-sim-icache"" 1>&2; exit 1; }; sim_icache="";; esac @@ -996,12 +1005,61 @@ if test x"$silent" != x"yes" && test x"$icache" != x""; then echo "Setting instruction cache size to $icache ($sim_icache)" fi else - sim_icache="-CI 1024" + sim_icache="-CSI 1024" if test x"$silent" != x"yes"; then echo "Setting instruction cache size to 1024 ($sim_icache)" fi fi +# Check whether --enable-sim-hardware or --disable-sim-hardware was given. +if test "${enable_sim_hardware+set}" = set; then + enableval="$enable_sim_hardware" + hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal" +case "${enableval}" in + yes) ;; + no) { echo "configure: error: "List of hardware must be specified for --enable-sim-hardware"" 1>&2; exit 1; }; hardware="";; + ,*) hardware="${hardware}${enableval}";; + *) hardware="${enableval}";; +esac +sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` +sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes" && test x"$hardware" != x""; then + echo "Setting hardware to $sim_hw_src, $sim_hw_obj" +fi +else + hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal" +sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` +sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes"; then + echo "Setting hardware to $sim_hw_src, $sim_hw_obj" +fi +fi + + +# Check whether --enable-sim-packages or --disable-sim-packages was given. +if test "${enable_sim_packages+set}" = set; then + enableval="$enable_sim_packages" + packages=disklabel +case "${enableval}" in + yes) ;; + no) { echo "configure: error: "List of packages must be specified for --enable-sim-packages"" 1>&2; exit 1; }; packages="";; + ,*) packages="${packages}${enableval}";; + *) packages="${enableval}"'' +esac +sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` +sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes" && test x"$packages" != x""; then + echo "Setting packages to $sim_pk_src, $sim_pk_obj" +fi +else + packages=disklabel +sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` +sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes"; then + echo "Setting packages to $sim_pk_src, $sim_pk_obj" +fi +fi + # Check whether --enable-sim-inline or --disable-sim-inline was given. if test "${enable_sim_inline+set}" = set; then enableval="$enable_sim_inline" @@ -1015,8 +1073,8 @@ case "$enableval" in new_flag="" case "$x" in *_INLINE=*) new_flag="-D$x";; - *_INLINE) new_flag="-D$x=ALL_INLINE";; *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; + *_INLINE) new_flag="-D$x=ALL_INLINE";; *) new_flag="-D$x""_INLINE=ALL_INLINE";; esac if test x"$sim_inline" = x""; then @@ -1076,6 +1134,38 @@ else sim_endian="" fi +# Check whether --enable-sim-regparm or --disable-sim-regparm was given. +if test "${enable_sim_regparm+set}" = set; then + enableval="$enable_sim_regparm" + case "${enableval}" in + 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";; + no) sim_regparm="" ;; + yes) sim_regparm="-DWITH_REGPARM=3";; + *) { echo "configure: error: "Unknown value $enableval for --enable-sim-regparm"" 1>&2; exit 1; }; sim_regparm="";; +esac +if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then + echo "Setting regparm flags = $sim_regparm" 6>&1 +fi +else + sim_regparm="" +fi + +# Check whether --enable-sim-stdcall or --disable-sim-stdcall was given. +if test "${enable_sim_stdcall+set}" = set; then + enableval="$enable_sim_stdcall" + case "${enableval}" in + no) sim_stdcall="" ;; + std*) sim_stdcall="-DWITH_STDCALL=1";; + yes) sim_stdcall="-DWITH_STDCALL=1";; + *) { echo "configure: error: "Unknown value $enableval for --enable-sim-stdcall"" 1>&2; exit 1; }; sim_stdcall="";; +esac +if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then + echo "Setting function call flags = $sim_stdcall" 6>&1 +fi +else + sim_stdcall="" +fi + # Check whether --enable-sim-hostendian or --disable-sim-hostendian was given. if test "${enable_sim_hostendian+set}" = set; then enableval="$enable_sim_hostendian" @@ -1098,7 +1188,7 @@ else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -1110,11 +1200,11 @@ int t() { #endif ; return 0; } EOF -if { (eval echo configure:1114: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1204: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -1126,7 +1216,7 @@ int t() { #endif ; return 0; } EOF -if { (eval echo configure:1130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1220: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1143,7 +1233,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_c_bigendian=no else @@ -1563,7 +1653,7 @@ if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1572,7 +1662,7 @@ int t() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:1576: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1666: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -1596,7 +1686,7 @@ if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1605,7 +1695,7 @@ int t() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:1609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -1631,7 +1721,7 @@ if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1640,7 +1730,7 @@ int t() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:1644: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1734: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -1664,7 +1754,7 @@ if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1673,7 +1763,7 @@ int t() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:1677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1767: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -1697,7 +1787,7 @@ if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_cv_struct_tm> @@ -1706,7 +1796,7 @@ int t() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:1710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -1729,7 +1819,7 @@ if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifndef tzname /* For SGI. */ @@ -1740,7 +1830,7 @@ int t() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:1744: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:1834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -1776,13 +1866,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1786: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1876: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1791,13 +1881,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1822,7 +1912,7 @@ if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -1858,7 +1948,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:1977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then ac_cv_type_getgroups=gid_t else @@ -1893,7 +1983,7 @@ fi rm -fr conftest* if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext < EOF @@ -1921,7 +2011,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1929,7 +2019,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1944,7 +2034,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1962,7 +2052,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1983,7 +2073,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1994,7 +2084,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -{ (eval echo configure:1998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } +{ (eval echo configure:2088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } if test -s conftest && (./conftest; exit) 2>/dev/null; then : else @@ -2018,7 +2108,7 @@ if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2049,7 +2139,7 @@ if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2080,7 +2170,7 @@ if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2111,7 +2201,7 @@ if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2129,7 +2219,7 @@ int t() { int i; ; return 0; } EOF -if { (eval echo configure:2133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2151,7 +2241,7 @@ if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -2182,7 +2272,7 @@ if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF @@ -2218,7 +2308,7 @@ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2273,12 +2363,12 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2311,7 +2401,7 @@ if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -2320,7 +2410,7 @@ int t() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:2324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2414: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -2351,7 +2441,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2390,7 +2480,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; }; then +if { (eval echo configure:2496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2429,7 +2519,7 @@ if eval "test \"`echo '$''{'ac_cv_termios_struct'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2443,7 +2533,7 @@ static struct termios x; x.c_cc[NCCS] = 0; ; return 0; } EOF -if { (eval echo configure:2447: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_termios_struct=yes else @@ -2465,7 +2555,7 @@ if test "$ac_cv_termios_struct" = "yes"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2474,7 +2564,7 @@ int t() { static struct termios x; x.c_line = 0; ; return 0; } EOF -if { (eval echo configure:2478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_termios_cline=yes else @@ -2500,7 +2590,7 @@ if test "$ac_cv_termios_struct" != "yes"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2514,7 +2604,7 @@ static struct termio x; x.c_cc[NCC] = 0; ; return 0; } EOF -if { (eval echo configure:2518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_termio_struct=yes else @@ -2539,7 +2629,7 @@ if test "$ac_cv_termio_struct" = "yes"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2548,7 +2638,7 @@ int t() { static struct termio x; x.c_line = 0; ; return 0; } EOF -if { (eval echo configure:2552: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_termio_cline=yes else @@ -2627,6 +2717,12 @@ fi + + + + + + @@ -2785,9 +2881,15 @@ s%@sim_dup@%$sim_dup%g s%@sim_jump@%$sim_jump%g s%@sim_filter@%$sim_filter%g s%@sim_icache@%$sim_icache%g +s%@sim_hw_src@%$sim_hw_src%g +s%@sim_hw_obj@%$sim_hw_obj%g +s%@sim_pk_src@%$sim_pk_src%g +s%@sim_pk_obj@%$sim_pk_obj%g s%@sim_inline@%$sim_inline%g s%@sim_bswap@%$sim_bswap%g s%@sim_endian@%$sim_endian%g +s%@sim_regparm@%$sim_regparm%g +s%@sim_stdcall@%$sim_stdcall%g s%@sim_xor_endian@%$sim_xor_endian%g s%@sim_hostendian@%$sim_hostendian%g s%@sim_smp@%$sim_smp%g diff --git a/sim/ppc/configure.in b/sim/ppc/configure.in index e7b40ad73bc..1314a9340d0 100644 --- a/sim/ppc/configure.in +++ b/sim/ppc/configure.in @@ -44,7 +44,7 @@ AC_ARG_ENABLE(sim-line-nr, esac if test x"$silent" != x"yes" && test x"$sim_line_nr" != x""; then echo "Setting warning flags = $sim_line_nr" 6>&1 -fi],[sim_line-nr=""])dnl +fi],[sim_line_nr=""])dnl AC_ARG_ENABLE(sim-config, [ --enable-sim-config=file Override default config file], @@ -144,8 +144,8 @@ fi])dnl AC_ARG_ENABLE(sim-icache, [ --enable-sim-icache=size Specify instruction cache size.], -icache="" -[case "${enableval}" in +[icache="" + case "${enableval}" in yes) icache="1024"; sim_icache="-I $icache";; no) sim_icache="";; *) icache=1024 @@ -154,6 +154,7 @@ icache="" case "$x" in define) sim_icache="${sim_icache}R";; semantic) sim_icache="${sim_icache}C";; + insn) sim_icache="${sim_icache}S";; 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) icache=$x;; *) AC_MSG_ERROR("Unknown value $x for --enable-sim-icache"); sim_icache="";; esac @@ -162,11 +163,52 @@ icache="" esac if test x"$silent" != x"yes" && test x"$icache" != x""; then echo "Setting instruction cache size to $icache ($sim_icache)" -fi],[sim_icache="-CI 1024" +fi],[sim_icache="-CSI 1024" if test x"$silent" != x"yes"; then echo "Setting instruction cache size to 1024 ($sim_icache)" fi])dnl +AC_ARG_ENABLE(sim-hardware, +[ --enable-sim-hardware=list Specify the hardware to be included in the build.], +[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal" +case "${enableval}" in + yes) ;; + no) AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";; + ,*) hardware="${hardware}${enableval}";; + *) hardware="${enableval}";; +esac +sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` +sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes" && test x"$hardware" != x""; then + echo "Setting hardware to $sim_hw_src, $sim_hw_obj" +fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal" +sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'` +sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes"; then + echo "Setting hardware to $sim_hw_src, $sim_hw_obj" +fi])dnl + + +AC_ARG_ENABLE(sim-packages, +[ --enable-sim-packages=list Specify the packages to be included in the build.], +[packages=disklabel +case "${enableval}" in + yes) ;; + no) AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";; + ,*) packages="${packages}${enableval}";; + *) packages="${enableval}"'' +esac +sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` +sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes" && test x"$packages" != x""; then + echo "Setting packages to $sim_pk_src, $sim_pk_obj" +fi],[packages=disklabel +sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'` +sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'` +if test x"$silent" != x"yes"; then + echo "Setting packages to $sim_pk_src, $sim_pk_obj" +fi])dnl + AC_ARG_ENABLE(sim-inline, [ --enable-sim-inline=inlines Specify which functions should be inlined.], [sim_inline="" @@ -179,8 +221,8 @@ case "$enableval" in new_flag="" case "$x" in *_INLINE=*) new_flag="-D$x";; - *_INLINE) new_flag="-D$x=ALL_INLINE";; *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; + *_INLINE) new_flag="-D$x=ALL_INLINE";; *) new_flag="-D$x""_INLINE=ALL_INLINE";; esac if test x"$sim_inline" = x""; then @@ -229,6 +271,30 @@ if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then echo "Setting endian flags = $sim_endian" 6>&1 fi],[sim_endian=""])dnl +AC_ARG_ENABLE(sim-regparm, +[ --enable-sim-regparm=nr-parm Pass parameters in registers instead of on the stack - x86/GCC specific.], +[case "${enableval}" in + 0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";; + no) sim_regparm="" ;; + yes) sim_regparm="-DWITH_REGPARM=3";; + *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";; +esac +if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then + echo "Setting regparm flags = $sim_regparm" 6>&1 +fi],[sim_regparm=""])dnl + +AC_ARG_ENABLE(sim-stdcall, +[ --enable-sim-stdcall=type Use an alternative function call/return mechanism - x86/GCC specific.], +[case "${enableval}" in + no) sim_stdcall="" ;; + std*) sim_stdcall="-DWITH_STDCALL=1";; + yes) sim_stdcall="-DWITH_STDCALL=1";; + *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";; +esac +if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then + echo "Setting function call flags = $sim_stdcall" 6>&1 +fi],[sim_stdcall=""])dnl + AC_ARG_ENABLE(sim-hostendian, [ --enable-sim-hostendain=end Specify host byte endian orientation.], [case "${enableval}" in @@ -543,9 +609,15 @@ AC_SUBST(sim_dup) AC_SUBST(sim_jump) AC_SUBST(sim_filter) AC_SUBST(sim_icache) +AC_SUBST(sim_hw_src) +AC_SUBST(sim_hw_obj) +AC_SUBST(sim_pk_src) +AC_SUBST(sim_pk_obj) AC_SUBST(sim_inline) AC_SUBST(sim_bswap) AC_SUBST(sim_endian) +AC_SUBST(sim_regparm) +AC_SUBST(sim_stdcall) AC_SUBST(sim_xor_endian) AC_SUBST(sim_hostendian) AC_SUBST(sim_smp) diff --git a/sim/ppc/emul_generic.c b/sim/ppc/emul_generic.c index 73209f56422..3b8ca025362 100644 --- a/sim/ppc/emul_generic.c +++ b/sim/ppc/emul_generic.c @@ -282,10 +282,13 @@ emul_add_tree_options(device *tree, device_tree_add_parsed(tree, "/openprom/options/env %s", env); device_tree_add_parsed(tree, "/openprom/options/os-emul %s", emul); device_tree_add_parsed(tree, "/openprom/options/strict-alignment? %s", - (WITH_ALIGNMENT == STRICT_ALIGNMENT || little_endian) + ((WITH_ALIGNMENT == 0 && little_endian) + || (WITH_ALIGNMENT == STRICT_ALIGNMENT)) ? "true" : "false"); device_tree_add_parsed(tree, "/openprom/options/floating-point? %s", WITH_FLOATING_POINT ? "true" : "false"); + device_tree_add_parsed(tree, "/openprom/options/use-stdio? %s", + WITH_STDIO == DO_USE_STDIO ? "true" : "false"); device_tree_add_parsed(tree, "/openprom/options/model \"%s", model_name[WITH_DEFAULT_MODEL]); device_tree_add_parsed(tree, "/openprom/options/model-issue %d", diff --git a/sim/ppc/main.c b/sim/ppc/main.c index 783778225a5..99201dbd43b 100644 --- a/sim/ppc/main.c +++ b/sim/ppc/main.c @@ -21,6 +21,7 @@ #include #include +#include #include "psim.h" #include "options.h" @@ -42,10 +43,19 @@ #endif #endif +#if !defined(O_NDELAY) || !defined(F_GETFL) || !defined(F_SETFL) +#undef WITH_STDIO +#define WITH_STDIO DO_USE_STDIO +#endif + + extern char **environ; +static psim *simulation = NULL; + + void -printf_filtered(const char *msg, ...) +sim_io_printf_filtered(const char *msg, ...) { va_list ap; va_start(ap, msg); @@ -53,12 +63,6 @@ printf_filtered(const char *msg, ...) va_end(ap); } -void -flush_stdoutput(void) -{ - fflush (stdout); -} - void error (char *msg, ...) { @@ -66,9 +70,125 @@ error (char *msg, ...) va_start(ap, msg); vprintf(msg, ap); va_end(ap); + + /* any final clean up */ + if (ppc_trace[trace_print_info] && simulation != NULL) + psim_print_info (simulation, ppc_trace[trace_print_info]); + exit (1); } +int +sim_io_write_stdout(const char *buf, + int sizeof_buf) +{ + switch (CURRENT_STDIO) { + case DO_USE_STDIO: + { + int i; + for (i = 0; i < sizeof_buf; i++) { + putchar(buf[i]); + } + return i; + } + break; + case DONT_USE_STDIO: + return write(1, buf, sizeof_buf); + break; + default: + error("sim_io_write_stdout: invalid switch\n"); + } +} + +int +sim_io_write_stderr(const char *buf, + int sizeof_buf) +{ + switch (CURRENT_STDIO) { + case DO_USE_STDIO: + { + int i; + for (i = 0; i < sizeof_buf; i++) { + fputc(buf[i], stderr); + } + return i; + } + break; + case DONT_USE_STDIO: + return write(2, buf, sizeof_buf); + break; + default: + error("sim_io_write_stdout: invalid switch\n"); + } +} + +int +sim_io_read_stdin(char *buf, + int sizeof_buf) +{ + switch (CURRENT_STDIO) { + case DO_USE_STDIO: + if (fgets(buf, sizeof_buf, stdin) == NULL) + return sim_io_eof; + else + return strlen(buf); + break; + case DONT_USE_STDIO: + { + /* check for input */ + int flags; + int status; + int nr_read; + /* get the old status */ + flags = fcntl(0, F_GETFL, 0); + if (flags == -1) { + perror("sim_io_read_stdin"); + return sim_io_eof; + } + /* temp, disable blocking IO */ + status = fcntl(0, F_SETFL, flags | O_NDELAY); + if (status == -1) { + perror("sim_io_read_stdin"); + return sim_io_eof; + } + /* try for input */ + nr_read = read(0, &buf, sizeof_buf); + /* return to regular vewing */ + status = fcntl(0, F_SETFL, flags); + if (status == -1) { + perror("sim_io_read_stdin"); + return sim_io_eof; + } + if (status > 0) + return 1; + else if (status < 0) + return sim_io_eof; + else + return sim_io_not_ready; + } + break; + default: + error("sim_io_read_stdin: invalid switch\n"); + break; + } +} + +void +sim_io_flush_stdoutput(void) +{ + switch (CURRENT_STDIO) { + case DO_USE_STDIO: + fflush (stdout); + break; + case DONT_USE_STDIO: + break; + default: + error("sim_io_flush_stdoutput: invalid switch\n"); + break; + } +} + + void * zalloc(long size) { @@ -88,7 +208,6 @@ zfree(void *chunk) int main(int argc, char **argv) { - psim *system; const char *name_of_file; char *arg_; psim_status status; @@ -104,7 +223,7 @@ main(int argc, char **argv) print_options (); /* create the simulator */ - system = psim_create(name_of_file, root); + simulation = psim_create(name_of_file, root); /* fudge the environment so that _=prog-name */ arg_ = (char*)zalloc(strlen(argv[0]) + strlen("_=") + 1); @@ -113,17 +232,17 @@ main(int argc, char **argv) putenv(arg_); /* initialize it */ - psim_init(system); - psim_stack(system, argv, environ); + psim_init(simulation); + psim_stack(simulation, argv, environ); - psim_run(system); + psim_run(simulation); /* any final clean up */ if (ppc_trace[trace_print_info]) - psim_print_info (system, ppc_trace[trace_print_info]); + psim_print_info (simulation, ppc_trace[trace_print_info]); /* why did we stop */ - status = psim_get_status(system); + status = psim_get_status(simulation); switch (status.reason) { case was_continuing: error("psim: continuing while stoped!\n"); diff --git a/sim/ppc/options.c b/sim/ppc/options.c index 7240b588e89..74f0b035d4a 100644 --- a/sim/ppc/options.c +++ b/sim/ppc/options.c @@ -24,7 +24,8 @@ #include "cpu.h" #include "options.h" -STATIC_INLINE const char * +STATIC_INLINE_OPTIONS\ +(const char *) options_byte_order (int order) { switch (order) { @@ -36,7 +37,8 @@ options_byte_order (int order) return "UNKNOWN"; } -STATIC_INLINE const char * +STATIC_INLINE_OPTIONS\ +(const char *) options_env (int env) { switch (env) { @@ -49,7 +51,8 @@ options_env (int env) return "UNKNOWN"; } -STATIC_INLINE const char * +STATIC_INLINE_OPTIONS\ +(const char *) options_align (int align) { switch (align) { @@ -61,7 +64,8 @@ options_align (int align) return "UNKNOWN"; } -STATIC_INLINE const char * +STATIC_INLINE_OPTIONS\ +(const char *) options_float (int float_type) { switch (float_type) { @@ -72,7 +76,8 @@ options_float (int float_type) return "UNKNOWN"; } -STATIC_INLINE const char * +STATIC_INLINE_OPTIONS\ +(const char *) options_mon (int mon) { switch (mon) { @@ -85,7 +90,26 @@ options_mon (int mon) return "UNKNOWN"; } -INLINE_OPTIONS void +STATIC_INLINE_OPTIONS\ +(const char *) +options_inline (int in) +{ + switch (in) { + case /*0*/ 0: return "0"; + case /*1*/ REVEAL_MODULE: return "REVEAL_MODULE"; + case /*2*/ INLINE_MODULE: return "INLINE_MODULE"; + case /*3*/ REVEAL_MODULE|INLINE_MODULE: return "REVEAL_MODULE|INLINE_MODULE"; + case /*4*/ INLINE_LOCALS: return "LOCALS_INLINE"; + case /*5*/ INLINE_LOCALS|REVEAL_MODULE: return "INLINE_LOCALS|REVEAL_MODULE"; + case /*6*/ INLINE_LOCALS|INLINE_MODULE: return "INLINE_LOCALS|INLINE_MODULE"; + case /*7*/ ALL_INLINE: return "ALL_INLINE"; + } + return "0"; +} + + +INLINE_OPTIONS\ +(void) print_options (void) { #if defined(_GNUC_) && defined(__VERSION__) @@ -110,27 +134,30 @@ print_options (void) printf_filtered ("WITH_TRACE = %d\n", WITH_TRACE); printf_filtered ("WITH_ASSERT = %d\n", WITH_ASSERT); printf_filtered ("WITH_MON = %s\n", options_mon (WITH_MON)); - printf_filtered ("WITH_FUNCTION_UNIT = %d\n", WITH_FUNCTION_UNIT); printf_filtered ("WITH_DEFAULT_MODEL = %s\n", model_name[WITH_DEFAULT_MODEL]); printf_filtered ("WITH_MODEL = %s\n", model_name[WITH_MODEL]); + printf_filtered ("WITH_MODEL_ISSUE = %d\n", WITH_MODEL_ISSUE); printf_filtered ("WITH_RESERVED_BITS = %d\n", WITH_RESERVED_BITS); - printf_filtered ("DEFAULT_INLINE = %d\n", DEFAULT_INLINE); - printf_filtered ("SIM_ENDIAN_INLINE = %d\n", SIM_ENDIAN_INLINE); - printf_filtered ("BITS_INLINE = %d\n", BITS_INLINE); - printf_filtered ("CPU_INLINE = %d\n", CPU_INLINE); - printf_filtered ("VM_INLINE = %d\n", VM_INLINE); - printf_filtered ("CORE_INLINE = %d\n", CORE_INLINE); - printf_filtered ("EVENTS_INLINE = %d\n", EVENTS_INLINE); - printf_filtered ("MON_INLINE = %d\n", MON_INLINE); - printf_filtered ("INTERRUPTS_INLINE = %d\n", INTERRUPTS_INLINE); - printf_filtered ("REGISTERS_INLINE = %d\n", REGISTERS_INLINE); - printf_filtered ("DEVICE_TREE_INLINE = %d\n", DEVICE_TREE_INLINE); - printf_filtered ("DEVICES_INLINE = %d\n", DEVICES_INLINE); - printf_filtered ("SPREG_INLINE = %d\n", SPREG_INLINE); - printf_filtered ("SEMANTICS_INLINE = %d\n", SEMANTICS_INLINE); - printf_filtered ("IDECODE_INLINE = %d\n", IDECODE_INLINE); - printf_filtered ("FUNCTION_UNIT_INLINE = %d\n", FUNCTION_UNIT_INLINE); - printf_filtered ("OPTIONS_INLINE = %d\n", FUNCTION_UNIT_INLINE); + printf_filtered ("WITH_STDIO = %d\n", WITH_STDIO); + printf_filtered ("WITH_REGPARM = %d\n", WITH_REGPARM); + printf_filtered ("WITH_STDCALL = %d\n", WITH_STDCALL); + printf_filtered ("DEFAULT_INLINE = %s\n", options_inline (DEFAULT_INLINE)); + printf_filtered ("SIM_ENDIAN_INLINE = %s\n", options_inline (SIM_ENDIAN_INLINE)); + printf_filtered ("BITS_INLINE = %s\n", options_inline (BITS_INLINE)); + printf_filtered ("CPU_INLINE = %s\n", options_inline (CPU_INLINE)); + printf_filtered ("VM_INLINE = %s\n", options_inline (VM_INLINE)); + printf_filtered ("CORE_INLINE = %s\n", options_inline (CORE_INLINE)); + printf_filtered ("EVENTS_INLINE = %s\n", options_inline (EVENTS_INLINE)); + printf_filtered ("MON_INLINE = %s\n", options_inline (MON_INLINE)); + printf_filtered ("INTERRUPTS_INLINE = %s\n", options_inline (INTERRUPTS_INLINE)); + printf_filtered ("REGISTERS_INLINE = %s\n", options_inline (REGISTERS_INLINE)); + printf_filtered ("DEVICE_INLINE = %s\n", options_inline (DEVICE_INLINE)); + printf_filtered ("SPREG_INLINE = %s\n", options_inline (SPREG_INLINE)); + printf_filtered ("SEMANTICS_INLINE = %s\n", options_inline (SEMANTICS_INLINE)); + printf_filtered ("IDECODE_INLINE = %s\n", options_inline (IDECODE_INLINE)); + printf_filtered ("OPTIONS_INLINE = %s\n", options_inline (OPTIONS_INLINE)); + printf_filtered ("OS_EMUL_INLINE = %s\n", options_inline (OS_EMUL_INLINE)); + printf_filtered ("SUPPORT_INLINE = %s\n", options_inline (SUPPORT_INLINE)); #ifdef OPCODE_RULES printf_filtered ("OPCODE rules = %s\n", OPCODE_RULES); diff --git a/sim/ppc/ppc-cache-rules b/sim/ppc/ppc-cache-rules index 88c55e8f8ce..270fb4a6097 100644 --- a/sim/ppc/ppc-cache-rules +++ b/sim/ppc/ppc-cache-rules @@ -23,10 +23,10 @@ cache:RA:RA_BITMASK:unsigned32:(1 << RA) cache:RT:RT:: cache:RT:rT:signed_word *:(cpu_registers(processor)->gpr + RT) cache:RT:RT_BITMASK:unsigned32:(1 << RT) -compute:RS:RS:: +cache:RS:RS:: cache:RS:rS:signed_word *:(cpu_registers(processor)->gpr + RS) cache:RS:RS_BITMASK:unsigned32:(1 << RS) -compute:RB:RB:: +cache:RB:RB:: cache:RB:rB:signed_word *:(cpu_registers(processor)->gpr + RB) cache:RB:RB_BITMASK:unsigned32:(1 << RB) compute:FRA:FRA:: diff --git a/sim/ppc/std-config.h b/sim/ppc/std-config.h index 76750f941cb..1a3349c3efb 100644 --- a/sim/ppc/std-config.h +++ b/sim/ppc/std-config.h @@ -289,13 +289,21 @@ extern int current_model_issue; /* Whether or not input/output just uses stdio, or uses printf_filtered for output, and polling input for input. */ -#define DONT_USE_STDIO 0 + +#define DONT_USE_STDIO 2 #define DO_USE_STDIO 1 #ifndef WITH_STDIO -#define WITH_STDIO DONT_USE_STDIO +#define WITH_STDIO DO_USE_STDIO #endif +extern int current_stdio; +#define CURRENT_STDIO (WITH_STDIO \ + ? WITH_STDIO \ + : current_stdio) + + + /* INLINE CODE SELECTION: GCC -O3 attempts to inline any function or procedure in scope. The @@ -454,15 +462,34 @@ extern int current_model_issue; #endif #endif + /* Your compilers pass parameters in registers reserved word */ +#ifndef WITH_REGPARM +#define WITH_REGPARM 0 +#endif + +#ifndef WITH_STDCALL +#define WITH_STDCALL 0 +#endif + #if !defined REGPARM -#if (defined(i386) || defined(i486) || defined(i586) || defined(__i386__) || defined(__i486__) || defined(__i586__)) && WITH_REGPARM +#if (defined(i386) || defined(i486) || defined(i586) || defined(__i386__) || defined(__i486__) || defined(__i586__)) +#if (WITH_REGPARM && WITH_STDCALL) +#define REGPARM __attribute__((__regparm__(WITH_REGPARM),__stdcall__)) +#else +#if (WITH_REGPARM && !WITH_STDCALL) #define REGPARM __attribute__((__regparm__(WITH_REGPARM))) #else +#if (!WITH_REGPARM && WITH_STDCALL) +#define REGPARM __attribute__((__stdcall__)) +#else #define REGPARM #endif #endif +#endif +#endif +#endif @@ -572,7 +599,7 @@ extern int current_model_issue; inline all of their called functions */ #ifndef SEMANTICS_INLINE -#define SEMANTICS_INLINE DEFAULT_INLINE +#define SEMANTICS_INLINE (DEFAULT_INLINE & ~INLINE_MODULE) #endif /* When using the instruction cache, code to decode an instruction and @@ -580,7 +607,7 @@ extern int current_model_issue; miss in the instruction cache. */ #ifndef ICACHE_INLINE -#define ICACHE_INLINE DEFAULT_INLINE +#define ICACHE_INLINE (DEFAULT_INLINE & ~INLINE_MODULE) #endif /* General functions called by semantics functions but part of the -- 2.30.2