uwx_env.h revision 121642
1115013Smarcel/* 2121642SmarcelCopyright (c) 2003 Hewlett-Packard Development Company, L.P. 3121642SmarcelPermission is hereby granted, free of charge, to any person 4121642Smarcelobtaining a copy of this software and associated documentation 5121642Smarcelfiles (the "Software"), to deal in the Software without 6121642Smarcelrestriction, including without limitation the rights to use, 7121642Smarcelcopy, modify, merge, publish, distribute, sublicense, and/or sell 8121642Smarcelcopies of the Software, and to permit persons to whom the 9121642SmarcelSoftware is furnished to do so, subject to the following 10121642Smarcelconditions: 11115013Smarcel 12121642SmarcelThe above copyright notice and this permission notice shall be 13121642Smarcelincluded in all copies or substantial portions of the Software. 14121642Smarcel 15121642SmarcelTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16121642SmarcelEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17121642SmarcelOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18121642SmarcelNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19121642SmarcelHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20121642SmarcelWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21121642SmarcelFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22121642SmarcelOTHER DEALINGS IN THE SOFTWARE. 23121642Smarcel*/ 24121642Smarcel 25115013Smarcel#include "uwx.h" 26115013Smarcel 27115013Smarcel#define WORDSZ 4 28115013Smarcel#define DWORDSZ 8 29115013Smarcel#define BUNDLESZ 16 30115013Smarcel#define SLOTSPERBUNDLE 3 31115013Smarcel 32115013Smarcel#define UNWIND_TBL_32BIT 0x8000000000000000LL 33115013Smarcel 34115013Smarcel#define UNW_VER(x) ((x) >> 48) 35115013Smarcel#define UNW_FLAG_MASK 0x0000ffff00000000LL 36115013Smarcel#define UNW_FLAG_EHANDLER 0x0000000100000000LL 37115013Smarcel#define UNW_FLAG_UHANDLER 0x0000000200000000LL 38115013Smarcel#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffLL) 39115013Smarcel 40115013Smarcelstruct uwx_scoreboard; 41115013Smarcel 42115013Smarcel#define NSCOREBOARDS 8 /* Initial allocation of scoreboards */ 43115013Smarcel 44120925Smarcel#define NSPECIALREG 16 /* Must be even, so FRs are aligned */ 45115013Smarcel#define NPRESERVEDGR 4 46115013Smarcel#define NPRESERVEDBR 5 47115013Smarcel#define NPRESERVEDFR 20 48115013Smarcel 49115013Smarcelstruct uwx_fpreg { 50115013Smarcel uint64_t part0; 51115013Smarcel uint64_t part1; 52115013Smarcel}; 53115013Smarcel 54115013Smarcelstruct uwx_context { 55115013Smarcel unsigned int valid_regs; 56115013Smarcel unsigned int valid_frs; 57115013Smarcel uint64_t special[NSPECIALREG]; 58115013Smarcel uint64_t gr[NPRESERVEDGR]; 59115013Smarcel uint64_t br[NPRESERVEDBR]; 60115013Smarcel struct uwx_fpreg fr[NPRESERVEDFR]; 61115013Smarcel}; 62115013Smarcel 63115013Smarcel#define VALID_GR_SHIFT NSPECIALREG 64115013Smarcel#define VALID_BR_SHIFT (NSPECIALREG + NPRESERVEDGR) 65115013Smarcel 66120925Smarcel#define VALID_BASIC4 0x0f /* IP, SP, BSP, CFM */ 67120925Smarcel#define VALID_MARKERS 0x70 /* RP, PSP, PFS */ 68115013Smarcel 69115013Smarcelstruct uwx_history { 70115013Smarcel uint64_t special[NSPECIALREG]; 71115013Smarcel uint64_t gr[NPRESERVEDGR]; 72115013Smarcel uint64_t br[NPRESERVEDBR]; 73115013Smarcel uint64_t fr[NPRESERVEDFR]; 74115013Smarcel}; 75115013Smarcel 76115013Smarcelstruct uwx_str_pool; 77115013Smarcel 78115013Smarcelstruct uwx_env { 79115013Smarcel struct uwx_context context; 80115013Smarcel uint64_t *rstate; 81115013Smarcel int64_t function_offset; 82115013Smarcel struct uwx_history history; 83115013Smarcel alloc_cb allocate_cb; 84115013Smarcel free_cb free_cb; 85115013Smarcel struct uwx_scoreboard *free_scoreboards; 86115013Smarcel struct uwx_scoreboard *used_scoreboards; 87115013Smarcel struct uwx_scoreboard *labeled_scoreboards; 88115013Smarcel struct uwx_str_pool *string_pool; 89115013Smarcel char *module_name; 90115013Smarcel char *function_name; 91115013Smarcel intptr_t cb_token; 92115013Smarcel copyin_cb copyin; 93115013Smarcel lookupip_cb lookupip; 94115013Smarcel int remote; 95115013Smarcel int byte_swap; 96115013Smarcel int abi_context; 97115013Smarcel int nsbreg; 98115013Smarcel int nscoreboards; 99115013Smarcel int trace; 100115013Smarcel}; 101115013Smarcel 102115013Smarcelextern alloc_cb uwx_allocate_cb; 103115013Smarcelextern free_cb uwx_free_cb; 104