From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsEh5-00035A-TG for qemu-devel@nongnu.org; Fri, 20 Jul 2012 11:00:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsEh4-0006Y8-Dy for qemu-devel@nongnu.org; Fri, 20 Jul 2012 11:00:39 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:57948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsEh4-0006Wi-7b for qemu-devel@nongnu.org; Fri, 20 Jul 2012 11:00:38 -0400 From: Peter Maydell Date: Fri, 20 Jul 2012 16:00:24 +0100 Message-Id: <1342796430-16636-5-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1342796430-16636-1-git-send-email-peter.maydell@linaro.org> References: <1342796430-16636-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 04/10] hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , Blue Swirl Cc: qemu-devel@nongnu.org, Paul Brook The legacy ATAGS format for passing information to the kernel only allows RAM sizes which fit in 32 bits; enforce this restriction rather than silently doing something weird. Signed-off-by: Peter Maydell Reviewed-by: Peter A. G. Crosthwaite --- hw/arm_boot.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/arm_boot.c b/hw/arm_boot.c index 29ae324..af71ed6 100644 --- a/hw/arm_boot.c +++ b/hw/arm_boot.c @@ -399,6 +399,12 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info) bootloader[5] = dtb_start; } else { bootloader[5] = info->loader_start + KERNEL_ARGS_ADDR; + if (info->ram_size >= (1ULL << 32)) { + fprintf(stderr, "qemu: RAM size must be less than 4GB to boot" + " Linux kernel using ATAGS (try passing a device tree" + " using -dtb)\n"); + exit(1); + } } bootloader[6] = entry; for (n = 0; n < sizeof(bootloader) / 4; n++) { -- 1.7.5.4