From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MRvmm-0002Ny-Qu for qemu-devel@nongnu.org; Fri, 17 Jul 2009 18:20:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MRvmh-0002Ng-DX for qemu-devel@nongnu.org; Fri, 17 Jul 2009 18:20:11 -0400 Received: from [199.232.76.173] (port=41107 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MRvmh-0002Nd-8R for qemu-devel@nongnu.org; Fri, 17 Jul 2009 18:20:07 -0400 Received: from mx20.gnu.org ([199.232.41.8]:35643) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MRvmg-0002fF-Tl for qemu-devel@nongnu.org; Fri, 17 Jul 2009 18:20:07 -0400 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MRvmf-0002v0-He for qemu-devel@nongnu.org; Fri, 17 Jul 2009 18:20:05 -0400 From: Nathan Froyd Date: Fri, 17 Jul 2009 13:33:18 -0700 Message-Id: <1247862802-13033-3-git-send-email-froydnj@codesourcery.com> In-Reply-To: <1247862802-13033-1-git-send-email-froydnj@codesourcery.com> References: <1247862802-13033-1-git-send-email-froydnj@codesourcery.com> Subject: [Qemu-devel] [PATCH 2/6] add softmmu_target_strlen List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Nathan Froyd --- softmmu-semi.h | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/softmmu-semi.h b/softmmu-semi.h index 79278cc..dc667bc 100644 --- a/softmmu-semi.h +++ b/softmmu-semi.h @@ -60,6 +60,22 @@ static char *softmmu_lock_user_string(CPUState *env, uint32_t addr) return s; } #define lock_user_string(p) softmmu_lock_user_string(env, p) + +static int softmmu_target_strlen(CPUState *env, target_ulong addr) +{ + uint8_t c; + int len; + + len = 0; + do { + cpu_memory_rw_debug(env, addr + len, &c, 1, 0); + len++; + } while (c); + + return len - 1; +} +#define target_strlen(p) softmmu_target_strlen(env, p) + static void softmmu_unlock_user(CPUState *env, void *p, target_ulong addr, target_ulong len) { -- 1.6.3.2