X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=sim%2Fm32c%2Fmem.c;h=d7e26828ebb5c287a805f9d51242104366b9ac48;hb=17fc27167f678285d2f64040837b8cc41b6a664a;hp=51bb0ab3d9e0c28ec86ec2a0b611fa7e67e852e4;hpb=e4d013fc0f3df3200be2dca48ed2e330e8a4ddf9;p=deliverable%2Fbinutils-gdb.git diff --git a/sim/m32c/mem.c b/sim/m32c/mem.c index 51bb0ab3d9..d7e26828eb 100644 --- a/sim/m32c/mem.c +++ b/sim/m32c/mem.c @@ -1,6 +1,6 @@ /* mem.c --- memory for M32C simulator. -Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. +Copyright (C) 2005-2020 Free Software Foundation, Inc. Contributed by Red Hat, Inc. This file is part of the GNU simulators. @@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +#include "config.h" #include #include #include @@ -26,8 +27,12 @@ along with this program. If not, see . */ #include #include #include +#ifdef HAVE_SYS_SELECT_H #include +#endif +#ifdef HAVE_TERMIOS_H #include +#endif #include "mem.h" #include "cpu.h" @@ -48,9 +53,13 @@ along with this program. If not, see . */ static unsigned char **pt[L1_LEN]; +#ifdef HAVE_TERMIOS_H int m32c_console_ifd = 0; +#endif int m32c_console_ofd = 1; +#ifdef HAVE_TERMIOS_H int m32c_use_raw_console = 0; +#endif #ifdef TIMER_A Timer_A timer_a; @@ -80,7 +89,7 @@ init_mem (void) } static unsigned char * -mem_ptr (address) +mem_ptr (int address) { static int recursing = 0; int pt1 = (address >> (L2_BITS + OFF_BITS)) & ((1 << L1_BITS) - 1); @@ -130,7 +139,7 @@ mcs (int isput, int bytes) } void -mem_usage_stats () +mem_usage_stats (void) { int i, j; int rstart = 0; @@ -183,7 +192,7 @@ s (int address, char *dir) #define S(d) if (trace) s(address, d) static void -e () +e (void) { if (!trace) return; @@ -196,7 +205,7 @@ e () extern int m32c_disassemble; -void +static void mem_put_byte (int address, unsigned char value) { unsigned char *m; @@ -356,29 +365,30 @@ mem_put_si (int address, unsigned long value) } void -mem_put_blk (int address, void *bufptr, int nbytes) +mem_put_blk (int address, const void *bufptr, int nbytes) { S ("<="); if (enable_counting) mem_counters[1][1] += nbytes; while (nbytes--) - mem_put_byte (address++, *(unsigned char *) bufptr++); + mem_put_byte (address++, *(const unsigned char *) bufptr++); E (); } unsigned char -mem_get_pc () +mem_get_pc (void) { unsigned char *m = mem_ptr (regs.r_pc & membus_mask); COUNT (0, 0); return *m; } +#ifdef HAVE_TERMIOS_H static int console_raw = 0; static struct termios oattr; static int -stdin_ready () +stdin_ready (void) { fd_set ifd; int n; @@ -393,12 +403,13 @@ stdin_ready () } void -m32c_sim_restore_console () +m32c_sim_restore_console (void) { if (console_raw) tcsetattr (m32c_console_ifd, TCSANOW, &oattr); console_raw = 0; } +#endif static unsigned char mem_get_byte (int address) @@ -408,6 +419,7 @@ mem_get_byte (int address) m = mem_ptr (address); switch (address) { +#ifdef HAVE_TERMIOS_H case 0x2ed: /* m32c uart1c1 */ case 0x3ad: /* m16c uart1c1 */ @@ -447,6 +459,7 @@ mem_get_byte (int address) } return c; } +#endif #ifdef TIMER_A case 0x346: /* TA0low */ @@ -457,6 +470,9 @@ mem_get_byte (int address) return timer_a.count; #endif + default: + /* In case both cases above are not included. */ + ; } S ("=>"); @@ -541,7 +557,7 @@ sign_ext (int v, int bits) #if TIMER_A void -update_timer_a () +update_timer_a (void) { if (timer_a.bsr & 1) {