Sync usage with man page.
[netbsd-mini2440.git] / lib / libc / pc532 / gen / setjmp.s
blob0987a948fbc3e21b86377eca28880ede018d35de
1 /*
2 * Copyright (c) 1992 Helsinki University of Technology
3 * All Rights Reserved.
4 *
5 * Permission to use, copy, modify and distribute this software and its
6 * documentation is hereby granted, provided that both the copyright
7 * notice and this permission notice appear in all copies of the
8 * software, derivative works or modified versions, and any portions
9 * thereof, and that both notices appear in supporting documentation.
11 * HELSINKI UNIVERSITY OF TECHNOLOGY ALLOWS FREE USE OF THIS SOFTWARE IN
12 * ITS "AS IS" CONDITION. HELSINKI UNIVERSITY OF TECHNOLOGY DISCLAIMS ANY
13 * LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE
14 * USE OF THIS SOFTWARE.
17 * HISTORY
18 * 29-Apr-92 Johannes Helander (jvh) at Helsinki University of Technology
19 * Created.
21 * $Id: setjmp.s,v 1.1 1993/09/17 18:43:46 phil Exp $
24 #include <machine/asm.h>
25 #include <machine/jmpbuf.h>
27 ENTRY(setjmp)
28 movqd 0, tos
29 bsr EX(sigblock)
30 adjspb -4
31 movd 4(sp), r2 /* jmp_buf */
32 movd 0(sp), JMP_BUF_PC(r2) /* pc of caller */
33 movd r0, JMP_BUF_SIGMASK(r2) /* save mask */
35 sprd sp, JMP_BUF_SP(r2)
36 sprd fp, JMP_BUF_FP(r2)
37 sprd sb, JMP_BUF_SB(r2)
38 movd r3, JMP_BUF_R3(r2) /* save registers r3-r7 */
39 movd r4, JMP_BUF_R4(r2)
40 movd r5, JMP_BUF_R5(r2)
41 movd r6, JMP_BUF_R6(r2)
42 movd r7, JMP_BUF_R7(r2)
44 movqd 0, r0
45 ret 0
47 ENTRY(longjmp)
48 movd 4(sp),r2 /* jmp_buf */
49 movd JMP_BUF_SIGMASK(r2), tos /* restore mask */
50 bsr EX(sigsetmask)
51 adjspb -4
52 movd 4(sp), r2 /* jmp_buf */
53 movd 8(sp), r0 /* value */
55 lprd sp, JMP_BUF_SP(r2)
56 lprd fp, JMP_BUF_FP(r2)
57 lprd sb, JMP_BUF_SB(r2)
58 movd JMP_BUF_R3(r2), r3 /* load registers r3-r7 */
59 movd JMP_BUF_R4(r2), r4
60 movd JMP_BUF_R5(r2), r5
61 movd JMP_BUF_R6(r2), r6
62 movd JMP_BUF_R7(r2), r7
63 movd JMP_BUF_PC(r2), 0(sp) /* patch return pc */
65 cmpqd 0, r0
66 bne nonzero
67 movqd 1, r0
68 nonzero:
69 ret 0