2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (C) 2003,2007 Free Software Foundation, Inc.
2N/A *
2N/A * GRUB is free software: you can redistribute it and/or modify
2N/A * it under the terms of the GNU General Public License as published by
2N/A * the Free Software Foundation, either version 3 of the License, or
2N/A * (at your option) any later version.
2N/A *
2N/A * GRUB is distributed in the hope that it will be useful,
2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A * GNU General Public License for more details.
2N/A *
2N/A * You should have received a copy of the GNU General Public License
2N/A * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2N/A */
2N/A
2N/A#include <grub/symbol.h>
2N/A#include <grub/dl.h>
2N/A
2N/A .file "setjmp.S"
2N/A
2N/AGRUB_MOD_LICENSE ("GPLv3+")
2N/A
2N/A .text
2N/A
2N/A/*
2N/A * int grub_setjmp (grub_jmp_buf env)
2N/A */
2N/AFUNCTION(grub_setjmp)
2N/A movl %ebx, 0(%eax) /* EBX */
2N/A movl %esi, 4(%eax) /* ESI */
2N/A movl %edi, 8(%eax) /* EDI */
2N/A movl %ebp, 12(%eax) /* EBP */
2N/A popl %ecx
2N/A movl %esp, 16(%eax) /* ESP */
2N/A movl %ecx, 20(%eax) /* EIP */
2N/A xorl %eax, %eax
2N/A jmp *%ecx
2N/A
2N/A
2N/A/*
2N/A * int grub_longjmp (grub_jmp_buf env, int val)
2N/A */
2N/AFUNCTION(grub_longjmp)
2N/A movl 0(%eax), %ebx
2N/A movl 4(%eax), %esi
2N/A movl 8(%eax), %edi
2N/A movl 12(%eax), %ebp
2N/A movl 16(%eax), %esp
2N/A movl 20(%eax), %ecx
2N/A
2N/A movl %edx, %eax
2N/A testl %eax, %eax
2N/A jnz 1f
2N/A incl %eax
2N/A1: jmp *%ecx
2N/A