diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index f1f298f0b5..c1b687eb7c 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,50 @@ +Wed Feb 14 17:38:12 1996 J. T. Conklin + + * configure.in (AC_HEADER_DIRENT): Add, so that we can figure out + where the directory functions are declared. + * configure: Regenerate + + * emul_netbsd.c: Use the macros defined by configure to find the + appropriate directory functions. + +Fri Jan 19 00:32:27 1996 Andrew Cagney - aka Noid + + * psim.c (psim_create): Re-order so that all options are set + before the CPU's are created. Was breaking mon_create(); + + * psim.c (psim_create): Tidy up conflicting configuration errors. + + * debug.c: Add missing print-info entry to trace table. + + * os_emul.c (os_emul_create): Fix `-e' option. Was looking under + wrong name. + + * psim.c (psim_options): Fix `-r' option. Was entering under wrong + name. + +Thu Jan 18 20:33:48 1996 Andrew Cagney + + * vm.c (om_unpack_bats): Fix checking of bat bits. + + * emul_chirp.c (emul_chirp_create): Store address of OB in memory + in the os_emul_data structure. + + * emul_bugapi.c (emul_bugapi_create): Store the address of the + bugapi code (in main memory) in the os_emul_data structure. + +Thu Jan 18 01:14:55 1996 Andrew Cagney + + * vm.c (om_translate_effective_to_real): Fix trace output. + +Wed Jan 17 22:21:55 1996 Andrew Cagney + + * device_table.c (generic_device_init_address): Create memory from + information obtained from `reg' property. + * device_table.c (vm_init_address_callback): Use information + obtained from properties. + * emul_netbsd.c (emul_netbsd_create): Update to create device and + property entries to match + Tue Jan 16 09:50:53 1996 Michael Meissner * idecode_expression.h (ALU_END): Add ITRACE of the result. diff --git a/sim/ppc/configure b/sim/ppc/configure index 6bdb818f47..04d0ac66fd 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -660,7 +660,7 @@ if test x"$silent" != x"yes" && test x"$sim_switch" != x""; then echo "Setting switch flags = $sim_switch" 6>&1 fi else - sim_switch="-s"; + sim_switch=""; if test x"$silent" != x"yes"; then echo "Setting switch flags = $sim_switch" 6>&1 fi @@ -727,17 +727,17 @@ if test "${enable_sim_inline+set}" = set; then enableval="$enable_sim_inline" sim_inline="" case "$enableval" in - no) sim_inline="-DDEFAULT_INLINE=0 -DINLINE=";; + no) sim_inline="-DDEFAULT_INLINE=0";; 0) sim_inline="-DDEFAULT_INLINE=0";; - yes | 2) sim_inline="-DDEFAULT_INLINE=2";; - 1) sim_inline="-DDEFAULT_INLINE=1";; + yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_INLINE";; + 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";; *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do new_flag="" case "$x" in *_INLINE=*) new_flag="-D$x";; - *_INLINE) new_flag="-D$x=2";; + *_INLINE) new_flag="-D$x=ALL_INLINE";; *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; - *) new_flag="-D$x""_INLINE=2";; + *) new_flag="-D$x""_INLINE=ALL_INLINE";; esac if test x"$sim_inline" = x""; then sim_inline="$new_flag" @@ -751,7 +751,7 @@ if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then fi else if test x"$GCC" != ""; then - sim_inline="-DDEFAULT_INLINE=1" + sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS" if test x"$silent" != x"yes"; then echo "Setting inline flags = $sim_inline" 6>&1 fi @@ -981,17 +981,17 @@ fi if test "${enable_sim_monitor+set}" = set; then enableval="$enable_sim_monitor" case "${enableval}" in - yes) sim_mon="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";; - no) sim_mon="-DWITH_MON=0";; - instruction) sim_mon="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";; - memory) sim_mon="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";; + yes) sim_monitor="-DWITH_MON='MONITOR_INSTRUCTION_ISSUE | MONITOR_LOAD_STORE_UNIT'";; + no) sim_monitor="-DWITH_MON=0";; + instruction) sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";; + memory) sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";; *) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-mon"" 1>&2; exit 1; }; sim_env="";; esac -if test x"$silent" != x"yes" && test x"$sim_mon" != x""; then - echo "Setting monitor flags = $sim_mon" 6>&1 +if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then + echo "Setting monitor flags = $sim_monitor" 6>&1 fi else - sim_mon="" + sim_monitor="" fi # Check whether --enable-sim-model or --disable-sim-model was given. @@ -1385,6 +1385,8 @@ if test "x$cross_compiling" = "xno"; then else CC_FOR_BUILD=gcc fi + + echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1392,7 +1394,7 @@ else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -1408,7 +1410,7 @@ if eval $ac_compile; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -1437,7 +1439,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 <&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -1487,7 +1488,7 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error @@ -1501,7 +1502,7 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error @@ -1534,7 +1535,7 @@ 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 @@ -1562,6 +1563,118 @@ else fi done +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +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> +int main() { return 0; } +int t() { +DIR *dirp = 0; +; return 0; } +EOF +if eval $ac_compile; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdedfghijklmnopqrstuvwxyz./\055' 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ___'` + cat >> confdefs.h <&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for -ldir""... $ac_c" 1>&6 +ac_lib_var=`echo dir | tr '.-/+' '___p'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for -lx""... $ac_c" 1>&6 +ac_lib_var=`echo x | tr '.-/+' '___p'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + trap '' 1 2 15 cat > confcache <<\EOF @@ -1726,6 +1839,7 @@ s%@sim_model@%$sim_model%g s%@sim_default_model@%$sim_default_model%g s%@sim_model_issue@%$sim_model_issue%g s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g +s%@WORDS_BIGENDIAN@%$WORDS_BIGENDIAN%g s%@CPP@%$CPP%g CEOF diff --git a/sim/ppc/configure.in b/sim/ppc/configure.in index 9bf61e26fb..ac0f4072d8 100644 --- a/sim/ppc/configure.in +++ b/sim/ppc/configure.in @@ -418,6 +418,7 @@ AC_C_BIGENDIAN AC_SUBST(WORDS_BIGENDIAN) AC_CHECK_HEADERS(string.h strings.h stdlib.h time.h sys/types.h sys/time.h sys/times.h unistd.h sys/resource.h) +AC_HEADER_DIRENT AC_OUTPUT(Makefile, [case x$CONFIG_HEADERS in xconfig.h:config.in) echo > stamp-h ;; esac]) diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c index 6d1ad89eb8..6db39a44da 100644 --- a/sim/ppc/emul_netbsd.c +++ b/sim/ppc/emul_netbsd.c @@ -1,6 +1,6 @@ /* This file is part of the program psim. - Copyright (C) 1994-1995, Andrew Cagney + Copyright (C) 1994-1996, Andrew Cagney This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,7 +50,23 @@ int getrusage(); #include #include -#include + +#if HAVE_DIRENT_H +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +#endif #ifdef HAVE_UNISTD_H #include @@ -92,6 +108,7 @@ extern int errno; /* NetBSD's idea of what is needed to implement emulations */ struct _os_emul_data { + device *vm; emul_syscall *syscalls; }; @@ -380,16 +397,15 @@ do_break(os_emul_data *emul, const int arg0, cpu *processor, unsigned_word cia) - /* just pass this onto the `vm' device */ { + /* just pass this onto the `vm' device */ psim *system = cpu_system(processor); - device *vm = psim_device(system, "/vm"); if (WITH_TRACE && ppc_trace[trace_os_emul]) printf_filtered ("0x%lx", (long)cpu_registers(processor)->gpr[arg0]); SYS(break); - device_ioctl(vm, + device_ioctl(emul->vm, system, processor, cia, @@ -1235,6 +1251,7 @@ emul_netbsd_create(device *root, unsigned stack_size; int elf_binary; os_emul_data *bsd_data; + device *vm; /* check that this emulation is really for us */ if (name != NULL && strcmp(name, "netbsd") != 0) @@ -1258,60 +1275,35 @@ emul_netbsd_create(device *root, } /* options */ - { - device *options = device_tree_add_found(root, "/", "options"); - device_add_integer_property(options, "smp", 1); /* always */ - device_add_boolean_property(options, "little-endian?", - !image->xvec->byteorder_big_p); - device_add_string_property(options, "env", - (WITH_ENVIRONMENT == USER_ENVIRONMENT - ? "user" : "virtual")); - device_add_boolean_property(options, "strict-alignment?", - (WITH_ALIGNMENT == STRICT_ALIGNMENT - || !image->xvec->byteorder_big_p)); - device_add_boolean_property(options, "floating-point?", - WITH_FLOATING_POINT); - device_add_string_property(options, "os-emul", "netbsd"); - } + emul_add_tree_options(root, image, "netbsd", + (WITH_ENVIRONMENT == USER_ENVIRONMENT + ? "user" : "virtual")); /* virtual memory - handles growth of stack/heap */ - { - device *vm_node = device_tree_add_found_uw_u(root, "/", "vm", - top_of_stack - stack_size, - stack_size); - device *vm_map_binary = device_tree_add_found(vm_node, "", "map-binary"); - device_add_null_property(vm_map_binary, - bfd_get_filename(image)); - } + vm = device_tree_add_parsed(root, "/openprom/vm@0x%lx", + (unsigned long)(top_of_stack - stack_size)); + device_tree_add_parsed(vm, "./stack-base 0x%lx", + (unsigned long)(top_of_stack - stack_size)); + device_tree_add_parsed(vm, "./nr-bytes 0x%x", stack_size); + + device_tree_add_parsed(root, "/openprom/vm/map-binary/file-name %s", + bfd_get_filename(image)); /* finish the init */ - { - device *init = device_tree_add_found(root, "/", "init"); - { - device *init_register = device_tree_add_found(init, "", "register"); - device_add_integer_property(init_register, - "pc", - bfd_get_start_address(image)); - device_add_integer_property(init_register, - "sp", - top_of_stack); - device_add_integer_property(init_register, - "msr", - (image->xvec->byteorder_big_p - ? 0 - : msr_little_endian_mode)); - } - { - device *init_stack = device_tree_add_found(init, "", "stack"); - device_add_null_property(init_stack, - (elf_binary - ? "elf" - : "xcoff")); - } - } + device_tree_add_parsed(root, "/openprom/init/register/pc 0x%lx", + (unsigned long)bfd_get_start_address(image)); + device_tree_add_parsed(root, "/openprom/init/register/sp 0x%lx", + (unsigned long)top_of_stack); + device_tree_add_parsed(root, "/openprom/init/register/msr 0x%x", + (device_find_boolean_property(root, "/options/little-endian?") + ? msr_little_endian_mode + : 0)); + device_tree_add_parsed(root, "/openprom/init/stack/stack-type %s", + (elf_binary ? "elf" : "xcoff")); /* finally our emulation data */ bsd_data = ZALLOC(os_emul_data); + bsd_data->vm = vm; bsd_data->syscalls = &emul_netbsd_syscalls; return bsd_data; }