From patchwork Wed Nov 14 17:27:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 151096 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5962912ljp; Wed, 14 Nov 2018 09:28:11 -0800 (PST) X-Google-Smtp-Source: AJdET5dV7iERqjpP6jJi5kYj/94yjgNZgoijjtNEzbr+QoWxmNwZuzYxV+LTuPlm9iIGEgazo5oH X-Received: by 2002:a0c:ad16:: with SMTP id u22mr2790774qvc.240.1542216490942; Wed, 14 Nov 2018 09:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542216490; cv=none; d=google.com; s=arc-20160816; b=pTDIBCwogaOXjEjjLMGhuYEYXoEVcVF37j8qcfZLgP3bgK2QIEpXi6BsxamawHwmDn HNz+QR4dMVAyvh8Rmc+Q6d+Z79vcWpwekdwAgg50A5Z2M26ElguhIOrWbdR7zTmVViQ5 TJjSaKZNVSMW/+KH5/Jb2WEBPCxqDeoTPvEixcPal0PrdbCu4vK3pDu47V9c92uyT4KM OjT6N2KrnMtbWx/qZmp9oBE2Lr1ECAjLcVb8OpCbV8bKGgJfUjovqfEk3oMh9rKaytfh Uq57yPNLslMrRcW8/F6KITlPVdNwDQpV8jv204MG8+rKg8dXKZ8BQUcYAQpGl/l0gFJ3 hW3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from; bh=XkNdS3nAMf3uJX1Zw3fmO4PBaPFvpzjsLSD2n1KzzJ0=; b=Klny98Qvt9O539mihOtY/aC3JdQnradMX2w5TmprciDxy4/3WhGacCEKk7bqGA4Rzr 7J6Bx1Y/CYGlUniVojbOPZcNmmF+6cQHX7LL5r4NKlVSELazPBVYn8h1bVEBx5Pkxbff pQx+OD3/c8brTApE+QBFRSJa8NQvXqDZolAzMpy8HNT+z03pQVlWo8ITUfZyEUSjuK31 0ZNwIqzBJOXybK94du1mbC8qtBq3ol2FSABXlNPnrHiDg2fbM4Q+jvH8MWs/o9KCJqoQ 43vLhwzHEBNyhmzl8V+evZzA5Cx7lVZSt06bQeROqmXtIM7laH+D+GzdVPVto53rnhFU J7xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v6si6447382qte.364.2018.11.14.09.28.10 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 14 Nov 2018 09:28:10 -0800 (PST) Received-SPF: pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grub-devel-bounces+patch=linaro.org@gnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="grub-devel-bounces+patch=linaro.org@gnu.org" Received: from localhost ([::1]:33494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMyxW-0005Av-2d for patch@linaro.org; Wed, 14 Nov 2018 12:28:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gMyxF-00056o-AA for grub-devel@gnu.org; Wed, 14 Nov 2018 12:27:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gMyxA-0007eE-Bj for grub-devel@gnu.org; Wed, 14 Nov 2018 12:27:53 -0500 Received: from mx2.suse.de ([195.135.220.15]:48624 helo=mx1.suse.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gMyx5-0007YF-8L for grub-devel@gnu.org; Wed, 14 Nov 2018 12:27:45 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0CF83AF4C; Wed, 14 Nov 2018 17:27:41 +0000 (UTC) From: Alexander Graf To: grub-devel@gnu.org Subject: [PATCH v3 05/10] RISC-V: Add early startup code Date: Wed, 14 Nov 2018 18:27:34 +0100 Message-Id: <20181114172739.51640-6-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20181114172739.51640-1-agraf@suse.de> References: <20181114172739.51640-1-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 195.135.220.15 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The development of GNU GRUB Cc: "rickchen36 @ gmail . com" , David Abdurachmanov , schwab@suse.de, "greentime @ andestech . com" , leif.lindholm@linaro.org, atish.patra@wdc.com, Michael Chang , Alistair Francis , Lukas Auer , Paul Walmsley , Bin Meng MIME-Version: 1.0 Errors-To: grub-devel-bounces+patch=linaro.org@gnu.org Sender: "Grub-devel" On entry, we need to save the system table pointer as well as our image handle. Add an early startup file that saves them and then brings us into our main function. Signed-off-by: Alexander Graf Reviewed-by: Alistair Francis --- grub-core/kern/riscv/efi/startup.S | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 grub-core/kern/riscv/efi/startup.S -- 2.12.3 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel Reviewed-by: Bin Meng Tested-by: Bin Meng diff --git a/grub-core/kern/riscv/efi/startup.S b/grub-core/kern/riscv/efi/startup.S new file mode 100644 index 000000000..026f99bab --- /dev/null +++ b/grub-core/kern/riscv/efi/startup.S @@ -0,0 +1,49 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2013 Free Software Foundation, Inc. + * + * GRUB is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GRUB is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GRUB. If not, see . + */ + +#include + +#if __riscv_xlen == 64 +#define sl sd +#define ll ld +#else +#define sl sw +#define ll lw +#endif + + + .file "startup.S" + .text +FUNCTION(_start) + /* + * EFI_SYSTEM_TABLE and EFI_HANDLE are passed in a1/a0. + */ + + ll a2, efi_image_handle_val + sl a0, 0(a2) + ll a2, efi_system_table_val + sl a1, 0(a2) + ll a2, grub_main_val + jr a2 +grub_main_val: + .quad EXT_C(grub_main) +efi_system_table_val: + .quad EXT_C(grub_efi_system_table) +efi_image_handle_val: + .quad EXT_C(grub_efi_image_handle) +