From 5558e7e691534636afa28f6bf68bfd83530d8054 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 14 Apr 2010 07:38:06 +0000 Subject: [PATCH] sim: constify sim_write source buffer (part 2) As pointed out by Sandra Loosemore, a bunch of targets define sim_write themselves instead of using the common/ code. So constify them too. Signed-off-by: Mike Frysinger --- sim/arm/ChangeLog | 4 ++++ sim/arm/wrapper.c | 2 +- sim/avr/ChangeLog | 3 +++ sim/avr/interp.c | 2 +- sim/cr16/ChangeLog | 4 ++++ sim/cr16/interp.c | 2 +- sim/d10v/ChangeLog | 4 ++++ sim/d10v/interp.c | 2 +- sim/erc32/ChangeLog | 4 ++++ sim/erc32/interf.c | 2 +- sim/h8300/ChangeLog | 4 ++++ sim/h8300/compile.c | 2 +- sim/m32c/ChangeLog | 6 ++++++ sim/m32c/gdb-if.c | 2 +- sim/m32c/mem.c | 4 ++-- sim/m32c/mem.h | 2 +- sim/mcore/ChangeLog | 4 ++++ sim/mcore/interp.c | 2 +- sim/microblaze/ChangeLog | 3 +++ sim/microblaze/interp.c | 2 +- sim/mips/ChangeLog | 4 ++++ sim/mips/interp.c | 2 +- sim/moxie/ChangeLog | 4 ++++ sim/moxie/interp.c | 2 +- sim/ppc/ChangeLog | 4 ++++ sim/ppc/sim_calls.c | 2 +- sim/rx/ChangeLog | 4 ++++ sim/rx/gdb-if.c | 2 +- sim/sh/ChangeLog | 4 ++++ sim/sh/interp.c | 4 ++-- 30 files changed, 74 insertions(+), 18 deletions(-) create mode 100644 sim/avr/ChangeLog create mode 100644 sim/microblaze/ChangeLog diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog index 9c1291801c0..192f07e5737 100644 --- a/sim/arm/ChangeLog +++ b/sim/arm/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * wrapper.c (sim_write): Add const to buffer arg. + 2010-01-09 Ralf Wildenhues * configure: Regenerate. diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index 67441e0dd20..0060582f720 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -158,7 +158,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd ATTRIBUTE_UNUSED; SIM_ADDR addr; - unsigned char * buffer; + const unsigned char * buffer; int size; { int i; diff --git a/sim/avr/ChangeLog b/sim/avr/ChangeLog new file mode 100644 index 00000000000..a03bde85b91 --- /dev/null +++ b/sim/avr/ChangeLog @@ -0,0 +1,3 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buffer arg. diff --git a/sim/avr/interp.c b/sim/avr/interp.c index de94f2c4887..e297c77bf6a 100644 --- a/sim/avr/interp.c +++ b/sim/avr/interp.c @@ -1622,7 +1622,7 @@ sim_trace (SIM_DESC sd) } int -sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) +sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) { int osize = size; diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog index 7f256e270ec..c4770397e28 100644 --- a/sim/cr16/ChangeLog +++ b/sim/cr16/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buffer arg. + 2010-01-09 Ralf Wildenhues * configure: Regenerate. diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c index f8b7842c653..758b62c0cf5 100644 --- a/sim/cr16/interp.c +++ b/sim/cr16/interp.c @@ -883,7 +883,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char *buffer; + const unsigned char *buffer; int size; { /* FIXME: this should be performing a virtual transfer */ diff --git a/sim/d10v/ChangeLog b/sim/d10v/ChangeLog index e2d801fd8a5..5aee8d15fe2 100644 --- a/sim/d10v/ChangeLog +++ b/sim/d10v/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buffer arg. + 2010-01-09 Ralf Wildenhues * configure: Regenerate. diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c index 9caec412890..cd18eadc550 100644 --- a/sim/d10v/interp.c +++ b/sim/d10v/interp.c @@ -761,7 +761,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char *buffer; + const unsigned char *buffer; int size; { /* FIXME: this should be performing a virtual transfer */ diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog index 107692fed77..d6f0cafca6f 100644 --- a/sim/erc32/ChangeLog +++ b/sim/erc32/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buf arg. + 2010-01-09 Ralf Wildenhues * configure: Regenerate. diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c index fe075e1f286..c7ffa992cad 100644 --- a/sim/erc32/interf.c +++ b/sim/erc32/interf.c @@ -351,7 +351,7 @@ int sim_write(sd, mem, buf, length) SIM_DESC sd; SIM_ADDR mem; - unsigned char *buf; + const unsigned char *buf; int length; { return (sis_memory_write(mem, buf, length)); diff --git a/sim/h8300/ChangeLog b/sim/h8300/ChangeLog index e12d291441f..adda60ef6ae 100644 --- a/sim/h8300/ChangeLog +++ b/sim/h8300/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * compile.c (sim_write): Add const to buffer arg. + 2010-01-09 Ralf Wildenhues * configure: Regenerate. diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c index 70394e639ba..44d60f6d152 100644 --- a/sim/h8300/compile.c +++ b/sim/h8300/compile.c @@ -4616,7 +4616,7 @@ sim_trace (SIM_DESC sd) } int -sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) +sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) { int i; diff --git a/sim/m32c/ChangeLog b/sim/m32c/ChangeLog index e443c162da2..982793734d6 100644 --- a/sim/m32c/ChangeLog +++ b/sim/m32c/ChangeLog @@ -1,3 +1,9 @@ +2010-04-14 Mike Frysinger + + * gdb-if.c (sim_write): Add const to buf arg. + * mem.h (mem_put_blk): Add const to bufptr arg. + * mem.c (mem_put_blk): Likewise, and add const to cast. + 2010-01-20 DJ Delorie * m32c.opc (MATH_OP): When doing subtraction, also set carry if diff --git a/sim/m32c/gdb-if.c b/sim/m32c/gdb-if.c index c44c7ec7659..fb943f5d956 100644 --- a/sim/m32c/gdb-if.c +++ b/sim/m32c/gdb-if.c @@ -167,7 +167,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) } int -sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { check_desc (sd); diff --git a/sim/m32c/mem.c b/sim/m32c/mem.c index c25b9637d7e..02604d59177 100644 --- a/sim/m32c/mem.c +++ b/sim/m32c/mem.c @@ -365,13 +365,13 @@ 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 (); } diff --git a/sim/m32c/mem.h b/sim/m32c/mem.h index 5caef25edff..a36a389a950 100644 --- a/sim/m32c/mem.h +++ b/sim/m32c/mem.h @@ -27,7 +27,7 @@ void mem_put_hi (int address, unsigned short value); void mem_put_psi (int address, unsigned long value); void mem_put_si (int address, unsigned long value); -void mem_put_blk (int address, void *bufptr, int nbytes); +void mem_put_blk (int address, const void *bufptr, int nbytes); unsigned char mem_get_pc (); diff --git a/sim/mcore/ChangeLog b/sim/mcore/ChangeLog index 1cdfd3e37fe..b75aa3558e2 100644 --- a/sim/mcore/ChangeLog +++ b/sim/mcore/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buffer arg. + 2010-01-09 Ralf Wildenhues * configure: Regenerate. diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c index ccdb64e914e..35b70f08b5a 100644 --- a/sim/mcore/interp.c +++ b/sim/mcore/interp.c @@ -1718,7 +1718,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char * buffer; + const unsigned char * buffer; int size; { int i; diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog new file mode 100644 index 00000000000..a03bde85b91 --- /dev/null +++ b/sim/microblaze/ChangeLog @@ -0,0 +1,3 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buffer arg. diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c index 044a55b879e..9769f701b79 100644 --- a/sim/microblaze/interp.c +++ b/sim/microblaze/interp.c @@ -704,7 +704,7 @@ sim_resume (SIM_DESC sd, int step, int siggnal) int -sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) +sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) { int i; init_pointers (); diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index 8c8256dcb7c..149bded26d5 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buffer arg. + 2010-01-18 Masaki Muranaka (tiny change) * interp.c: Don't include sysdep.h diff --git a/sim/mips/interp.c b/sim/mips/interp.c index 5516e0021ac..a276d06f9bd 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -862,7 +862,7 @@ int sim_write (sd,addr,buffer,size) SIM_DESC sd; SIM_ADDR addr; - unsigned char *buffer; + const unsigned char *buffer; int size; { int index; diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog index 043927d2b95..7bd86101fd3 100644 --- a/sim/moxie/ChangeLog +++ b/sim/moxie/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buffer arg. + 2010-02-27 Jan Kratochvil * interp.c (sim_create_inferior): Fix crashes on zero PROG_BFD or ARGV. diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c index 079ef9b1fff..a031c593fef 100644 --- a/sim/moxie/interp.c +++ b/sim/moxie/interp.c @@ -1028,7 +1028,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char * buffer; + const unsigned char * buffer; int size; { sim_cpu *scpu = STATE_CPU (sd, 0); /* FIXME */ diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index 183f1e65672..f33c2d0e1ce 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * sim_calls.c (sim_write): Add const to buf arg. + 2010-02-14 Andreas Schwab * ppc-instructions: Fix missing assignment in last change. diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c index 781ff055f5c..276161b50b5 100644 --- a/sim/ppc/sim_calls.c +++ b/sim/ppc/sim_calls.c @@ -144,7 +144,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) int -sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { int result = psim_write_memory(simulator, MAX_NR_PROCESSORS, buf, mem, length, diff --git a/sim/rx/ChangeLog b/sim/rx/ChangeLog index c1a2675af54..5f5ee20a95e 100644 --- a/sim/rx/ChangeLog +++ b/sim/rx/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * gdb-if.c (sim_write): Add const to buf arg. + 2010-01-30 Masaki Muranaka * configure.in: Check if the host has getopt.h. diff --git a/sim/rx/gdb-if.c b/sim/rx/gdb-if.c index d5a84d75d09..873817fb1a1 100644 --- a/sim/rx/gdb-if.c +++ b/sim/rx/gdb-if.c @@ -245,7 +245,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) } int -sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { int i; diff --git a/sim/sh/ChangeLog b/sim/sh/ChangeLog index fb8e8ff3ca5..82ab457a787 100644 --- a/sim/sh/ChangeLog +++ b/sim/sh/ChangeLog @@ -1,3 +1,7 @@ +2010-04-14 Mike Frysinger + + * interp.c (sim_write): Add const to buffer arg. + 2010-01-12 Masaki Muranaka * interp.c: Don't include sysdep.h. diff --git a/sim/sh/interp.c b/sim/sh/interp.c index 2b2044430fc..0d1360f385a 100644 --- a/sim/sh/interp.c +++ b/sim/sh/interp.c @@ -81,7 +81,7 @@ extern unsigned short sh_jump_table[], sh_dsp_table[0x1000], ppi_table[]; -int sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size); +int sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size); #define O_RECOMPILE 85 #define DEFINE_TABLE @@ -2141,7 +2141,7 @@ int sim_write (sd, addr, buffer, size) SIM_DESC sd; SIM_ADDR addr; - unsigned char *buffer; + const unsigned char *buffer; int size; { int i; -- 2.30.2