grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v9 03/10] LoongArch: Add setjmp implementation


From: 孙海勇
Subject: Re: [PATCH v9 03/10] LoongArch: Add setjmp implementation
Date: Mon, 15 Aug 2022 21:53:36 +0800 (GMT+08:00)

Hi

     I've tested this patch set on a physical machine, the OS environment is a 
CLFS system I made based on LoongArch and they work well. It would be great if 
this patch set could be merged into the master branch. That way, I can happily 
boot my system directly with the official code.


> -----原始邮件-----
> 发件人: "Xiaotian Wu" <wuxiaotian@loongson.cn>
> 发送时间:2022-08-11 20:28:18 (星期四)
> 收件人: grub-devel@gnu.org
> 抄送: git@xen0n.name, development@efficientek.com, daniel.kiper@oracle.com, 
> "Xiaotian Wu" <wuxiaotian@loongson.cn>, "Zhou Yang" <zhouyang@loongson.cn>, 
> "Sun Haiyong" <sunhaiyong@loongson.cn>
> 主题: [PATCH v9 03/10] LoongArch: Add setjmp implementation
> 
> Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn>
> Signed-off-by: Zhou Yang <zhouyang@loongson.cn>
> Signed-off-by: Sun Haiyong <sunhaiyong@loongson.cn>
> ---
>  grub-core/lib/loongarch64/setjmp.S | 69 ++++++++++++++++++++++++++++++
>  grub-core/lib/setjmp.S             |  2 +
>  include/grub/loongarch64/setjmp.h  | 27 ++++++++++++
>  3 files changed, 98 insertions(+)
>  create mode 100644 grub-core/lib/loongarch64/setjmp.S
>  create mode 100644 include/grub/loongarch64/setjmp.h
> 
> diff --git a/grub-core/lib/loongarch64/setjmp.S 
> b/grub-core/lib/loongarch64/setjmp.S
> new file mode 100644
> index 000000000..41d58f569
> --- /dev/null
> +++ b/grub-core/lib/loongarch64/setjmp.S
> @@ -0,0 +1,69 @@
> +/*
> + *  GRUB  --  GRand Unified Bootloader
> + *  Copyright (C) 2022 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 <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <grub/dl.h>
> +
> +     .file   "setjmp.S"
> +
> +GRUB_MOD_LICENSE "GPLv3+"
> +
> +     .text
> +
> +/*
> + * int grub_setjmp (jmp_buf env)
> + */
> +FUNCTION(grub_setjmp)
> +     st.d $s0, $a0, 0x0
> +     st.d $s1, $a0, 0x8
> +     st.d $s2, $a0, 0x10
> +     st.d $s3, $a0, 0x18
> +     st.d $s4, $a0, 0x20
> +     st.d $s5, $a0, 0x28
> +     st.d $s6, $a0, 0x30
> +     st.d $s7, $a0, 0x38
> +     st.d $s8, $a0, 0x40
> +     st.d $fp, $a0, 0x48
> +     st.d $sp, $a0, 0x50
> +     st.d $ra, $a0, 0x58
> +
> +     move $a0, $zero
> +     jr   $ra
> +
> +/*
> + * void grub_longjmp (jmp_buf env, int val)
> + */
> +FUNCTION(grub_longjmp)
> +     ld.d $s0, $a0, 0x0
> +     ld.d $s1, $a0, 0x8
> +     ld.d $s2, $a0, 0x10
> +     ld.d $s3, $a0, 0x18
> +     ld.d $s4, $a0, 0x20
> +     ld.d $s5, $a0, 0x28
> +     ld.d $s6, $a0, 0x30
> +     ld.d $s7, $a0, 0x38
> +     ld.d $s8, $a0, 0x40
> +     ld.d $fp, $a0, 0x48
> +     ld.d $sp, $a0, 0x50
> +     ld.d $ra, $a0, 0x58
> +
> +     /* Return 1 if passed 0, otherwise returns the value in place. */
> +     li.w $a0, 1
> +     beqz $a1, 1f
> +     move $a0, $a1
> +1:
> +     jr   $ra
> diff --git a/grub-core/lib/setjmp.S b/grub-core/lib/setjmp.S
> index 9c8721088..cba1d546d 100644
> --- a/grub-core/lib/setjmp.S
> +++ b/grub-core/lib/setjmp.S
> @@ -19,6 +19,8 @@
>  #include "./arm/setjmp.S"
>  #elif defined(__aarch64__)
>  #include "./arm64/setjmp.S"
> +#elif defined(__loongarch64)
> +#include "./loongarch64/setjmp.S"
>  #elif defined(__riscv)
>  #include "./riscv/setjmp.S"
>  #else
> diff --git a/include/grub/loongarch64/setjmp.h 
> b/include/grub/loongarch64/setjmp.h
> new file mode 100644
> index 000000000..cb3e17763
> --- /dev/null
> +++ b/include/grub/loongarch64/setjmp.h
> @@ -0,0 +1,27 @@
> +/*
> + *  GRUB  --  GRand Unified Bootloader
> + *  Copyright (C) 2022 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 <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef GRUB_SETJMP_CPU_HEADER
> +#define GRUB_SETJMP_CPU_HEADER       1
> +
> +typedef grub_uint64_t grub_jmp_buf[12];
> +
> +int grub_setjmp (grub_jmp_buf env) RETURNS_TWICE;
> +void grub_longjmp (grub_jmp_buf env, int val) __attribute__ ((noreturn));
> +
> +#endif /* ! GRUB_SETJMP_CPU_HEADER */
> -- 
> 2.35.1


本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
 
This email and its attachments contain confidential information from Loongson 
Technology , which is intended only for the person or entity whose address is 
listed above. Any use of the information contained herein in any way 
(including, but not limited to, total or partial disclosure, reproduction or 
dissemination) by persons other than the intended recipient(s) is prohibited. 
If you receive this email in error, please notify the sender by phone or email 
immediately and delete it. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]