From 6c29acca43b2c78b7668b5c8c6676181303b9cfd Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Tue, 4 Jul 2000 05:00:54 +0000 Subject: TIc80 simulator. --- sim/ChangeLog | 6 + sim/configure | 10 +- sim/configure.in | 5 + sim/tic80/ChangeLog | 662 +++++++ sim/tic80/Makefile.in | 140 ++ sim/tic80/acconfig.h | 15 + sim/tic80/alu.h | 75 + sim/tic80/config.in | 168 ++ sim/tic80/configure | 4459 ++++++++++++++++++++++++++++++++++++++++++++++++ sim/tic80/configure.in | 21 + sim/tic80/cpu.h | 345 ++++ sim/tic80/interp.c | 127 ++ sim/tic80/misc.c | 624 +++++++ sim/tic80/sim-calls.c | 203 +++ sim/tic80/sim-main.h | 81 + sim/tic80/tic80.dc | 6 + sim/tic80/tic80.ic | 52 + sim/tic80/tic80.igen | 1615 ++++++++++++++++++ 18 files changed, 8613 insertions(+), 1 deletion(-) create mode 100644 sim/tic80/ChangeLog create mode 100644 sim/tic80/Makefile.in create mode 100644 sim/tic80/acconfig.h create mode 100644 sim/tic80/alu.h create mode 100644 sim/tic80/config.in create mode 100755 sim/tic80/configure create mode 100644 sim/tic80/configure.in create mode 100644 sim/tic80/cpu.h create mode 100644 sim/tic80/interp.c create mode 100644 sim/tic80/misc.c create mode 100644 sim/tic80/sim-calls.c create mode 100644 sim/tic80/sim-main.h create mode 100644 sim/tic80/tic80.dc create mode 100644 sim/tic80/tic80.ic create mode 100644 sim/tic80/tic80.igen (limited to 'sim') diff --git a/sim/ChangeLog b/sim/ChangeLog index e50696f..f8fc051 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,9 @@ +Tue Jul 4 13:43:54 2000 Andrew Cagney + + * tic80: New directory. + * configure.in: Add configury. + * configure: Regenerate. + 2000-04-20 Nick Clifton * configure.in (extra_subdirs): Add testsuite to strongarm diff --git a/sim/configure b/sim/configure index 57d3bd8..561e194 100755 --- a/sim/configure +++ b/sim/configure @@ -1411,7 +1411,10 @@ case "${target}" in sim_target=arm extra_subdirs="${extra_subdirs} testsuite" ;; - strongarm*-*-*) sim_target=arm ;; + strongarm*-*-*) + sim_target=arm + extra_subdirs="${extra_subdirs} testsuite" + ;; d10v-*-*) sim_target=d10v ;; d30v-*-*) sim_target=d30v @@ -1448,6 +1451,11 @@ case "${target}" in only_if_gcc=yes #extra_subdirs="${extra_subdirs}" ;; + tic80-*-*) + sim_target=tic80 + only_if_gcc=yes + extra_subdirs="${extra_subdirs} igen" + ;; v850-*-*) # The V850 simulator can only be compiled by gcc. sim_target=v850 diff --git a/sim/configure.in b/sim/configure.in index 4d6a9ea..41cec77 100644 --- a/sim/configure.in +++ b/sim/configure.in @@ -90,6 +90,11 @@ case "${target}" in only_if_gcc=yes #extra_subdirs="${extra_subdirs}" ;; + tic80-*-*) + sim_target=tic80 + only_if_gcc=yes + extra_subdirs="${extra_subdirs} igen" + ;; v850-*-*) # The V850 simulator can only be compiled by gcc. sim_target=v850 diff --git a/sim/tic80/ChangeLog b/sim/tic80/ChangeLog new file mode 100644 index 0000000..a98b57d --- /dev/null +++ b/sim/tic80/ChangeLog @@ -0,0 +1,662 @@ +Tue Jul 4 13:58:43 2000 Andrew Cagney + + * tic80.igen: Rename insns. Re-format. + * tic80.dc: rename dc. + * tic80.ic: rename ic. Replace ``compute'' with ``cache''. + +Wed May 24 14:40:34 2000 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +2000-04-12 Frank Ch. Eigler + + * cpu.h (GPR_CLEAR): New macro. + (GPR_SET): Removed macro. + +Thu Sep 2 18:15:53 1999 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +1999-05-08 Felix Lee + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Fri May 1 14:41:11 1998 Andrew Cagney + + * insns: Pass correct arguments to sim_engine_abort. + +Tue Apr 28 18:33:31 1998 Geoffrey Noer + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Sun Apr 26 15:31:55 1998 Tom Tromey + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * config.in: Ditto. + +Sun Apr 26 15:19:45 1998 Tom Tromey + + * acconfig.h: New file. + * configure.in: Reverted change of Apr 24; use sinclude again. + +Fri Apr 24 14:16:40 1998 Tom Tromey + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * config.in: Ditto. + +Fri Apr 24 11:18:28 1998 Tom Tromey + + * configure.in: Don't call sinclude. + +Fri Apr 24 19:43:30 1998 Andrew Cagney + + * ic (rBase, rLink): Make the type a pointer. + +Sat Apr 4 20:36:25 1998 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Fri Mar 27 16:15:52 1998 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Wed Mar 25 12:35:29 1998 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Wed Mar 18 12:38:12 1998 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Wed Mar 11 14:12:56 1998 Andrew Cagney + + * alu.h (IMEM32_IMMED, IMEM32, STORE, MEM): Replace sim_core_*_map + with read_map, write_map, exec_map resp. + +Thu Feb 26 19:08:37 1998 Andrew Cagney + + * sim-calls.c (sim_info): Delete. + +Tue Feb 17 14:35:05 1998 Michael Meissner + + * misc.c (tic80_trace_cond_br): Take size/code arguments, and + decode bcond conditions and bbo/bbz comparison bits. + + * cpu.h (tic80_trace_cond_br): Update prototype. + (TRACE_COND_PR): Take size/code additional arguments. + + * insns: (bbo/bbz/bcnd): Update call to TRACE_COND_PR. + +Tue Feb 17 12:50:27 1998 Andrew Cagney + + * sim-calls.c (sim_store_register, sim_fetch_register): Pass in + length parameter. Return -1. + +Fri Feb 13 17:11:22 1998 Michael Meissner + + * insns ({get,set}_fp_reg): Tic80 floating point is little endian, + not big endian. + + * misc.c (tic80_trace_fpu*): Pass address of sim_fpu structure, + not the structure itself. Use %g consistantly to print floating + point. + + * cpu.h: (tic80_trace_fpu*): Update prototypes. + +Tue Feb 3 16:25:47 1998 Andrew Cagney + + * alu.h (IMEM32, IMEM32_IMMED): Rename IMEM and IMEM_IMMED so that + in sync with recent igen change. + +Sun Feb 1 16:47:51 1998 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Sat Jan 31 18:15:41 1998 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Fri Jan 30 11:47:50 1998 Andrew Cagney + + * cpu.h (CPU_CIA): Delete macro, replace with... + (CIA_SET, CIA_GET): Define. + +Wed Jan 28 18:44:33 1998 Michael Meissner + + * misc.c (tic80_trace_cmp_internal): New function to return + compare bits as a string. + (tic80_trace_{,fpu2}cmp): New functions for tracing cmp and fcmp. + + * cpu.h (tic80_trace_{,fpu2}cmp): Add declaration. + (TRACE_{,FPU2}CMP): New macros for tracing compares. + + * insns (do_{,f}cmp): Use compare specific tracing functions to + print out the flag bits. + +Mon Jan 19 22:26:29 1998 Doug Evans + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Mon Dec 15 23:17:11 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * config.in: Ditto. + +Thu Dec 4 09:21:05 1997 Doug Evans + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Mon Nov 24 14:57:58 1997 Doug Evans + + * cpu.h (TRACE_COND_BR): Use TRACE_BRANCH_P, not TRACE_ALU_P. + +Sat Nov 22 21:42:09 1997 Andrew Cagney + + * interp.c (engine_step): Replace SIGTRAP with SIM_SIGTRAP. + (engine_run_until_stop): Replace SIGINT with SIM_SIGINT. + + * sim-main.h: Include sim-signal.h. + (SIGTRAP): Delete definition. + + * interp.c, sim-calls.c: Do not include signal.h. + + * insns (illegal): SIGILL -> SIM_SIGILL. + (fp_unavailable): SIGFPE -> SIM_SIGFPE. + (do_trap): SIGTRAP -> SIM_SIGTRAP. + +Tue Nov 18 15:33:48 1997 Doug Evans + + * sim-main.h (CIA_ADDR): Define. + + * Makefile.in (SIM_OBJS): Use $(SIM_NEW_COMMON_OBJS). + +Fri Oct 17 17:26:36 1997 Andrew Cagney + + * alu.h (ALU32_END): Use ALU32_RESULT. + +Mon Sep 29 12:49:06 1997 Andrew Cagney + + * insns (get_fp_reg, set_fp_reg): Update to use changed sim_fpu + interface. + (do_fadd, do_fcmp, do_fdiv, do_fmpy, do_frnd, do_fsub): Ditto. + + * misc.c (tic80_trace_fpu3, tic80_trace_fpu2, tic80_trace_fpu1, + tic80_trace_fpu2i) Update to use changed sim_fpu interface. + +Fri Oct 3 09:28:00 1997 Andrew Cagney + + * configure.in (SIM_AC_OPTIONS_BITSIZE): Define. + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Wed Sep 24 17:38:57 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Tue Sep 23 11:04:38 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Tue Sep 23 10:19:51 1997 Andrew Cagney + + * Makefile.in (SIM_WARNINGS, SIM_ALIGNMENT, SIM_ENDIAN, + SIM_HOSTENDIAN, SIM_INLINE, SIM_RESERVED_BITS): Delete, moved to + common. + (SIM_EXTRA_CFLAGS): Update. + +Mon Sep 22 11:46:20 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Fri Sep 19 17:45:25 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Tue Sep 16 23:10:03 1997 Felix Lee + + * sim-main.h (kill): macro was missing args. + (SIGTRAP): define for MSVC. + +Mon Sep 15 17:36:15 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Mon Sep 8 20:10:43 1997 Andrew Cagney + + * cpu.h (CPU_CIA): Define. + + * sim-main.h (struct sim_state): Delete halt_ok, path_to_halt, + restart_ok, path_to_restart members. + (struct sim_state): Delete reason, siggnal members. + +Thu Sep 4 17:21:23 1997 Doug Evans + + * configure: Regenerated to track ../common/aclocal.m4 changes. + +Thu Sep 4 17:45:14 1997 Andrew Cagney + + * sim-calls.c (sim_open): Add memory before parsing arguments. + (sim_read): Delete, replace with sim-hrw. + (sim_write): Delete, replace with sim-hrw. + +Thu Sep 4 10:48:57 1997 Andrew Cagney + + * sim-calls.c (sim_open): Use sim_do_command to add memory, only + add memory if none already present. + (sim_open): Move init of registers from here. + (sim_create_inferior): To here. Init modules. + + * Makefile.in (SIM_OBJS): Add sim-memopt.o module. + + * sim-calls.c (sim_open): Add zero modulo arg to sim_core_attach. + +Mon Sep 1 11:06:30 1997 Andrew Cagney + + * sim-calls.c (sim_open): Use sim_state_alloc + (simulation): Delete. + +Sat Aug 30 09:40:47 1997 Andrew Cagney + + * insns (do_trap): Unsigned `i' for unsigned iterator. + (do_trap): Ditto for comparison with getpid. + +Wed Aug 27 18:13:22 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * config.in: Ditto. + +Wed Aug 27 13:41:24 1997 Andrew Cagney + + * insns (do_st): Use U8_4 instead of V4_L8. + + * sim-calls.c (sim_open): Add call to sim_analyze_program, update + call to sim_config. + + * sim-calls.c (sim_kill): Delete. + (sim_create_inferior): Add ABFD argument. Initialize PC from ABFD + and not SD. + (sim_load): Delete, use sim-hload.c. + + * Makefile.in (SIM_OBJS): Add sim-hload.o module. + +Mon Aug 25 17:50:22 1997 Andrew Cagney + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * config.in: Ditto. + +Mon Aug 25 16:33:29 1997 Andrew Cagney + + * sim-calls.c (sim_open): Add ABFD argument. + (sim_open): Move sim_config call to just after argument + parsing. Check return status. + +Fri Aug 8 21:52:27 1997 Mark Alexander + + * sim-calls.c (sim_store_register): Allow accumulators + other than A0 to be modified. Correct error message. + +Thu May 29 14:02:40 1997 Andrew Cagney + + * misc.c (tic80_trace_fpu3, tic80_trace_fpu2, tic80_trace_fpu1, + tic80_trace_fpu2i): Pass in function prefix. + (tic80_trace_ldst): Rewrite so it calls print_one_insn directly. + + * Makefile.in (SIM_OBJS): Include sim-watch.o module. + + * sim-main.h (WITH_WATCHPOINTS): Enable watchpoints. + + * ic (bitnum): Compute bitnum from BITNUM. + * insn (bbo, bbz): Use. + + * insn: Convert long immediate instructions to igen long immediate + form. + * insn: Add disasembler information. + +Thu May 29 12:09:13 1997 Andrew Cagney + + * alu.h (IMEM_IMMED): New macro, fetch 32bit immediate operand N. + + * insns (subu i): Immediate is signed not unsigned. + +Tue May 27 13:22:13 1997 Andrew Cagney + + * sim-calls.c (sim_read): Pass NULL cpu to sim_core_read_buffer. + (sim_write): Ditto for write. + +Tue May 20 09:33:31 1997 Andrew Cagney + + * sim-calls.c (sim_load): Set STATE_LOADED_P. + + * sim-main.h: Include . + + * sim-calls.c (sim_set_callback): Delete. + (sim_open): Add/install callback argument. + (sim_size): Delete. + +Mon May 19 18:59:33 1997 Mike Meissner + + * 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 + + * sim-calls.c (sim_open): Set the simulator base magic number. + (sim_load): Delete prototype of sim_load_file. + (sim_open): Define sd to be &simulation. + +Fri May 16 14:35:30 1997 Andrew Cagney + + * insns (illegal, fp_unavailable): Halt instead of abort the + simulator. + + * insns: Replace calls to engine_error with sim_engine_abort. + Ditto for engine_halt V sim_engine_halt. + +Tue May 13 15:24:12 1997 Andrew Cagney + + * interp.c (engine_run_until_stop): Delete. Moved to common. + (engine_step): Ditto. + (engine_step): Ditto. + (engine_halt): Ditto. + (engine_restart): Ditto. + (engine_halt): Ditto. + (engine_error): Ditto. + + * sim-calls.c (sim_stop): Delete. Moved to common. + (sim_stop_reason): Ditto. + (sim_resume): Ditto. + + * Makefile.in (SIM_OBJS): Link in generic sim-engine, sim-run, + sim-resume, sim-reason, sim-stop modules. + +Fri May 16 11:57:49 1997 Andrew Cagney + + * ic (compute): Drop check for REG == 0, now always forced to + zero. + + * cpu.h (GPR_SET): New macro update the gpr. + * insns (do_add): Use GPR_SET to update the GPR register. + + * sim-calls.c (sim_fetch_register): Pretend that r0 is zero. + + * Makefile.in (tmp-igen): Specify zero-r0 so that every + instruction clears r0. + + * interp.c (engine_run_until_stop): Igen now generates code to + clear r0. + (engine_step): Ditto. + +Thu May 15 11:45:37 1997 Andrew Cagney + + * insns (do_shift): When rot==0 and zero/sign merge treat it as + 32. + (set_fp_reg): For interger conversion, use sim-fpu fpu2i + functions. + (do_fmpy): Perform iii and uuu using integer arithmetic. + + * Makefile.in (ENGINE_H): Assume everything depends on the fpu. + + * insns (get_fp_reg): Use sim_fpu_u32to to perform unsigned + conversion. + (do_fcmp): Update to use new fp compare functions. Make reg nr arg + instead of reg. Stops fp overflow. + (get_fp_reg): Assume val is valid when reg == 0. + (set_fp_reg): Fix double conversion. + + * misc.c (tic80_trace_fpu1): New function, trace simple fp op. + + * insns (do_frnd): Add tracing. + + * cpu.h (TRACE_FPU1): Ditto. + + * insns (do_trap): Printf formatting. + +Wed May 14 18:05:50 1997 Mike Meissner + + * misc.c (tic80_trace_fpu{3,2,2i}): Align columns with other + insns. Use %g to print floating point instead of %f in case the + numbers are real large. + +Tue May 13 18:00:10 1997 Mike Meissner + + * insns (do_trap): For system calls that are defined, but not + provided return EINVAL. Temporarily add traps 74-79 to just print + the register state. + + * interp.c (engine_{run_until_stop,step}): Before executing + instructions, make sure r0 == 0. + +Tue May 13 16:39:37 1997 Andrew Cagney + + * alu.h (IMEM): Take full cia not just IP as argument. + + * interp.c (engine_run_until_stop): Delete handling of annuled + instructions. + (engine_step): Ditto. + + * insn (do_branch): New function. + (do_bbo, do_bbz, do_bcnd, do_bsr, do_jsr): Use do_branch to handle + annuled branches. + +Mon May 12 17:15:52 1997 Mike Meissner + + * insns (do_{ld,st}): Fix tracing for ld/st. + +Mon May 12 11:12:24 1997 Andrew Cagney + + * sim-calls.c (sim_stop_reason): Restore keep_running after a + CNTRL-C, don't re-clear it. + + * interp.c (engine_error): stop rather than signal with SIGABRT + when an error. + + * insns (do_ld): For 64bit loads, always store LSW in rDest, MSW in + rDest + 1. Also done by Michael Meissner + (do_st): Converse for store. + + * misc.c (tic80_trace_fpu2i): Correct printf format for int type. + +Sun May 11 11:02:57 1997 Andrew Cagney + + * sim-calls.c (sim_stop_reason): Return a SIGINT if keep_running + was cleared. + + * interp.c (engine_step): New function. Single step the simulator + taking care of cntrl-c during a step. + + * sim-calls.c (sim_resume): Differentiate between stepping and + running so that a cntrl-c during a step is reported. + +Sun May 11 10:54:31 1997 Mark Alexander + + * sim-calls.c (sim_fetch_register): Use correct reg base. + (sim_store_register): Ditto. + +Sun May 11 10:25:14 1997 Michael Meissner + + * cpu.h (tic80_trace_shift): Add declaration. + (TRACE_SHIFT): New macro to trace shift instructions. + + * misc.c (tic80_trace_alu2): Align spacing. + (tic80_trace_shift): New function to trace shifts. + + * insns (lmo): Add missing 0b prefix to bits. + (do_shift): Use ~ (unsigned32)0, instead of -1. Use TRACE_SHIFT + instead of TRACE_ALU2. + (sl r): Use EndMask as is, instead of using Source+1 register. + (subu): Operands are unsigned, not signed. + (do_{ld,st}): Fix endian problems with ld.d/st.d. + +Sat May 10 12:35:47 1997 Michael Meissner + + * insns (and{.tt,.tf,.ft,.ff}): Immediate values are unsigned, not + signed. + +Fri May 9 15:47:36 1997 Mike Meissner + + * insns (cmp_vals,do_cmp): Produce the correct bits as specified + by the architecture. + (xor): Fix xor immediate patterns to use the correct bits. + +Fri May 9 09:55:33 1997 Andrew Cagney + + * alu.h (long_immediate): Adjust the CIA delay-pointer as well as + the NIA when a 64bit insn. + +Thu May 8 11:57:47 1997 Michael Meissner + + * insns (jsr,bsr): For non-allulled calls, set r31 so that the + return address does not reexecute the instruction in the delay + slot. + (bbo,bbz): Complement bit number to reverse the one's complement + that the assembler is required to do. + + * misc.c (tic80_trace_*): Change format slightly to accomidate + real large decimal values. + +Thu May 8 14:07:16 1997 Andrew Cagney + + * sim-calls.c (sim_do_command): Implement. + (sim_store_register): Fix typo T2H v H2T. + +Wed May 7 11:48:55 1997 Andrew Cagney + + * cpu.h (TRACE_FPU2, TRACE_FPU3, TRACE_FPU2I): Add. + * insn: Clean up fpu tracing. + + * sim-calls.c (sim_create_inferior): Start out with interrupts + enabled. + + * cpu.h (TRACE_SINK3), misc.c (tic80_trace_sink3): Three argument + sink + + * insns (rdcr, swcr, wrcr, brcr, rmo, lmo): Implement. + + * insns (do_*): Remove MY_INDEX/indx argument from support functions, + igen now handles this. + + * cpu.h (CR): New macro - access TIc80 control registers. + + * misc.c: New file. + (tic80_cr2index): New function, map control register opcode index + into the internal CR enum. + + * interp.c + (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): Move from + here + * misc.c: to here. + + * Makefile.in (SIM_OBJS): Add misc.o. + +Tue May 6 15:22:58 1997 Mike Meissner + + * cpu.h ({,v}{S,D}P_FPR): Delete unused macros that won't work on + big endian hosts. + (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): Declare + new functions. + (TRACE_{ALU{2,3},NOP,SINK{1,2},{,U}COND_BR,LD,ST}): New macros to + trace various instruction types. + + * insns: Modify all instructions to support semantic tracing. + + * interp.c (toplevel): Include itable.h. + (tic80_trace_{alu{2,3},nop,sink{1,2},{,u}cond_br,ldst}): New + functions to provide semantic level tracing information. + +Mon May 5 11:50:43 1997 Andrew Cagney + + * alu.h: Update usage of core object to reflect recent changes in + ../common/sim-*core. + * sim-calls.c (sim_open): Ditto. + +Mon May 5 14:10:17 1997 Andrew Cagney + + * insn (cmnd): No-op cache flushes. + + * insns (do_trap): Allow writes to STDERR. + + * Makefile.in (SIM_OBJS): Link in sim-fpu.o. + (SIM_EXTRA_LIBS): Link in the math library. + + * alu.h: Add support for floating point unit using sim-alu. + + * insns (fadd, fsub, fmpy, fdiv, fcmp, frnd*): Implement. + +Fri May 2 14:57:14 1997 Andrew Cagney + + * sim-calls.c: Include sim-utils.h and sim-options.h. + + * sim-main.h (sim_state): Drop sim_events and sim_core members, + moved to simulator base type. + + * alu.h (IMEM, MEM, STORE): Update track changes in common + directory. + + * insns: Drop cia argument from functions, igen now handles this. + + * interp.c (engine_init): Include string.h/strings.h to define + memset et.al. + + * sim-main.h (sim_cia): Delcare, tracking common dir changes. + + * cpu.h (sim_cpu): Update instruction_address with sim_cia. + +Wed Apr 30 11:26:56 1997 Andrew Cagney + + * sim-main.h (signal.h): Include so that SIG* available to all + callers of sig_halt. + + * insns (do_shift): New function, implement shift operations. + (do_trap): Add handler for trap 73 - SIGTRAP. + +Tue Apr 29 10:58:48 1997 Andrew Cagney + + * alu.h (MEM, STORE): Force addresses to be correctly aligned. + + * insns (do_jsr): Fix. + (do_st, do_ld): Handle 64bit transfers. + (do_trap): Match libgloss. + (rdcr): Implement nop - Dest == r0 - variant. + + * sim-calls.c (sim_create_inferior): Initialize SP. + + * Makefile.in (ENGINE_H): Everything now depends on sim-options.h. + (support.o): Depends on ENGINE_H. + + * cpu.h: Four accumulators. + + * Makefile.in (tmp-igen): Include line number information in + generated files. + + * insns (dld, dst): Fill in. + +Mon Apr 28 13:02:26 1997 Andrew Cagney + + * insns (vld): Fix instruction format wrong. + +Thu Apr 24 16:43:09 1997 Andrew Cagney + + * dc: Add additional rules so that minor opcode files are + detected. + * insns: Enable more instructions. + + * sim-calls.c (sim_fetch_register,sim_store_register, sim_write): + Implement. + +Thu Apr 24 00:39:51 1997 Doug Evans + + * configure: Regenerated to track ../common/aclocal.m4 changes. + * Makefile.in (SIM_OBJS): Add sim-module.o, sim-profile.o. + * sim-calls.c (sim_open): Call sim_module_uninstall if argument + parsing fails. Call sim_post_argv_init. + (sim_close): Call sim_module_uninstall. + +Wed Apr 23 20:05:33 1997 Andrew Cagney + + * insns (and, bbo, bcnd, bsr, dcache, jsr, or, xor, nor): Enable. + * ic: Add fields for enabled instructions. + diff --git a/sim/tic80/Makefile.in b/sim/tic80/Makefile.in new file mode 100644 index 0000000..7111a61 --- /dev/null +++ b/sim/tic80/Makefile.in @@ -0,0 +1,140 @@ +# Makefile for blah ... +# Copyright blah ... + + + +## COMMON_PRE_CONFIG_FRAG + +# These variables are given default values in COMMON_PRE_CONFIG_FRAG. +# We override the ones we need to here. +# Not all of these need to be mentioned, only the necessary ones. + +# List of object files, less common parts. +SIM_OBJS = \ + $(SIM_NEW_COMMON_OBJS) \ + support.o idecode.o semantics.o itable.o misc.o \ + sim-engine.o \ + sim-calls.o \ + sim-hload.o \ + sim-hrw.o \ + sim-reason.o \ + sim-resume.o \ + sim-run.o \ + sim-stop.o \ + +# List of extra dependencies. +# Generally this consists of simulator specific files included by sim-main.h. +SIM_EXTRA_DEPS = itable.h idecode.h cpu.h alu.h + +# List of extra libraries to link with +SIM_EXTRA_LIBS = -lm + +# List of generators +SIM_GEN=tmp-igen + +# List of flags to always pass to $(CC). + +SIM_EXTRA_CFLAGS = \ + -DWITH_TARGET_WORD_MSB=31 + +# List of main object files for `run'. +SIM_RUN_OBJS = nrun.o + +# Dependency of `clean' to clean any extra files. +SIM_EXTRA_CLEAN = clean-igen + + +## COMMON_POST_CONFIG_FRAG + +# Rules need to build $(SIM_OBJS), plus whatever else the target wants. + +# ... target specific rules ... + +BUILT_SRC_FROM_IGEN = \ + icache.h \ + icache.c \ + idecode.h \ + idecode.c \ + semantics.h \ + semantics.c \ + model.h \ + model.c \ + support.h \ + support.c \ + itable.h itable.c +$(BUILT_SRC_FROM_IGEN): tmp-igen +# + +.PHONY: clean-igen +clean-igen: + rm -f $(BUILT_SRC_FROM_IGEN) + rm -f tmp-igen tmp-insns + +../igen/igen: + cd ../igen && $(MAKE) + +tmp-igen: $(srcdir)/tic80.dc $(srcdir)/tic80.igen $(srcdir)/tic80.ic ../igen/igen + cd ../igen && $(MAKE) + ../igen/igen \ + -F f \ + -G direct-access \ + -G delayed-branch \ + -G zero-r0 \ + -F short,emul \ + -B 32 -H 31 \ + -o $(srcdir)/tic80.dc \ + -k $(srcdir)/tic80.ic \ + -i $(srcdir)/tic80.igen \ + -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 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 \ + -n itable.h -ht tmp-itable.h \ + -n itable.c -t tmp-itable.c + $(srcdir)/../../move-if-change tmp-icache.h icache.h + $(srcdir)/../../move-if-change tmp-icache.c icache.c + $(srcdir)/../../move-if-change tmp-idecode.h idecode.h + $(srcdir)/../../move-if-change tmp-idecode.c idecode.c + $(srcdir)/../../move-if-change tmp-semantics.h semantics.h + $(srcdir)/../../move-if-change tmp-semantics.c semantics.c + $(srcdir)/../../move-if-change tmp-model.h model.h + $(srcdir)/../../move-if-change tmp-model.c model.c + $(srcdir)/../../move-if-change tmp-support.h support.h + $(srcdir)/../../move-if-change tmp-support.c support.c + $(srcdir)/../../move-if-change tmp-itable.h itable.h + $(srcdir)/../../move-if-change tmp-itable.c itable.c + touch tmp-igen + +ENGINE_H = \ + sim-main.h \ + $(srcdir)/../common/sim-basics.h \ + config.h \ + $(srcdir)/../common/sim-config.h \ + $(srcdir)/../common/sim-inline.h \ + $(srcdir)/../common/sim-types.h \ + $(srcdir)/../common/sim-bits.h \ + $(srcdir)/../common/sim-endian.h \ + $(srcdir)/../common/sim-options.h \ + itable.h \ + idecode.h \ + cpu.h \ + alu.h \ + $(srcdir)/../common/sim-alu.h \ + $(srcdir)/../common/sim-core.h \ + $(srcdir)/../common/sim-events.h \ + $(srcdir)/../common/sim-fpu.h \ + $(srcdir)/../common/sim-engine.h \ + +idecode.o: $(ENGINE_H) +semantics.o: $(ENGINE_H) +support.o: $(ENGINE_H) +interp.o: interp.c $(ENGINE_H) +sim-calls.o: sim-calls.c $(ENGINE_H) +cpu.o: cpu.c $(ENGINE_H) +misc.o: $(ENGINE_H) \ No newline at end of file diff --git a/sim/tic80/acconfig.h b/sim/tic80/acconfig.h new file mode 100644 index 0000000..f9b87a1 --- /dev/null +++ b/sim/tic80/acconfig.h @@ -0,0 +1,15 @@ + +/* Define to 1 if NLS is requested. */ +#undef ENABLE_NLS + +/* Define as 1 if you have catgets and don't want to use GNU gettext. */ +#undef HAVE_CATGETS + +/* 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. */ +#undef HAVE_LC_MESSAGES diff --git a/sim/tic80/alu.h b/sim/tic80/alu.h new file mode 100644 index 0000000..b5bc7c1 --- /dev/null +++ b/sim/tic80/alu.h @@ -0,0 +1,75 @@ +/* Texas Instruments TMS320C80 (MVP) Simulator. + Copyright (C) 1997 Free Software Foundation, Inc. + Contributed by Cygnus Support. + +This file is part of GDB, the GNU debugger. + +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 +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + + + +#ifndef _TIC80_ALU_H_ +#define _TIC80_ALU_H_ + +#define ALU_CARRY 0 /* FIXME */ + +#define ALU32_END(TARG) \ +{ \ + (TARG) = ALU32_RESULT; /* FIXME */ \ +} + +#define ALU_END(TARG) ALU32_END(TARG) + +#include "sim-alu.h" + + + +/* Bring data in from the cold */ + +#define IMEM32(CIA) \ +(sim_core_read_aligned_4(STATE_CPU (sd, 0), CIA, exec_map, (CIA).ip)) + +#define IMEM32_IMMED(CIA, N) \ +(sim_core_read_aligned_4 (STATE_CPU (sd, 0), CIA, exec_map, (CIA).ip + 4 * (N))) + +#define MEM(SIGN, EA, NR_BYTES) \ +((SIGN##_##NR_BYTES) sim_core_read_unaligned_##NR_BYTES (STATE_CPU (sd, 0), cia, \ + read_map, \ + (EA))) + +#define STORE(EA, NR_BYTES, VAL) \ +do { \ + sim_core_write_unaligned_##NR_BYTES (STATE_CPU (sd, 0), cia, \ + write_map, \ + (EA), (VAL)); \ +} while (0) + + +#define long_immediate(VARIABLE) \ + unsigned_word VARIABLE = MEM (unsigned, nia.ip, 4); \ + cia.dp += sizeof (instruction_word); \ + nia.ip += sizeof (instruction_word); \ + nia.dp += sizeof (instruction_word); + + + +/* Floating point support */ + +#define IS_FP_AVAILABLE ((CPU)->cr[IE_CR] & IE_CR_IE) + +#include "sim-fpu.h" + + +#endif diff --git a/sim/tic80/config.in b/sim/tic80/config.in new file mode 100644 index 0000000..fffbc59 --- /dev/null +++ b/sim/tic80/config.in @@ -0,0 +1,168 @@ +/* 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 if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define to `long' if doesn't define. */ +#undef off_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). */ +#undef RETSIGTYPE + +/* Define to `unsigned' if 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. */ +#undef STDC_HEADERS + +/* 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. */ +#undef ENABLE_NLS + +/* 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. */ +#undef HAVE_LC_MESSAGES + +/* 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 __setfpucw function. */ +#undef HAVE___SETFPUCW + +/* Define if you have the dcgettext function. */ +#undef HAVE_DCGETTEXT + +/* Define if you have the getcwd function. */ +#undef HAVE_GETCWD + +/* Define if you have the getpagesize function. */ +#undef HAVE_GETPAGESIZE + +/* 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 munmap function. */ +#undef HAVE_MUNMAP + +/* Define if you have the putenv function. */ +#undef HAVE_PUTENV + +/* Define if you have the setenv function. */ +#undef HAVE_SETENV + +/* Define if you have the setlocale function. */ +#undef HAVE_SETLOCALE + +/* Define if you have the sigaction function. */ +#undef HAVE_SIGACTION + +/* Define if you have the stpcpy function. */ +#undef HAVE_STPCPY + +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + +/* Define if you have the strchr function. */ +#undef HAVE_STRCHR + +/* Define if you have the time function. */ +#undef HAVE_TIME + +/* Define if you have the header file. */ +#undef HAVE_ARGZ_H + +/* Define if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define if you have the header file. */ +#undef HAVE_FPU_CONTROL_H + +/* Define if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define if you have the header file. */ +#undef HAVE_LOCALE_H + +/* Define if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define if you have the header file. */ +#undef HAVE_NL_TYPES_H + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the header file. */ +#undef HAVE_STRING_H + +/* Define if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define if you have the header file. */ +#undef HAVE_TIME_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the header file. */ +#undef HAVE_VALUES_H diff --git a/sim/tic80/configure b/sim/tic80/configure new file mode 100755 index 0000000..b681188 --- /dev/null +++ b/sim/tic80/configure @@ -0,0 +1,4459 @@ +#! /bin/sh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +sim_inline="-DDEFAULT_INLINE=0" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# This file is derived from `gettext.m4'. The difference is that the +# included macros assume Cygnus-style source and build trees. + +# Macro to add for using GNU gettext. +# Ulrich Drepper , 1995. +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 3 + + + + + +# Search path for a program which passes the given test. +# Ulrich Drepper , 1996. +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + + + +# Check whether LC_MESSAGES is available in . +# Ulrich Drepper , 1995. +# +# This file file be copied and used freely without restrictions. It can +# be used in projects which are not available under the GNU Public License +# but which still want to provide support for the GNU gettext functionality. +# Please note that the actual code is *not* freely available. + +# serial 1 + + + + + + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --disable-nls do not use Native Language Support" +ac_help="$ac_help + --with-included-gettext use the GNU gettext library included here" +ac_help="$ac_help + --enable-maintainer-mode Enable developer functionality." +ac_help="$ac_help + --enable-sim-bswap Use Host specific BSWAP instruction." +ac_help="$ac_help + --enable-sim-cflags=opts Extra CFLAGS for use in building simulator" +ac_help="$ac_help + --enable-sim-debug=opts Enable debugging flags" +ac_help="$ac_help + --enable-sim-stdio Specify whether to use stdio for console input/output." +ac_help="$ac_help + --enable-sim-trace=opts Enable tracing flags" +ac_help="$ac_help + --enable-sim-profile=opts Enable profiling flags" +ac_help="$ac_help + --enable-sim-inline=inlines Specify which functions should be inlined." +ac_help="$ac_help + --enable-sim-endian=endian Specify target byte endian orientation." +ac_help="$ac_help + --enable-sim-alignment=align Specify strict, nonstrict or forced alignment of memory accesses." +ac_help="$ac_help + --enable-sim-hostendian=end Specify host byte endian orientation." +ac_help="$ac_help + --enable-build-warnings[=LIST] Enable build-time compiler warnings" +ac_help="$ac_help + --enable-sim-reserved-bits Specify whether to check reserved bits in instruction." +ac_help="$ac_help + --enable-sim-bitsize=N Specify target bitsize (32 or 64)." + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +sitefile= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --site-file=FILE use FILE as the site file + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -site-file | --site-file | --site-fil | --site-fi | --site-f) + ac_prev=sitefile ;; + -site-file=* | --site-file=* | --site-fil=* | --site-fi=* | --site-f=*) + sitefile="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=Makefile.in + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$sitefile"; then + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi +else + CONFIG_SITE="$sitefile" +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:693: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # 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:714: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + 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:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:773: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:800: checking for POSIXized ISC" >&5 +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 +then + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:821: checking for ANSI C header files" >&5 +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 +#include +#include +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:834: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +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 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +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 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext < +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:925: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:1000: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <&6 +echo "configure:1040: checking for off_t" >&5 +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 +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:1073: checking for size_t" >&5 +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 +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:1108: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:1120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:1141: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:1174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:1206: checking whether alloca needs Cray hooks" >&5 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1236: 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 < +/* 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:1264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + cat >> confdefs.h <&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:1291: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext < addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:1318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <&6 +echo "configure:1343: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1353: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:1382: 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 < +/* 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:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <&6 +fi +done + +echo $ac_n "checking for working mmap""... $ac_c" 1>&6 +echo "configure:1435: checking for working mmap" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat > conftest.$ac_ext < +#include +#include + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:1583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_fixed_mapped=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:1606: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:1639: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes + +# autoconf.info says this should be called right after AC_INIT. + + +ac_aux_dir= +for ac_dir in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in `cd $srcdir;pwd`/../.. $srcdir/`cd $srcdir;pwd`/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;; +esac + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +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:1718: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +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:1739: checking target system type" >&5 + +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +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:1757: checking build system type" >&5 + +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$build" 1>&6 + +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +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:1801: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +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:1831: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1882: 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 + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:1914: 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. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 1925 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:1930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +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:1956: 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:1961: 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 + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:1989: 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 + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# 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:2032: 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 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Put a plausible default for CC_FOR_BUILD in Makefile. +if test "x$cross_compiling" = "xno"; then + CC_FOR_BUILD='$(CC)' +else + CC_FOR_BUILD=gcc +fi + + + + +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:2100: 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 + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +ALL_LINGUAS= + + for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h values.h sys/param.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2135: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + + for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2175: 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 < +/* 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:2203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <&6 +fi +done + + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + for ac_func in stpcpy +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2232: 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 < +/* 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:2260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <&6 +fi +done + + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_STPCPY 1 +EOF + + fi + + if test $ac_cv_header_locale_h = yes; then + echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 +echo "configure:2294: checking for LC_MESSAGES" >&5 +if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return LC_MESSAGES +; return 0; } +EOF +if { (eval echo configure:2306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_val_LC_MESSAGES=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_val_LC_MESSAGES=no +fi +rm -f conftest* +fi + +echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 + if test $am_cv_val_LC_MESSAGES = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LC_MESSAGES 1 +EOF + + fi + fi + echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 +echo "configure:2327: checking whether NLS is requested" >&5 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi + + echo "$ac_t""$USE_NLS" 1>&6 + + + USE_INCLUDED_LIBINTL=no + + if test "$USE_NLS" = "yes"; then + cat >> confdefs.h <<\EOF +#define ENABLE_NLS 1 +EOF + + echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 +echo "configure:2347: checking whether included gettext is requested" >&5 + # Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval +else + nls_cv_force_use_gnu_gettext=no +fi + + echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 +echo "configure:2366: checking for libintl.h" >&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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 +echo "configure:2393: checking for gettext in libc" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int main() { +return (int) gettext ("") +; return 0; } +EOF +if { (eval echo configure:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + gt_cv_func_gettext_libc=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gettext_libc=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 + + if test "$gt_cv_func_gettext_libc" != "yes"; then + echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 +echo "configure:2421: checking for bindtextdomain in -lintl" >&5 +ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__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="-lintl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 +echo "configure:2456: checking for gettext in libintl" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + gt_cv_func_gettext_libintl=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gettext_libintl=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2496: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$MSGFMT" != "no"; then + for ac_func in dcgettext +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2530: 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 < +/* 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:2558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <&6 +fi +done + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2585: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2621: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + CATOBJEXT=.gmo + DATADIRNAME=share +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CATOBJEXT=.mo + DATADIRNAME=lib +fi +rm -f conftest* + INSTOBJEXT=.mo + fi + fi + +else + echo "$ac_t""no" 1>&6 +fi + + + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + INTLOBJS="\$(GETTOBJS)" + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2693: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2727: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2763: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS='$(top_builddir)/../intl/libintl.a' + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=libintl.h + nls_cv_header_libgt=libgettext.h + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6 + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + else + DATADIRNAME=share + nls_cv_header_intl=libintl.h + nls_cv_header_libgt=libgettext.h + fi + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + + + + + + + + + + + + + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 +echo "configure:2853: checking for catalogs to be installed" >&5 + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + echo "$ac_t""$LINGUAS" 1>&6 + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + if test $ac_cv_header_locale_h = yes; then + INCLUDE_LOCALE_H="#include " + else + INCLUDE_LOCALE_H="\ +/* The system does not provide the header . Take care yourself. */" + fi + + + if test -f $srcdir/po2tbl.sed.in; then + if test "$CATOBJEXT" = ".cat"; then + ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 +echo "configure:2881: checking for linux/version.h" >&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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + msgformat=linux +else + echo "$ac_t""no" 1>&6 +msgformat=xopen +fi + + + sed -e '/^#/d' $srcdir/$msgformat-msg.sed > po2msg.sed + fi + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/po2tbl.sed.in > po2tbl.sed + fi + + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + + + + MKINSTALLDIRS="\$(srcdir)/../../mkinstalldirs" + + + l= + + + if test -d $srcdir/po; then + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + rm -f po/POTFILES + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + fi + + +# Check for common headers. +# FIXME: Seems to me this can cause problems for i386-windows hosts. +# At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*. +for ac_hdr in stdlib.h string.h strings.h unistd.h time.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2960: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2970: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_hdr in sys/time.h sys/resource.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3000: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3010: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_hdr in fcntl.h fpu_control.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3040: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3050: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_hdr in dlfcn.h errno.h sys/stat.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:3080: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_func in getrusage time sigaction __setfpucw +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3119: 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 < +/* 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:3147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <&6 +fi +done + + +# Check for socket libraries +echo $ac_n "checking for bind in -lsocket""... $ac_c" 1>&6 +echo "configure:3174: checking for bind in -lsocket" >&5 +ac_lib_var=`echo socket'_'bind | sed 'y%./+-%__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="-lsocket $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + +echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 +echo "configure:3221: checking for gethostbyname in -lnsl" >&5 +ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__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="-lnsl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 +fi + + +. ${srcdir}/../../bfd/configure.host + + + +USE_MAINTAINER_MODE=no +# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + case "${enableval}" in + yes) MAINT="" USE_MAINTAINER_MODE=yes ;; + no) MAINT="#" ;; + *) { echo "configure: error: "--enable-maintainer-mode does not take a value"" 1>&2; exit 1; }; MAINT="#" ;; +esac +if test x"$silent" != x"yes" && test x"$MAINT" = x""; then + echo "Setting maintainer mode" 6>&1 +fi +else + MAINT="#" +fi + + + +# Check whether --enable-sim-bswap or --disable-sim-bswap was given. +if test "${enable_sim_bswap+set}" = set; then + enableval="$enable_sim_bswap" + case "${enableval}" in + yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";; + no) sim_bswap="-DWITH_BSWAP=0";; + *) { echo "configure: error: "--enable-sim-bswap does not take a value"" 1>&2; exit 1; }; sim_bswap="";; +esac +if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then + echo "Setting bswap flags = $sim_bswap" 6>&1 +fi +else + sim_bswap="" +fi + + + +# Check whether --enable-sim-cflags or --disable-sim-cflags was given. +if test "${enable_sim_cflags+set}" = set; then + enableval="$enable_sim_cflags" + case "${enableval}" in + yes) sim_cflags="-O2 -fomit-frame-pointer";; + trace) { echo "configure: error: "Please use --enable-sim-debug instead."" 1>&2; exit 1; }; sim_cflags="";; + no) sim_cflags="";; + *) sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;; +esac +if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then + echo "Setting sim cflags = $sim_cflags" 6>&1 +fi +else + sim_cflags="" +fi + + + +# Check whether --enable-sim-debug or --disable-sim-debug was given. +if test "${enable_sim_debug+set}" = set; then + enableval="$enable_sim_debug" + case "${enableval}" in + yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";; + no) sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";; + *) sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";; +esac +if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then + echo "Setting sim debug = $sim_debug" 6>&1 +fi +else + sim_debug="" +fi + + + +# Check whether --enable-sim-stdio or --disable-sim-stdio was given. +if test "${enable_sim_stdio+set}" = set; then + enableval="$enable_sim_stdio" + case "${enableval}" in + yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";; + no) sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";; + *) { echo "configure: error: "Unknown value $enableval passed to --enable-sim-stdio"" 1>&2; exit 1; }; sim_stdio="";; +esac +if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then + echo "Setting stdio flags = $sim_stdio" 6>&1 +fi +else + sim_stdio="" +fi + + + +# Check whether --enable-sim-trace or --disable-sim-trace was given. +if test "${enable_sim_trace+set}" = set; then + enableval="$enable_sim_trace" + case "${enableval}" in + yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";; + no) sim_trace="-DTRACE=0 -DWITH_TRACE=0";; + [-0-9]*) + sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";; + [a-z]*) + sim_trace="" + for x in `echo "$enableval" | sed -e "s/,/ /g"`; do + if test x"$sim_trace" = x; then + sim_trace="-DWITH_TRACE='(TRACE_$x" + else + sim_trace="${sim_trace}|TRACE_$x" + fi + done + sim_trace="$sim_trace)'" ;; +esac +if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then + echo "Setting sim trace = $sim_trace" 6>&1 +fi +else + sim_trace="" +fi + + + +# Check whether --enable-sim-profile or --disable-sim-profile was given. +if test "${enable_sim_profile+set}" = set; then + enableval="$enable_sim_profile" + case "${enableval}" in + yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";; + no) sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";; + [-0-9]*) + sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";; + [a-z]*) + sim_profile="" + for x in `echo "$enableval" | sed -e "s/,/ /g"`; do + if test x"$sim_profile" = x; then + sim_profile="-DWITH_PROFILE='(PROFILE_$x" + else + sim_profile="${sim_profile}|PROFILE_$x" + fi + done + sim_profile="$sim_profile)'" ;; +esac +if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then + echo "Setting sim profile = $sim_profile" 6>&1 +fi +else + sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1" +fi + + + +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:3416: 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 < +#include +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:3438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <&6 +echo "configure:3460: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:3470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj | *.ilk | *.pdb) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + + +sim_link_files= +sim_link_links= + +sim_link_links=tconfig.h +if test -f ${srcdir}/tconfig.in +then + sim_link_files=tconfig.in +else + sim_link_files=../common/tconfig.in +fi + +# targ-vals.def points to the libc macro description file. +case "${target}" in +*-*-*) TARG_VALS_DEF=../common/nltvals.def ;; +esac +sim_link_files="${sim_link_files} ${TARG_VALS_DEF}" +sim_link_links="${sim_link_links} targ-vals.def" + + + + +default_sim_inline="-DDEFAULT_INLINE=0" +# Check whether --enable-sim-inline or --disable-sim-inline was given. +if test "${enable_sim_inline+set}" = set; then + enableval="$enable_sim_inline" + sim_inline="" +case "$enableval" in + no) sim_inline="-DDEFAULT_INLINE=0";; + 0) sim_inline="-DDEFAULT_INLINE=0";; + yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_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";; + *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; + *_INLINE) new_flag="-D$x=ALL_C_INLINE";; + *) new_flag="-D$x""_INLINE=ALL_C_INLINE";; + esac + if test x"$sim_inline" = x""; then + sim_inline="$new_flag" + else + sim_inline="$sim_inline $new_flag" + fi + done;; +esac +if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then + echo "Setting inline flags = $sim_inline" 6>&1 +fi +else + +if test "x$cross_compiling" = "xno"; then + if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then + sim_inline="${default_sim_inline}" + if test x"$silent" != x"yes"; then + echo "Setting inline flags = $sim_inline" 6>&1 + fi + else + sim_inline="" + fi +else + sim_inline="-DDEFAULT_INLINE=0" +fi +fi + + +wire_endian="LITTLE_ENDIAN" +default_endian="" +# Check whether --enable-sim-endian or --disable-sim-endian was given. +if test "${enable_sim_endian+set}" = set; then + enableval="$enable_sim_endian" + case "${enableval}" in + b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";; + l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";; + yes) if test x"$wire_endian" != x; then + sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}" + else + if test x"$default_endian" != x; then + sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}" + else + echo "No hard-wired endian for target $target" 1>&6 + sim_endian="-DWITH_TARGET_BYTE_ORDER=0" + fi + fi;; + no) if test x"$default_endian" != x; then + sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}" + else + if test x"$wire_endian" != x; then + sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}" + else + echo "No default endian for target $target" 1>&6 + sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0" + fi + fi;; + *) { echo "configure: error: "Unknown value $enableval for --enable-sim-endian"" 1>&2; exit 1; }; sim_endian="";; +esac +if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then + echo "Setting endian flags = $sim_endian" 6>&1 +fi +else + if test x"$default_endian" != x; then + sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}" +else + if test x"$wire_endian" != x; then + sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}" + else + sim_endian= + fi +fi +fi + +wire_alignment="FORCED_ALIGNMENT" +default_alignment="" + +# 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 + strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";; + nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";; + forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";; + yes) if test x"$wire_alignment" != x; then + sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" + else + if test x"$default_alignment" != x; then + sim_alignment="-DWITH_ALIGNMENT=${default_alignment}" + else + echo "No hard-wired alignment for target $target" 1>&6 + sim_alignment="-DWITH_ALIGNMENT=0" + fi + fi;; + no) if test x"$default_alignment" != x; then + sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" + else + if test x"$wire_alignment" != x; then + sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}" + else + echo "No default alignment for target $target" 1>&6 + sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0" + fi + fi;; + *) { 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 + if test x"$default_alignment" != x; then + sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}" +else + if test x"$wire_alignment" != x; then + sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}" + else + sim_alignment= + fi +fi +fi + + +# Check whether --enable-sim-hostendian or --disable-sim-hostendian was given. +if test "${enable_sim_hostendian+set}" = set; then + enableval="$enable_sim_hostendian" + case "${enableval}" in + no) sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";; + b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";; + l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";; + *) { echo "configure: error: "Unknown value $enableval for --enable-sim-hostendian"" 1>&2; exit 1; }; sim_hostendian="";; +esac +if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then + echo "Setting hostendian flags = $sim_hostendian" 6>&1 +fi +else + +if test "x$cross_compiling" = "xno"; then + echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +echo "configure:3666: 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 < +#include +int main() { + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif +; return 0; } +EOF +if { (eval echo configure:3684: \"$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 +int main() { + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif +; return 0; } +EOF +if { (eval echo configure:3699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_bigendian=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_bigendian=no +fi +rm -f conftest* +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test $ac_cv_c_bigendian = unknown; then +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; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_bigendian=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_bigendian=yes +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +if test $ac_cv_c_bigendian = yes; then + cat >> confdefs.h <<\EOF +#define WORDS_BIGENDIAN 1 +EOF + +fi + + if test $ac_cv_c_bigendian = yes; then + sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN" + else + sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN" + fi +else + sim_hostendian="-DWITH_HOST_BYTE_ORDER=0" +fi +fi + + +# Check whether --enable-build-warnings or --disable-build-warnings was given. +if test "${enable_build_warnings+set}" = set; then + enableval="$enable_build_warnings" + build_warnings="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" +case "${enableval}" in + yes) ;; + no) build_warnings="-w";; + ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` + build_warnings="${build_warnings} ${t}";; + *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` + build_warnings="${t} ${build_warnings}";; + *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;; +esac +if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then + echo "Setting warning flags = $build_warnings" 6>&1 +fi +WARN_CFLAGS="" +WERROR_CFLAGS="" +if test "x${build_warnings}" != x -a "x$GCC" = xyes +then + # Separate out the -Werror flag as some files just cannot be + # compiled with it enabled. + for w in ${build_warnings}; do + case $w in + -Werr*) WERROR_CFLAGS=-Werror ;; + *) WARN_CFLAGS="${WARN_CFLAGS} $w" + esac + done +fi +else + build_warnings="" +fi + + +default_sim_reserved_bits="1" +# Check whether --enable-sim-reserved-bits or --disable-sim-reserved-bits was given. +if test "${enable_sim_reserved_bits+set}" = set; then + enableval="$enable_sim_reserved_bits" + case "${enableval}" in + yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";; + no) sim_reserved_bits="-DWITH_RESERVED_BITS=0";; + *) { echo "configure: error: "--enable-sim-reserved-bits does not take a value"" 1>&2; exit 1; }; sim_reserved_bits="";; +esac +if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then + echo "Setting reserved flags = $sim_reserved_bits" 6>&1 +fi +else + sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}" +fi + +wire_word_bitsize="32" +wire_word_msb="31" +wire_address_bitsize="" +wire_cell_bitsize="" +# Check whether --enable-sim-bitsize or --disable-sim-bitsize was given. +if test "${enable_sim_bitsize+set}" = set; then + enableval="$enable_sim_bitsize" + sim_bitsize= +case "${enableval}" in + 64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";; + 32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";; + 64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; + 32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";; + 32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then + sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31" + else + sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0" + fi ;; + 64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then + sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63" + else + sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0" + fi ;; + *) { echo "configure: error: "--enable-sim-bitsize was given $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;; +esac +# address bitsize +tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9]*,*//"` +case x"${tmp}" in + x ) ;; + x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;; + x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;; + * ) { echo "configure: error: "--enable-sim-bitsize was given address size $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;; +esac +# cell bitsize +tmp=`echo "${enableval}" | sed -e "s/^[0-9]*,*[0-9*]*,*[0-9]*,*//"` +case x"${tmp}" in + x ) ;; + x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;; + x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;; + * ) { echo "configure: error: "--enable-sim-bitsize was given cell size $enableval. Expected 32 or 64"" 1>&2; exit 1; } ;; +esac +if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then + echo "Setting bitsize flags = $sim_bitsize" 6>&1 +fi +else + sim_bitsize="" +if test x"$wire_word_bitsize" != x; then + sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize" +fi +if test x"$wire_word_msb" != x; then + sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb" +fi +if test x"$wire_address_bitsize" != x; then + sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize" +fi +if test x"$wire_cell_bitsize" != x; then + sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize" +fi +fi + + +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:3881: 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 +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 +fi +done + +for ac_func in getpid kill +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3920: 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 < +/* 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:3948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; 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 <&6 +fi +done + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile.sim:Makefile.in Make-common.sim:../common/Make-common.in .gdbinit:../common/gdbinit.in config.h:config.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@sim_environment@%$sim_environment%g +s%@sim_alignment@%$sim_alignment%g +s%@sim_assert@%$sim_assert%g +s%@sim_bitsize@%$sim_bitsize%g +s%@sim_endian@%$sim_endian%g +s%@sim_hostendian@%$sim_hostendian%g +s%@sim_float@%$sim_float%g +s%@sim_scache@%$sim_scache%g +s%@sim_default_model@%$sim_default_model%g +s%@sim_hw_cflags@%$sim_hw_cflags%g +s%@sim_hw_objs@%$sim_hw_objs%g +s%@sim_hw@%$sim_hw%g +s%@sim_inline@%$sim_inline%g +s%@sim_packages@%$sim_packages%g +s%@sim_regparm@%$sim_regparm%g +s%@sim_reserved_bits@%$sim_reserved_bits%g +s%@sim_smp@%$sim_smp%g +s%@sim_stdcall@%$sim_stdcall%g +s%@sim_xor_endian@%$sim_xor_endian%g +s%@WARN_CFLAGS@%$WARN_CFLAGS%g +s%@WERROR_CFLAGS@%$WERROR_CFLAGS%g +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@target@%$target%g +s%@target_alias@%$target_alias%g +s%@target_cpu@%$target_cpu%g +s%@target_vendor@%$target_vendor%g +s%@target_os@%$target_os%g +s%@build@%$build%g +s%@build_alias@%$build_alias%g +s%@build_cpu@%$build_cpu%g +s%@build_vendor@%$build_vendor%g +s%@build_os@%$build_os%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@CC_FOR_BUILD@%$CC_FOR_BUILD%g +s%@HDEFINES@%$HDEFINES%g +s%@AR@%$AR%g +s%@RANLIB@%$RANLIB%g +s%@SET_MAKE@%$SET_MAKE%g +s%@CPP@%$CPP%g +s%@ALLOCA@%$ALLOCA%g +s%@USE_NLS@%$USE_NLS%g +s%@MSGFMT@%$MSGFMT%g +s%@GMSGFMT@%$GMSGFMT%g +s%@XGETTEXT@%$XGETTEXT%g +s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g +s%@CATALOGS@%$CATALOGS%g +s%@CATOBJEXT@%$CATOBJEXT%g +s%@DATADIRNAME@%$DATADIRNAME%g +s%@GMOFILES@%$GMOFILES%g +s%@INSTOBJEXT@%$INSTOBJEXT%g +s%@INTLDEPS@%$INTLDEPS%g +s%@INTLLIBS@%$INTLLIBS%g +s%@INTLOBJS@%$INTLOBJS%g +s%@POFILES@%$POFILES%g +s%@POSUB@%$POSUB%g +s%@INCLUDE_LOCALE_H@%$INCLUDE_LOCALE_H%g +s%@GT_NO@%$GT_NO%g +s%@GT_YES@%$GT_YES%g +s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g +s%@l@%$l%g +s%@MAINT@%$MAINT%g +s%@sim_bswap@%$sim_bswap%g +s%@sim_cflags@%$sim_cflags%g +s%@sim_debug@%$sim_debug%g +s%@sim_stdio@%$sim_stdio%g +s%@sim_trace@%$sim_trace%g +s%@sim_profile@%$sim_profile%g +s%@EXEEXT@%$EXEEXT%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$1; shift; ac_dests=$* + set $ac_sources; ac_source=$1; shift; ac_sources=$* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } + fi +done +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +case "x$CONFIG_FILES" in + xMakefile*) + echo "Merging Makefile.sim+Make-common.sim into Makefile ..." + rm -f Makesim1.tmp Makesim2.tmp Makefile + sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' Makesim1.tmp + sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' Makesim2.tmp + sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \ + -e '/^## COMMON_POST_/ r Makesim2.tmp' \ + Makefile + rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp + ;; + esac + case "x$CONFIG_HEADERS" in xconfig.h:config.in) echo > stamp-h ;; esac + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + + diff --git a/sim/tic80/configure.in b/sim/tic80/configure.in new file mode 100644 index 0000000..730b62e --- /dev/null +++ b/sim/tic80/configure.in @@ -0,0 +1,21 @@ +dnl Process this file with autoconf to produce a configure script. +sinclude(../common/aclocal.m4) +AC_PREREQ(2.5)dnl +AC_INIT(Makefile.in) + +SIM_AC_COMMON + +dnl Options available in this module +SIM_AC_OPTION_INLINE(0) +SIM_AC_OPTION_ENDIAN(LITTLE_ENDIAN) +SIM_AC_OPTION_ALIGNMENT(FORCED_ALIGNMENT) +SIM_AC_OPTION_HOSTENDIAN +SIM_AC_OPTION_WARNINGS +SIM_AC_OPTION_RESERVED_BITS(1) +SIM_AC_OPTION_BITSIZE(32,31) + +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/cpu.h b/sim/tic80/cpu.h new file mode 100644 index 0000000..642c181 --- /dev/null +++ b/sim/tic80/cpu.h @@ -0,0 +1,345 @@ +/* TIc80 Simulator. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Contributed by Cygnus Support. + +This file is part of GDB, the GNU debugger. + +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 +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + + + +/* TI C80 control registers */ + +typedef enum { + EPC_CR, + EIP_CR, + CONFIG_CR, + INTPEN_CR, + IE_CR, + FPST_CR, + PPERROR_CR, + PKTREQ_CR, + TCOUNT_CR, + TSCALE_CR, + FLTOP_CR, + FLTADR_CR, + FLTTAG_CR, + FLTDLT_CR, + FLTDTH_CR, + FLT005_CR, + FLT006_CR, + FLT007_CR, + FLT008_CR, + FLT009_CR, + FLT010_CR, + FLT011_CR, + FLT012_CR, + FLT013_CR, + FLT014_CR, + FLT015_CR, + SYSSTK_CR, + SYSTMP_CR, + MPC_CR, + MIP_CR, + ECOMCNTL_CR, + ANASTAT_CR, + BRK1_CR, + BRK2_CR, + ITAG0_CR, + ITAG1_CR, + ITAG2_CR, + ITAG3_CR, + ITAG4_CR, + ITAG5_CR, + ITAG6_CR, + ITAG7_CR, + ITAG8_CR, + ITAG9_CR, + ITAG10_CR, + ITAG11_CR, + ITAG12_CR, + ITAG13_CR, + ITAG14_CR, + ITAG15_CR, + ILRU_CR, + DTAG0_CR, + DTAG1_CR, + DTAG2_CR, + DTAG3_CR, + DTAG4_CR, + DTAG5_CR, + DTAG6_CR, + DTAG7_CR, + DTAG8_CR, + DTAG9_CR, + DTAG10_CR, + DTAG11_CR, + DTAG12_CR, + DTAG13_CR, + DTAG14_CR, + DTAG15_CR, + DLRU_CR, + IN0P_CR, + IN1P_CR, + OUTP_CR, + SCRATCH_CR, + nr_tic80_control_regs, +} tic80_control_regs; + +/* extern int tic80_cr2index (tic80_control_regs reg); */ + +/* Map an instruction CR index onto the corresponding internal cr enum + or SCRATCH_CR if the index is invalid */ + +extern tic80_control_regs tic80_index2cr (int index); + + +/* TIc80 interrupt register bits */ + +enum { + IE_CR_PE = BIT32(31), + IE_CR_X4 = BIT32(30), + IE_CR_X3 = BIT32(29), + IE_CR_BP = BIT32(28), + IE_CR_PB = BIT32(27), + IE_CR_PC = BIT32(26), + IE_CR_MI = BIT32(25), + /**/ + IE_CR_P3 = BIT32(19), + IE_CR_P2 = BIT32(18), + IE_CR_P1 = BIT32(17), + IE_CR_P0 = BIT32(16), + IE_CR_IO = BIT32(15), + IE_CR_MF = BIT32(14), + /**/ + IE_CR_X2 = BIT32(12), + IE_CR_X1 = BIT32(11), + IE_CR_TI = BIT32(10), + IE_CR_F1 = BIT32(9), + IE_CR_F0 = BIT32(8), + IE_CR_FX = BIT32(7), + IE_CR_FU = BIT32(6), + IE_CR_FO = BIT32(5), + /**/ + IE_CR_FZ = BIT32(3), + IE_CR_FI = BIT32(2), + /**/ + IE_CR_IE = BIT32(0), +}; + + + + +struct _sim_cpu { + unsigned32 reg[32]; + unsigned64 acc[4]; + unsigned32 cr[nr_tic80_control_regs]; + int is_user_mode; /* hidden mode latch */ + sim_cia cia; + sim_cpu_base base; +}; + +#define CIA_GET(CPU) ((CPU)->cia) +#define CIA_SET(CPU,VAL) ((CPU)->cia = (VAL)) + +#define GPR(N) ((CPU)->reg[N]) +#define GPR_CLEAR(N) (GPR((N)) = 0) +#define ACC(N) ((CPU)->acc[N]) +#define CR(N) ((CPU)->cr[tic80_index2cr ((N))]) + + + +#if defined(WITH_TRACE) +extern char *tic80_trace_alu3 PARAMS ((int, unsigned32, unsigned32, unsigned32)); +extern char *tic80_trace_cmp PARAMS ((int, unsigned32, unsigned32, unsigned32)); +extern char *tic80_trace_alu2 PARAMS ((int, unsigned32, unsigned32)); +extern char *tic80_trace_shift PARAMS ((int, unsigned32, unsigned32, int, int, int, int, int)); +extern void tic80_trace_fpu3 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *, sim_fpu *, sim_fpu *)); +extern void tic80_trace_fpu2 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *, sim_fpu *)); +extern void tic80_trace_fpu1 PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, sim_fpu *)); +extern void tic80_trace_fpu2i PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu *, sim_fpu *)); +extern void tic80_trace_fpu2cmp PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, unsigned32, sim_fpu *, sim_fpu *)); +extern char *tic80_trace_nop PARAMS ((int)); +extern char *tic80_trace_sink1 PARAMS ((int, unsigned32)); +extern char *tic80_trace_sink2 PARAMS ((int, unsigned32, unsigned32)); +extern char *tic80_trace_sink3 PARAMS ((int, unsigned32, unsigned32, unsigned32)); +extern char *tic80_trace_cond_br PARAMS ((int, int, unsigned32, unsigned32, int, int)); +extern char *tic80_trace_ucond_br PARAMS ((int, unsigned32)); +extern void tic80_trace_ldst PARAMS ((SIM_DESC, sim_cpu *, sim_cia, int, int, int, int, unsigned32, unsigned32, unsigned32)); + +#define TRACE_ALU3(indx, result, input1, input2) \ +do { \ + if (TRACE_ALU_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "alu", \ + tic80_trace_alu3 (indx, result, input1, input2)); \ + } \ +} while (0) + +#define TRACE_CMP(indx, result, input1, input2) \ +do { \ + if (TRACE_ALU_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "alu", \ + tic80_trace_cmp (indx, result, input1, input2)); \ + } \ +} while (0) + +#define TRACE_ALU2(indx, result, input) \ +do { \ + if (TRACE_ALU_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "alu", \ + tic80_trace_alu2 (indx, result, input)); \ + } \ +} while (0) + +#define TRACE_SHIFT(indx, result, input, i, n, merge, endmask, rotate) \ +do { \ + if (TRACE_ALU_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "shift", \ + tic80_trace_shift (indx, result, input, i, n, \ + merge, endmask, rotate)); \ + } \ +} while (0) + +#define TRACE_FPU3(result, input1, input2) \ +do { \ + if (TRACE_FPU_P (CPU)) { \ + tic80_trace_fpu3 (SD, CPU, cia, MY_INDEX, \ + &result, &input1, &input2); \ + } \ +} while (0) + +#define TRACE_FPU2(result, input) \ +do { \ + if (TRACE_FPU_P (CPU)) { \ + tic80_trace_fpu2 (SD, CPU, cia, MY_INDEX, \ + &result, &input); \ + } \ +} while (0) + +#define TRACE_FPU1(result) \ +do { \ + if (TRACE_FPU_P (CPU)) { \ + tic80_trace_fpu1 (SD, CPU, cia, MY_INDEX, \ + &result); \ + } \ +} while (0) + +#define TRACE_FPU2I(result, input1, input2) \ +do { \ + if (TRACE_FPU_P (CPU)) { \ + tic80_trace_fpu2i (SD, CPU, cia, MY_INDEX, \ + result, &input1, &input2); \ + } \ +} while (0) + +#define TRACE_FPU2CMP(result, input1, input2) \ +do { \ + if (TRACE_FPU_P (CPU)) { \ + tic80_trace_fpu2cmp (SD, CPU, cia, MY_INDEX, \ + result, &input1, &input2); \ + } \ +} while (0) + +#define TRACE_NOP(indx) \ +do { \ + if (TRACE_ALU_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "nop", \ + tic80_trace_nop (indx)); \ + } \ +} while (0) + +#define TRACE_SINK1(indx, input) \ +do { \ + if (TRACE_ALU_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "nop", \ + tic80_trace_sink1 (indx, input)); \ + } \ +} while (0) + +#define TRACE_SINK2(indx, input1, input2) \ +do { \ + if (TRACE_ALU_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "nop", \ + tic80_trace_sink2 (indx, input1, input2)); \ + } \ +} while (0) + +#define TRACE_SINK3(indx, input1, input2, input3) \ +do { \ + if (TRACE_ALU_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "nop", \ + tic80_trace_sink3 (indx, input1, input2, input3)); \ + } \ +} while (0) + +#define TRACE_COND_BR(indx, jump_p, cond, target, size, code) \ +do { \ + if (TRACE_BRANCH_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "branch", \ + tic80_trace_cond_br (indx, jump_p, cond, target, \ + size, code)); \ + } \ +} while (0) + +#define TRACE_UCOND_BR(indx, target) \ +do { \ + if (TRACE_BRANCH_P (CPU)) { \ + trace_one_insn (SD, CPU, cia.ip, 1, itable[indx].file, \ + itable[indx].line_nr, "branch", \ + tic80_trace_ucond_br (indx, target)); \ + } \ +} while (0) + +#define TRACE_LD(result, m, s, addr1, addr2) \ +do { \ + if (TRACE_MEMORY_P (CPU)) { \ + tic80_trace_ldst (SD, CPU, cia, MY_INDEX, \ + 0, m, s, result, addr1, addr2); \ + } \ +} while (0) + +#define TRACE_ST(value, m, s, addr1, addr2) \ +do { \ + if (TRACE_MEMORY_P (CPU)) { \ + tic80_trace_ldst (SD, CPU, cia, MY_INDEX, \ + 1, m, s, value, addr1, addr2); \ + } \ +} while (0) + +#else +#define TRACE_ALU3(indx, result, input1, input2) +#define TRACE_ALU2(indx, result, input) +#define TRACE_FPU3(result, input1, input2) +#define TRACE_FPU2(result, input) +#define TRACE_FPU1(result) +#define TRACE_FPU2I(result, input1, input2) +#define TRACE_NOP(indx) +#define TRACE_SINK1(indx, input) +#define TRACE_SINK2(indx, input1, input2) +#define TRACE_SINK3(indx, input1, input2, input3) +#define TRACE_COND_BR(indx, jump_p, cond, target, size, code) +#define TRACE_UCOND_BR(indx, target) +#define TRACE_LD(m, s, result, addr1, addr2) +#define TRACE_ST(m, s, value, addr1, addr2) +#endif diff --git a/sim/tic80/interp.c b/sim/tic80/interp.c new file mode 100644 index 0000000..17f06d4 --- /dev/null +++ b/sim/tic80/interp.c @@ -0,0 +1,127 @@ +/* This file is part of the GDB simulators. + + Copyright (C) 1997, Free Software Foundation + Condtributed by Cyngnus Solutions. + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + + +#include "sim-main.h" + +#include "idecode.h" +#include "itable.h" + +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif + + +#if 0 + +void +engine_error (SIM_DESC sd, + sim_cpu *cpu, + instruction_address cia, + const char *fmt, + ...) +{ + va_list ap; + va_start (ap, fmt); + sim_io_evprintf (sd, fmt, ap); + va_end (ap); + + sim_halt (sd, cpu, NULL, cia, sim_stopped, SIGABRT); +} + +void +engine_halt (SIM_DESC sd, + sim_cpu *cpu, + instruction_address cia, + enum sim_stop reason, + int siggnal) +{ + if (!sd->halt_ok) + sim_io_error (sd, "engine_halt - bad longjmp"); + sd->reason = reason; + sd->siggnal = siggnal; + sd->halt_ok = 0; + sd->restart_ok = 0; + if (cpu != NULL) + cpu->cia = cia; + longjmp (sd->path_to_halt, 1); +} + +void +engine_restart (SIM_DESC sd, + sim_cpu *cpu, + instruction_address cia) +{ + if (!sd->restart_ok) + sim_io_error (sd, "engine_restart - bad longjmp"); + sd->restart_ok = 0; + cpu->cia = cia; + longjmp(sd->path_to_restart, 1); +} + + +void +engine_run_until_stop (SIM_DESC sd, + volatile int *keep_running) +{ + if (!setjmp (sd->path_to_halt)) + { + instruction_address cia; + sim_cpu *cpu = STATE_CPU (sd, 0); + sd->halt_ok = 1; + setjmp (sd->path_to_restart); + sd->restart_ok = 1; + cia = cpu->cia; + do + { + instruction_word insn = IMEM (cia); + cia = idecode_issue (sd, insn, cia); + } + while (*keep_running); + engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGINT); + } +} + + +void +engine_step (SIM_DESC sd) +{ + if (!setjmp (sd->path_to_halt)) + { + instruction_address cia; + instruction_word insn; + sim_cpu *cpu = STATE_CPU (sd, 0); + sd->halt_ok = 1; + setjmp (sd->path_to_restart); + sd->restart_ok = 1; + cia = cpu->cia; + insn = IMEM (cia); + cia = idecode_issue (sd, insn, cia); + engine_halt (sd, cpu, cia, sim_stopped, SIM_SIGTRAP); + } +} + +#endif diff --git a/sim/tic80/misc.c b/sim/tic80/misc.c new file mode 100644 index 0000000..fc7fbec --- /dev/null +++ b/sim/tic80/misc.c @@ -0,0 +1,624 @@ +/* TIc80 Simulator. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + Contributed by Cygnus Support. + +This file is part of GDB, the GNU debugger. + +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 +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + + +#include "sim-main.h" + +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif + + +tic80_control_regs +tic80_index2cr (int index) +{ + switch (index) + { + case 0x0000: return EPC_CR; + case 0x0001: return EIP_CR; + case 0x0002: return CONFIG_CR; + case 0x0004: return INTPEN_CR; + case 0x0006: return IE_CR; + case 0x0008: return FPST_CR; + case 0x000A: return PPERROR_CR; + case 0x000D: return PKTREQ_CR; + case 0x000E: return TCOUNT_CR; + case 0x000F: return TSCALE_CR; + case 0x0010: return FLTOP_CR; + case 0x0011: return FLTADR_CR; + case 0x0012: return FLTTAG_CR; + case 0x0013: return FLTDLT_CR; + case 0x0014: return FLTDTH_CR; + case 0x0015: return FLT005_CR; + case 0x0016: return FLT006_CR; + case 0x0017: return FLT007_CR; + case 0x0018: return FLT008_CR; + case 0x0019: return FLT009_CR; + case 0x001a: return FLT010_CR; + case 0x001b: return FLT011_CR; + case 0x001c: return FLT012_CR; + case 0x001d: return FLT013_CR; + case 0x001e: return FLT014_CR; + case 0x001f: return FLT015_CR; + case 0x0020: return SYSSTK_CR; + case 0x0021: return SYSTMP_CR; + case 0x0030: return MPC_CR; + case 0x0031: return MIP_CR; + case 0x0033: return ECOMCNTL_CR; + case 0x0034: return ANASTAT_CR; + case 0x0039: return BRK1_CR; + case 0x003A: return BRK2_CR; + case 0x0200: return ITAG0_CR; + case 0x0201: return ITAG1_CR; + case 0x0202: return ITAG2_CR; + case 0x0203: return ITAG3_CR; + case 0x0204: return ITAG4_CR; + case 0x0205: return ITAG5_CR; + case 0x0206: return ITAG6_CR; + case 0x0207: return ITAG7_CR; + case 0x0208: return ITAG8_CR; + case 0x0209: return ITAG9_CR; + case 0x020a: return ITAG10_CR; + case 0x020b: return ITAG11_CR; + case 0x020c: return ITAG12_CR; + case 0x020d: return ITAG13_CR; + case 0x020e: return ITAG14_CR; + case 0x020f: return ITAG15_CR; + case 0x0300: return ILRU_CR; + case 0x0400: return DTAG0_CR; + case 0x0401: return DTAG1_CR; + case 0x0402: return DTAG2_CR; + case 0x0403: return DTAG3_CR; + case 0x0404: return DTAG4_CR; + case 0x0405: return DTAG5_CR; + case 0x0406: return DTAG6_CR; + case 0x0407: return DTAG7_CR; + case 0x0408: return DTAG8_CR; + case 0x0409: return DTAG9_CR; + case 0x040a: return DTAG10_CR; + case 0x040b: return DTAG11_CR; + case 0x040c: return DTAG12_CR; + case 0x040d: return DTAG13_CR; + case 0x040e: return DTAG14_CR; + case 0x040f: return DTAG15_CR; + case 0x0500: return DLRU_CR; + case 0x4000: return IN0P_CR; + case 0x4001: return IN1P_CR; + case 0x4002: return OUTP_CR; + default: return SCRATCH_CR; + } +} + + + +#if defined(WITH_TRACE) +/* Tracing support routines */ + +static char tic80_trace_buffer[1024]; +static int tic80_size_name; + +#define SIZE_HEX 8 +#define SIZE_DECIMAL 11 + +/* Initialize tracing by calculating the maximum name size */ +static void +tic80_init_trace (void) +{ + int i; + int len, max_len = 0; + + for (i = 0; i < (int)nr_itable_entries; i++) { + len = strlen (itable[i].name); + if (len > max_len) + max_len = len; + } + + tic80_size_name = max_len + sizeof(":m") - 1 + sizeof (":s") - 1; +} + +/* Given an integer which is the result of a comparison, return a string + giving which bits are set. */ + +static char * +tic80_trace_cmp_internal (unsigned32 flag) +{ + struct cmp_bits { unsigned32 bit; char *string; }; + static char buffer[32*8]; + static struct cmp_bits bits[] = + { + { BIT32(29), "hs" }, + { BIT32(28), "lo" }, + { BIT32(27), "ls" }, + { BIT32(26), "hi" }, + { BIT32(25), "ge" }, + { BIT32(24), "lt" }, + { BIT32(23), "le" }, + { BIT32(22), "gt" }, + { BIT32(21), "ne" }, + { BIT32(20), "eq" }, + + { BIT32(19), "hs.h" }, + { BIT32(18), "lo.h" }, + { BIT32(17), "ls.h" }, + { BIT32(16), "hi.h" }, + { BIT32(15), "ge.h" }, + { BIT32(14), "lt.h" }, + { BIT32(13), "le.h" }, + { BIT32(12), "gt.h" }, + { BIT32(11), "ne.h" }, + { BIT32(10), "eq.h" }, + + { BIT32( 9), "hs.b" }, + { BIT32( 8), "lo.b" }, + { BIT32( 7), "ls.b" }, + { BIT32( 6), "hi.b" }, + { BIT32( 5), "ge.b" }, + { BIT32( 4), "lt.b" }, + { BIT32( 3), "le.b" }, + { BIT32( 2), "gt.b" }, + { BIT32( 1), "ne.b" }, + { BIT32( 0), "eq.b" }, + { 0, (char *)0 }, + }; + + int i; + char *p = buffer; + + for (i = 0; bits[i].bit != 0; i++) + { + if ((flag & bits[i].bit) != 0) + { + if (p != buffer) + *p++ = ' '; + + strcpy (p, bits[i].string); + p += strlen (p); + } + } + + *p = '\0'; + return buffer; +} + +/* Trace the result of an ALU operation with 2 integer inputs and an integer output */ +char * +tic80_trace_alu3 (int indx, + unsigned32 result, + unsigned32 input1, + unsigned32 input2) +{ + if (!tic80_size_name) + tic80_init_trace (); + + sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx/%*ld", + tic80_size_name, itable[indx].name, + SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, + SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2, + SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result); + + return tic80_trace_buffer; +} + +/* Trace the result of an ALU operation with 2 integer inputs and an integer output + that sets the bits from a compare instruction. */ +char * +tic80_trace_cmp (int indx, + unsigned32 result, + unsigned32 input1, + unsigned32 input2) +{ + if (!tic80_size_name) + tic80_init_trace (); + + sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld => 0x%.*lx %s", + tic80_size_name, itable[indx].name, + SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, + SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2, + SIZE_HEX, result, tic80_trace_cmp_internal (result)); + + return tic80_trace_buffer; +} + +/* Trace the result of an ALU operation with 1 integer input and an integer output */ +char * +tic80_trace_alu2 (int indx, + unsigned32 result, + unsigned32 input) +{ + if (!tic80_size_name) + tic80_init_trace (); + + sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld %*s => 0x%.*lx/%*ld", + tic80_size_name, itable[indx].name, + SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input, + SIZE_HEX + SIZE_DECIMAL + 3, "", + SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result); + + return tic80_trace_buffer; +} + +/* Trace the result of a shift instruction */ +char * +tic80_trace_shift (int indx, + unsigned32 result, + unsigned32 input, + int i, + int n, + int merge, + int endmask, + int rotate) +{ + const char *merge_name; + char name[40]; + char *p; + + if (!tic80_size_name) + tic80_init_trace (); + + switch (merge) + { + default: merge_name = ".??"; break; + case 0: merge_name = ".dz"; break; + case 1: merge_name = ".dm"; break; + case 2: merge_name = ".ds"; break; + case 3: merge_name = ".ez"; break; + case 4: merge_name = ".em"; break; + case 5: merge_name = ".es"; break; + case 6: merge_name = ".iz"; break; + case 7: merge_name = ".im"; break; + } + + /* Don't use itable[indx].name, which is just sl {r,i}. Instead reconstruct + the name, using the i and n fields. */ + p = strchr (itable[indx].name, ' '); + sprintf (name, "s%s%s%s%s", + (n) ? "r" : "l", + (i) ? "i" : "", + merge_name, + (p) ? p : ""); + + sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld %*s%2d,%2d => 0x%.*lx/%*ld", + tic80_size_name, name, + SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input, + SIZE_HEX + SIZE_DECIMAL - 2, "", + rotate, endmask, + SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result); + + return tic80_trace_buffer; +} + +/* Trace the result of an FPU operation with 2 floating point inputs and a floating point output */ +void +tic80_trace_fpu3 (SIM_DESC sd, + sim_cpu *cpu, + sim_cia cia, + int indx, + sim_fpu *result, + sim_fpu *input1, + sim_fpu *input2) +{ + if (!tic80_size_name) + tic80_init_trace (); + + trace_one_insn (sd, cpu, cia.ip, 1, + itable[indx].file, itable[indx].line_nr, "fpu", + "%-*s %*g %*g => %*g", + tic80_size_name, itable[indx].name, + SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1), + SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2), + SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (result)); +} + +/* Trace the result of an FPU operation with 1 floating point input and a floating point output */ +void +tic80_trace_fpu2 (SIM_DESC sd, + sim_cpu *cpu, + sim_cia cia, + int indx, + sim_fpu *result, + sim_fpu *input) +{ + if (!tic80_size_name) + tic80_init_trace (); + + trace_one_insn (sd, cpu, cia.ip, 1, + itable[indx].file, itable[indx].line_nr, "fpu", + "%-*s %*g %-*s => %*g", + tic80_size_name, itable[indx].name, + SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input), + SIZE_HEX + SIZE_DECIMAL + 3, "", + SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (result)); +} + +/* Trace the result of an FPU operation with 1 floating point input and a floating point output */ +void +tic80_trace_fpu1 (SIM_DESC sd, + sim_cpu *cpu, + sim_cia cia, + int indx, + sim_fpu *result) +{ + if (!tic80_size_name) + tic80_init_trace (); + + trace_one_insn (sd, cpu, cia.ip, 1, + itable[indx].file, itable[indx].line_nr, "fpu", + "%-*s %-*s %-*s => %*g", + tic80_size_name, itable[indx].name, + SIZE_HEX + SIZE_DECIMAL + 3, "", + SIZE_HEX + SIZE_DECIMAL + 3, "", + SIZE_HEX + SIZE_DECIMAL, sim_fpu_2d (result)); +} + +/* Trace the result of an FPU operation with 2 floating point inputs and an integer output */ +void +tic80_trace_fpu2i (SIM_DESC sd, + sim_cpu *cpu, + sim_cia cia, + int indx, + unsigned32 result, + sim_fpu *input1, + sim_fpu *input2) +{ + if (!tic80_size_name) + tic80_init_trace (); + + trace_one_insn (sd, cpu, cia.ip, 1, + itable[indx].file, itable[indx].line_nr, "fpu", + "%-*s %*g %*g => 0x%.*lx %-*ld", + tic80_size_name, itable[indx].name, + SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1), + SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2), + SIZE_HEX, result, SIZE_DECIMAL, (long)(signed32)result); +} + +/* Trace the result of an FPU operation with 2 floating point inputs and an integer output + that is the result of a comparison. */ +void +tic80_trace_fpu2cmp (SIM_DESC sd, + sim_cpu *cpu, + sim_cia cia, + int indx, + unsigned32 result, + sim_fpu *input1, + sim_fpu *input2) +{ + if (!tic80_size_name) + tic80_init_trace (); + + trace_one_insn (sd, cpu, cia.ip, 1, + itable[indx].file, itable[indx].line_nr, "fpu", + "%-*s %*g %*g => 0x%.*lx %s", + tic80_size_name, itable[indx].name, + SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input1), + SIZE_HEX + SIZE_DECIMAL + 3, sim_fpu_2d (input2), + SIZE_HEX, result, tic80_trace_cmp_internal (result)); +} + +/* Trace the result of a NOP operation */ +char * +tic80_trace_nop (int indx) +{ + if (!tic80_size_name) + tic80_init_trace (); + + sprintf (tic80_trace_buffer, "%s", itable[indx].name); + return tic80_trace_buffer; +} + +/* Trace the result of a data sink with one input */ +char * +tic80_trace_sink1 (int indx, unsigned32 input) +{ + if (!tic80_size_name) + tic80_init_trace (); + + sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld", + tic80_size_name, itable[indx].name, + SIZE_HEX, input, SIZE_DECIMAL, (long)(signed32)input); + + return tic80_trace_buffer; +} + +/* Trace the result of a data sink with two inputs */ +char * +tic80_trace_sink2 (int indx, unsigned32 input1, unsigned32 input2) +{ + if (!tic80_size_name) + tic80_init_trace (); + + sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld", + tic80_size_name, itable[indx].name, + SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, + SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2); + + return tic80_trace_buffer; +} + +/* Trace the result of a data sink with three inputs */ +char * +tic80_trace_sink3 (int indx, unsigned32 input1, unsigned32 input2, unsigned32 input3) +{ + if (!tic80_size_name) + tic80_init_trace (); + + sprintf (tic80_trace_buffer, "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld 0x%.*lx/%*ld", + tic80_size_name, itable[indx].name, + SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, + SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2, + SIZE_HEX, input3, SIZE_DECIMAL, (long)(signed32)input3); + + return tic80_trace_buffer; +} + +/* Trace the result of a conditional branch operation */ +char * +tic80_trace_cond_br (int indx, + int jump_p, + unsigned32 cond, + unsigned32 target, + int size, + int code) +{ + char *suffix1, *suffix2; + + if (!tic80_size_name) + tic80_init_trace (); + + if (size >= 0 && code >= 0) + { /* BCND */ + switch (code) + { + default: suffix1 = "???"; break; + case 0: suffix1 = "nev"; break; + case 1: suffix1 = "gt0"; break; + case 2: suffix1 = "eq0"; break; + case 3: suffix1 = "ge0"; break; + case 4: suffix1 = "lt0"; break; + case 5: suffix1 = "ne0"; break; + case 6: suffix1 = "le0"; break; + case 7: suffix1 = "alw"; break; + } + + switch (size) + { + default: suffix2 = ".?"; break; + case 0: suffix2 = ".b"; break; + case 1: suffix2 = ".h"; break; + case 2: suffix2 = ".w"; break; + } + + } else { /* BBO/BBZ */ + + suffix2 = ""; + switch (cond) + { + default: suffix1 = "??.?"; break; + case 29: suffix1 = "hs.w"; break; + case 28: suffix1 = "lo.w"; break; + case 27: suffix1 = "ls.w"; break; + case 26: suffix1 = "hi.w"; break; + case 25: suffix1 = "ge.w"; break; + case 24: suffix1 = "lt.w"; break; + case 23: suffix1 = "le.w"; break; + case 22: suffix1 = "gt.w"; break; + case 21: suffix1 = "ne.w"; break; + case 20: suffix1 = "eq.w"; break; + case 19: suffix1 = "hs.h"; break; + case 18: suffix1 = "lo.h"; break; + case 17: suffix1 = "ls.h"; break; + case 16: suffix1 = "hi.h"; break; + case 15: suffix1 = "ge.h"; break; + case 14: suffix1 = "lt.h"; break; + case 13: suffix1 = "le.h"; break; + case 12: suffix1 = "gt.h"; break; + case 11: suffix1 = "ne.h"; break; + case 10: suffix1 = "eq.h"; break; + case 9: suffix1 = "hs.b"; break; + case 8: suffix1 = "lo.b"; break; + case 7: suffix1 = "ls.b"; break; + case 6: suffix1 = "hi.b"; break; + case 5: suffix1 = "ge.b"; break; + case 4: suffix1 = "lt.b"; break; + case 3: suffix1 = "le.b"; break; + case 2: suffix1 = "gt.b"; break; + case 1: suffix1 = "ne.b"; break; + case 0: suffix1 = "eq.b"; break; + } + } + + if (jump_p) + sprintf (tic80_trace_buffer, + "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => 0x%.*lx %s%s", + tic80_size_name, itable[indx].name, + SIZE_HEX, target, SIZE_DECIMAL, "", + SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond, + SIZE_HEX, target, + suffix1, suffix2); + else + sprintf (tic80_trace_buffer, + "%-*s 0x%.*lx %*s 0x%.*lx/%*ld => %-*s %s%s", + tic80_size_name, itable[indx].name, + SIZE_HEX, target, SIZE_DECIMAL, "", + SIZE_HEX, cond, SIZE_DECIMAL, (long)(signed32)cond, + SIZE_HEX + 2, "[no jump]", + suffix1, suffix2); + + return tic80_trace_buffer; +} + +/* Trace the result of a unconditional branch operation */ +char * +tic80_trace_ucond_br (int indx, + unsigned32 target) +{ + if (!tic80_size_name) + tic80_init_trace (); + + sprintf (tic80_trace_buffer, + "%-*s 0x%.*lx %*s => 0x%.*lx", + tic80_size_name, itable[indx].name, + SIZE_HEX, target, (SIZE_DECIMAL*2) + SIZE_HEX + 4, "", + SIZE_HEX, target); + + return tic80_trace_buffer; +} + +/* Trace the result of a load or store operation with 2 integer addresses + and an integer output or input */ +void +tic80_trace_ldst (SIM_DESC sd, + sim_cpu *cpu, + sim_cia cia, + int indx, + int st_p, + int m_p, + int s_p, + unsigned32 value, + unsigned32 input1, + unsigned32 input2) +{ + char name[40]; + + if (!tic80_size_name) + tic80_init_trace (); + + strcpy (name, itable[indx].name); + if (m_p) + strcat (name, ":m"); + + if (s_p) + strcat (name, ":s"); + + trace_one_insn (sd, cpu, cia.ip, 1, + itable[indx].file, itable[indx].line_nr, "memory", + "%-*s 0x%.*lx/%*ld 0x%.*lx/%*ld %s 0x%.*lx/%*ld", + tic80_size_name, name, + SIZE_HEX, input1, SIZE_DECIMAL, (long)(signed32)input1, + SIZE_HEX, input2, SIZE_DECIMAL, (long)(signed32)input2, + (!st_p) ? "=>" : "<=", + SIZE_HEX, value, SIZE_DECIMAL, (long)(signed32)value); +} + +#endif /* WITH_TRACE */ diff --git a/sim/tic80/sim-calls.c b/sim/tic80/sim-calls.c new file mode 100644 index 0000000..c60bd9b --- /dev/null +++ b/sim/tic80/sim-calls.c @@ -0,0 +1,203 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1996, Andrew Cagney + Copyright (C) 1997, Free Software Foundation + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#include +#include + +#include "bfd.h" +#include "sim-main.h" +#include "sim-utils.h" +#include "sim-options.h" + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif + + +#define SIM_ADDR unsigned + +SIM_DESC +sim_open (SIM_OPEN_KIND kind, + host_callback *callback, + struct _bfd *abfd, + char **argv) +{ + char *buf; + SIM_DESC sd = sim_state_alloc (kind, callback); + + if (sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK) + return 0; + +#define TIC80_MEM_START 0x2000000 +#define TIC80_MEM_SIZE 0x100000 + + /* main memory */ + asprintf (&buf, "memory region 0x%lx,0x%lx", + TIC80_MEM_START, TIC80_MEM_SIZE); + sim_do_command (sd, buf); + free (buf); + /* interrupt memory */ + sim_do_command (sd, "memory region 0x1010000,0x1000"); + /* some memory at zero */ + sim_do_command (sd, "memory region 0,0x100000"); + + /* getopt will print the error message so we just have to exit if this fails. + FIXME: Hmmm... in the case of gdb we need getopt to call + print_filtered. */ + if (sim_parse_args (sd, argv) != SIM_RC_OK) + { + /* Uninstall the modules to avoid memory leaks, + file descriptor leaks, etc. */ + sim_module_uninstall (sd); + return 0; + } + + /* check for/establish the a reference program image */ + if (sim_analyze_program (sd, + (STATE_PROG_ARGV (sd) != NULL + ? *STATE_PROG_ARGV (sd) + : NULL), + abfd) != SIM_RC_OK) + { + sim_module_uninstall (sd); + return 0; + } + + /* establish any remaining configuration options */ + if (sim_config (sd) != SIM_RC_OK) + { + sim_module_uninstall (sd); + return 0; + } + + if (sim_post_argv_init (sd) != SIM_RC_OK) + { + /* Uninstall the modules to avoid memory leaks, + file descriptor leaks, etc. */ + sim_module_uninstall (sd); + return 0; + } + + /* FIXME: for now */ + return sd; +} + + +void +sim_close (SIM_DESC sd, int quitting) +{ + /* Uninstall the modules to avoid memory leaks, + file descriptor leaks, etc. */ + sim_module_uninstall (sd); +} + + +/* FIXME - these magic numbers need to be moved elsewhere */ + +#define SP_REGNUM 1 /* Contains address of top of stack */ +#define FP_REGNUM 31 /* Contains address of executing stack frame */ +#define PC_REGNUM 32 /* Contains program counter (FIXME?) */ +#define NPC_REGNUM 33 /* Contains the next program counter (FIXME?) */ +#define A0_REGNUM 34 /* Accumulator register 0 */ +#define A3_REGNUM 37 /* Accumulator register 1 */ + +#define R0_REGNUM 0 /* General Purpose Register 0 - for sim */ +#define Rn_REGNUM 31 /* Last General Purpose Register - for sim */ +#define An_REGNUM A3_REGNUM /* Last Accumulator register - for sim */ + +int +sim_fetch_register (SIM_DESC sd, int regnr, unsigned char *buf, int length) +{ + if (regnr == R0_REGNUM) + memset (buf, 0, sizeof (unsigned32)); + else if (regnr > R0_REGNUM && regnr <= Rn_REGNUM) + *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->reg[regnr - R0_REGNUM]); + else if (regnr == PC_REGNUM) + *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->cia.ip); + else if (regnr == NPC_REGNUM) + *(unsigned32*)buf = H2T_4 (STATE_CPU (sd, 0)->cia.dp); + else if (regnr >= A0_REGNUM && regnr <= An_REGNUM) + *(unsigned64*)buf = H2T_8 (STATE_CPU (sd, 0)->acc[regnr - A0_REGNUM]); + else + sim_io_error (sd, "sim_fetch_register - unknown register nr %d", regnr); + return -1; +} + + +int +sim_store_register (SIM_DESC sd, int regnr, unsigned char *buf, int length) +{ + if (regnr >= R0_REGNUM && regnr <= Rn_REGNUM) + STATE_CPU (sd, 0)->reg[regnr - R0_REGNUM] = T2H_4 (*(unsigned32*)buf); + else if (regnr == PC_REGNUM) + STATE_CPU (sd, 0)->cia.ip = T2H_4 (*(unsigned32*)buf); + else if (regnr == NPC_REGNUM) + STATE_CPU (sd, 0)->cia.dp = T2H_4 (*(unsigned32*)buf); + else if (regnr >= A0_REGNUM && regnr <= An_REGNUM) + STATE_CPU (sd, 0)->acc[regnr - A0_REGNUM] = T2H_8 (*(unsigned64*)buf); + else + sim_io_error (sd, "sim_store_register - unknown register nr %d", regnr); + return -1; +} + + +SIM_RC +sim_create_inferior (SIM_DESC sd, + struct _bfd *abfd, + char **argv, + char **envp) +{ + /* clear all registers */ + memset (&STATE_CPU (sd, 0)->reg, 0, sizeof (STATE_CPU (sd, 0)->reg)); + memset (&STATE_CPU (sd, 0)->acc, 0, sizeof (STATE_CPU (sd, 0)->acc)); + memset (&STATE_CPU (sd, 0)->cr, 0, sizeof (STATE_CPU (sd, 0)->cr)); + STATE_CPU (sd, 0)->is_user_mode = 0; + memset (&STATE_CPU (sd, 0)->cia, 0, sizeof (STATE_CPU (sd, 0)->cia)); + /* initialize any modules */ + sim_module_init (sd); + /* set the stack-pointer/program counter */ + if (abfd != NULL) + STATE_CPU (sd, 0)->cia.ip = bfd_get_start_address (abfd); + else + STATE_CPU (sd, 0)->cia.ip = 0; + STATE_CPU (sd, 0)->cia.dp = (STATE_CPU (sd, 0)->cia.ip + + sizeof (instruction_word)); + STATE_CPU (sd, 0)->cr[IE_CR] |= IE_CR_IE; + STATE_CPU (sd, 0)->reg[1] = TIC80_MEM_START + TIC80_MEM_SIZE - 16; + return SIM_RC_OK; +} + + +void +sim_do_command (SIM_DESC sd, char *cmd) +{ + if (sim_args_command (sd, cmd) != SIM_RC_OK) + sim_io_eprintf (sd, "Unknown command `%s'\n", cmd); +} diff --git a/sim/tic80/sim-main.h b/sim/tic80/sim-main.h new file mode 100644 index 0000000..67db353 --- /dev/null +++ b/sim/tic80/sim-main.h @@ -0,0 +1,81 @@ +/* This file is part of the program psim. + + Copyright (C) 1994-1997, Andrew Cagney + Copyright (C) 1997, Free Software Foundation + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + +#ifndef _SIM_MAIN_H_ +#define _SIM_MAIN_H_ + + +#include "sim-basics.h" +#include "sim-signal.h" + +#include /* For kill() in insns:do_trap */ + +#include +#ifdef HAVE_UNISTD_H +#include +#endif + +/* These are generated files. */ +#include "itable.h" +#include "idecode.h" +#include "idecode.h" + +typedef instruction_address sim_cia; +static const sim_cia null_cia = {0}; /* Dummy */ +#define NULL_CIA null_cia +/* FIXME: Perhaps igen should generate access macros for + `instruction_address' that we could use. */ +#define CIA_ADDR(cia) ((cia).ip) + +#define WITH_WATCHPOINTS 1 + +#include "sim-base.h" + +#include "alu.h" +#include "cpu.h" + + +struct sim_state { + + /* the processors proper */ + sim_cpu cpu; +#define STATE_CPU(sd, n) (&(sd)->cpu) + + /* The base class. */ + sim_state_base base; + +}; + +/* (re) initialize the simulator */ + +extern void engine_init +(SIM_DESC sd); + + +#ifndef HAVE_GETPID +#define getpid() 42 +#endif + +#ifndef HAVE_KILL +#define kill(sig, pid) (errno = EINVAL, -1) +#endif +#endif diff --git a/sim/tic80/tic80.dc b/sim/tic80/tic80.dc new file mode 100644 index 0000000..4199826 --- /dev/null +++ b/sim/tic80/tic80.dc @@ -0,0 +1,6 @@ +# most instructions +switch: 21: 12: 21: 12 +switch: 11: 7: 6: 12 +#switch: 21: 13: 21: 13 +#switch: 12: 7: 6: 13 +switch: 27: 27: 27: 27 diff --git a/sim/tic80/tic80.ic b/sim/tic80/tic80.ic new file mode 100644 index 0000000..de81d14 --- /dev/null +++ b/sim/tic80/tic80.ic @@ -0,0 +1,52 @@ +cache:Dest:Dest: +cache:Dest:rDest:signed_word *:(&(CPU)->reg[Dest]) +# +cache:Source1:Source1: +cache:Source1:vSource1:signed_word:(GPR (Source1) + 0) +#cache:Source1:vSource1:signed_word:(Source1 == 0 ? 0 : (CPU)->reg[Source1]) +# +cache:Source2:Source2: +cache:Source2:vSource2:signed_word:(GPR (Source2) + 0) +#cache:Source2:vSource2:signed_word:(Source2 == 0 ? 0 : (CPU)->reg[Source2]) +# +cache:Source:Source: +cache:Source:vSource:signed_word:(GPR (Source) + 0) +#cache:Source:vSource:signed_word:(Source == 0 ? 0 : (CPU)->reg[Source]) +# +cache:IndOff:IndOff: +cache:IndOff:rIndOff:signed_word:(GPR (IndOff) + 0) +#cache:IndOff:rIndOff:signed_word:(IndOff == 0 ? 0 : (CPU)->reg[IndOff]) +# +cache:Base:Base: +cache:Base:vBase:signed_word:(GPR (Base) + 0) +cache:Base:rBase:signed_word*:(&GPR (Base)) +#cache:Base:vBase:signed_word:(Base == 0 ? 0 : (CPU)->reg[Base]) +# +cache:Link:Link: +cache:Link:rLink:signed_word*:(&(CPU)->reg[Link]) +# +# Trap Number +cache:UTN:UTN: +cache:INDTR:INDTR: +cache:INDTR:UTN:unsigned_word:(INDTR == 0 ? 0 : (CPU)->reg[INDTR]) +# +cache:A:A: +# +cache:SignedImmediate:SignedImmediate: +cache:SignedImmediate:vSource1:signed_word:SEXT (SignedImmediate, 14) +# +cache:UnsignedImmediate:UnsignedImmediate: +cache:UnsignedImmediate:vSource1:signed_word:UnsignedImmediate +# +cache:BITNUM:BITNUM: +cache:Code:Code: +cache:BITNUM:bitnum:int:(~BITNUM) & 0x1f + +# +cache:SignedOffset:SignedOffset: +cache:SignedOffset:vSignedOffset:signed_word:SEXT (SignedOffset, 14) +# +cache:UCRN:UCRN: +cache:INDCR:INDCR: +cache:INDCR:UCRN:unsigned32:(GPR (INDCR) + 0) +#cache:INDCR:UCRN:unsigned32:(INDCR == 0 ? 0 : (CPU)->reg[INDCR]) diff --git a/sim/tic80/tic80.igen b/sim/tic80/tic80.igen new file mode 100644 index 0000000..1595693f --- /dev/null +++ b/sim/tic80/tic80.igen @@ -0,0 +1,1615 @@ +// Texas Instruments TMS320C80 (MVP) Simulator. + + +// The following is called when ever an illegal instruction is encountered. +:internal::::illegal: +{ + sim_io_eprintf (SD, "0x%lx: illegal instruction\n", (unsigned long) cia.ip); + sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGILL); +} + +// The following is called when ever an FP op is attempted with FPU disabled. +:internal::::fp_unavailable: +{ + sim_io_eprintf (SD, "0x%lx: floating-point unavailable\n", (unsigned long) cia.ip); + sim_engine_halt (SD, CPU, NULL, cia, sim_signalled, SIM_SIGFPE); +} + +// Handle a branch instruction +:function:::instruction_address:do_branch:int annul, address_word target, int rLink_p, unsigned32 *rLink +{ + instruction_address nia; + if (annul) + { + if (rLink_p) + *rLink = cia.dp; + nia.ip = target; + nia.dp = target + 4; + } + else + { + if (rLink_p) + *rLink = cia.dp + sizeof (instruction_word); + nia.ip = cia.dp; + nia.dp = target; + } + return nia; +} + +// Signed Integer Add - add source1, source2, dest +:function:::void:do_add:unsigned32 *rDest, signed32 source1, signed32 source2 +{ + unsigned32 result; + ALU_BEGIN (source1); + ALU_ADD (source2); + ALU_END (result); + *rDest = result; + TRACE_ALU3 (MY_INDEX, result, source1, source2); + /* FIXME - a signed add may cause an exception */ +} +31.Dest,26.Source2,21.0b101100,15.0,14.SignedImmediate::::add i +"add , r, r" +{ + do_add (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b11101100,13.0,12.0,11./,4.Source1::::add r +"add r, r, r" +{ + do_add (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b11101100,13.0,12.1,11./+LongSignedImmediate::::add l +"add 0x%08lx, r, r" +{ + do_add (_SD, rDest, LongSignedImmediate, vSource2); +} + + +// Unsigned Integer Add - addu source1, source2, dest +:function:::void:do_addu:unsigned32 *rDest, unsigned32 source1, unsigned32 source2 +{ + unsigned32 result = source1 + source2; + TRACE_ALU3 (MY_INDEX, result, source1, source2); + *rDest = result; +} + +31.Dest,26.Source2,21.0b101100,15.1,14.SignedImmediate::::addu i +"addu , r, r" +{ + do_addu (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b11101100,13.1,12.0,11./,4.Source1::::addu r +"addu r, r, r" +{ + do_addu (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b11101100,13.1,12.1,11./+LongSignedImmediate::::addu l +"addu 0x%08lx, r, r" +{ + do_addu (_SD, rDest, LongSignedImmediate, vSource2); +} + + +:function:::void:do_and:signed32 *rDest, signed32 source1, signed32 source2 +{ + unsigned32 result = source1 & source2; + TRACE_ALU3 (MY_INDEX, result, source1, source2); + *rDest = result; +} + + +// and, and.tt +31.Dest,26.Source2,21.0b0010001,14.UnsignedImmediate::::and.tt i +"and.tt , r, r" +{ + do_and (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110010001,12.0,11./,4.Source1::::and.tt r +"and.tt r, r, r" +{ + do_and (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110010001,12.1,11./+LongSignedImmediate::::and.tt l +"and.tt 0x%08lx, r, r" +{ + do_and (_SD, rDest, LongSignedImmediate, vSource2); + +} + +// and.ff +31.Dest,26.Source2,21.0b0011000,14.UnsignedImmediate::::and.ff i +"and.ff , r, r" +{ + do_and (_SD, rDest, ~vSource1, ~vSource2); +} +31.Dest,26.Source2,21.0b110011000,12.0,11./,4.Source1::::and.ff r +"and.ff r, r, r" +{ + do_and (_SD, rDest, ~vSource1, ~vSource2); +} +31.Dest,26.Source2,21.0b110011000,12.1,11./+LongSignedImmediate::::and.ff l +"and.ff 0x%08lx, r, r" +{ + do_and (_SD, rDest, ~LongSignedImmediate, ~vSource2); +} + +// and.ft +31.Dest,26.Source2,21.0b0010100,14.UnsignedImmediate::::and.ft i +"and.ft , r, r" +{ + do_and (_SD, rDest, ~vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110010100,12.0,11./,4.Source1::::and.ft r +"and.ft r, r, r" +{ + do_and (_SD, rDest, ~vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110010100,12.1,11./+LongSignedImmediate::::and.ft l +"and.ft 0x%08lx, r, r" +{ + do_and (_SD, rDest, ~LongSignedImmediate, vSource2); +} + +// and.tf +31.Dest,26.Source2,21.0b0010010,14.UnsignedImmediate::::and.tf i +"and.tf , r, r" +{ + do_and (_SD, rDest, vSource1, ~vSource2); +} +31.Dest,26.Source2,21.0b110010010,12.0,11./,4.Source1::::and.tf r +"and.tf r, r, r" +{ + do_and (_SD, rDest, vSource1, ~vSource2); +} +31.Dest,26.Source2,21.0b110010010,12.1,11./+LongSignedImmediate::::and.tf l +"and.tf 0x%08lx, r, r" +{ + do_and (_SD, rDest, LongSignedImmediate, ~vSource2); +} + +// bbo[.a] +:function:::instruction_address:do_bbo:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset +{ + int jump_p; + address_word target = cia.ip + 4 * offset; + if (MASKED32 (source, bitnum, bitnum)) + { + nia = do_branch (_SD, annul, target, 0, NULL); + jump_p = 1; + } + else + jump_p = 0; + TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1); + return nia; +} +:%s::::A:int A +{ + if (A) + return ".a"; + else + return ""; +} +31.BITNUM,26.Source,21.0b100101,15.A,14.SignedOffset::::bbo i +"bbo%s , r, " +{ + nia = do_bbo (_SD, nia, bitnum, vSource, A, vSignedOffset); +} +31.BITNUM,26.Source,21.0b11100101,13.A,12.0,11./,4.IndOff::::bbo r +"bbo%s r, r, " +{ + nia = do_bbo (_SD, nia, bitnum, vSource, A, rIndOff); +} +31.BITNUM,26.Source,21.0b11100101,13.A,12.1,11./+LongSignedImmediate::::bbo l +"bbo%s , r, " +{ + nia = do_bbo (_SD, nia, bitnum, vSource, A, LongSignedImmediate); +} + +// bbz[.a] +:function:::instruction_address:do_bbz:instruction_address nia, int bitnum, unsigned32 source, int annul, unsigned32 offset +{ + int jump_p; + address_word target = cia.ip + 4 * offset; + if (!MASKED32 (source, bitnum, bitnum)) + { + nia = do_branch (_SD, annul, target, 0, NULL); + jump_p = 1; + } + else + jump_p = 0; + TRACE_COND_BR(MY_INDEX, jump_p, bitnum, target, -1, -1); + return nia; +} +31.BITNUM,26.Source,21.0b100100,15.A,14.SignedOffset::::bbz i +"bbz%s , r, " +{ + nia = do_bbz (_SD, nia, bitnum, vSource, A, vSignedOffset); +} +31.BITNUM,26.Source,21.0b11100100,13.A,12.0,11./,4.IndOff::::bbz r +"bbz%s r, r, " +{ + nia = do_bbz (_SD, nia, bitnum, vSource, A, rIndOff); +} +31.BITNUM,26.Source,21.0b11100100,13.A,12.1,11./+LongSignedImmediate::::bbz l +"bbz%s , r, " +{ + nia = do_bbz (_SD, nia, bitnum, vSource, A, LongSignedImmediate); +} + +// bcnd[.a] +:function:::instruction_address:do_bcnd:instruction_address nia, int Cond, unsigned32 source, int annul, unsigned32 offset +{ + int condition; + int size = EXTRACTED32 (Cond, 31 - 27, 30 - 27); + int code = EXTRACTED32 (Cond, 29 - 27, 27 - 27); + signed32 val = 0; + address_word target = cia.ip + 4 * offset; + switch (size) + { + case 0: val = SEXT32 (source, 7); break; + case 1: val = SEXT32 (source, 15); break; + case 2: val = source; break; + default: sim_engine_abort (SD, CPU, cia, "bcnd - reserved size"); + } + switch (code) + { + case 0: condition = 0; break; + case 1: condition = val > 0; break; + case 2: condition = val == 0; break; + case 3: condition = val >= 0; break; + case 4: condition = val < 0; break; + case 5: condition = val != 0; break; + case 6: condition = val <= 0; break; + default: condition = 1; break; + } + if (condition) + { + nia = do_branch (_SD, annul, target, 0, NULL); + } + TRACE_COND_BR(MY_INDEX, condition, val, target, size, code); + return nia; +} +31.Code,26.Source,21.0b100110,15.A,14.SignedOffset::::bcnd i +"bcnd%s , r, " +{ + nia = do_bcnd (_SD, nia, Code, vSource, A, vSignedOffset); +} +31.Code,26.Source,21.0b11100110,13.A,12.0,11./,4.IndOff::::bcnd r +"bcnd%s r, r, " +{ + nia = do_bcnd (_SD, nia, Code, vSource, A, rIndOff); +} +31.Code,26.Source,21.0b11100110,13.A,12.1,11./+LongSignedImmediate::::bcnd l +"bcnd%s , r, " +{ + nia = do_bcnd (_SD, nia, Code, vSource, A, LongSignedImmediate); +} + +// br[.a] - see bbz[.a] + + +// brcr +:function:::sim_cia:do_brcr:instruction_address nia, int cr +{ + if (cr >= 0x4000 || !(CPU)->is_user_mode) + { + unsigned32 control = CR (cr); + unsigned32 ie = control & 0x00000001; + unsigned32 pc = control & 0xfffffffc; + unsigned32 is_user_mode = control & 0x00000002; + (CPU)->is_user_mode = is_user_mode; + nia.dp = pc; + if (ie) + (CPU)->cr[IE_CR] |= IE_CR_IE; + else + (CPU)->cr[IE_CR] &= ~IE_CR_IE; + } + TRACE_UCOND_BR (MY_INDEX, nia.dp); + return nia; +} +31.//,27.0,26.//,21.0b0000110,14.UCRN::::brcr i +"brcr CR[]" +{ + nia = do_brcr (_SD, nia, UCRN); +} +31.//,27.0,26.//,21.0b110000110,12.0,11./,4.INDCR::::brcr r +"brcr CR[r]" +{ + nia = do_brcr (_SD, nia, UCRN); +} +31.//,27.0,26.//,21.0b110000110,12.1,11./+UnsignedControlRegisterNumber::::brcr l +"brcr CR[]" +{ + nia = do_brcr (_SD, nia, UnsignedControlRegisterNumber); +} + +// bsr[.a] +:function:::instruction_address:do_bsr:instruction_address nia, signed32 *rLink, int annul, unsigned32 offset +{ + address_word target = cia.ip + 4 * offset; + nia = do_branch (_SD, annul, target, 1, rLink); + TRACE_UCOND_BR (MY_INDEX, target); + return nia; +} +31.Link,26./,21.0b100000,15.A,14.SignedOffset::::bsr i +"bsr%s , r" +{ + nia = do_bsr (_SD, nia, rLink, A, vSignedOffset); +} +31.Link,26./,21.0b11100000,13.A,12.0,11./,4.IndOff::::bsr r +"bsr%s r, r" +{ + nia = do_bsr (_SD, nia, rLink, A, rIndOff); +} +31.Link,26./,21.0b11100000,13.A,12.1,11./+LongSignedImmediate::::bsr l +"bsr%s , r" +{ + nia = do_bsr (_SD, nia, rLink, A, LongSignedImmediate); +} + +// cmnd +:function:::void:do_cmnd:signed32 source +{ + int Reset = EXTRACTED32 (source, 31, 31); + int Halt = EXTRACTED32 (source, 30, 30); + int Unhalt = EXTRACTED32 (source, 29, 29); + /* int ICR = EXTRACTED32 (source, 28, 28); */ + /* int DCR = EXTRACTED32 (source, 27, 27); */ + int Task = EXTRACTED32 (source, 14, 14); + int Msg = EXTRACTED32 (source, 13, 13); + int VC = EXTRACTED32 (source, 10, 10); + int TC = EXTRACTED32 (source, 9, 9); + int MP = EXTRACTED32 (source, 8, 8); + int PP = EXTRACTED32 (source, 3, 0); + /* what is implemented? */ + if (PP != 0) + sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - PPs not supported", + (unsigned long) cia.ip); + if (VC != 0) + sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - VC not supported", + (unsigned long) cia.ip); + if (TC != 0) + sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - TC not supported", + (unsigned long) cia.ip); + if (MP) + { + if (Reset || Halt) + sim_engine_halt (SD, CPU, NULL, cia, sim_exited, 0); + if (Unhalt) + sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Can not unhalt the MP", + (unsigned long) cia.ip); + /* if (ICR || DCR); */ + if (Task) + sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Can not Task the MP", + (unsigned long) cia.ip); + if (Msg) + sim_engine_abort (SD, CPU, cia, "0x%lx: cmnd - Msg to MP not suported", + (unsigned long) cia.ip); + } + TRACE_SINK1 (MY_INDEX, source); +} +31./,21.0b0000010,14.UI::::cmnd i +"cmnd " +{ + do_cmnd (_SD, UI); +} +31./,21.0b110000010,12.0,11./,4.Source::::cmnd r +"cmnd r" +{ + do_cmnd (_SD, vSource); +} +31./,21.0b110000010,12.1,11./+LongUnsignedImmediate::::cmnd l +"cmnd " +{ + do_cmnd (_SD, LongUnsignedImmediate); +} + +// cmp +:function:::unsigned32:cmp_vals:signed32 s1, unsigned32 u1, signed32 s2, unsigned32 u2 +{ + unsigned32 field = 0; + if (s1 == s2) field |= 0x001; + if (s1 != s2) field |= 0x002; + if (s1 > s2) field |= 0x004; + if (s1 <= s2) field |= 0x008; + if (s1 < s2) field |= 0x010; + if (s1 >= s2) field |= 0x020; + if (u1 > u2) field |= 0x040; + if (u1 <= u2) field |= 0x080; + if (u1 < u2) field |= 0x100; + if (u1 >= u2) field |= 0x200; + return field; +} +:function:::void:do_cmp:unsigned32 *rDest, unsigned32 source1, unsigned32 source2 +{ + unsigned32 field = 0; + field |= cmp_vals (_SD, source1, source1, source2, source2) << 20; + field |= cmp_vals (_SD, (signed16)source1, (unsigned16)source1, + (signed16)source2, (unsigned16)source2) << 10; + field |= cmp_vals (_SD, (signed8)source1, (unsigned8)source1, + (signed8)source2, (unsigned8)source2); + TRACE_CMP (MY_INDEX, field, source1, source2); + *rDest = field; +} +31.Dest,26.Source2,21.0b1010000,14.SignedImmediate::::cmp i +"cmp , r, r" +{ + do_cmp (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b111010000,12.0,11./,4.Source1::::cmp r +"cmp r, r, r" +{ + do_cmp (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b111010000,12.1,11./+LongSignedImmediate::::cmp l +"cmp 0x%08lx, r, r" +{ + do_cmp (_SD, rDest, LongSignedImmediate, vSource2); +} + +// dcache +:%s::::F:int F +{ + if (F) + return "f"; + else + return "c"; +} +31./,27.F,26.Source2,21.0b0111,17.m,16.0b00,14.SignedOffset::::dcache i +"dcache%s (r%s)" +{ + TRACE_NOP (MY_INDEX); + /* NOP */ +} +31./,27.F,26.Source2,21.0b110111,15.m,14.0b00,12.0,11./,4.Source1::::dcache r +"dcache%s r (r%s)" +{ + TRACE_NOP (MY_INDEX); + /* NOP */ +} +31./,27.F,26.Source2,21.0b110111,15.m,14.0b00,12.1,11./+LongSignedImmediate::::dcache l +"dcache%s (r%s)" +{ + TRACE_NOP (MY_INDEX); + /* NOP */ +} + +// dld[{.b|.h|.d}] +void::function::do_dld:int Dest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset +{ + do_ld (_SD, Dest, base, rBase, m, sz, S, offset); +} +31.Dest,26.Base,21.0b110100,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dld r +"dld%s r%s (r%s), r" +{ + do_dld (_SD, Dest, vBase, rBase, m, sz, S, rIndOff); +} +31.Dest,26.Base,21.0b110100,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dld l +"dld%s 0x%08lx%s (r%s), r" +{ + do_dld (_SD, Dest, vBase, rBase, m, sz, S, LongSignedImmediateOffset); +} + +// dld.u[{.b|.h|.d}] +void::function::do_dld_u:unsigned32 *rDest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset +{ + do_ld_u (_SD, rDest, base, rBase, m, sz, S, offset); +} +31.Dest,26.Base,21.0b110101,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dld.u r +"dld.u%s r%s (r%s), r" +{ + do_dld_u (_SD, rDest, vBase, rBase, m, sz, S, rIndOff); +} +31.Dest,26.Base,21.0b110101,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dld.u l +"dld.u%s 0x%08lx%s (r%s), r" +{ + do_dld_u (_SD, rDest, vBase, rBase, m, sz, S, LongSignedImmediateOffset); +} + +// dst[{.b|.h|.d}] +void::function::do_dst:int Source, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset +{ + do_st (_SD, Source, base, rBase, m, sz, S, offset); +} +31.Source,26.Base,21.0b110110,15.m,14.sz,12.0,11.S,10.1,9./,4.IndOff::::dst r +"dst%s r%s (r%s), r" +{ + do_dst (_SD, Source, vBase, rBase, m, sz, S, rIndOff); +} +31.Source,26.Base,21.0b110110,15.m,14.sz,12.1,11.S,10.1,9./+LongSignedImmediateOffset::::dst l +"dst%s 0x%08lx%s (r%s), r" +{ + do_dst (_SD, Source, vBase, rBase, m, sz, S, LongSignedImmediateOffset); +} + +// estop +31./,21.0b1111111,14.1,13.0,12.0,11./::::estop + +// etrap +31./,27.1,26./,21.0b0000001,14.UTN::::etrap i +31./,27.1,26./,21.0b110000001,12.0,11./,4.iUTN::::etrap r +31./,27.1,26./,21.0b110000001,12.1,11./::::etrap l + + +// exts - see shift.ds + + +// extu - see shift.dz + + +sim_fpu::function::get_fp_reg:int reg, unsigned32 val, int precision +{ + sim_fpu ans; + switch (precision) + { + case 0: /* single */ + sim_fpu_32to (&ans, val); + break; + case 1: /* double */ + if (reg < 0) + sim_engine_abort (SD, CPU, cia, "DP immediate invalid"); + if (reg & 1) + sim_engine_abort (SD, CPU, cia, "DP FP register must be even"); + if (reg <= 1) + sim_engine_abort (SD, CPU, cia, "DP FP register must be >= 2"); + sim_fpu_232to (&ans, GPR (reg + 1), GPR (reg)); + break; + case 2: /* 32 bit signed integer */ + sim_fpu_i32to (&ans, val, 0); + break; + case 3: /* 32 bit unsigned integer */ + sim_fpu_u32to (&ans, val, 0); + break; + default: + sim_engine_abort (SD, CPU, cia, "Unsupported FP precision"); + } + return ans; +} +void::function::set_fp_reg:int Dest, sim_fpu val, int PD +{ + switch (PD) + { + case 0: /* single */ + { + sim_fpu_to32 (&GPR (Dest), &val); + break; + } + case 1: /* double */ + { + if (Dest & 1) + sim_engine_abort (SD, CPU, cia, "DP FP Dest register must be even"); + if (Dest <= 1) + sim_engine_abort (SD, CPU, cia, "DP FP Dest register must be >= 2"); + sim_fpu_to232 (&GPR (Dest + 1), &GPR (Dest + 0), &val); + break; + } + case 2: /* signed */ + { + sim_fpu_to32i (&GPR (Dest), &val, 0); + break; + } + case 3: /* unsigned */ + { + sim_fpu_to32u (&GPR (Dest), &val, 0); + break; + } + default: + sim_engine_abort (SD, CPU, cia, "Unsupported FP precision"); + } + +} +// fadd.{s|d}{s|d}{s|d} +void::function::do_fadd:int Dest, int PD, sim_fpu s1, sim_fpu s2 +{ + sim_fpu ans; + sim_fpu_add (&ans, &s1, &s2); + TRACE_FPU3 (ans, s1, s2); + set_fp_reg (_SD, Dest, ans, PD); +} +const char *::function::str_PX:int PX +{ + switch (PX) + { + case 0: return "s"; + case 1: return "d"; + case 2: return "i"; + case 3: return "u"; + default: return "?"; + } +} +31.Dest,26.Source2,21.0b111110000,12.0,11.r,10.PD,8.P2,6.P1,4.Source1::f::fadd r +"fadd.%s%s%s r, r, r" +{ + do_fadd (_SD, Dest, PD, + get_fp_reg (_SD, Source1, vSource1, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} +31.Dest,26.Source2,21.0b111110000,12.1,11.r,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fadd l +"fadd.%s%s%s 0x%08lx, r, r" +{ + do_fadd (_SD, Dest, PD, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); + +} + +// fcmp.{s|d}{s|d}{s|d} +void::function::do_fcmp:unsigned32 *rDest, sim_fpu s1, sim_fpu s2 +{ + unsigned32 result = 0; + if (sim_fpu_is_nan (&s1) || sim_fpu_is_nan (&s2)) + result |= BIT32 (30); + else + { + result |= BIT32 (31); + if (sim_fpu_is_eq (&s1, &s2)) result |= BIT32(20); + if (sim_fpu_is_ne (&s1, &s2)) result |= BIT32(21); + if (sim_fpu_is_gt (&s1, &s2)) result |= BIT32(22); + if (sim_fpu_is_le (&s1, &s2)) result |= BIT32(23); + if (sim_fpu_is_lt (&s1, &s2)) result |= BIT32(24); + if (sim_fpu_is_ge (&s1, &s2)) result |= BIT32(25); + if (sim_fpu_is_lt (&s1, &sim_fpu_zero) + || sim_fpu_is_gt (&s1, &s2)) result |= BIT32(26); + if (sim_fpu_is_lt (&sim_fpu_zero, &s1) + && sim_fpu_is_lt (&s1, &s2)) result |= BIT32(27); + if (sim_fpu_is_le (&sim_fpu_zero, &s1) + && sim_fpu_is_le (&s1, &s2)) result |= BIT32(28); + if (sim_fpu_is_le (&s1, &sim_fpu_zero) + || sim_fpu_is_ge (&s1, &s2)) result |= BIT32(29); + } + *rDest = result; + TRACE_FPU2CMP (result, s1, s2); +} +31.Dest,26.Source2,21.0b111110101,12.0,11./,10.0,8.P2,6.P1,4.Source1::f::fcmp r +"fcmp.%s%s r, r, r" +{ + do_fcmp (_SD, rDest, + get_fp_reg (_SD, Source1, vSource1, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} +31.Dest,26.Source2,21.0b111110101,12.1,11./,10.0,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fcmp l +"fcmp.%s%s 0x%08lx, r, r" +{ + do_fcmp (_SD, rDest, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} + + +// fdiv.{s|d}{s|d}{s|d} +void::function::do_fdiv:int Dest, int PD, sim_fpu s1, sim_fpu s2 +{ + sim_fpu ans; + sim_fpu_div (&ans, &s1, &s2); + TRACE_FPU3 (ans, s1, s2); + set_fp_reg (_SD, Dest, ans, PD); +} +31.Dest,26.Source2,21.0b111110011,12.0,11./,10.PD,8.P2,6.P1,4.Source1::f::fdiv r +"fdiv.%s%s%s r, r, r" +{ + do_fdiv (_SD, Dest, PD, + get_fp_reg (_SD, Source1, vSource1, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} +31.Dest,26.Source2,21.0b111110011,12.1,11./,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fdiv l +"fdiv.%s%s%s 0x%08lx, r, r" +{ + do_fdiv (_SD, Dest, PD, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} + +// fmpy.{s|d|i|u}{s|d|i|u}{s|d|i|u} +void::function::do_fmpy:int Dest, int PD, sim_fpu s1, sim_fpu s2 +{ + switch (PD) + { + case 2: /* signed */ + { + signed64 i1; + signed64 i2; + sim_fpu_to64i (&i1, &s1, 0); + sim_fpu_to64i (&i2, &s2, 0); + GPR (Dest) = i1 * i2; + TRACE_FPU2I (GPR (Dest), s1, s2); + break; + } + case 3: /* unsigned */ + { + unsigned64 u1; + unsigned64 u2; + sim_fpu_to64u (&u1, &s1, 0); + sim_fpu_to64u (&u2, &s2, 0); + GPR (Dest) = u1 * u2; + TRACE_FPU2I (GPR (Dest), s1, s2); + break; + } + default: + { + sim_fpu ans; + sim_fpu_mul (&ans, &s1, &s2); + set_fp_reg (_SD, Dest, ans, PD); + TRACE_FPU3 (ans, s1, s2); + } + } +} +31.Dest,26.Source2,21.0b111110010,12.0,11./,10.PD,8.P2,6.P1,4.Source1::f::fmpy r +"fmpy.%s%s%s r, r, r" +{ + do_fmpy (_SD, Dest, PD, + get_fp_reg (_SD, Source1, vSource1, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} +31.Dest,26.Source2,21.0b111110010,12.1,11./,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fmpy l +"fmpy.%s%s%s 0x%08lx, r, r" +{ + do_fmpy (_SD, Dest, PD, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} + +// frndm.{s|d|i|u}{s|d|i|u} +void::function::do_frnd:int Dest, int PD, sim_fpu s1 +{ + set_fp_reg (_SD, Dest, s1, PD); + TRACE_FPU1 (s1); +} +31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b11,6.P1,4.Source::f::frndm r +"frndm.%s%s r, r" +{ + do_frnd (_SD, Dest, PD, + get_fp_reg (_SD, Source, vSource, P1)); +} +31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b11,6.P1,4./+SinglePrecisionFloatingPoint::f::frndm l +"frndm.%s%s 0x%08lx, r" +{ + do_frnd (_SD, Dest, PD, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1)); +} + +// frndn.{s|d|i|u}{s|d|i|u} +31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b00,6.P1,4.Source::f::frndn r +"frndn.%s%s r, r" +{ + do_frnd (_SD, Dest, PD, + get_fp_reg (_SD, Source, vSource, P1)); +} +31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b00,6.P1,4./+SinglePrecisionFloatingPoint::f::frndn l +"frndn.%s%s 0x%08lx, r" +{ + do_frnd (_SD, Dest, PD, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1)); +} + +// frndp.{s|d|i|u}{s|d|i|u} +31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b10,6.P1,4.Source::f::frndp r +"frndp.%s%s r, r" +{ + do_frnd (_SD, Dest, PD, + get_fp_reg (_SD, Source, vSource, P1)); +} +31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b10,6.P1,4./+SinglePrecisionFloatingPoint::f::frndp l +"frndp.%s%s 0x%08lx, r" +{ + do_frnd (_SD, Dest, PD, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1)); +} + +// frndz.{s|d|i|u}{s|d|i|u} +31.Dest,26./,21.0b111110100,12.0,11.r,10.PD,8.0b01,6.P1,4.Source::f::frndz r +"frndz.%s%s r, r" +{ + do_frnd (_SD, Dest, PD, + get_fp_reg (_SD, Source, vSource, P1)); +} +31.Dest,26./,21.0b111110100,12.1,11.r,10.PD,8.0b01,6.P1,4./+SinglePrecisionFloatingPoint::f::frndz l +"frndz.%s%s 0x%08lx, r" +{ + do_frnd (_SD, Dest, PD, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1)); +} + +// fsqrt.{s|d}{s|d}{s|d} +#void::function::do_fsqrt:unsigned32 *rDest, unsigned32 Source, unsigned32 Source2 +# sim_io_error ("fsqrt"); +31.Dest,26./,21.0b111110111,12.0,11./,10.PD,8.//,6.P1,4.Source::f::fsqrt r +"fsqrt.%s%s r, r" +# do_fsqrt (_SD, rDest, vSource); +31.Dest,26./,21.0b111110111,12.1,11./,10.PD,8.//,6.P1,4./+SinglePrecisionFloatingPoint::f::fsqrt l +"fsqrt.%s%s 0x%08lx, r" +# do_fsqrt (_SD, rDest, SinglePrecisionFloatingPoint); + + +// fsub.{s|d}{s|d}{s|d} +void::function::do_fsub:int Dest, int PD, sim_fpu s1, sim_fpu s2 +{ + sim_fpu ans; + sim_fpu_sub (&ans, &s1, &s2); + TRACE_FPU3 (ans, s1, s2); + set_fp_reg (_SD, Dest, ans, PD); +} +31.Dest,26.Source2,21.0b111110001,12.0,11.r,10.PD,8.P2,6.P1,4.Source1::f::fsub r +"fsub.%s%s%s r, r, r" +{ + do_fsub (_SD, Dest, PD, + get_fp_reg (_SD, Source1, vSource1, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} +31.Dest,26.Source2,21.0b111110001,12.1,11.r,10.PD,8.P2,6.P1,4./+SinglePrecisionFloatingPoint::f::fsub l +"fsub.%s%s%s 0x%08lx, r, r" +{ + do_fsub (_SD, Dest, PD, + get_fp_reg (_SD, -1, SinglePrecisionFloatingPoint, P1), + get_fp_reg (_SD, Source2, vSource2, P2)); +} + +// illop +31./,21.0b0000000,14./::::illop +"illop" +31./,21.0b111111111,12./::::illop l +"illop" + + +// ins - see sl.im + + +// jsr[.a] +instruction_address::function::do_jsr:instruction_address nia, signed32 *rLink, int annul, unsigned32 offset, unsigned32 base +{ + address_word target = offset + base; + TRACE_UCOND_BR (MY_INDEX, target); + nia = do_branch (_SD, annul, target, 1, rLink); + if (nia.dp & 0x3) + sim_engine_abort (SD, CPU, cia, + "0x%lx: destination address 0x%lx misaligned", + (unsigned long) cia.ip, + (unsigned long) nia.dp); + return nia; +} +31.Link,26.Base,21.0b100010,15.A,14.SignedOffset::::jsr i +"jsr%s , r" +{ + nia = do_jsr (_SD, nia, rLink, A, vSignedOffset, vBase); +} +31.Link,26.Base,21.0b11100010,13.A,12.0,11./,4.IndOff::::jsr r +"jsr%s r, r" +{ + nia = do_jsr (_SD, nia, rLink, A, rIndOff, vBase); +} +31.Link,26.Base,21.0b11100010,13.A,12.1,11./+LongSignedImmediate::::jsr l +"jsr%s , r" +{ + nia = do_jsr (_SD, nia, rLink, A, LongSignedImmediate, vBase); +} + +// ld[{.b.h.d}] +void::function::do_ld:int Dest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset +{ + unsigned32 addr; + switch (sz) + { + case 0: + addr = base + (S ? (offset << 0) : offset); + if (m) + *rBase = addr; + GPR(Dest) = MEM (signed, addr, 1); + break; + case 1: + addr = base + (S ? (offset << 1) : offset); + if (m) + *rBase = addr; + GPR(Dest) = MEM (signed, addr, 2); + break; + case 2: + addr = base + (S ? (offset << 2) : offset); + if (m) + *rBase = addr; + GPR(Dest) = MEM (signed, addr, 4); + break; + case 3: + { + signed64 val; + if (Dest & 0x1) + sim_engine_abort (SD, CPU, cia, "0x%lx: ld.d to odd register %d", + cia.ip, Dest); + addr = base + (S ? (offset << 3) : offset); + if (m) + *rBase = addr; + val = MEM (signed, addr, 8); + GPR(Dest + 1) = VH4_8 (val); + GPR(Dest + 0) = VL4_8 (val); + } + break; + default: + addr = -1; + sim_engine_abort (SD, CPU, cia, "ld - invalid sz %d", sz); + } + TRACE_LD (GPR(Dest), m, S, base, offset); +} +const char *::function::str_sz:int sz +{ + switch (sz) + { + case 0: return ".b"; + case 1: return ".h"; + case 2: return ""; + case 3: return ".d"; + default: return "?"; + } +} +const char *::function::str_m:int m +{ + if (m) + return ":m"; + else + return ""; +} +const char *::function::str_S:int S +{ + if (S) + return ":s"; + else + return ""; +} +31.Dest,26.Base,21.0b0100,17.m,16.sz,14.SignedOffset::::ld i +"ld%s (r%s), r" +{ + do_ld (_SD, Dest, vBase, rBase, m, sz, 0, vSignedOffset); +} +31.Dest,26.Base,21.0b110100,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::ld r +"ld%s r%s (r%s), r" +{ + do_ld (_SD, Dest, vBase, rBase, m, sz, S, rIndOff); +} +31.Dest,26.Base,21.0b110100,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::ld l +"ld%s 0x%08lx%s (r%s), r" +{ + do_ld (_SD, Dest, vBase, rBase, m, sz, S, LongSignedImmediateOffset); +} + +// ld.u[{.b.h.d}] +void::function::do_ld_u:unsigned32 *rDest, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset +{ + unsigned32 addr; + switch (sz) + { + case 0: + addr = base + (S ? (offset << 0) : offset); + *rDest = MEM (unsigned, addr, 1); + break; + case 1: + addr = base + (S ? (offset << 1) : offset); + *rDest = MEM (unsigned, addr, 2); + break; + default: + addr = -1; + sim_engine_abort (SD, CPU, cia, "ld.u - invalid sz %d", sz); + } + if (m) + *rBase = addr; + TRACE_LD (m, S, *rDest, base, offset); +} +31.Dest,26.Base,21.0b0101,17.m,16.sz,14.SignedOffset::::ld.u i +"ld.u%s (r%s), r" +{ + do_ld_u (_SD, rDest, vBase, rBase, m, sz, 0, vSignedOffset); +} +31.Dest,26.Base,21.0b110101,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::ld.u r +"ld.u%s r%s (r%s), r" +{ + do_ld_u (_SD, rDest, vBase, rBase, m, sz, S, rIndOff); +} +31.Dest,26.Base,21.0b110101,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::ld.u l +"ld.u%s 0x%08lx%s (r%s), r" +{ + do_ld_u (_SD, rDest, vBase, rBase, m, sz, S, LongSignedImmediateOffset); +} + +// lmo +31.Dest,26.Source,21.0b111111000,12.0,11./::::lmo +"lmo r, r" +{ + int b; + for (b = 0; b < 32; b++) + if (vSource & BIT32 (31 - b)) + break; + TRACE_ALU2 (MY_INDEX, b, vSource); + *rDest = b; +} + + +// nop - see rdcr 0, r0 + + +void::function::do_or:unsigned32 *rDest, unsigned32 Source1, unsigned32 Source2 +{ + unsigned32 result = Source1 | Source2; + TRACE_ALU3 (MY_INDEX, result, Source1, Source2); + *rDest = result; +} + +// or, or.tt +31.Dest,26.Source2,21.0b0010111,14.UnsignedImmediate::::or.tt i +"or.tt , r, r" +{ + do_or (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110010111,12.0,11./,4.Source1::::or.tt r +"or.tt r, r, r" +{ + do_or (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110010111,12.1,11./+LongUnsignedImmediate::::or.tt l +"or.tt 0x%08lx, r, r" +{ + do_or (_SD, rDest, LongUnsignedImmediate, vSource2); +} + +// or.ff +31.Dest,26.Source2,21.0b0011110,14.UnsignedImmediate::::or.ff i +"or.ff , r, r" +{ + do_or (_SD, rDest, ~vSource1, ~vSource2); +} +31.Dest,26.Source2,21.0b110011110,12.0,11./,4.Source1::::or.ff r +"or.ff r, r, r" +{ + do_or (_SD, rDest, ~vSource1, ~vSource2); +} +31.Dest,26.Source2,21.0b110011110,12.1,11./+LongUnsignedImmediate::::or.ff l +"or.ff 0x%08lx, r, r" +{ + do_or (_SD, rDest, ~LongUnsignedImmediate, ~vSource2); +} + +// or.ft +31.Dest,26.Source2,21.0b0011101,14.UnsignedImmediate::::or.ft i +"or.ft , r, r" +{ + do_or (_SD, rDest, ~vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110011101,12.0,11./,4.Source1::::or.ft r +"or.ft r, r, r" +{ + do_or (_SD, rDest, ~vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110011101,12.1,11./+LongUnsignedImmediate::::or.ft l +"or.ft 0x%08lx, r, r" +{ + do_or (_SD, rDest, ~LongUnsignedImmediate, vSource2); +} + +// or.tf +31.Dest,26.Source2,21.0b0011011,14.UnsignedImmediate::::or.tf i +"or.tf , r, r" +{ + do_or (_SD, rDest, vSource1, ~vSource2); +} +31.Dest,26.Source2,21.0b110011011,12.0,11./,4.Source1::::or.tf r +"or.tf r, r, r" +{ + do_or (_SD, rDest, vSource1, ~vSource2); +} +31.Dest,26.Source2,21.0b110011011,12.1,11./+LongUnsignedImmediate::::or.tf l +"or.tf 0x%08lx, r, r" +{ + do_or (_SD, rDest, LongUnsignedImmediate, ~vSource2); +} + +// rdcr +void::function::do_rdcr:unsigned32 Dest, int cr +{ + TRACE_SINK2 (MY_INDEX, Dest, cr); + GPR (Dest) = CR (cr); +} +31.Dest,26.0,21.0b0000100,14.UCRN::::rdcr i +"rdcr CR[], r" +{ + do_rdcr (_SD, Dest, UCRN); +} +31.Dest,26.0,21.0b110000100,12.0,11./,4.INDCR::::rdcr r +"rdcr CR[r], r" +{ + do_rdcr (_SD, Dest, UCRN); +} +31.Dest,26.0,21.0b110000100,12.1,11./+UnsignedControlRegisterNumber::::rdcr l +"rdcr CR[], r" +{ + do_rdcr (_SD, Dest, UnsignedControlRegisterNumber); +} + +// rmo +31.Dest,26.Source,21.0b111111001,12.0,11./::::rmo +"rmo r, r" +{ + int b; + for (b = 0; b < 32; b++) + if (vSource & BIT32 (b)) + break; + if (b < 32) + b = 31 - b; + TRACE_ALU2 (MY_INDEX, b, vSource); + *rDest = b; +} + +// rotl - see sl.dz + + +// rotr - see sl.dz + + +// shl - see sl.iz + + +// sl.{d|e|i}{m|s|z} +void::function::do_shift:int Dest, unsigned32 source, int Merge, int i, int n, int EndMask, int Rotate +{ + /* see 10-30 for a reasonable description */ + unsigned32 input = source; + unsigned32 rotated; + unsigned32 endmask; + unsigned32 shiftmask; + unsigned32 cm; + int nRotate; + /* rotate the source */ + if (n) + { + rotated = ROTR32 (source, Rotate); + nRotate = (- Rotate) & 31; + } + else + { + rotated = ROTL32 (source, Rotate); + nRotate = Rotate; + } + /* form the end mask */ + if (EndMask == 0) + endmask = ~ (unsigned32)0; + else + endmask = (1 << EndMask) - 1; + if (i) + endmask = ~endmask; + /* form the shiftmask */ + switch (Merge) + { + case 0: case 1: case 2: + shiftmask = ~ (unsigned32)0; /* disabled */ + break; + case 3: case 5: /* enabled - 0 -> 32 */ + if (nRotate == 0) + shiftmask = ~ (unsigned32)0; + else + shiftmask = ((1 << nRotate) - 1); /* enabled - 0 -> 0 */ + break; + case 4: + shiftmask = ((1 << nRotate) - 1); /* enabled - 0 -> 0 */ + break; + case 6: case 7: + shiftmask = ~((1 << nRotate) - 1); /* inverted */ + break; + default: + sim_engine_abort (SD, CPU, cia, + "0x%lx: Invalid merge (%d) for shift", + (long) cia.ip, (int) source); + shiftmask = 0; + } + /* and the composite mask */ + cm = shiftmask & endmask; + /* and merge */ + switch (Merge) + { + case 0: case 3: case 6: /* zero */ + GPR (Dest) = rotated & cm; + break; + case 1: case 4: case 7: /* merge */ + GPR (Dest) = (rotated & cm) | (GPR (Dest) & ~cm); + break; + case 2: case 5: /* sign */ + { + int b; + GPR (Dest) = rotated & cm; + for (b = 1; b <= 31; b++) + if (!MASKED32 (cm, b, b)) + GPR (Dest) |= INSERTED32 (EXTRACTED32 (GPR (Dest), b - 1, b - 1), + b, b); + } + break; + default: + sim_engine_abort (SD, CPU, cia, + "0x%lx: Invalid merge (%d)", + (long) cia.ip, (int) source); + } + TRACE_SHIFT (MY_INDEX, GPR (Dest), input, i, n, Merge, EndMask, Rotate); +} +const char *::function::str_Merge:int Merge +{ + switch (Merge) + { + case 0: return "dz"; + case 1: return "dm"; + case 2: return "ds"; + case 3: return "ez"; + case 4: return "em"; + case 5: return "es"; + case 6: return "iz"; + case 7: return "im"; + default: return "?"; + } +} +31.Dest,26.Source,21.0b0001,17.Merge,14./,11.i,10.n,9.EndMask,4.Rotate::::sl i +"sl.%s , , r, r" +{ + do_shift (_SD, Dest, vSource, Merge, i, n, EndMask, Rotate); +} +31.Dest,26.Source,21.0b110001,15.Merge,12.0,11.i,10.n,9.EndMask,4.RotReg::::sl r +"sl.%s r, , r, r" +{ + do_shift (_SD, Dest, vSource, Merge, i, n, EndMask, GPR (RotReg) & 31); +} + +// sli.{d|e|i}{m|s|z} - see shift + + +// sr.{d|e|i}{m|s|z} - see shift + + +// sra - see sr.es - see shift + + +// sri.{d|e|i}{m|s|z} - see shift + + +// srl - see sr.ez + + +// st[{.b|.h|.d}] +void::function::do_st:int Source, unsigned32 base, unsigned32 *rBase, int m , int sz, int S, unsigned32 offset +{ + unsigned32 addr; + switch (sz) + { + case 0: + addr = base + (S ? (offset << 0) : offset); + STORE (addr, 1, GPR(Source)); + break; + case 1: + addr = base + (S ? (offset << 1) : offset); + STORE (addr, 2, GPR(Source)); + break; + case 2: + addr = base + (S ? (offset << 2) : offset); + STORE (addr, 4, GPR(Source)); + break; + case 3: + { + signed64 val; + if (Source & 0x1) + sim_engine_abort (SD, CPU, cia, + "0x%lx: st.d with odd source register %d", + cia.ip, Source); + addr = base + (S ? (offset << 3) : offset); + val = U8_4 (GPR(Source + 1), GPR(Source)); + STORE (addr, 8, val); + } + break; + default: + addr = -1; + sim_engine_abort (SD, CPU, cia, "st - invalid sz %d", sz); + } + if (m) + *rBase = addr; + TRACE_ST (Source, m, S, base, offset); +} +31.Source,26.Base,21.0b0110,17.m,16.sz,14.SignedOffset::::st i +"st%s (r%s), r" +{ + do_st (_SD, Source, vBase, rBase, m, sz, 0, vSignedOffset); +} +31.Source,26.Base,21.0b110110,15.m,14.sz,12.0,11.S,10.0,9./,4.IndOff::::st r +"st%s r%s (r%s), r" +{ + do_st (_SD, Source, vBase, rBase, m, sz, S, rIndOff); +} +31.Source,26.Base,21.0b110110,15.m,14.sz,12.1,11.S,10.0,9./+LongSignedImmediateOffset::::st l +"st%s 0x%08lx%s (r%s), r" +{ + do_st (_SD, Source, vBase, rBase, m, sz, S, LongSignedImmediateOffset); +} + +// sub +void::function::do_sub:signed32 *rDest, signed32 Source1, signed32 Source2 +{ + ALU_BEGIN (Source1); + ALU_SUB (Source2); + ALU_END (*rDest); + TRACE_ALU3 (MY_INDEX, *rDest, Source1, Source2); +} +31.Dest,26.Source2,21.0b101101,15.0,14.SignedImmediate::::sub i +"sub , r, r" +{ + do_sub (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b11101101,13.0,12.0,11./,4.Source1::::sub r +"sub r, r, r" +{ + do_sub (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b11101101,13.0,12.1,11./+LongSignedImmediate::::sub l +"sub 0x%08lx, r, r" +{ + do_sub (_SD, rDest, LongSignedImmediate, vSource2); +} + +// subu +void::function::do_subu:unsigned32 *rDest, unsigned32 Source1, signed32 Source2 +{ + unsigned32 result = Source1 - Source2; + TRACE_ALU3 (MY_INDEX, result, Source1, Source2); + *rDest = result; +} +// NOTE - the book has 15.1 which conflicts with subu. +31.Dest,26.Source2,21.0b101101,15.1,14.SignedImmediate::::subu i +"subu , r, r" +{ + do_subu (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b11101101,13.1,12.0,11./,4.Source1::::subu r +"subu r, r, r" +{ + do_subu (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b11101101,13.1,12.1,11./+LongSignedImmediate::::subu l +"subu 0x%08lx, r, r" +{ + do_subu (_SD, rDest, LongSignedImmediate, vSource2); +} + +// swcr +void::function::do_swcr:int Dest, signed32 source, signed32 cr +{ + tic80_control_regs reg = tic80_index2cr (cr); + /* cache the old CR value */ + unsigned32 old_cr = CR (cr); + /* Handle the write if allowed */ + if (cr >= 0x4000 || !(CPU)->is_user_mode) + switch (reg) + { + case INTPEN_CR: + CR (cr) &= ~source; + break; + default: + CR (cr) = source; + break; + } + /* Finish off the read */ + GPR (Dest) = old_cr; + TRACE_SINK3 (MY_INDEX, source, cr, Dest); +} +31.Dest,26.Source,21.0b000010,15.1,14.UCRN::::swcr i +"swcr CR[], r" +{ + do_swcr (_SD, Dest, vSource, UCRN); +} +31.Dest,26.Source,21.0b11000010,13.1,12.0,11./,4.INDCR::::swcr r +"swcr CR[r], r" +{ + do_swcr (_SD, Dest, vSource, UCRN); +} +31.Dest,26.Source,21.0b11000010,13.1,12.1,11./+LongUnsignedControlRegisterNumber::::swcr l +"swcr CR[], r" +{ + do_swcr (_SD, Dest, vSource, LongUnsignedControlRegisterNumber); +} + +// trap +void::function::do_trap:unsigned32 trap_number +{ + int i; + TRACE_SINK1 (MY_INDEX, trap_number); + switch (trap_number) + { + case 72: + switch (GPR(15)) + { + case 1: /* EXIT */ + { + sim_engine_halt (SD, CPU, NULL, cia, sim_exited, GPR(2)); + break; + } + case 4: /* WRITE */ + { + unsigned i; + if (GPR(2) == 1) + for (i = 0; i < GPR(6); i++) + { + char c; + c = MEM (unsigned, GPR(4) + i, 1); + sim_io_write_stdout (SD, &c, 1); + } + else if (GPR(2) == 2) + for (i = 0; i < GPR(6); i++) + { + char c; + c = MEM (unsigned, GPR(4) + i, 1); + sim_io_write_stderr (SD, &c, 1); + } + else + sim_engine_abort (SD, CPU, cia, + "0x%lx: write to invalid fid %d", + (long) cia.ip, (int) GPR(2)); + GPR(2) = GPR(6); + break; + } + case 20: /* GETPID */ + { + GPR(2) = getpid (); + break; + } + case 37: /* KILL */ + if ( GPR (2) != (unsigned) 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) + { + GPR(2) = -22; /* -EINVAL */ + break; + } + sim_engine_abort (SD, CPU, cia, + "0x%lx: unknown syscall %d", + (long) cia.ip, (int) GPR(15)); + } + break; + case 73: + sim_engine_halt (SD, CPU, NULL, cia, sim_stopped, SIM_SIGTRAP); + + /* Add a few traps for now to print the register state */ + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + if (!TRACE_ALU_P (CPU)) + trace_one_insn (SD, CPU, cia.ip, 1, itable[MY_INDEX].file, + itable[MY_INDEX].line_nr, "trap", + "Trap %ld", (long) trap_number); + + for (i = 0; i < 32; i++) + sim_io_eprintf (SD, "%s0x%.8lx%s", ((i % 8) == 0) ? "\t" : " ", (long)GPR(i), + (((i+1) % 8) == 0) ? "\n" : ""); + sim_io_write_stderr (SD, "\n", 1); + break; + + default: + sim_engine_abort (SD, CPU, cia, + "0x%lx: unsupported trap %d", + (long) cia.ip, (int) trap_number); + } +} +31./,27.0,26./,21.0b0000001,14.UTN::::trap i +"trap " +{ + do_trap (_SD, UTN); +} +31./,27.0,26./,21.0b110000001,12.0,11./,4.INDTR::::trap r +"trap r" +{ + do_trap (_SD, UTN); +} +31./,27.0,26./,21.0b110000001,12.1,11./+UTN::::trap l +"trap 0x%08lx" +{ + do_trap (_SD, UTN); +} + +// vadd.{s|d}{s|d} +31.*,26.Dest,21.0b11110,16./,15.0b000,12.0,11./,10.*,9.*,7.PD,6.*,5.P1,4.Source::f::vadd r +31.*,26.Dest,21.0b11110,16./,15.0b000,12.1,11./,10.*,9.*,7.PD,6.*,5.P1,4.Source::f::vadd l + + +// vld{0|1}.{s|d} - see above - same instruction +#31.Dest,26.*,21.0b11110,16.*,10.1,9.S,8.*,6.p,7.******::f::vld + + +// vmac.ss{s|d} +#31.*, 26.Source2,21.0b11110,16.a0,15.0b110,12.0,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4.Source1::f::vmac.ss ra +31.Dest,26.Source2,21.0b11110,16.a0,15.0b110,12.0,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4.Source1::f::vmac.ss rr +#31.*, 26.Source2,21.0b11110,16.a0,15.0b110,12.1,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4./::f::vmac.ss ia +31.Dest,26.Source2,21.0b11110,16.a0,15.0b110,12.1,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4./::f::vmac.ss ir + + +// vmpy.{s|d}{s|d} +31.*,26.Dest,21.0b11110,16./,15.0b010,12.0,11./,10.*,8.*,7.PD,6.*,5.P1,4.Source::f::vmpy r +31.*,26.Dest,21.0b11110,16./,15.0b010,12.1,11./,10.*,8.*,7.PD,6.*,5.P1,4./::f::vmpy l + + +// vmsc.ss{s|d} +#31.*, 26.Source2,21.0b11110,16.a0,15.0b111,12.0,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4.Source1::f::vmsc.ss ra +31.Dest,26.Source2,21.0b11110,16.a0,15.0b111,12.0,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4.Source1::f::vmsc.ss rr +#31.*, 26.Source2,21.0b11110,16.a0,15.0b111,12.1,11.a1,10.*,9.*, 8.Z,7./,6.*,5./,4./::f::vmsc.ss ia +31.Dest,26.Source2,21.0b11110,16.a0,15.0b111,12.1,11.a1,10.0,9.PD,8.Z,7./,6.0,5./,4./::f::vmsc.ss ir + + +// vmsub.{s|d}{s|d} +31.*,26.Dest,21.0b11110,16.a0,15.0b011,12.0,11.a1,10.*,8.Z,7.PD,6.*,5./,4.Source::f::vmsub r +31.*,26.Dest,21.0b11110,16.a0,15.0b011,12.1,11.a1,10.*,8.Z,7.PD,6.*,5./,4./::f::vmsub l + + +// vrnd.{s|d}{s|d} +31.*,26.Dest,21.0b11110,16.a0,15.0b100,12.0,11.a1,10.*,8.PD,6.*,5.P1,4.Source::f::vrnd f r +31.*,26.Dest,21.0b11110,16.a0,15.0b100,12.1,11.a1,10.*,8.PD,6.*,5.P1,4./::f::vrnd f l + + +// vrnd.{i|u}{s|d} +31.*,26.Dest,21.0b11110,16./,15.0b101,12.0,11./,10.*,8./,7.PD,6.*,5.P1,4.Source::f::vrnd i r +31.*,26.Dest,21.0b11110,16./,15.0b101,12.1,11./,10.*,8./,7.PD,6.*,5.P1,4./::f::vrnd i l + + +// vst.{s|d} - see above - same instruction +#31.Source,26.*,21.0b11110,16.*,10.0,9.S,8.*,6.1,5.*::f::vst + + +// vsub.{i|u}{s|d} +31.*,26.Dest,21.0b11110,16./,15.0b001,12.0,11./,10.*,8./,7.PD,6.*,5.P1,4.Source::f::vsub r +31.*,26.Dest,21.0b11110,16./,15.0b001,12.1,11./,10.*,8./,7.PD,6.*,5.P1,4./::f::vsub l + + +// wrcr - see swcr, creg, source, r0 + + +// xnor +void::function::do_xnor:signed32 *rDest, signed32 source1, signed32 source2 +{ + unsigned32 result = ~ (source1 ^ source2); + TRACE_ALU3 (MY_INDEX, result, source1, source2); + *rDest = result; +} +31.Dest,26.Source2,21.0b0011001,14.UnsignedImmediate::::xnor i +"xnor , r, r" +{ + do_xnor (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110011001,12.0,11./,4.Source1::::xnor r +"xnor r, r, r" +{ + do_xnor (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110011001,12.1,11./+LongUnsignedImmediate::::xnor l +"xnor 0x%08lx, r, r" +{ + do_xnor (_SD, rDest, LongUnsignedImmediate, vSource2); +} + +// xor +void::function::do_xor:signed32 *rDest, signed32 source1, signed32 source2 +{ + unsigned32 result = source1 ^ source2; + TRACE_ALU3 (MY_INDEX, result, source1, source2); + *rDest = result; +} +31.Dest,26.Source2,21.0b0010110,14.UnsignedImmediate::::xor i +"xor , r, r" +{ + do_xor (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110010110,12.0,11./,4.Source1::::xor r +"xor r, r, r" +{ + do_xor (_SD, rDest, vSource1, vSource2); +} +31.Dest,26.Source2,21.0b110010110,12.1,11./+LongUnsignedImmediate::::xor l +"xor 0x%08lx, r, r" +{ + do_xor (_SD, rDest, LongUnsignedImmediate, vSource2); +} -- cgit v1.1