Commit 2dc766dafc7f5416bfdf184b42f0c5c22567bb60
1 parent
bb0574fe
Fix ppc-softmmu warnings on OpenBSD host
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7099 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
19 additions
and
11 deletions
gdbstub.c
| ... | ... | @@ -1333,11 +1333,11 @@ static const char *get_feature_xml(const char *p, const char **newp) |
| 1333 | 1333 | GDB_CORE_XML); |
| 1334 | 1334 | |
| 1335 | 1335 | for (r = first_cpu->gdb_regs; r; r = r->next) { |
| 1336 | - strcat(target_xml, "<xi:include href=\""); | |
| 1337 | - strcat(target_xml, r->xml); | |
| 1338 | - strcat(target_xml, "\"/>"); | |
| 1336 | + pstrcat(target_xml, sizeof(target_xml), "<xi:include href=\""); | |
| 1337 | + pstrcat(target_xml, sizeof(target_xml), r->xml); | |
| 1338 | + pstrcat(target_xml, sizeof(target_xml), "\"/>"); | |
| 1339 | 1339 | } |
| 1340 | - strcat(target_xml, "</target>"); | |
| 1340 | + pstrcat(target_xml, sizeof(target_xml), "</target>"); | |
| 1341 | 1341 | } |
| 1342 | 1342 | return target_xml; |
| 1343 | 1343 | } |
| ... | ... | @@ -1838,7 +1838,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) |
| 1838 | 1838 | if (strncmp(p, "Supported", 9) == 0) { |
| 1839 | 1839 | snprintf(buf, sizeof(buf), "PacketSize=%x", MAX_PACKET_LENGTH); |
| 1840 | 1840 | #ifdef GDB_CORE_XML |
| 1841 | - strcat(buf, ";qXfer:features:read+"); | |
| 1841 | + pstrcat(buf, sizeof(buf), ";qXfer:features:read+"); | |
| 1842 | 1842 | #endif |
| 1843 | 1843 | put_packet(s, buf); |
| 1844 | 1844 | break; | ... | ... |
target-ppc/translate.c
| ... | ... | @@ -81,6 +81,7 @@ void ppc_translate_init(void) |
| 81 | 81 | { |
| 82 | 82 | int i; |
| 83 | 83 | char* p; |
| 84 | + size_t cpu_reg_names_size; | |
| 84 | 85 | static int done_init = 0; |
| 85 | 86 | |
| 86 | 87 | if (done_init) |
| ... | ... | @@ -89,32 +90,37 @@ void ppc_translate_init(void) |
| 89 | 90 | cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); |
| 90 | 91 | |
| 91 | 92 | p = cpu_reg_names; |
| 93 | + cpu_reg_names_size = sizeof(cpu_reg_names); | |
| 92 | 94 | |
| 93 | 95 | for (i = 0; i < 8; i++) { |
| 94 | - sprintf(p, "crf%d", i); | |
| 96 | + snprintf(p, cpu_reg_names_size, "crf%d", i); | |
| 95 | 97 | cpu_crf[i] = tcg_global_mem_new_i32(TCG_AREG0, |
| 96 | 98 | offsetof(CPUState, crf[i]), p); |
| 97 | 99 | p += 5; |
| 100 | + cpu_reg_names_size -= 5; | |
| 98 | 101 | } |
| 99 | 102 | |
| 100 | 103 | for (i = 0; i < 32; i++) { |
| 101 | - sprintf(p, "r%d", i); | |
| 104 | + snprintf(p, cpu_reg_names_size, "r%d", i); | |
| 102 | 105 | cpu_gpr[i] = tcg_global_mem_new(TCG_AREG0, |
| 103 | 106 | offsetof(CPUState, gpr[i]), p); |
| 104 | 107 | p += (i < 10) ? 3 : 4; |
| 108 | + cpu_reg_names_size -= (i < 10) ? 3 : 4; | |
| 105 | 109 | #if !defined(TARGET_PPC64) |
| 106 | - sprintf(p, "r%dH", i); | |
| 110 | + snprintf(p, cpu_reg_names_size, "r%dH", i); | |
| 107 | 111 | cpu_gprh[i] = tcg_global_mem_new_i32(TCG_AREG0, |
| 108 | 112 | offsetof(CPUState, gprh[i]), p); |
| 109 | 113 | p += (i < 10) ? 4 : 5; |
| 114 | + cpu_reg_names_size -= (i < 10) ? 4 : 5; | |
| 110 | 115 | #endif |
| 111 | 116 | |
| 112 | - sprintf(p, "fp%d", i); | |
| 117 | + snprintf(p, cpu_reg_names_size, "fp%d", i); | |
| 113 | 118 | cpu_fpr[i] = tcg_global_mem_new_i64(TCG_AREG0, |
| 114 | 119 | offsetof(CPUState, fpr[i]), p); |
| 115 | 120 | p += (i < 10) ? 4 : 5; |
| 121 | + cpu_reg_names_size -= (i < 10) ? 4 : 5; | |
| 116 | 122 | |
| 117 | - sprintf(p, "avr%dH", i); | |
| 123 | + snprintf(p, cpu_reg_names_size, "avr%dH", i); | |
| 118 | 124 | #ifdef WORDS_BIGENDIAN |
| 119 | 125 | cpu_avrh[i] = tcg_global_mem_new_i64(TCG_AREG0, |
| 120 | 126 | offsetof(CPUState, avr[i].u64[0]), p); |
| ... | ... | @@ -123,8 +129,9 @@ void ppc_translate_init(void) |
| 123 | 129 | offsetof(CPUState, avr[i].u64[1]), p); |
| 124 | 130 | #endif |
| 125 | 131 | p += (i < 10) ? 6 : 7; |
| 132 | + cpu_reg_names_size -= (i < 10) ? 6 : 7; | |
| 126 | 133 | |
| 127 | - sprintf(p, "avr%dL", i); | |
| 134 | + snprintf(p, cpu_reg_names_size, "avr%dL", i); | |
| 128 | 135 | #ifdef WORDS_BIGENDIAN |
| 129 | 136 | cpu_avrl[i] = tcg_global_mem_new_i64(TCG_AREG0, |
| 130 | 137 | offsetof(CPUState, avr[i].u64[1]), p); |
| ... | ... | @@ -133,6 +140,7 @@ void ppc_translate_init(void) |
| 133 | 140 | offsetof(CPUState, avr[i].u64[0]), p); |
| 134 | 141 | #endif |
| 135 | 142 | p += (i < 10) ? 6 : 7; |
| 143 | + cpu_reg_names_size -= (i < 10) ? 6 : 7; | |
| 136 | 144 | } |
| 137 | 145 | |
| 138 | 146 | cpu_nip = tcg_global_mem_new(TCG_AREG0, | ... | ... |