From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 450113858018 for ; Sat, 15 May 2021 15:00:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 450113858018 Received: from vapier.lan (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 52C9D335D7D for ; Sat, 15 May 2021 15:00:43 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: ppc: clean up various warnings Date: Sat, 15 May 2021 11:00:39 -0400 Message-Id: <20210515150039.6205-1-vapier@gentoo.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 15:00:49 -0000 A random grab bag of minor fixes to enable -Werror for this port. Cast address vars to long when the format was using %l. Use %zu with sizeof operations. Add const to a bunch of strings. Trim unused variables. Fix sizeof call to calculate target storage and not the pointer itself. --- sim/ppc/ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ sim/ppc/Makefile.in | 3 ++- sim/ppc/configure | 22 ++++++++++++++++++++++ sim/ppc/configure.ac | 17 +++++++++++++++++ sim/ppc/device.c | 12 +++--------- sim/ppc/emul_chirp.c | 5 +++-- sim/ppc/hw_glue.c | 4 ++-- sim/ppc/hw_ide.c | 4 ++-- sim/ppc/hw_init.c | 4 ++-- sim/ppc/hw_phb.c | 4 ++-- sim/ppc/hw_shm.c | 3 --- sim/ppc/igen.c | 1 + sim/ppc/interrupts.c | 2 +- sim/ppc/ld-insn.c | 2 +- sim/ppc/main.c | 2 +- sim/ppc/options.c | 2 +- sim/ppc/ppc-instructions | 5 ++--- sim/ppc/psim.c | 26 +++++++++++++------------- sim/ppc/psim.h | 10 +++++----- sim/ppc/tree.c | 2 +- sim/ppc/vm.c | 6 +++--- sim/ppc/vm_n.h | 4 ++-- 22 files changed, 122 insertions(+), 54 deletions(-) diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index e1ed6d624afb..42db5f26857e 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,39 @@ +2021-05-15 Mike Frysinger + + * Makefile.in (WERROR_CFLAGS): Define. + (STD_CFLAGS): Add $(WERROR_CFLAGS). + * configure.ac: Add --enable-werror. + * device.c (device_full_name): Delete full_name variable. + (device_clean): Delete system variable. + * emul_chirp.c (chirp_emul_getprop): Cast vars to unsigned long. + (chirp_emul_seek): Likewise. + * hw_glue.c (hw_glue_init_address): Use %zu format. + * hw_ide.c (hw_ide_io_read_buffer): Cast vars to unsigned long. + (hw_ide_io_write_buffer): Likewise. + * hw_init.c (update_for_binary_section): Cast vars to unsigned long. + * hw_phb.c (hw_phb_dma_read_buffer): Likewise. + (hw_phb_dma_write_buffer): Likewise. + * hw_shm.c (hw_shm_init_data): Delete d variable. + (hw_shm_attach_address_callback): Delete shm variable. + * igen.c (gen_semantics_c): Include tree.h. + * interrupts.c (alignment_interrupt): Cast vars to unsigned long. + * ld-insn.c (dump_insn_field): Cast vars to unsigned long. + * main.c (main): Add const to argv. + * options.c (print_options): Cast var to int. + * ppc-instructions: Add %s to format. Delete shifted variable. Add + parenthesis to binary operations. + * psim.c (find_arg): Add const to return and argv. + (is_num): Add const to string. + (psim_options): Add const to return and argv, and p & param. + (psim_command): Add const to argv, device, and media. + (psim_stack): Add const to argv and envp. + * psim.h: Add const to psim_options, psim_command, and psim_stack. + * tree.c (parse_reg_property): Delete & from sizeof. + * vm.c (om_virtual_to_real): Const vars to long. + * vm_n.h (vm_data_map_read_N): Change format to %zu. + (vm_data_map_write_N): Likewise. + * configure: Regenerate. + 2021-05-14 Mike Frysinger * Makefile.in: Update path. diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in index 63b957d1b4fc..9fc864e677af 100644 --- a/sim/ppc/Makefile.in +++ b/sim/ppc/Makefile.in @@ -64,6 +64,7 @@ AR = @AR@ AR_FLAGS = rc CC = @CC@ CFLAGS = @CFLAGS@ +WERROR_CFLAGS = @WERROR_CFLAGS@ CC_FOR_BUILD = @CC_FOR_BUILD@ CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ BISON = bison @@ -103,7 +104,7 @@ CONFIG_CFLAGS = \ $(DEVZERO_CFLAGS) SIM_FPU_CFLAGS = @sim_fpu_cflags@ -STD_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(INCLUDES) $(INTL_CFLAGS) $(SIM_FPU_CFLAGS) +STD_CFLAGS = $(CFLAGS) $(WERROR_CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(INCLUDES) $(INTL_CFLAGS) $(SIM_FPU_CFLAGS) NOWARN_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(INCLUDES) $(SIM_FPU_CFLAGS) BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(INCLUDES) $(WARNING_CFLAGS) diff --git a/sim/ppc/configure b/sim/ppc/configure index 3de2ba81a82e..235595b7b2c4 100755 --- a/sim/ppc/configure +++ b/sim/ppc/configure @@ -678,6 +678,7 @@ build REPORT_BUGS_TEXI REPORT_BUGS_TO PKGVERSION +WERROR_CFLAGS EGREP GREP CPP @@ -773,6 +774,7 @@ enable_sim_stdio enable_sim_switch enable_sim_timebase enable_sim_trace +enable_werror enable_sim_warnings enable_sim_xor_endian with_pkgversion @@ -1435,6 +1437,7 @@ Optional Features: --enable-sim-switch Use a switch instead of a table for instruction call. --enable-sim-timebase Specify whether the PPC timebase is supported. --enable-sim-trace Specify whether tracing is supported. + --enable-werror treat compile warnings as errors --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o --enable-sim-xor-endian=n Specify number bytes involved in PowerPC XOR bi-endian mode (default 8). --enable-plugins Enable support for plugins @@ -4758,6 +4761,25 @@ _ACEOF $as_echo "$sim_trace" >&6; } +# Check whether --enable-werror was given. +if test "${enable_werror+set}" = set; then : + enableval=$enable_werror; case "${enableval}" in + yes | y) ERROR_ON_WARNING="yes" ;; + no | n) ERROR_ON_WARNING="no" ;; + *) as_fn_error $? "bad value ${enableval} for --enable-werror" "$LINENO" 5 ;; + esac +fi + +# Enable -Werror by default when using gcc +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then + ERROR_ON_WARNING=yes +fi +WERROR_CFLAGS="" +if test "${ERROR_ON_WARNING}" = yes ; then + WERROR_CFLAGS="-Werror" +fi + + # Check whether --enable-sim-warnings was given. if test "${enable_sim_warnings+set}" = set; then : enableval=$enable_sim_warnings; case "${enableval}" in diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac index 6482fbab1d74..21913a913294 100644 --- a/sim/ppc/configure.ac +++ b/sim/ppc/configure.ac @@ -587,6 +587,23 @@ AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings]) AC_MSG_RESULT($sim_trace) +AC_ARG_ENABLE(werror, + AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]), + [case "${enableval}" in + yes | y) ERROR_ON_WARNING="yes" ;; + no | n) ERROR_ON_WARNING="no" ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;; + esac]) +# Enable -Werror by default when using gcc +if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then + ERROR_ON_WARNING=yes +fi +WERROR_CFLAGS="" +if test "${ERROR_ON_WARNING}" = yes ; then + WERROR_CFLAGS="-Werror" +fi +AC_SUBST(WERROR_CFLAGS) + AC_ARG_ENABLE(sim-warnings, [ --enable-sim-warnings=opts Extra CFLAGS for turning on compiler warnings except for idecode.o, semantics.o and psim.o], [case "${enableval}" in diff --git a/sim/ppc/device.c b/sim/ppc/device.c index 6a0209e5ce69..4abef6f9e234 100644 --- a/sim/ppc/device.c +++ b/sim/ppc/device.c @@ -180,10 +180,9 @@ device_full_name(device *leaf, unsigned sizeof_buf) { /* get a buffer */ - char full_name[1024]; - if (buf == (char*)0) { - buf = full_name; - sizeof_buf = sizeof(full_name); + if (buf == NULL) { + sizeof_buf = 1024; + buf = malloc(sizeof_buf); } /* construct a name */ @@ -211,9 +210,6 @@ device_full_name(device *leaf, strcat (buf, unit); } - /* return it usefully */ - if (buf == full_name) - buf = (char *) strdup(full_name); return buf; } @@ -1915,8 +1911,6 @@ INLINE_DEVICE\ device_clean(device *me, void *data) { - psim *system; - system = (psim*)data; TRACE(trace_device_init, ("device_clean - initializing %s", me->path)); clean_device_interrupt_edges(&me->interrupt_destinations); clean_device_instances(me); diff --git a/sim/ppc/emul_chirp.c b/sim/ppc/emul_chirp.c index d4214f51b971..ed49169cc238 100644 --- a/sim/ppc/emul_chirp.c +++ b/sim/ppc/emul_chirp.c @@ -533,7 +533,7 @@ chirp_emul_getprop(os_emul_data *data, break; case ihandle_property: TRACE(trace_os_emul, ("getprop - ihandle=0x%lx(0x%lx`%s')\n", - BE2H_cell(*(unsigned_cell*)prop->array), + (unsigned long)BE2H_cell(*(unsigned_cell*)prop->array), (unsigned long)device_find_ihandle_property(phandle, name), ihandle_name(device_find_ihandle_property(phandle, name)))); break; @@ -1143,7 +1143,8 @@ chirp_emul_seek(os_emul_data *data, (unsigned long)args.ihandle, (unsigned long)ihandle, ihandle_name(ihandle), - args.pos_hi, args.pos_lo)); + (unsigned long)args.pos_hi, + (unsigned long)args.pos_lo)); if (ihandle == NULL) { /* OpenFirmware doesn't define this error */ error("chirp: invalid ihandle passed to seek method"); diff --git a/sim/ppc/hw_glue.c b/sim/ppc/hw_glue.c index c82477339307..2af2434b5c34 100644 --- a/sim/ppc/hw_glue.c +++ b/sim/ppc/hw_glue.c @@ -193,13 +193,13 @@ hw_glue_init_address(device *me) if (glue->sizeof_output == 0) device_error(me, "at least one reg property size must be nonzero"); if (glue->sizeof_output % sizeof(unsigned_word) != 0) - device_error(me, "reg property size must be %d aligned", sizeof(unsigned_word)); + device_error(me, "reg property size must be %zu aligned", sizeof(unsigned_word)); /* and the address */ device_address_to_attach_address(device_parent(me), &unit.address, &glue->space, &glue->address, me); if (glue->address % (sizeof(unsigned_word) * max_nr_interrupts) != 0) - device_error(me, "reg property address must be %d aligned", + device_error(me, "reg property address must be %zu aligned", sizeof(unsigned_word) * max_nr_interrupts); glue->nr_outputs = glue->sizeof_output / sizeof(unsigned_word); glue->output = zalloc(glue->sizeof_output); diff --git a/sim/ppc/hw_ide.c b/sim/ppc/hw_ide.c index 9d3a7118b71f..6c5e05163ba1 100644 --- a/sim/ppc/hw_ide.c +++ b/sim/ppc/hw_ide.c @@ -766,7 +766,7 @@ hw_ide_io_read_buffer(device *me, *(unsigned8*)dest = controller->reg[reg]; break; default: - device_error(me, "bus-error at address 0x%lx", addr); + device_error(me, "bus-error at address 0x%lx", (unsigned long)addr); break; } return nr_bytes; @@ -820,7 +820,7 @@ hw_ide_io_write_buffer(device *me, controller->reg[reg] = *(unsigned8*)source; break; default: - device_error(me, "bus-error at 0x%lx", addr); + device_error(me, "bus-error at 0x%lx", (unsigned long)addr); break; } return nr_bytes; diff --git a/sim/ppc/hw_init.c b/sim/ppc/hw_init.c index 779c95c5a24c..e46643c9b49b 100644 --- a/sim/ppc/hw_init.c +++ b/sim/ppc/hw_init.c @@ -369,8 +369,8 @@ update_for_binary_section(bfd *abfd, mem_in[2] = section_vma; if (device_instance_call_method(memory, "claim", 3, mem_in, 1, mem_out) < 0) device_error(me, "failed to claim memory for section at 0x%lx (0x%lx", - section_vma, - section_size); + (unsigned long)section_vma, + (unsigned long)section_size); if (mem_out[0] != section_vma) device_error(me, "section address not as requested"); } diff --git a/sim/ppc/hw_phb.c b/sim/ppc/hw_phb.c index 08defc2868ca..70d59d308449 100644 --- a/sim/ppc/hw_phb.c +++ b/sim/ppc/hw_phb.c @@ -967,7 +967,7 @@ hw_phb_dma_read_buffer(device *me, device_error(me, "Do not support DMA into own bus"); /* do it */ DTRACE(phb, ("dma read - %s:0x%lx (%d bytes)\n", - pci_space->name, addr, nr_bytes)); + pci_space->name, (unsigned long)addr, nr_bytes)); return device_dma_read_buffer(device_parent(me), dest, pci_space->parent_space, addr, nr_bytes); @@ -996,7 +996,7 @@ hw_phb_dma_write_buffer(device *me, device_error(me, "Do not support DMA into own bus"); /* do it */ DTRACE(phb, ("dma write - %s:0x%lx (%d bytes)\n", - pci_space->name, addr, nr_bytes)); + pci_space->name, (unsigned long)addr, nr_bytes)); return device_dma_write_buffer(device_parent(me), source, pci_space->parent_space, addr, nr_bytes, diff --git a/sim/ppc/hw_shm.c b/sim/ppc/hw_shm.c index f2fa144244ac..c4d5cae83453 100644 --- a/sim/ppc/hw_shm.c +++ b/sim/ppc/hw_shm.c @@ -89,7 +89,6 @@ static void hw_shm_init_data(device *me) { hw_shm_device *shm = (hw_shm_device*)device_data(me); - const device_unit *d; reg_property_spec reg; int i; @@ -147,8 +146,6 @@ hw_shm_attach_address_callback(device *me, access_type access, device *client) /*callback/default*/ { - hw_shm_device *shm = (hw_shm_device*)device_data(me); - if (space != 0) error("shm_attach_address_callback() invalid address space\n"); diff --git a/sim/ppc/igen.c b/sim/ppc/igen.c index c036f049aefb..0bf3b58ca26d 100644 --- a/sim/ppc/igen.c +++ b/sim/ppc/igen.c @@ -218,6 +218,7 @@ gen_semantics_c(insn_table *table, lf_printf(file, "#include \"cpu.h\"\n"); lf_printf(file, "#include \"idecode.h\"\n"); lf_printf(file, "#include \"semantics.h\"\n"); + lf_printf(file, "#include \"tree.h\"\n"); lf_printf(file, "#ifdef HAVE_COMMON_FPU\n"); lf_printf(file, "#include \"sim-inline.h\"\n"); lf_printf(file, "#include \"sim-fpu.h\"\n"); diff --git a/sim/ppc/interrupts.c b/sim/ppc/interrupts.c index db100fd26b9a..133638fdcafd 100644 --- a/sim/ppc/interrupts.c +++ b/sim/ppc/interrupts.c @@ -262,7 +262,7 @@ alignment_interrupt(cpu *processor, case USER_ENVIRONMENT: case VIRTUAL_ENVIRONMENT: - cpu_error(processor, cia, "alignment interrupt - ra=0x%lx", ra); + cpu_error(processor, cia, "alignment interrupt - ra=0x%lx", (unsigned long)ra); case OPERATING_ENVIRONMENT: DAR = (spreg)ra; diff --git a/sim/ppc/ld-insn.c b/sim/ppc/ld-insn.c index 585071a861ff..126fc78037b7 100644 --- a/sim/ppc/ld-insn.c +++ b/sim/ppc/ld-insn.c @@ -828,7 +828,7 @@ dump_insn_field(insn_field *field, int indent) { - printf("(insn_field*)0x%x\n", (unsigned)field); + printf("(insn_field*)0x%lx\n", (unsigned long)field); dumpf(indent, "(first %d)\n", field->first); diff --git a/sim/ppc/main.c b/sim/ppc/main.c index f3f2e9ef338f..0c1a070fc2c2 100644 --- a/sim/ppc/main.c +++ b/sim/ppc/main.c @@ -251,7 +251,7 @@ cntrl_c(int sig) int -main(int argc, char **argv) +main(int argc, char * const *argv) { const char *name_of_file; char *arg_; diff --git a/sim/ppc/options.c b/sim/ppc/options.c index ddb492f54fb7..e327187b3756 100644 --- a/sim/ppc/options.c +++ b/sim/ppc/options.c @@ -233,7 +233,7 @@ print_options (void) (((i == ARRAY_SIZE (defines) - 1) || (((i + 1) % cols) == 0)) ? 0 - : max_len + 4 - strlen (defines[i])), + : max_len + 4 - (int)strlen (defines[i])), ""); } printf_filtered ("\n"); diff --git a/sim/ppc/ppc-instructions b/sim/ppc/ppc-instructions index 9f9773477f77..70aa04e2210e 100644 --- a/sim/ppc/ppc-instructions +++ b/sim/ppc/ppc-instructions @@ -331,7 +331,7 @@ void::model-static::model_trace_release:model_data *model_ptr, model_busy *busy } } if (busy->vscr_busy) - TRACE(trace_model, ("VSCR Register is now available.\n", spr_name(busy->spr_busy))); + TRACE(trace_model, ("VSCR Register %s is now available.\n", spr_name(busy->spr_busy))); # Trace making registers busy void::model-static::model_trace_make_busy:model_data *model_ptr, unsigned32 int_mask, unsigned32 fp_mask, unsigned32 cr_mask @@ -3315,7 +3315,6 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia, unsigned64 mask; int n = MASKED(*rB, 59, 63); signed32 source = (signed32)*rS; /* signed to keep sign bit */ - signed32 shifted = source >> n; int S = (MASKED(*rS,32,32) != 0); signed64 r = ((unsigned64) source); r = ((unsigned64) source) << 32 | (unsigned32) source; @@ -3324,7 +3323,7 @@ void::function::invalid_zero_divide_operation:cpu *processor, unsigned_word cia, mask = (unsigned64) MASK64(n+32,63); else mask = (unsigned64) 0; - *rA = (signed_word) (r & mask | ((signed64) -1*S) & ~mask); /* if 64bit will sign extend */ + *rA = (signed_word) ((r & mask) | (((signed64) -1*S) & ~mask)); /* if 64bit will sign extend */ if (S && (MASKED(r & ~mask,32,63)!=0)) XER |= xer_carry; else diff --git a/sim/ppc/psim.c b/sim/ppc/psim.c index ebb9cb427377..70c02f7141d4 100644 --- a/sim/ppc/psim.c +++ b/sim/ppc/psim.c @@ -93,10 +93,10 @@ psim_tree(void) } STATIC_INLINE_PSIM\ -(char *) -find_arg(char *err_msg, +(const char *) +find_arg(const char *err_msg, int *ptr_to_argp, - char **argv) + char * const *argv) { *ptr_to_argp += 1; if (argv[*ptr_to_argp] == NULL) @@ -216,7 +216,7 @@ psim_usage (int verbose, int help, SIM_OPEN_KIND kind) /* Test "string" for containing a string of digits that form a number between "min" and "max". The return value is the number or "err". */ static -int is_num( char *string, int min, int max, int err) +int is_num(const char *string, int min, int max, int err) { int result = 0; @@ -236,9 +236,9 @@ int is_num( char *string, int min, int max, int err) } INLINE_PSIM\ -(char **) +(char * const *) psim_options(device *root, - char **argv, + char * const *argv, SIM_OPEN_KIND kind) { device *current = root; @@ -247,8 +247,8 @@ psim_options(device *root, return NULL; argp = 0; while (argv[argp] != NULL && argv[argp][0] == '-') { - char *p = argv[argp] + 1; - char *param; + const char *p = argv[argp] + 1; + const char *param; while (*p != '\0') { switch (*p) { default: @@ -395,7 +395,7 @@ psim_options(device *root, INLINE_PSIM\ (void) psim_command(device *root, - char **argv) + char * const *argv) { int argp = 0; if (argv[argp] == NULL) { @@ -409,8 +409,8 @@ psim_command(device *root, trace_option(opt, 1); } else if (strcmp(*argv, "change-media") == 0) { - char *device = find_arg("Missing device name", &argp, argv); - char *media = argv[++argp]; + const char *device = find_arg("Missing device name", &argp, argv); + const char *media = argv[++argp]; device_ioctl(tree_find_device(root, device), NULL, 0, device_ioctl_change_media, media); } @@ -738,8 +738,8 @@ psim_init(psim *system) INLINE_PSIM\ (void) psim_stack(psim *system, - char **argv, - char **envp) + char * const *argv, + char * const *envp) { /* pass the stack device the argv/envp and let it work out what to do with it */ diff --git a/sim/ppc/psim.h b/sim/ppc/psim.h index c38b03d89947..2070cbf7b903 100644 --- a/sim/ppc/psim.h +++ b/sim/ppc/psim.h @@ -47,14 +47,14 @@ typedef struct _psim_status { extern device *psim_tree (void); -extern char **psim_options +extern char * const *psim_options (device *root, - char **argv, + char * const *argv, SIM_OPEN_KIND kind); extern void psim_command (device *root, - char **argv); + char * const *argv); extern void psim_merge_device_file @@ -79,8 +79,8 @@ extern void psim_init extern void psim_stack (psim *system, - char **argv, - char **envp); + char * const *argv, + char * const *envp); /* Run/stop the system */ diff --git a/sim/ppc/tree.c b/sim/ppc/tree.c index a0e0820b4d95..5c35d32f3c5c 100644 --- a/sim/ppc/tree.c +++ b/sim/ppc/tree.c @@ -528,7 +528,7 @@ parse_reg_property(device *current, if (device_nr_size_cells(bus) > 0) chp = parse_size(current, bus, chp, ®s[reg_nr].size); else - memset(®s[reg_nr].size, 0, sizeof (®s[reg_nr].size)); + memset(®s[reg_nr].size, 0, sizeof (regs[reg_nr].size)); } /* create it */ diff --git a/sim/ppc/vm.c b/sim/ppc/vm.c index 8cf4e8fcf53c..9562fb6762c0 100644 --- a/sim/ppc/vm.c +++ b/sim/ppc/vm.c @@ -627,9 +627,9 @@ om_virtual_to_real(om_map *map, TRACE(trace_vm, ("ea=0x%lx - htab search %d - htab=0x%lx hash=0x%lx mask=0x%lx pteg=0x%lx\n", (long)ea, current_hash, - map->real_address_of_page_table, - page_hash, - map->page_table_hash_mask, + (long)map->real_address_of_page_table, + (long)page_hash, + (long)map->page_table_hash_mask, (long)real_address_of_pte_group)); for (real_address_of_pte_0 = real_address_of_pte_group; real_address_of_pte_0 < (real_address_of_pte_group diff --git a/sim/ppc/vm_n.h b/sim/ppc/vm_n.h index 563cd1ca6a1d..ce1e05059e1f 100644 --- a/sim/ppc/vm_n.h +++ b/sim/ppc/vm_n.h @@ -59,7 +59,7 @@ vm_data_map_read_N(vm_data_map *map, unsigned_N val; if (vm_data_map_read_buffer(map, &val, ea, sizeof(unsigned_N), processor, cia) != sizeof(unsigned_N)) { - cpu_error(processor, cia, "misaligned %d byte read to 0x%lx failed", + cpu_error(processor, cia, "misaligned %zu byte read to 0x%lx failed", sizeof(unsigned_N), (unsigned long)ea); } val = T2H_N(val); @@ -107,7 +107,7 @@ vm_data_map_write_N(vm_data_map *map, unsigned_N data = H2T_N(val); if (vm_data_map_write_buffer(map, &data, ea, sizeof(unsigned_N), 0, processor, cia) != sizeof(unsigned_N)) { - cpu_error(processor, cia, "misaligned %d byte write to 0x%lx failed", + cpu_error(processor, cia, "misaligned %zu byte write to 0x%lx failed", sizeof(unsigned_N), (unsigned long)ea); } if (WITH_MON & MONITOR_LOAD_STORE_UNIT) { -- 2.31.1