1 /* @(#)stkframe.h 1.13 10/08/27 Copyright 1995-2010 J. Schilling */ 2 /* 3 * Common definitions for routines that parse the stack frame. 4 * 5 * This file has to be fixed if you want to port routines which use getfp(). 6 * Have a look at struct frame below and use it as a sample, 7 * the new struct frame must at least contain a member 'fr_savfp'. 8 */ 9 /* 10 * The contents of this file are subject to the terms of the 11 * Common Development and Distribution License, Version 1.0 only 12 * (the "License"). You may not use this file except in compliance 13 * with the License. 14 * 15 * See the file CDDL.Schily.txt in this distribution for details. 16 * A copy of the CDDL is also available via the Internet at 17 * http://www.opensource.org/licenses/cddl1.txt 18 * 19 * When distributing Covered Code, include this CDDL HEADER in each 20 * file and include the License file CDDL.Schily.txt from this distribution. 21 */ 22 23 #ifndef _SCHILY_STKFRAME_H 24 #define _SCHILY_STKFRAME_H 25 26 #ifndef _SCHILY_MCONFIG_H 27 #include <schily/mconfig.h> 28 #endif 29 30 #if defined(sun) && (defined(SVR4) || defined(__SVR4) || defined(__SVR4__)) 31 /* 32 * Solaris 2.x aka SunOS 5.x 33 */ 34 # ifdef i386 35 /* 36 * On Solaris 2.1 x86 sys/frame.h is not useful at all 37 * On Solaris 2.4 x86 sys/frame.h is buggy (fr_savfp is int!!) 38 */ 39 # ifndef _INCL_SYS_REG_H 40 # include <sys/reg.h> 41 # define _INCL_SYS_REG_H 42 # endif 43 # endif 44 # ifndef _INCL_SYS_FRAME_H 45 # include <sys/frame.h> 46 # define _INCL_SYS_FRAME_H 47 # endif 48 49 #else 50 # if defined(sun) 51 /* 52 * SunOS 4.x 53 */ 54 # ifndef _INCL_MACHINE_FRAME_H 55 # include <machine/frame.h> 56 # define _INCL_MACHINE_FRAME_H 57 # endif 58 # else 59 /* 60 * Anything that is not SunOS 61 */ 62 63 #ifdef __cplusplus 64 extern "C" { 65 #endif 66 67 #ifndef _SCHILY_UTYPES_H 68 #include <schily/utypes.h> 69 #endif 70 71 /* 72 * XXX: I hope this will be useful on other machines (no guarantee) 73 * XXX: It is taken from a sun Motorola system, but should also be useful 74 * XXX: on a i386. 75 * XXX: In general you have to write a sample program, set a breakpoint 76 * XXX: on a small function and inspect the stackframe with adb. 77 */ 78 79 struct frame { 80 struct frame *fr_savfp; /* saved frame pointer */ 81 Intptr_t fr_savpc; /* saved program counter */ 82 int fr_arg[1]; /* array of arguments */ 83 }; 84 85 #ifdef __cplusplus 86 } 87 #endif 88 89 # endif /* ! defined (sun) */ 90 #endif /* ! defined (sun) && (defined(SVR4) || defined(__SVR4) || ... */ 91 92 #endif /* _SCHILY_STKFRAME_H */ 93