aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meissner <gnu@the-meissners.org>1997-05-19 23:02:30 +0000
committerMichael Meissner <gnu@the-meissners.org>1997-05-19 23:02:30 +0000
commit8c5b6ead7d2880ce708ee185ce3506cda1aeff4d (patch)
tree2290bff85b6e809a587e49f04ea2f64ce9ff7955
parent2aec653f17a6f02608cee5863223034d0395198b (diff)
downloadgdb-8c5b6ead7d2880ce708ee185ce3506cda1aeff4d.zip
gdb-8c5b6ead7d2880ce708ee185ce3506cda1aeff4d.tar.gz
gdb-8c5b6ead7d2880ce708ee185ce3506cda1aeff4d.tar.bz2
Make getpid, kill supported system calls
-rw-r--r--sim/tic80/ChangeLog10
-rw-r--r--sim/tic80/config.in6
-rwxr-xr-xsim/tic80/configure151
-rw-r--r--sim/tic80/configure.in2
-rw-r--r--sim/tic80/insns19
-rw-r--r--sim/tic80/sim-main.h8
6 files changed, 157 insertions, 39 deletions
diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog
index 5f582de..ac4fd96 100644
--- a/sim/tic80/ChangeLog
+++ b/sim/tic80/ChangeLog
@@ -1,3 +1,13 @@
+Mon May 19 18:59:33 1997 Mike Meissner <meissner@cygnus.com>
+
+ * configure.in: Check for getpid, kill functions.
+ * config{.in,ure}: Regenerate.
+
+ * insns (do_trap): Add support for kill, getpid system calls.
+
+ * sim-main.h (errno.h): Include.
+ (getpid,kill): Define as NOPs if the host doesn't have them.
+
Mon May 19 14:58:47 1997 Andrew Cagney <cagney@b1.cygnus.com>
* sim-calls.c (sim_open): Set the simulator base magic number.
diff --git a/sim/tic80/config.in b/sim/tic80/config.in
index 41a2785..79f4423 100644
--- a/sim/tic80/config.in
+++ b/sim/tic80/config.in
@@ -7,9 +7,15 @@
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
+/* Define if you have the getpid function. */
+#undef HAVE_GETPID
+
/* Define if you have the getrusage function. */
#undef HAVE_GETRUSAGE
+/* Define if you have the kill function. */
+#undef HAVE_KILL
+
/* Define if you have the time function. */
#undef HAVE_TIME
diff --git a/sim/tic80/configure b/sim/tic80/configure
index be8b7df..2b8e6ea 100755
--- a/sim/tic80/configure
+++ b/sim/tic80/configure
@@ -28,6 +28,8 @@ ac_help="$ac_help
ac_help="$ac_help
--enable-sim-endian=endian Specify target byte endian orientation."
ac_help="$ac_help
+ --enable-sim-alignment=align Specify strict or nonstrict alignment."
+ac_help="$ac_help
--enable-sim-hostendain=end Specify host byte endian orientation."
ac_help="$ac_help
--enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o"
@@ -542,7 +544,7 @@ fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:546: checking how to run the C preprocessor" >&5
+echo "configure:548: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -557,13 +559,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 561 "configure"
+#line 563 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -574,13 +576,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 578 "configure"
+#line 580 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:586: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -653,7 +655,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:657: checking host system type" >&5
+echo "configure:659: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -674,7 +676,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$host" 1>&6
echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:678: checking target system type" >&5
+echo "configure:680: checking target system type" >&5
target_alias=$target
case "$target_alias" in
@@ -692,7 +694,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
echo "$ac_t""$target" 1>&6
echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:696: checking build system type" >&5
+echo "configure:698: checking build system type" >&5
build_alias=$build
case "$build_alias" in
@@ -736,7 +738,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x,"
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:740: checking for $ac_word" >&5
+echo "configure:742: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -765,7 +767,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:769: checking for $ac_word" >&5
+echo "configure:771: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -813,7 +815,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:817: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:819: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -823,11 +825,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 827 "configure"
+#line 829 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -847,12 +849,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:851: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:853: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:856: checking whether we are using GNU C" >&5
+echo "configure:858: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -861,7 +863,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:865: \"$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:867: \"$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
@@ -876,7 +878,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:880: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:882: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -914,7 +916,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:918: checking for a BSD compatible install" >&5
+echo "configure:920: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -979,7 +981,7 @@ AR=${AR-ar}
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:983: checking for $ac_word" >&5
+echo "configure:985: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1013,17 +1015,17 @@ for ac_hdr in stdlib.h string.h strings.h unistd.h time.h sys/time.h sys/resourc
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1017: checking for $ac_hdr" >&5
+echo "configure:1019: checking for $ac_hdr" >&5
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
-#line 1022 "configure"
+#line 1024 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1027: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1052,12 +1054,12 @@ done
for ac_func in getrusage time
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1056: checking for $ac_func" >&5
+echo "configure:1058: checking for $ac_func" >&5
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 <<EOF
-#line 1061 "configure"
+#line 1063 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -1080,7 +1082,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:1084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -1235,12 +1237,12 @@ fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1239: checking return type of signal handlers" >&5
+echo "configure:1241: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1244 "configure"
+#line 1246 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1257,7 +1259,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:1261: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1263: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -1363,6 +1365,24 @@ fi
+# Check whether --enable-sim-alignment or --disable-sim-alignment was given.
+if test "${enable_sim_alignment+set}" = set; then
+ enableval="$enable_sim_alignment"
+ case "${enableval}" in
+ yes | strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
+ no | nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
+ 0 | default | DEFAULT) sim_alignment="-DWITH_ALIGNMENT=0";;
+ *) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-alignment"" 1>&2; exit 1; }; sim_alignment="";;
+esac
+if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
+ echo "Setting alignment flags = $sim_alignment" 6>&1
+fi
+else
+ sim_alignment=""
+fi
+
+
+
# Check whether --enable-sim-hostendian or --disable-sim-hostendian was given.
if test "${enable_sim_hostendian+set}" = set; then
enableval="$enable_sim_hostendian"
@@ -1379,14 +1399,14 @@ else
if test "x$cross_compiling" = "xno"; then
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:1383: checking whether byte ordering is bigendian" >&5
+echo "configure:1403: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
-#line 1390 "configure"
+#line 1410 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1397,11 +1417,11 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1401: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1421: \"$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 <<EOF
-#line 1405 "configure"
+#line 1425 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
@@ -1412,7 +1432,7 @@ int main() {
#endif
; return 0; }
EOF
-if { (eval echo configure:1416: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
@@ -1432,7 +1452,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 <<EOF
-#line 1436 "configure"
+#line 1456 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
@@ -1445,7 +1465,7 @@ main () {
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
-if { (eval echo configure:1449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
@@ -1519,17 +1539,17 @@ for ac_hdr in stdlib.h unistd.h string.h strings.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1523: checking for $ac_hdr" >&5
+echo "configure:1543: checking for $ac_hdr" >&5
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
-#line 1528 "configure"
+#line 1548 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1533: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1553: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1555,6 +1575,60 @@ else
fi
done
+for ac_func in getpid kill
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1582: checking for $ac_func" >&5
+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 <<EOF
+#line 1587 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
@@ -1721,6 +1795,7 @@ s%@sim_trace@%$sim_trace%g
s%@sim_profile@%$sim_profile%g
s%@sim_inline@%$sim_inline%g
s%@sim_endian@%$sim_endian%g
+s%@sim_alignment@%$sim_alignment%g
s%@sim_hostendian@%$sim_hostendian%g
s%@sim_warnings@%$sim_warnings%g
s%@sim_reserved_bits@%$sim_reserved_bits%g
diff --git a/sim/tic80/configure.in b/sim/tic80/configure.in
index cb1cde7..a747b17 100644
--- a/sim/tic80/configure.in
+++ b/sim/tic80/configure.in
@@ -15,6 +15,6 @@ SIM_AC_OPTION_RESERVED_BITS(1)
dnl For UNIX emulation
AC_CHECK_HEADERS(stdlib.h unistd.h string.h strings.h)
-
+AC_CHECK_FUNCS(getpid kill)
SIM_AC_OUTPUT
diff --git a/sim/tic80/insns b/sim/tic80/insns
index 89502fc..ad71d21 100644
--- a/sim/tic80/insns
+++ b/sim/tic80/insns
@@ -1063,6 +1063,25 @@ void::function::do_trap:unsigned32 trap_number
GPR(2) = GPR(6);
break;
}
+ case 20: /* GETPID */
+ {
+ GPR(2) = getpid ();
+ break;
+ }
+ case 37: /* KILL */
+ if (GPR (2) != getpid ())
+ {
+ int ret = kill (GPR(2), GPR(4));
+ if (ret < 0)
+ ret = -errno;
+ GPR (2) = ret;
+ break;
+ }
+ else
+ {
+ sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, GPR(4));
+ break;
+ }
default:
/* For system calls which are defined, just return EINVAL instead of trapping */
if (GPR(15) <= 204)
diff --git a/sim/tic80/sim-main.h b/sim/tic80/sim-main.h
index bb7aad0..3b06723 100644
--- a/sim/tic80/sim-main.h
+++ b/sim/tic80/sim-main.h
@@ -26,6 +26,7 @@
#include "sim-basics.h"
#include <signal.h>
+#include <errno.h>
/* These are generated files. */
#include "itable.h"
@@ -69,4 +70,11 @@ extern void engine_init
(SIM_DESC sd);
+#ifndef HAVE_GETPID
+#define getpid() 42
+#endif
+
+#ifndef HAVE_KILL
+#define kill() (errno = EINVAL, -1)
+#endif
#endif