From patchwork Wed Mar 2 06:56:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Crosthwaite X-Patchwork-Id: 8478351 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B02E99F314 for ; Wed, 2 Mar 2016 07:04:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EF03D2035E for ; Wed, 2 Mar 2016 07:04:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 45B342035D for ; Wed, 2 Mar 2016 07:04:58 +0000 (UTC) Received: from localhost ([::1]:54520 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab0q9-00048R-Kr for patchwork-qemu-devel@patchwork.kernel.org; Wed, 02 Mar 2016 02:04:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab0iu-0007B1-6H for qemu-devel@nongnu.org; Wed, 02 Mar 2016 01:57:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ab0it-0003cr-CL for qemu-devel@nongnu.org; Wed, 02 Mar 2016 01:57:28 -0500 Received: from mail-pf0-x22a.google.com ([2607:f8b0:400e:c00::22a]:36137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ab0it-0003cW-6M; Wed, 02 Mar 2016 01:57:27 -0500 Received: by mail-pf0-x22a.google.com with SMTP id l6so30968938pfl.3; Tue, 01 Mar 2016 22:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=6pq0lY0+7R43ZPoXbcKGvXyrVWj9qPcpsft4ostSGDg=; b=pz5KyOPeIcJ+xADNx/rcQecJ6J+TkP9WwsV5VfsQC9HRl1J/r+9KqPpy5DuXTkbR4k /Ok4vP23LQl3gfBbWfRdOIA3bL4eIlHUOetYzEEvQva2cbXrFc6stz9HKVjRbJBgjfqs Qymjkh3Q6HcaU93Kqj9SNThnOxASazzBhVXKbXKtuM4pbE5zJEh2Opd1r3+MZSojrJsU SxdiJOf5K5L8ErBGXBkQFlE86PeLWmAou7xvSE+ymVQTHfJjSlbJR7/hpfz45zL7+B9M xQO1Q7XYS51HC96UIJbDLXcrWQUlB6iNFdhPtPxOcibFJOfyxHV5E7tUJz/ZtKc/zNyH pinQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=6pq0lY0+7R43ZPoXbcKGvXyrVWj9qPcpsft4ostSGDg=; b=QujkIz+OVXAjZ808ghfU3yKPi81bfTF6e3wEYm8vk2Si/sWc6J60XXm35sAiitMXcV ISEVQ4RLnIkfc77brvrdnMR7WmwGUJS2AdjWc+DQT1ecAb1t0poXJbwYLUmv9naT8CRO 3+eF+vQHFEF0SYggJTFbzpYSfkGCJmla2ftiDYeeQ3qgcgupjmBanPj2+3hfyUta46Vz xrW6wRFPfdpGs1MyPHRUJaCZaeHPV8Y0TBA/PsHBr0vCIMW4zHYqKW51WIAXAz5JQAPY u64yOgiUKHEpbPVHA4DM04pMH+aYmOpgQVIGYMklRd5hhxRu6kBb0bXNvmad0eZIo5Qp /voA== X-Gm-Message-State: AD7BkJLHHq9zoER9NXaSoerSamV5PUv0vkmf2ApnEgOnzQTVRex061///MwpDZsALU1dSQ== X-Received: by 10.98.79.9 with SMTP id d9mr35358148pfb.46.1456901846385; Tue, 01 Mar 2016 22:57:26 -0800 (PST) Received: from localhost.localdomain (mobile-166-137-179-103.mycingular.net. [166.137.179.103]) by smtp.gmail.com with ESMTPSA id 19sm50069248pfb.64.2016.03.01.22.57.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Mar 2016 22:57:25 -0800 (PST) From: Peter Crosthwaite X-Google-Original-From: Peter Crosthwaite To: qemu-devel@nongnu.org Date: Tue, 1 Mar 2016 22:56:20 -0800 Message-Id: <26d6575268b8f625b1c31e1b7a1e8854b34cc0c5.1456901522.git.crosthwaite.peter@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::22a Cc: peter.maydell@linaro.org, Peter Crosthwaite , sw@weilnetz.de, Andrew.Baumann@microsoft.com, alistair.francis@xilinx.com, sridhar_kulk@yahoo.com, qemu-arm@nongnu.org, pbonzini@redhat.com, piotr.krol@3mdeb.com Subject: [Qemu-devel] [PATCH v2 16/18] loader: load_elf(): Add doc comment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Document the usage of load_elf() for clarity on current features. Signed-off-by: Peter Crosthwaite --- include/hw/loader.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/hw/loader.h b/include/hw/loader.h index a626c9b..264ef89 100644 --- a/include/hw/loader.h +++ b/include/hw/loader.h @@ -32,6 +32,29 @@ int load_image_gzipped(const char *filename, hwaddr addr, uint64_t max_sz); #define ELF_LOAD_WRONG_ARCH -3 #define ELF_LOAD_WRONG_ENDIAN -4 const char *load_elf_strerror(int error); + +/** load_elf: + * @filename: Path of ELF file + * @translate_fn: optional function to translate load addresses + * @translate_opaque: opaque data passed to @translate_fn + * @pentry: Populated with program entry point. Ignored if NULL. + * @lowaddr: Populated with lowest loaded address. Ignored if NULL. + * @highaddr: Populated with highest loaded address. Ignored if NULL. + * @bigendian: Expected ELF endianness. 0 for LE otherwise BE + * @elf_machine: Expected ELF machine type + * @clear_lsb: Set to mask off LSB of addresses (Some architectures use + * this for non-address data) + * + * Load an ELF file's contents to the emulated system's address space. + * Clients may optionally specify a callback to perform address + * translations. @pentry, @lowaddr and @highaddr are optional pointers + * which will be populated with various load information. @bigendian and + * @elf_machine give the expected endianness and machine for the ELF the + * load will fail if the target ELF does not match. Some architectures + * have some architecture-specific behaviours that come into effect when + * their particular values for @elf_machine are set. + */ + int load_elf(const char *filename, uint64_t (*translate_fn)(void *, uint64_t), void *translate_opaque, uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr, int big_endian, int elf_machine,