summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-13 16:06:19 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-13 16:06:19 +0000
commit2dc766dafc7f5416bfdf184b42f0c5c22567bb60 (patch)
treefdd3c1a804da6b8470dcb965271fc51ac1a3d655
parentbb0574fe2bb1781d0afc1c1ad26df68a4d30d5ea (diff)
downloadhqemu-2dc766dafc7f5416bfdf184b42f0c5c22567bb60.zip
hqemu-2dc766dafc7f5416bfdf184b42f0c5c22567bb60.tar.gz
Fix ppc-softmmu warnings on OpenBSD host
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7099 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--gdbstub.c10
-rw-r--r--target-ppc/translate.c20
2 files changed, 19 insertions, 11 deletions
diff --git a/gdbstub.c b/gdbstub.c
index a06ef34..f3eb827 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -1333,11 +1333,11 @@ static const char *get_feature_xml(const char *p, const char **newp)
GDB_CORE_XML);
for (r = first_cpu->gdb_regs; r; r = r->next) {
- strcat(target_xml, "<xi:include href=\"");
- strcat(target_xml, r->xml);
- strcat(target_xml, "\"/>");
+ pstrcat(target_xml, sizeof(target_xml), "<xi:include href=\"");
+ pstrcat(target_xml, sizeof(target_xml), r->xml);
+ pstrcat(target_xml, sizeof(target_xml), "\"/>");
}
- strcat(target_xml, "</target>");
+ pstrcat(target_xml, sizeof(target_xml), "</target>");
}
return target_xml;
}
@@ -1838,7 +1838,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf)
if (strncmp(p, "Supported", 9) == 0) {
snprintf(buf, sizeof(buf), "PacketSize=%x", MAX_PACKET_LENGTH);
#ifdef GDB_CORE_XML
- strcat(buf, ";qXfer:features:read+");
+ pstrcat(buf, sizeof(buf), ";qXfer:features:read+");
#endif
put_packet(s, buf);
break;
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 9ba4937..24c78d1 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -81,6 +81,7 @@ void ppc_translate_init(void)
{
int i;
char* p;
+ size_t cpu_reg_names_size;
static int done_init = 0;
if (done_init)
@@ -89,32 +90,37 @@ void ppc_translate_init(void)
cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
p = cpu_reg_names;
+ cpu_reg_names_size = sizeof(cpu_reg_names);
for (i = 0; i < 8; i++) {
- sprintf(p, "crf%d", i);
+ snprintf(p, cpu_reg_names_size, "crf%d", i);
cpu_crf[i] = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, crf[i]), p);
p += 5;
+ cpu_reg_names_size -= 5;
}
for (i = 0; i < 32; i++) {
- sprintf(p, "r%d", i);
+ snprintf(p, cpu_reg_names_size, "r%d", i);
cpu_gpr[i] = tcg_global_mem_new(TCG_AREG0,
offsetof(CPUState, gpr[i]), p);
p += (i < 10) ? 3 : 4;
+ cpu_reg_names_size -= (i < 10) ? 3 : 4;
#if !defined(TARGET_PPC64)
- sprintf(p, "r%dH", i);
+ snprintf(p, cpu_reg_names_size, "r%dH", i);
cpu_gprh[i] = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, gprh[i]), p);
p += (i < 10) ? 4 : 5;
+ cpu_reg_names_size -= (i < 10) ? 4 : 5;
#endif
- sprintf(p, "fp%d", i);
+ snprintf(p, cpu_reg_names_size, "fp%d", i);
cpu_fpr[i] = tcg_global_mem_new_i64(TCG_AREG0,
offsetof(CPUState, fpr[i]), p);
p += (i < 10) ? 4 : 5;
+ cpu_reg_names_size -= (i < 10) ? 4 : 5;
- sprintf(p, "avr%dH", i);
+ snprintf(p, cpu_reg_names_size, "avr%dH", i);
#ifdef WORDS_BIGENDIAN
cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0,
offsetof(CPUState, avr[i].u64[0]), p);
@@ -123,8 +129,9 @@ void ppc_translate_init(void)
offsetof(CPUState, avr[i].u64[1]), p);
#endif
p += (i < 10) ? 6 : 7;
+ cpu_reg_names_size -= (i < 10) ? 6 : 7;
- sprintf(p, "avr%dL", i);
+ snprintf(p, cpu_reg_names_size, "avr%dL", i);
#ifdef WORDS_BIGENDIAN
cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0,
offsetof(CPUState, avr[i].u64[1]), p);
@@ -133,6 +140,7 @@ void ppc_translate_init(void)
offsetof(CPUState, avr[i].u64[0]), p);
#endif
p += (i < 10) ? 6 : 7;
+ cpu_reg_names_size -= (i < 10) ? 6 : 7;
}
cpu_nip = tcg_global_mem_new(TCG_AREG0,
OpenPOWER on IntegriCloud