|
|
0a122b |
From 3ed0fb61a3dc912ef036d7ef450bed192090709e Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
Message-Id: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
|
|
|
0a122b |
From: "Michael S. Tsirkin" <mst@redhat.com>
|
|
|
0a122b |
Date: Tue, 17 Dec 2013 15:16:49 +0100
|
|
|
0a122b |
Subject: [PATCH 01/56] range: add Range structure
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
Message-id: <1387293161-4085-2-git-send-email-mst@redhat.com>
|
|
|
0a122b |
Patchwork-id: 56306
|
|
|
0a122b |
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 01/57] range: add Range structure
|
|
|
0a122b |
Bugzilla: 1034876
|
|
|
0a122b |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
Sometimes we need to pass ranges around, add a
|
|
|
0a122b |
handy structure for this purpose.
|
|
|
0a122b |
|
|
|
0a122b |
Note: memory.c defines its own concept of AddrRange structure for
|
|
|
0a122b |
working with 128 addresses. It's necessary there for doing range math.
|
|
|
0a122b |
This is not needed for most users: struct Range is
|
|
|
0a122b |
much simpler, and is only used for passing the range around.
|
|
|
0a122b |
|
|
|
0a122b |
Cc: Peter Maydell <peter.maydell@linaro.org>
|
|
|
0a122b |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
(cherry picked from commit 620ac82eb0fc4218fb6a4937bcef3fdab3126703)
|
|
|
0a122b |
---
|
|
|
0a122b |
include/qemu/range.h | 16 ++++++++++++++++
|
|
|
0a122b |
1 file changed, 16 insertions(+)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Michal Novotny <minovotn@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
include/qemu/range.h | 16 ++++++++++++++++
|
|
|
0a122b |
1 file changed, 16 insertions(+)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/include/qemu/range.h b/include/qemu/range.h
|
|
|
0a122b |
index 3502372..b76cc0d 100644
|
|
|
0a122b |
--- a/include/qemu/range.h
|
|
|
0a122b |
+++ b/include/qemu/range.h
|
|
|
0a122b |
@@ -1,6 +1,22 @@
|
|
|
0a122b |
#ifndef QEMU_RANGE_H
|
|
|
0a122b |
#define QEMU_RANGE_H
|
|
|
0a122b |
|
|
|
0a122b |
+#include <inttypes.h>
|
|
|
0a122b |
+
|
|
|
0a122b |
+/*
|
|
|
0a122b |
+ * Operations on 64 bit address ranges.
|
|
|
0a122b |
+ * Notes:
|
|
|
0a122b |
+ * - ranges must not wrap around 0, but can include the last byte ~0x0LL.
|
|
|
0a122b |
+ * - this can not represent a full 0 to ~0x0LL range.
|
|
|
0a122b |
+ */
|
|
|
0a122b |
+
|
|
|
0a122b |
+/* A structure representing a range of addresses. */
|
|
|
0a122b |
+struct Range {
|
|
|
0a122b |
+ uint64_t begin; /* First byte of the range, or 0 if empty. */
|
|
|
0a122b |
+ uint64_t end; /* 1 + the last byte. 0 if range empty or ends at ~0x0LL. */
|
|
|
0a122b |
+};
|
|
|
0a122b |
+typedef struct Range Range;
|
|
|
0a122b |
+
|
|
|
0a122b |
/* Get last byte of a range from offset + length.
|
|
|
0a122b |
* Undefined for ranges that wrap around 0. */
|
|
|
0a122b |
static inline uint64_t range_get_last(uint64_t offset, uint64_t len)
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.11.7
|
|
|
0a122b |
|