1N/A/*
1N/A * GRUB -- GRand Unified Bootloader
1N/A * Copyright (C) 2000 Free Software Foundation, Inc.
1N/A *
1N/A * This program is free software; you can redistribute it and/or modify
1N/A * it under the terms of the GNU General Public License as published by
1N/A * the Free Software Foundation; either version 2 of the License, or
1N/A * (at your option) any later version.
1N/A *
1N/A * This program is distributed in the hope that it will be useful,
1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1N/A * GNU General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU General Public License
1N/A * along with this program; if not, write to the Free Software
1N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1N/A */
1N/A
1N/A/* This is stolen from libc/x86/setjmp.S in the OSKit */
1N/A/*
1N/A * Mach Operating System
1N/A * Copyright (c) 1991,1990,1989 Carnegie Mellon University
1N/A * All Rights Reserved.
1N/A *
1N/A * Permission to use, copy, modify and distribute this software and its
1N/A * documentation is hereby granted, provided that both the copyright
1N/A * notice and this permission notice appear in all copies of the
1N/A * software, derivative works or modified versions, and any portions
1N/A * thereof, and that both notices appear in supporting documentation.
1N/A *
1N/A * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
1N/A * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
1N/A * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
1N/A *
1N/A * Carnegie Mellon requests users of this software to return to
1N/A *
1N/A * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
1N/A * School of Computer Science
1N/A * Carnegie Mellon University
1N/A * Pittsburgh PA 15213-3890
1N/A *
1N/A * any improvements or extensions that they make and grant Carnegie Mellon
1N/A * the rights to redistribute these changes.
1N/A */
1N/A/*
1N/A * C library -- _setjmp, _longjmp
1N/A *
1N/A * _longjmp(a,v)
1N/A * will generate a "return(v)" from
1N/A * the last call to
1N/A * _setjmp(a)
1N/A * by restoring registers from the stack,
1N/A * The previous signal state is NOT restored.
1N/A *
1N/A */
1N/A
1N/AENTRY(grub_setjmp)
1N/A movl 4(%esp), %ecx /* fetch buffer */
1N/A movl %ebx, 0(%ecx)
1N/A movl %esi, 4(%ecx)
1N/A movl %edi, 8(%ecx)
1N/A movl %ebp, 12(%ecx) /* save frame pointer of caller */
1N/A popl %edx
1N/A movl %esp, 16(%ecx) /* save stack pointer of caller */
1N/A movl %edx, 20(%ecx) /* save pc of caller */
1N/A xorl %eax, %eax
1N/A jmp *%edx
1N/A
1N/AENTRY(grub_longjmp)
1N/A movl 8(%esp), %eax /* return(v) */
1N/A movl 4(%esp), %ecx /* fetch buffer */
1N/A movl 0(%ecx), %ebx
1N/A movl 4(%ecx), %esi
1N/A movl 8(%ecx), %edi
1N/A movl 12(%ecx), %ebp
1N/A movl 16(%ecx), %esp
1N/A orl %eax, %eax
1N/A jnz 0f
1N/A incl %eax
1N/A0: jmp *20(%ecx) /* done, return.... */