From patchwork Thu Nov 22 17:26:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 151809 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1018669ljp; Thu, 22 Nov 2018 09:26:59 -0800 (PST) X-Google-Smtp-Source: AJdET5cspkzO1hZ47EAYZN4qpsub6z9xw4hzQiJT/LtS9Gtr5o2MTuRIP1qA1hb9jE9eXfLn272J X-Received: by 2002:a1c:950f:: with SMTP id x15-v6mr10867748wmd.3.1542907619645; Thu, 22 Nov 2018 09:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542907619; cv=none; d=google.com; s=arc-20160816; b=y9SHLcEEOgOWrSIMhbJnumgzlx0GF6dR0MqJgm3FnS4imxNXQxkr+nF1mnbP4ZbUUQ Dki/aSQLW+88y8EndfJi+JnNhEbYxiuXKvP2w45BTJzkVfPG+SQqoY1MmnedTzDuuY0I GsssrXj6W9BKLqYlsPHZhVWg8Vr2kYJUJiGNuiC5KzEcHhOuOsN4ppPKDzzmJzlBxzUE eW2HZOIPGjH/ia0AAAK6ZwW6AEwlEJIVHCApqMxmt2sLOw9JUWKOtthrpJarAD4EDFNw O0eH5ee0o7+0JJZ86HXfemk2Wihxg3Frt8Vo+x+WT+TdMkAccXq2kwAP6cLQxRnAymvZ vhXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=XGEW7nyDacq1HwaQphwG+1IzZu6IuS4CTxik4WzDDbg=; b=dJU8e33Dt3YCV6Zv+EkUYDp7s+ECtfXrLxwraqSY6sFzTNZ7RxmpVa8BOZdV8NQXoF /5W73JqmCjWPg02nPOtOkR+XZrssouDgsytRaPsPWOnPIff8LmQnl6vNYCFxRENtEMgs DU3S0ATUsgUopv4I//38npVHiv9X0ZS/omSEyIDNeUPuxZnaN7URDU1teYQbL2GA+ASN TD2Jvw3CZOFfQX8WtjSZVBKnnpwmuUBtiQ85C9wt2sDr1Ac7+nYTOMIeCXTpYvagjLWM pBppGwe3xBYmArYhewQ7fAEp1GAkdYFGMKfkv85kRr/04h8odt/IiYZzbhjh8PPqXhND a/1A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id s82si3907487wmf.82.2018.11.22.09.26.59 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 22 Nov 2018 09:26:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gPskl-0005fB-6E; Thu, 22 Nov 2018 17:26:59 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, "Dr. David Alan Gilbert" , Markus Armbruster , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 for-4.0 3/3] elf_ops.h: Use address_space_write() to write memory Date: Thu, 22 Nov 2018 17:26:53 +0000 Message-Id: <20181122172653.3413-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181122172653.3413-1-peter.maydell@linaro.org> References: <20181122172653.3413-1-peter.maydell@linaro.org> MIME-Version: 1.0 Currently the load_elf function in elf_ops.h uses cpu_physical_memory_write() to write the ELF file to memory if it is not handling it as a ROM blob. This means we ignore the AddressSpace that the function is passed to define where it should be loaded. Use address_space_write() instead. Signed-off-by: Peter Maydell --- v1->v2: handle NULL as --- include/hw/elf_ops.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.19.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index 81cecaf27e2..74679ff8da3 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -482,7 +482,9 @@ static int glue(load_elf, SZ)(const char *name, int fd, rom_add_elf_program(label, data, file_size, mem_size, addr, as); } else { - cpu_physical_memory_write(addr, data, file_size); + address_space_write(as ? as : &address_space_memory, + addr, MEMTXATTRS_UNSPECIFIED, + data, file_size); g_free(data); } }