From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LtOfw-0002zp-QW for qemu-devel@nongnu.org; Mon, 13 Apr 2009 12:06:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LtOfw-0002yz-4n for qemu-devel@nongnu.org; Mon, 13 Apr 2009 12:06:24 -0400 Received: from [199.232.76.173] (port=37304 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LtOfv-0002ys-W1 for qemu-devel@nongnu.org; Mon, 13 Apr 2009 12:06:24 -0400 Received: from savannah.gnu.org ([199.232.41.3]:59643 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LtOfv-0002GB-69 for qemu-devel@nongnu.org; Mon, 13 Apr 2009 12:06:23 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LtOft-0003iC-GF for qemu-devel@nongnu.org; Mon, 13 Apr 2009 16:06:21 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LtOfs-0003hy-NN for qemu-devel@nongnu.org; Mon, 13 Apr 2009 16:06:21 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Mon, 13 Apr 2009 16:06:20 +0000 Subject: [Qemu-devel] [7099] Fix ppc-softmmu warnings on OpenBSD host Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 7099 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7099 Author: blueswir1 Date: 2009-04-13 16:06:19 +0000 (Mon, 13 Apr 2009) Log Message: ----------- Fix ppc-softmmu warnings on OpenBSD host Modified Paths: -------------- trunk/gdbstub.c trunk/target-ppc/translate.c Modified: trunk/gdbstub.c =================================================================== --- trunk/gdbstub.c 2009-04-13 13:29:40 UTC (rev 7098) +++ trunk/gdbstub.c 2009-04-13 16:06:19 UTC (rev 7099) @@ -1333,11 +1333,11 @@ GDB_CORE_XML); for (r = first_cpu->gdb_regs; r; r = r->next) { - strcat(target_xml, "xml); - strcat(target_xml, "\"/>"); + pstrcat(target_xml, sizeof(target_xml), "xml); + pstrcat(target_xml, sizeof(target_xml), "\"/>"); } - strcat(target_xml, ""); + pstrcat(target_xml, sizeof(target_xml), ""); } return target_xml; } @@ -1838,7 +1838,7 @@ 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; Modified: trunk/target-ppc/translate.c =================================================================== --- trunk/target-ppc/translate.c 2009-04-13 13:29:40 UTC (rev 7098) +++ trunk/target-ppc/translate.c 2009-04-13 16:06:19 UTC (rev 7099) @@ -81,6 +81,7 @@ { int i; char* p; + size_t cpu_reg_names_size; static int done_init = 0; if (done_init) @@ -89,32 +90,37 @@ 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 @@ 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 @@ 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,