1 /* @(#)fpoff.c	1.20 18/04/09 Copyright 1988-2018 J. Schilling */
2 /*
3  *	Get frame pointer offset
4  *
5  *	Copyright (c) 1988-2018 J. Schilling
6  */
7 /*
8  * The contents of this file are subject to the terms of the
9  * Common Development and Distribution License, Version 1.0 only
10  * (the "License").  You may not use this file except in compliance
11  * with the License.
12  *
13  * See the file CDDL.Schily.txt in this distribution for details.
14  * A copy of the CDDL is also available via the Internet at
15  * http://www.opensource.org/licenses/cddl1.txt
16  *
17  * When distributing Covered Code, include this CDDL HEADER in each
18  * file and include the License file CDDL.Schily.txt from this distribution.
19  */
20 
21 #include <schily/mconfig.h>
22 #include <schily/standard.h>
23 #include <schily/schily.h>
24 
25 #if defined(sparc) && defined(__GNUC__)
26 #	define	FP_OFF		0x10	/* some strange things on sparc gcc */
27 #else
28 #	define	FP_OFF		0
29 #endif
30 
31 EXPORT	void	**___fpoff	__PR((char *cp));
32 
33 /*
34  * Don't make it static to avoid inline optimization.
35  *
36  * We need this function to fool GCCs check for returning addresses
37  * from outside the functions local address space.
38  */
39 EXPORT void **
___fpoff(cp)40 ___fpoff(cp)
41 	char	*cp;
42 {
43 	long ***lp;
44 
45 	lp = (long ***)(cp + FP_OFF);
46 	lp++;
47 	return ((void **)lp);
48 }
49