Revisão | 2bb20c887d2222685ea51da8469b251bfd1afaa2 (tree) |
---|---|
Hora | 2016-01-08 23:32:07 |
Autor | Yoshinori Sato <ysato@user...> |
Commiter | Yoshinori Sato |
Fix warning for clang.
@@ -28,6 +28,8 @@ | ||
28 | 28 | #ifdef HAVE_SYS_PARAM_H |
29 | 29 | #include <sys/param.h> |
30 | 30 | #endif |
31 | +#include <unistd.h> | |
32 | +#include <ctype.h> | |
31 | 33 | |
32 | 34 | #include "bfd.h" |
33 | 35 | #include "sim-main.h" |
@@ -1266,7 +1268,7 @@ static struct memlog *memlog_buffer; | ||
1266 | 1268 | static int memlogtail; |
1267 | 1269 | static int memlogsize; |
1268 | 1270 | |
1269 | -static add_memlog(unsigned long pc, unsigned long addr, | |
1271 | +static void add_memlog(unsigned long pc, unsigned long addr, | |
1270 | 1272 | enum mem_access_type type, unsigned long data) |
1271 | 1273 | { |
1272 | 1274 | if (!logging) |
@@ -1289,7 +1291,7 @@ static int pc; | ||
1289 | 1291 | |
1290 | 1292 | static unsigned char *breg[32]; |
1291 | 1293 | static unsigned short *wreg[16]; |
1292 | -static unsigned int *lreg[18]; | |
1294 | +static unsigned int *lreg[19]; | |
1293 | 1295 | |
1294 | 1296 | #define GET_B_REG(X) *(breg[X]) |
1295 | 1297 | #define SET_B_REG(X, Y) (*(breg[X])) = (Y) |
@@ -1817,10 +1819,11 @@ init_pointers (SIM_DESC sd) | ||
1817 | 1819 | /* `msize' must be a power of two. */ |
1818 | 1820 | if ((memory_size & (memory_size - 1)) != 0) |
1819 | 1821 | { |
1822 | + memory_size = H8300S_MSIZE; | |
1820 | 1823 | (*sim_callback->printf_filtered) |
1821 | 1824 | (sim_callback, |
1822 | 1825 | "init_pointers: bad memory size %d, defaulting to %d.\n", |
1823 | - memory_size, memory_size = H8300S_MSIZE); | |
1826 | + memory_size, H8300S_MSIZE); | |
1824 | 1827 | } |
1825 | 1828 | |
1826 | 1829 | if (h8_get_memory_buf (sd)) |
@@ -1962,6 +1965,7 @@ static int intlevel(SIM_DESC sd) | ||
1962 | 1965 | } else { |
1963 | 1966 | return h8_get_ccr (sd) & 0x80?0x100 << 8:-1; |
1964 | 1967 | } |
1968 | + return 0; | |
1965 | 1969 | } |
1966 | 1970 | |
1967 | 1971 | int iosimulation(SIM_DESC, int); |
@@ -4722,8 +4726,6 @@ sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) | ||
4722 | 4726 | int i; |
4723 | 4727 | |
4724 | 4728 | init_pointers (sd); |
4725 | - if (addr < 0) | |
4726 | - return 0; | |
4727 | 4729 | for (i = 0; i < size; i++) |
4728 | 4730 | { |
4729 | 4731 | if (addr < memory_size) |
@@ -4743,8 +4745,6 @@ int | ||
4743 | 4745 | sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) |
4744 | 4746 | { |
4745 | 4747 | init_pointers (sd); |
4746 | - if (addr < 0) | |
4747 | - return 0; | |
4748 | 4748 | if (addr < memory_size) |
4749 | 4749 | memcpy (buffer, h8_get_memory_buf (sd) + addr, size); |
4750 | 4750 | else |
@@ -5096,6 +5096,8 @@ sim_open (SIM_OPEN_KIND kind, | ||
5096 | 5096 | |
5097 | 5097 | /* Called by gdb to load a program into memory. */ |
5098 | 5098 | |
5099 | +void init_ioregs(SIM_DESC sd); | |
5100 | + | |
5099 | 5101 | SIM_RC |
5100 | 5102 | sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty) |
5101 | 5103 | { |
@@ -5243,7 +5245,7 @@ static void save_trace(const char *filename) | ||
5243 | 5245 | return ; |
5244 | 5246 | } |
5245 | 5247 | for (idx = 0; idx < tracetail; idx++) |
5246 | - fprintf(fp, "0x%06x\n", trace_buffer[idx]); | |
5248 | + fprintf(fp, "0x%06lx\n", trace_buffer[idx]); | |
5247 | 5249 | fclose(fp); |
5248 | 5250 | } |
5249 | 5251 |
@@ -5261,7 +5263,7 @@ static void show_memlog(int lines) | ||
5261 | 5263 | for (; lines > 0; --lines) |
5262 | 5264 | { |
5263 | 5265 | (*sim_callback->printf_filtered) (sim_callback, |
5264 | - "0x%06x 0x%06x %s %08x\n", | |
5266 | + "0x%06lx 0x%06lx %s %08lx\n", | |
5265 | 5267 | memlog_buffer[idx].pc, |
5266 | 5268 | memlog_buffer[idx].addr, |
5267 | 5269 | memtype_str[memlog_buffer[idx].type], |
@@ -5288,7 +5290,7 @@ static void save_memlog(const char *filename) | ||
5288 | 5290 | return ; |
5289 | 5291 | } |
5290 | 5292 | for (idx = 0; idx < memlogtail; idx++) |
5291 | - fprintf(fp, "0x%06x 0x%06x %s %08x\n", | |
5293 | + fprintf(fp, "0x%06lx 0x%06lx %s %08lx\n", | |
5292 | 5294 | memlog_buffer[idx].pc, |
5293 | 5295 | memlog_buffer[idx].addr, |
5294 | 5296 | memtype_str[memlog_buffer[idx].type], |
@@ -5296,6 +5298,9 @@ static void save_memlog(const char *filename) | ||
5296 | 5298 | fclose(fp); |
5297 | 5299 | } |
5298 | 5300 | |
5301 | +void sci_open_pty(struct host_callback_struct *callback); | |
5302 | +void sci_open_net(struct host_callback_struct *callback, int port); | |
5303 | + | |
5299 | 5304 | void |
5300 | 5305 | sim_do_command (SIM_DESC sd, const char *cmd) |
5301 | 5306 | { |