1*0d34bfa2Suebayasi/* $NetBSD: _setjmp.S,v 1.9 2014/05/23 02:34:19 uebayasi Exp $ */ 2f5df298aSchristos 3f5df298aSchristos/*- 4f5df298aSchristos * Copyright (c) 1990 The Regents of the University of California. 5f5df298aSchristos * All rights reserved. 6f5df298aSchristos * 7f5df298aSchristos * This code is derived from software contributed to Berkeley by 8f5df298aSchristos * William Jolitz. 9f5df298aSchristos * 10f5df298aSchristos * Redistribution and use in source and binary forms, with or without 11f5df298aSchristos * modification, are permitted provided that the following conditions 12f5df298aSchristos * are met: 13f5df298aSchristos * 1. Redistributions of source code must retain the above copyright 14f5df298aSchristos * notice, this list of conditions and the following disclaimer. 15f5df298aSchristos * 2. Redistributions in binary form must reproduce the above copyright 16f5df298aSchristos * notice, this list of conditions and the following disclaimer in the 17f5df298aSchristos * documentation and/or other materials provided with the distribution. 18f5df298aSchristos * 3. Neither the name of the University nor the names of its contributors 19f5df298aSchristos * may be used to endorse or promote products derived from this software 20f5df298aSchristos * without specific prior written permission. 21f5df298aSchristos * 22f5df298aSchristos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23f5df298aSchristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24f5df298aSchristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25f5df298aSchristos * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26f5df298aSchristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27f5df298aSchristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28f5df298aSchristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29f5df298aSchristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30f5df298aSchristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31f5df298aSchristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32f5df298aSchristos * SUCH DAMAGE. 33f5df298aSchristos * 34f5df298aSchristos * from: @(#)_setjmp.s 5.1 (Berkeley) 4/23/90 35f5df298aSchristos */ 36f5df298aSchristos 37f5df298aSchristos#include <machine/asm.h> 38f5df298aSchristos#if defined(LIBC_SCCS) 39*0d34bfa2Suebayasi RCSID("$NetBSD: _setjmp.S,v 1.9 2014/05/23 02:34:19 uebayasi Exp $") 40f5df298aSchristos#endif 41f5df298aSchristos 42f5df298aSchristos/* 43f5df298aSchristos * C library -- _setjmp, _longjmp 44f5df298aSchristos * 45f5df298aSchristos * _longjmp(a,v) 46f5df298aSchristos * will generate a "return(v)" from the last call to 47f5df298aSchristos * _setjmp(a) 48f5df298aSchristos * by restoring registers from the stack. 49f5df298aSchristos * The previous signal state is NOT restored. 50f5df298aSchristos */ 51f5df298aSchristos 52f5df298aSchristosENTRY(_setjmp) 53f5df298aSchristos movl 4(%esp),%eax 54f5df298aSchristos movl 0(%esp),%edx 55f5df298aSchristos movl %edx, 0(%eax) /* rta */ 56f5df298aSchristos movl %ebx, 4(%eax) 57f5df298aSchristos movl %esp, 8(%eax) 58f5df298aSchristos movl %ebp,12(%eax) 59f5df298aSchristos movl %esi,16(%eax) 60f5df298aSchristos movl %edi,20(%eax) 61f5df298aSchristos xorl %eax,%eax 62f5df298aSchristos ret 63*0d34bfa2SuebayasiEND(_setjmp) 64f5df298aSchristos 65f5df298aSchristosENTRY(_longjmp) 66f5df298aSchristos movl 4(%esp),%edx 67f5df298aSchristos movl 8(%esp),%eax 68f5df298aSchristos movl 0(%edx),%ecx 69f5df298aSchristos movl 4(%edx),%ebx 70f5df298aSchristos movl 8(%edx),%esp 71f5df298aSchristos movl 12(%edx),%ebp 72f5df298aSchristos movl 16(%edx),%esi 73f5df298aSchristos movl 20(%edx),%edi 74f5df298aSchristos testl %eax,%eax 75f5df298aSchristos jnz 1f 76f5df298aSchristos incl %eax 77f5df298aSchristos1: movl %ecx,0(%esp) 78f5df298aSchristos ret 79*0d34bfa2SuebayasiEND(_longjmp) 80