[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 31/36] loader: Add AddressSpace loading support to ta
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 31/36] loader: Add AddressSpace loading support to targphys |
Date: |
Thu, 22 Sep 2016 18:22:10 +0100 |
From: Alistair Francis <address@hidden>
Add a new function load_image_targphys_as() that allows the caller
to specify an AddressSpace to use when loading a targphys. The
original load_image_targphys() function doesn't have any change in
functionality.
Signed-off-by: Alistair Francis <address@hidden>
Reviewed-by: Peter Maydell <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
hw/core/loader.c | 10 ++++++++--
include/hw/loader.h | 22 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 86ed784..6e022b5 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -133,10 +133,16 @@ ssize_t read_targphys(const char *name,
return did;
}
-/* return the size or -1 if error */
int load_image_targphys(const char *filename,
hwaddr addr, uint64_t max_sz)
{
+ return load_image_targphys_as(filename, addr, max_sz, NULL);
+}
+
+/* return the size or -1 if error */
+int load_image_targphys_as(const char *filename,
+ hwaddr addr, uint64_t max_sz, AddressSpace *as)
+{
int size;
size = get_image_size(filename);
@@ -144,7 +150,7 @@ int load_image_targphys(const char *filename,
return -1;
}
if (size > 0) {
- rom_add_file_fixed(filename, addr, -1);
+ rom_add_file_fixed_as(filename, addr, -1, as);
}
return size;
}
diff --git a/include/hw/loader.h b/include/hw/loader.h
index bce8f43..0381706 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -14,8 +14,28 @@
int get_image_size(const char *filename);
int load_image(const char *filename, uint8_t *addr); /* deprecated */
ssize_t load_image_size(const char *filename, void *addr, size_t size);
+
+/**load_image_targphys_as:
+ * @filename: Path to the image file
+ * @addr: Address to load the image to
+ * @max_sz: The maximum size of the image to load
+ * @as: The AddressSpace to load the ELF to. The value of address_space_memory
+ * is used if nothing is supplied here.
+ *
+ * Load a fixed image into memory.
+ *
+ * Returns the size of the loaded image on success, -1 otherwise.
+ */
+int load_image_targphys_as(const char *filename,
+ hwaddr addr, uint64_t max_sz, AddressSpace *as);
+
+/** load_image_targphys:
+ * Same as load_image_targphys_as(), but doesn't allow the caller to specify
+ * an AddressSpace.
+ */
int load_image_targphys(const char *filename, hwaddr,
uint64_t max_sz);
+
/**
* load_image_mr: load an image into a memory region
* @filename: Path to the image file
@@ -179,6 +199,8 @@ void hmp_info_roms(Monitor *mon, const QDict *qdict);
rom_add_file(_f, NULL, 0, _i, false, _mr, NULL)
#define rom_add_file_as(_f, _as, _i) \
rom_add_file(_f, NULL, 0, _i, false, NULL, _as)
+#define rom_add_file_fixed_as(_f, _a, _i, _as) \
+ rom_add_file(_f, NULL, _a, _i, false, NULL, _as)
#define rom_add_blob_fixed_as(_f, _b, _l, _a, _as) \
rom_add_blob(_f, _b, _l, _l, _a, NULL, NULL, _as)
--
2.7.4
- [Qemu-devel] [PULL 11/36] palmetto-bmc: remove extra no_sdcard assignement, (continued)
- [Qemu-devel] [PULL 11/36] palmetto-bmc: remove extra no_sdcard assignement, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 14/36] aspeed: add a ram_size property to the memory controller, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 21/36] cadence_gem: Add the num-priority-queues property, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 27/36] loader: Use the specified MemoryRegion, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 02/36] ast2400: rename the Aspeed SoC files to aspeed_soc, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 20/36] cadence_gem: QOMify Cadence GEM, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 29/36] loader: Add AddressSpace loading support to ELFs, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 30/36] loader: Add AddressSpace loading support to uImages, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 01/36] arm: add Cortex A7 CPU parameters, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 04/36] aspeed-soc: provide a framework to add new SoCs, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 31/36] loader: Add AddressSpace loading support to targphys,
Peter Maydell <=
- [Qemu-devel] [PULL 32/36] dma: xlnx-zynq-devcfg: Fix up XLNX_ZYNQ_DEVCFG_R_MAX, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 34/36] vmstateify ssi-sd, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 36/36] imx: Use 'const char', not 'char const', Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 06/36] palmetto-bmc: replace palmetto_bmc with aspeed, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 17/36] hw/ptimer: Introduce timer policy feature, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 19/36] tests: Add ptimer tests, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 24/36] cadence_gem: Correct indentation, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 28/36] loader: Allow a custom AddressSpace when loading ROMs, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 26/36] loader: Allow ELF loader to auto-detect the ELF arch, Peter Maydell, 2016/09/22
- [Qemu-devel] [PULL 05/36] palmetto-bmc: rename the Aspeed board file to aspeed.c, Peter Maydell, 2016/09/22