From patchwork Tue Jun 4 12:13:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 248559 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 70E612C00A2 for ; Tue, 4 Jun 2013 22:24:07 +1000 (EST) Received: from localhost ([::1]:51263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjqHV-0004kK-Dx for incoming@patchwork.ozlabs.org; Tue, 04 Jun 2013 08:24:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ujq8O-0008HM-DL for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:14:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ujq8N-0002bS-42 for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:14:40 -0400 Received: from mail-bk0-x22f.google.com ([2a00:1450:4008:c01::22f]:33568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ujq8M-0002bL-T3 for qemu-devel@nongnu.org; Tue, 04 Jun 2013 08:14:39 -0400 Received: by mail-bk0-f47.google.com with SMTP id jg9so91122bkc.6 for ; Tue, 04 Jun 2013 05:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=5SEVweGz2wSg+TLwjH6ZKcfbnrG7g0rwZIgiV9MFjJk=; b=vyatVuCCYqVuo9jK1kYgBUtE1JQj/foDYaUs0EQAUge8vnSPupwYzxDpk7+ygcJhcS l3UjMfMhmtJcAldN1PGfui7tHYcU0grtPA6u+oSHwncXEo/2NtPcoPk3vXgGiCIFYB18 GYFMCCvfy8uDR5qV/02momYXRU9fW5+UiaVWNgzvEs80tFtlkYHDn+wZ2ZzY39RMRohy Gi827ZOq0APdcsI4McS7mZyt7mcDFcKJ72VMsc0Rwt9p2TH/ZJtdTLZqXOFMPnxFYldQ kmiBYQScKOGtRND93kqm0MUE4oU6ld4QO+LEU5elDCedH0JraZdPpRy/4T+OVZBVgekI GNXA== X-Received: by 10.204.239.131 with SMTP id kw3mr7803698bkb.156.1370348078163; Tue, 04 Jun 2013 05:14:38 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id es13sm22715636bkc.8.2013.06.04.05.14.36 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Jun 2013 05:14:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 4 Jun 2013 14:13:59 +0200 Message-Id: <1370348041-6768-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370348041-6768-1-git-send-email-pbonzini@redhat.com> References: <1370348041-6768-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4008:c01::22f Cc: peter.maydell@linaro.org Subject: [Qemu-devel] [PATCH v2 15/17] exec: move qemu_ram_addr_from_host_nofail to cputlb.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It is only used there, and the _nofail and the standard versions of this function return different things. Limit confusion by removing the function from the public headers. Signed-off-by: Paolo Bonzini --- cputlb.c | 11 +++++++++++ exec.c | 15 ++------------- include/exec/cpu-common.h | 1 - 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/cputlb.c b/cputlb.c index 060c67d..c34bd7b 100644 --- a/cputlb.c +++ b/cputlb.c @@ -158,6 +158,17 @@ void tlb_reset_dirty_range(CPUTLBEntry *tlb_entry, uintptr_t start, } } +static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) +{ + ram_addr_t ram_addr; + + if (qemu_ram_addr_from_host(ptr, &ram_addr)) { + fprintf(stderr, "Bad ram pointer %p\n", ptr); + abort(); + } + return ram_addr; +} + static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry) { ram_addr_t ram_addr; diff --git a/exec.c b/exec.c index 9fd4c90..07d4b5f 100644 --- a/exec.c +++ b/exec.c @@ -1431,6 +1431,8 @@ static void *qemu_ram_ptr_length(ram_addr_t addr, ram_addr_t *size) } } +/* Some of the softmmu routines need to translate from a host pointer + (typically a TLB entry) back to a ram offset. */ int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr) { RAMBlock *block; @@ -1463,19 +1465,6 @@ found: return 0; } -/* Some of the softmmu routines need to translate from a host pointer - (typically a TLB entry) back to a ram offset. */ -ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr) -{ - ram_addr_t ram_addr; - - if (qemu_ram_addr_from_host(ptr, &ram_addr)) { - fprintf(stderr, "Bad ram pointer %p\n", ptr); - abort(); - } - return ram_addr; -} - static void notdirty_mem_write(void *opaque, hwaddr ram_addr, uint64_t val, unsigned size) { diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index e061e21..8063ba2 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -51,7 +51,6 @@ typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr); void qemu_ram_remap(ram_addr_t addr, ram_addr_t length); /* This should not be used by devices. */ int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr); -ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr); void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev); void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,