]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/testjump.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * @OSF_FREE_COPYRIGHT@
28 #include <ppc/setjmp.h>
30 int recursed(jmp_buf_t
*bufp
, int retval
, int depth
)
38 printf("in recursed(0x%x,%d,%d)\n",bufp
,retval
,depth
);
42 printf("LONGJUMPING from depth %d to buffer at 0x%x!\n",retval
, bufp
);
44 _longjmp(bufp
, retval
);
45 printf("SHOULDN'T GET HERE\n");
47 recursed(bufp
,retval
,depth
-1);
49 return mumbojumbo
[15]=-1; /* make sure we generate our own frame */
58 printf("calling setjmp\n");
62 for (i
=0; i
<64; i
++) {
63 if ((i
% 8) == 0) printf("\n%2d :",i
);
64 printf(" %8x",buf
.jmp_buf[i
]);
67 printf("\nsetjmp returned %d, structure at 0x%x\n",val
,&buf
);
70 recursed(&buf
,val
+1,val
+1);
72 printf("returning from setjmp/longjmp test\n");