[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/39] loader: Add new load_ramdisk_as()
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 05/39] loader: Add new load_ramdisk_as() |
Date: |
Fri, 2 Mar 2018 11:06:06 +0000 |
Add a function load_ramdisk_as() which behaves like the existing
load_ramdisk() but allows the caller to specify the AddressSpace
to use. This matches the pattern we have already for various
other loader functions.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-id: address@hidden
---
include/hw/loader.h | 12 +++++++++++-
hw/core/loader.c | 8 +++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/include/hw/loader.h b/include/hw/loader.h
index 5edbe02b1c..2504cc2259 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -162,16 +162,26 @@ int load_uimage(const char *filename, hwaddr *ep,
void *translate_opaque);
/**
- * load_ramdisk:
+ * load_ramdisk_as:
* @filename: Path to the ramdisk image
* @addr: Memory address to load the ramdisk to
* @max_sz: Maximum allowed ramdisk size (for non-u-boot ramdisks)
+ * @as: The AddressSpace to load the ELF to. The value of address_space_memory
+ * is used if nothing is supplied here.
*
* Load a ramdisk image with U-Boot header to the specified memory
* address.
*
* Returns the size of the loaded image on success, -1 otherwise.
*/
+int load_ramdisk_as(const char *filename, hwaddr addr, uint64_t max_sz,
+ AddressSpace *as);
+
+/**
+ * load_ramdisk:
+ * Same as load_ramdisk_as(), but doesn't allow the caller to specify
+ * an AddressSpace.
+ */
int load_ramdisk(const char *filename, hwaddr addr, uint64_t max_sz);
ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen);
diff --git a/hw/core/loader.c b/hw/core/loader.c
index c08f130461..76b244c508 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -729,9 +729,15 @@ int load_uimage_as(const char *filename, hwaddr *ep,
hwaddr *loadaddr,
/* Load a ramdisk. */
int load_ramdisk(const char *filename, hwaddr addr, uint64_t max_sz)
+{
+ return load_ramdisk_as(filename, addr, max_sz, NULL);
+}
+
+int load_ramdisk_as(const char *filename, hwaddr addr, uint64_t max_sz,
+ AddressSpace *as)
{
return load_uboot_image(filename, NULL, &addr, NULL, IH_TYPE_RAMDISK,
- NULL, NULL, NULL);
+ NULL, NULL, as);
}
/* Load a gzip-compressed kernel to a dynamically allocated buffer. */
--
2.16.2
- [Qemu-devel] [PULL 00/39] target-arm queue, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 03/39] xlnx-zynqmp: Connect the RTC device, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 01/39] xlnx-zynqmp-rtc: Initial commit, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 04/39] decodetree: Propagate return value from translate subroutines, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 02/39] xlnx-zynqmp-rtc: Add basic time support, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 05/39] loader: Add new load_ramdisk_as(),
Peter Maydell <=
- [Qemu-devel] [PULL 07/39] hw/arm/armv7m: Honour CPU's address space for image loads, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 08/39] target/arm: Define an IDAU interface, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 12/39] target/arm: Add Cortex-M33, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 09/39] armv7m: Forward idau property to CPU object, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 11/39] armv7m: Forward init-svtor property to CPU object, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 15/39] qdev: Add new qdev_init_gpio_in_named_with_opaque(), Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 06/39] hw/arm/boot: Honour CPU's address space for image loads, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 13/39] hw/misc/unimp: Move struct to header file, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 10/39] target/arm: Define init-svtor property for the reset secure VTOR value, Peter Maydell, 2018/03/02
- [Qemu-devel] [PULL 17/39] hw/misc/mps2-fpgaio: FPGA control block for MPS2 AN505, Peter Maydell, 2018/03/02