Deleted Added
full compact
uwx_env.h (121642) uwx_env.h (129059)
1/*
2Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
3Permission is hereby granted, free of charge, to any person
4obtaining a copy of this software and associated documentation
5files (the "Software"), to deal in the Software without
6restriction, including without limitation the rights to use,
7copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the
9Software is furnished to do so, subject to the following
10conditions:
11
12The above copyright notice and this permission notice shall be
13included in all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
23*/
24
25#include "uwx.h"
26
27#define WORDSZ 4
28#define DWORDSZ 8
29#define BUNDLESZ 16
30#define SLOTSPERBUNDLE 3
31
32#define UNWIND_TBL_32BIT 0x8000000000000000LL
33
34#define UNW_VER(x) ((x) >> 48)
35#define UNW_FLAG_MASK 0x0000ffff00000000LL
36#define UNW_FLAG_EHANDLER 0x0000000100000000LL
37#define UNW_FLAG_UHANDLER 0x0000000200000000LL
38#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffLL)
39
40struct uwx_scoreboard;
41
42#define NSCOREBOARDS 8 /* Initial allocation of scoreboards */
43
44#define NSPECIALREG 16 /* Must be even, so FRs are aligned */
45#define NPRESERVEDGR 4
46#define NPRESERVEDBR 5
47#define NPRESERVEDFR 20
48
49struct uwx_fpreg {
50 uint64_t part0;
51 uint64_t part1;
52};
53
54struct uwx_context {
55 unsigned int valid_regs;
56 unsigned int valid_frs;
57 uint64_t special[NSPECIALREG];
58 uint64_t gr[NPRESERVEDGR];
59 uint64_t br[NPRESERVEDBR];
60 struct uwx_fpreg fr[NPRESERVEDFR];
61};
62
63#define VALID_GR_SHIFT NSPECIALREG
64#define VALID_BR_SHIFT (NSPECIALREG + NPRESERVEDGR)
65
66#define VALID_BASIC4 0x0f /* IP, SP, BSP, CFM */
67#define VALID_MARKERS 0x70 /* RP, PSP, PFS */
68
69struct uwx_history {
70 uint64_t special[NSPECIALREG];
71 uint64_t gr[NPRESERVEDGR];
72 uint64_t br[NPRESERVEDBR];
73 uint64_t fr[NPRESERVEDFR];
74};
75
76struct uwx_str_pool;
77
78struct uwx_env {
79 struct uwx_context context;
80 uint64_t *rstate;
1/*
2Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
3Permission is hereby granted, free of charge, to any person
4obtaining a copy of this software and associated documentation
5files (the "Software"), to deal in the Software without
6restriction, including without limitation the rights to use,
7copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the
9Software is furnished to do so, subject to the following
10conditions:
11
12The above copyright notice and this permission notice shall be
13included in all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
23*/
24
25#include "uwx.h"
26
27#define WORDSZ 4
28#define DWORDSZ 8
29#define BUNDLESZ 16
30#define SLOTSPERBUNDLE 3
31
32#define UNWIND_TBL_32BIT 0x8000000000000000LL
33
34#define UNW_VER(x) ((x) >> 48)
35#define UNW_FLAG_MASK 0x0000ffff00000000LL
36#define UNW_FLAG_EHANDLER 0x0000000100000000LL
37#define UNW_FLAG_UHANDLER 0x0000000200000000LL
38#define UNW_LENGTH(x) ((x) & 0x00000000ffffffffLL)
39
40struct uwx_scoreboard;
41
42#define NSCOREBOARDS 8 /* Initial allocation of scoreboards */
43
44#define NSPECIALREG 16 /* Must be even, so FRs are aligned */
45#define NPRESERVEDGR 4
46#define NPRESERVEDBR 5
47#define NPRESERVEDFR 20
48
49struct uwx_fpreg {
50 uint64_t part0;
51 uint64_t part1;
52};
53
54struct uwx_context {
55 unsigned int valid_regs;
56 unsigned int valid_frs;
57 uint64_t special[NSPECIALREG];
58 uint64_t gr[NPRESERVEDGR];
59 uint64_t br[NPRESERVEDBR];
60 struct uwx_fpreg fr[NPRESERVEDFR];
61};
62
63#define VALID_GR_SHIFT NSPECIALREG
64#define VALID_BR_SHIFT (NSPECIALREG + NPRESERVEDGR)
65
66#define VALID_BASIC4 0x0f /* IP, SP, BSP, CFM */
67#define VALID_MARKERS 0x70 /* RP, PSP, PFS */
68
69struct uwx_history {
70 uint64_t special[NSPECIALREG];
71 uint64_t gr[NPRESERVEDGR];
72 uint64_t br[NPRESERVEDBR];
73 uint64_t fr[NPRESERVEDFR];
74};
75
76struct uwx_str_pool;
77
78struct uwx_env {
79 struct uwx_context context;
80 uint64_t *rstate;
81 uint64_t remapped_ip;
81 int64_t function_offset;
82 struct uwx_history history;
83 alloc_cb allocate_cb;
84 free_cb free_cb;
85 struct uwx_scoreboard *free_scoreboards;
86 struct uwx_scoreboard *used_scoreboards;
87 struct uwx_scoreboard *labeled_scoreboards;
88 struct uwx_str_pool *string_pool;
89 char *module_name;
90 char *function_name;
91 intptr_t cb_token;
92 copyin_cb copyin;
93 lookupip_cb lookupip;
94 int remote;
95 int byte_swap;
96 int abi_context;
97 int nsbreg;
98 int nscoreboards;
99 int trace;
100};
101
102extern alloc_cb uwx_allocate_cb;
103extern free_cb uwx_free_cb;
82 int64_t function_offset;
83 struct uwx_history history;
84 alloc_cb allocate_cb;
85 free_cb free_cb;
86 struct uwx_scoreboard *free_scoreboards;
87 struct uwx_scoreboard *used_scoreboards;
88 struct uwx_scoreboard *labeled_scoreboards;
89 struct uwx_str_pool *string_pool;
90 char *module_name;
91 char *function_name;
92 intptr_t cb_token;
93 copyin_cb copyin;
94 lookupip_cb lookupip;
95 int remote;
96 int byte_swap;
97 int abi_context;
98 int nsbreg;
99 int nscoreboards;
100 int trace;
101};
102
103extern alloc_cb uwx_allocate_cb;
104extern free_cb uwx_free_cb;