2009-07-20 Vladimir Serbinenko <phcoder@gmail.com>
[grub2/phcoder.git] / lib / sparc64 / setjmp.S
blob0e23ecfa15262629706cd5851c3e3cbfc637151f
1 /*
2  *  GRUB  --  GRand Unified Bootloader
3  *  Copyright (C) 2005,2007,2009  Free Software Foundation, Inc.
4  *
5  *  GRUB is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  GRUB is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17  */
19 #include <grub/symbol.h>
21         .file   "setjmp.S"
23         .text
26  * int grub_setjmp (grub_jmp_buf env)
27  */
28 FUNCTION(grub_setjmp)
29         stx     %o7, [%o0 + 0x00]
30         stx     %sp, [%o0 + 0x08]
31         stx     %fp, [%o0 + 0x10]
32         retl
33          clr    %o0
36  * int grub_longjmp (grub_jmp_buf env, int val)
37  */
38 FUNCTION(grub_longjmp)
39         ldx     [%o0 + 0x10], %g1
40         movrz   %o1, 1, %o1
41         flushw
42         ldx     [%o0 + 0x00], %o7
43         ldx     [%o0 + 0x08], %fp
44         sub     %fp, 192, %sp
45         stx     %g1, [%sp + 2047 + (14 * 8)]
46         retl
47          restore %o1, 0, %o0