Path: blob/main/sys/contrib/openzfs/module/lua/setjmp/setjmp_loongarch64.S
48535 views
// SPDX-License-Identifier: BSD-2-Clause1/*-2* Copyright 2022 Han Gao <[email protected]>3* All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND15* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE18* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS20* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)21* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT22* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24* SUCH DAMAGE.25*/2627#if __loongarch_lp642829#define ENTRY(symbol) \30.text; \31.globl symbol; \32.align 3; \33.type symbol, @function; \34symbol:3536#define END(function) \37.size function, .- function;3839ENTRY(setjmp)40st.d $ra, $a0, 0*841st.d $sp, $a0, 1*842st.d $r21, $a0, 2*843st.d $fp, $a0, 3*844st.d $s0, $a0, 4*845st.d $s1, $a0, 5*846st.d $s2, $a0, 6*847st.d $s3, $a0, 7*848st.d $s4, $a0, 8*849st.d $s5, $a0, 9*850st.d $s6, $a0, 10*851st.d $s7, $a0, 11*852st.d $s8, $a0, 12*85354li.w $a0, 055jr $ra56END(setjmp)5758ENTRY(longjmp)59ld.d $ra, $a0, 0*860ld.d $sp, $a0, 1*861ld.d $r21, $a0, 2*862ld.d $fp, $a0, 3*863ld.d $s0, $a0, 4*864ld.d $s1, $a0, 5*865ld.d $s2, $a0, 6*866ld.d $s3, $a0, 7*867ld.d $s4, $a0, 8*868ld.d $s5, $a0, 9*869ld.d $s6, $a0, 10*870ld.d $s7, $a0, 11*871ld.d $s8, $a0, 12*87273sltui $a0, $a1, 174add.d $a0, $a0, $a1 // a0 = (a1 == 0) ? 1 : a175jr $ra76END(longjmp)7778#ifdef __ELF__79.section .note.GNU-stack,"",%progbits80#endif8182#endif838485