Path: blob/main/sys/contrib/openzfs/module/lua/setjmp/setjmp_i386.S
48534 views
// SPDX-License-Identifier: CDDL-1.01/*2* CDDL HEADER START3*4* The contents of this file are subject to the terms of the5* Common Development and Distribution License (the "License").6* You may not use this file except in compliance with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or https://opensource.org/licenses/CDDL-1.0.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/2122/*23* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.24*/2526#define ENTRY(x) \27.text; \28.balign 8; \29.globl x; \30.type x, @function; \31x:3233#define SET_SIZE(x) \34.size x, [.-x]3536/*37* Setjmp and longjmp implement non-local gotos using state vectors38* type label_t.39*/40#ifdef __i386__4142ENTRY(setjmp) /* save area is passed in eax */43movl %ebp, 0(%eax) /* save ebp */44movl %ebx, 4(%eax) /* save ebx */45movl %esi, 8(%eax) /* save esi */46movl %edi, 12(%eax) /* save edi */47movl %esp, 16(%eax) /* save esp */48movl (%esp), %ecx /* %eip (return address) */49movl %ecx, 20(%eax) /* save eip */50subl %eax, %eax /* return 0 */51ret52SET_SIZE(setjmp)5354ENTRY(longjmp) /* save area is passed in eax */55movl 0(%eax), %ebp /* restore ebp */56movl 4(%eax), %ebx /* restore ebx */57movl 8(%eax), %esi /* restore esi */58movl 12(%eax), %edi /* restore edi */59movl 16(%eax), %esp /* restore esp */60movl 20(%eax), %ecx /* %eip (return address) */61addl $4, %esp /* pop ret adr */62jmp *%ecx /* indirect jump */63SET_SIZE(longjmp)6465#ifdef __ELF__66.section .note.GNU-stack,"",%progbits67#endif6869#endif /* __i386__ */707172