From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MswIe-0004lR-Qr for qemu-devel@nongnu.org; Wed, 30 Sep 2009 06:20:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MswIO-0004a1-Qh for qemu-devel@nongnu.org; Wed, 30 Sep 2009 06:20:37 -0400 Received: from [199.232.76.173] (port=43895 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MswIM-0004Yu-UP for qemu-devel@nongnu.org; Wed, 30 Sep 2009 06:20:27 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:55876) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MswIM-0005qF-08 for qemu-devel@nongnu.org; Wed, 30 Sep 2009 06:20:26 -0400 From: Isaku Yamahata Date: Wed, 30 Sep 2009 19:18:13 +0900 Message-Id: <1254305917-14784-38-git-send-email-yamahata@valinux.co.jp> In-Reply-To: <1254305917-14784-1-git-send-email-yamahata@valinux.co.jp> References: <1254305917-14784-1-git-send-email-yamahata@valinux.co.jp> Subject: [Qemu-devel] [PATCH 37/61] pci: add helper function for pci config write function to check address. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, anthony@codemonkey.ws Cc: yamahata@valinux.co.jp add helper function for pci config write function to check address. Those function will be used later. Signed-off-by: Isaku Yamahata --- hw/pci.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/hw/pci.h b/hw/pci.h index 5cd882c..26c15c5 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -406,6 +406,20 @@ pci_config_get_quad(PCIDevice *d, uint32_t addr) return pci_get_quad(&d->config[addr]); } +static inline int pci_config_changed(uint32_t addr, uint32_t len, + uint32_t base, uint32_t end) +{ + /* check if [addr, addr + len] intersects [base, end] */ + return base <= addr + len && addr <= end; +} + +static inline int pci_config_changed_with_size(uint32_t addr, uint32_t len, + uint32_t base, uint32_t size) +{ + /* check if [addr, addr + len] intersects [base, base + size] */ + return base <= addr + len && addr <= base + size; +} + typedef int (*pci_qdev_initfn)(PCIDevice *dev); typedef struct { DeviceInfo qdev; -- 1.6.0.2