From patchwork Mon Jul 16 13:24:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10008 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5B4CD23F2A for ; Mon, 16 Jul 2012 13:24:23 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 278BBA188A3 for ; Mon, 16 Jul 2012 13:24:23 +0000 (UTC) Received: by ggnf1 with SMTP id f1so5363090ggn.11 for ; Mon, 16 Jul 2012 06:24:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=sd9zrBm6uP1Y2M+17U2CZ4o20D87ad+QYE/T8Ug65sk=; b=X1y08GUI1SNBDTtbAyAoDZ+xLmjceyMLNW6v5Xa0BvYMamfjkTeUElz6UXmVoZCOIz xOo28OBG2O4pWV0gj8UJPM3YrrD1Ytja+RlO7Qwne6+5OxJmARxpNaI8XktOq22e7HCf z9sWb03kDbpUoJ9uhlApqarguSKQyNmEA6RVXE0RVs00dmB9FL1m7l9Dc34Y5HD8EVeU gGrRXgwLWqVvzvs9XgdfUc3fweh5k+SNsGNHJkKdzqOGlk8Ja2Rxxs5fii/ZdcfZzqJO 60q3ECclyMiI1biPg+XZ6Ek/jMhTCMv4qmkGUZAK0R4yb7PqozmNoKad3B9n7HkFuYCw DSNQ== Received: by 10.50.195.234 with SMTP id ih10mr5229349igc.0.1342445062469; Mon, 16 Jul 2012 06:24:22 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.241.2 with SMTP id lc2csp7927ibb; Mon, 16 Jul 2012 06:24:20 -0700 (PDT) Received: by 10.216.136.158 with SMTP id w30mr5796385wei.136.1342445059770; Mon, 16 Jul 2012 06:24:19 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id fl5si2189460wib.46.2012.07.16.06.24.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jul 2012 06:24:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SqlHd-0002Nm-69; Mon, 16 Jul 2012 14:24:17 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Peter Crosthwaite Subject: [PATCH v2 3/6] hw/arm_boot.c: Check for RAM sizes exceeding ATAGS capacity Date: Mon, 16 Jul 2012 14:24:13 +0100 Message-Id: <1342445056-9129-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1342445056-9129-1-git-send-email-peter.maydell@linaro.org> References: <1342445056-9129-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQmTvtSISfCI6R9x19jGnblsvnyvzUaNk5bwqomqD08r9t2WXlVWSaujmwdzxi89B3QWkQ/5 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++) {