Path: blob/main/sys/contrib/openzfs/module/lua/setjmp/setjmp_arm.S
48534 views
// SPDX-License-Identifier: BSD-2-Clause1/*-2* Copyright 2004-2014 Olivier Houchard <[email protected]>3* Copyright 2012-2014 Ian Lepore <[email protected]>4* Copyright 2013-2014 Andrew Turner <[email protected]>5* Copyright 2014 Svatopluk Kraus <[email protected]>6* Copyright 2014 Michal Meloun <[email protected]>7* All rights reserved.8*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*/303132#if defined(__arm__) && !defined(__aarch64__)3334#if defined(__thumb2__)35#define _FUNC_MODE .code 16; .thumb_func36#else37#define _FUNC_MODE .code 3238#endif3940#define ENTRY(x) \41.text; \42.syntax unified; \43.balign 2; \44.global x; \45.type x,#function; \46_FUNC_MODE; \47x:4849#define END(x) \50.size x, . - x;5152#define RET bx lr535455/*56* setjump + longjmp57*/58ENTRY(setjmp)59#if defined(__thumb2__)60mov ip, sp61stmia r0, {r4-r12,r14}62#else63stmia r0, {r4-r14}64#endif65mov r0, #0x0000000066RET67END(setjmp)6869ENTRY(longjmp)70#if defined(__thumb2__)71ldmia r0, {r4-r12,r14}72mov sp, ip73#else74ldmia r0, {r4-r14}75#endif76mov r0, #0x0000000177RET78END(longjmp)7980#ifdef __ELF__81.section .note.GNU-stack,"",%progbits82#endif8384#endif858687