Path: blob/main/sys/contrib/openzfs/module/lua/setjmp/setjmp_aarch64.S
48535 views
// SPDX-License-Identifier: BSD-2-Clause1/*-2* Copyright (c) 2014 Andrew Turner3* Copyright (c) 2014-2015 The FreeBSD Foundation4* All rights reserved.5*6* Portions of this software were developed by Andrew Turner7* under sponsorship from the FreeBSD Foundation8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17*18* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND19* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE20* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE21* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE22* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL23* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS24* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)25* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT26* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY27* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF28* SUCH DAMAGE.29*30*/313233#ifdef __aarch64__3435#define ENTRY(sym) \36.text; \37.globl sym; \38.balign 2; \39.type sym,#function; \40sym:4142#define END(sym) \43.size sym, . - sym444546ENTRY(setjmp)47/* Store the stack pointer */48mov x8, sp49str x8, [x0], #85051/* Store the general purpose registers and lr */52stp x19, x20, [x0], #1653stp x21, x22, [x0], #1654stp x23, x24, [x0], #1655stp x25, x26, [x0], #1656stp x27, x28, [x0], #1657stp x29, x30, [x0], #165859/* Return value */60mov x0, #061ret62END(setjmp)6364ENTRY(longjmp)65/* Restore the stack pointer */66ldr x8, [x0], #867mov sp, x86869/* Restore the general purpose registers and lr */70ldp x19, x20, [x0], #1671ldp x21, x22, [x0], #1672ldp x23, x24, [x0], #1673ldp x25, x26, [x0], #1674ldp x27, x28, [x0], #1675ldp x29, x30, [x0], #167677/* Load the return value */78mov x0, x179ret80END(longjmp)8182#ifdef __ELF__83.section .note.GNU-stack,"",%progbits84#endif8586#endif /* __aarch64__ */878889