0
|
1 /*
|
|
2 * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
|
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 *
|
|
5 * This code is free software; you can redistribute it and/or modify it
|
|
6 * under the terms of the GNU General Public License version 2 only, as
|
|
7 * published by the Free Software Foundation.
|
|
8 *
|
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 * version 2 for more details (a copy is included in the LICENSE file that
|
|
13 * accompanied this code).
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License version
|
|
16 * 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 *
|
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or
|
|
21 * have any questions.
|
|
22 *
|
|
23 */
|
|
24
|
|
25 package sun.jvm.hotspot.debugger.ia64;
|
|
26
|
|
27 import sun.jvm.hotspot.debugger.*;
|
|
28
|
|
29 /** Specifies the thread context on ia64 platform; only a sub-portion
|
|
30 of the context is guaranteed to be present on all operating
|
|
31 systems. */
|
|
32
|
|
33 public abstract class IA64ThreadContext implements ThreadContext {
|
|
34 // Refer to winnt.h CONTEXT structure - Nov 2001 edition Platform SDK
|
|
35 // only a relevant subset of CONTEXT structure is used here.
|
|
36 // For eg. floating point registers are ignored.
|
|
37
|
|
38 // NOTE: the indices for the various registers must be maintained as
|
|
39 // listed across various operating systems. However, only a
|
|
40 // subset of the registers' values are guaranteed to be present
|
|
41
|
|
42 // global registers r0-r31
|
|
43 public static final int GR0 = 0;
|
|
44 public static final int GR1 = 1;
|
|
45 public static final int GR2 = 2;
|
|
46 public static final int GR3 = 3;
|
|
47 public static final int GR4 = 4;
|
|
48 public static final int GR5 = 5;
|
|
49 public static final int GR6 = 6;
|
|
50 public static final int GR7 = 7;
|
|
51 public static final int GR8 = 8;
|
|
52 public static final int GR9 = 9;
|
|
53 public static final int GR10 = 10;
|
|
54 public static final int GR11 = 11;
|
|
55 public static final int GR12 = 12;
|
|
56 public static final int SP = GR12;
|
|
57 public static final int GR13 = 13;
|
|
58 public static final int GR14 = 14;
|
|
59 public static final int GR15 = 15;
|
|
60 public static final int GR16 = 16;
|
|
61 public static final int GR17 = 17;
|
|
62 public static final int GR18 = 18;
|
|
63 public static final int GR19 = 19;
|
|
64 public static final int GR20 = 20;
|
|
65 public static final int GR21 = 21;
|
|
66 public static final int GR22 = 22;
|
|
67 public static final int GR23 = 23;
|
|
68 public static final int GR24 = 24;
|
|
69 public static final int GR25 = 25;
|
|
70 public static final int GR26 = 26;
|
|
71 public static final int GR27 = 27;
|
|
72 public static final int GR28 = 28;
|
|
73 public static final int GR29 = 29;
|
|
74 public static final int GR30 = 30;
|
|
75 public static final int GR31 = 31;
|
|
76
|
|
77 // Nat bits for r1-r31
|
|
78 public static final int INT_NATS = 32;
|
|
79
|
|
80 // predicates
|
|
81 public static final int PREDS = 33;
|
|
82
|
|
83 // branch registers
|
|
84 public static final int BR0 = 34;
|
|
85 public static final int BR_RP = BR0;
|
|
86 public static final int BR1 = 35;
|
|
87 public static final int BR2 = 36;
|
|
88 public static final int BR3 = 37;
|
|
89 public static final int BR4 = 38;
|
|
90 public static final int BR5 = 39;
|
|
91 public static final int BR6 = 40;
|
|
92 public static final int BR7 = 41;
|
|
93
|
|
94 // application registers
|
|
95 public static final int AP_UNAT = 42; // User Nat Collection register
|
|
96 public static final int AP_LC = 43; // Loop counter register
|
|
97 public static final int AP_EC = 43; // Epilog counter register
|
|
98 public static final int AP_CCV = 45; // CMPXCHG value register
|
|
99 public static final int AP_DCR = 46; // Default control register
|
|
100
|
|
101 // register stack info
|
|
102 public static final int RS_PFS = 47; // Previous function state
|
|
103 public static final int AP_PFS = RS_PFS;
|
|
104 public static final int RS_BSP = 48; // Backing store pointer
|
|
105 public static final int AR_BSP = RS_BSP;
|
|
106 public static final int RS_BSPSTORE = 49;
|
|
107 public static final int AP_BSPSTORE = RS_BSPSTORE;
|
|
108 public static final int RS_RSC = 50; // RSE configuration
|
|
109 public static final int AP_RSC = RS_RSC;
|
|
110 public static final int RS_RNAT = 51; // RSE Nat collection register
|
|
111 public static final int AP_RNAT = RS_RNAT;
|
|
112
|
|
113 // trap status register
|
|
114 public static final int ST_IPSR = 52; // Interuption Processor Status
|
|
115 public static final int ST_IIP = 53; // Interruption IP
|
|
116 public static final int ST_IFS = 54; // Interruption Function State
|
|
117
|
|
118 // debug registers
|
|
119 public static final int DB_I0 = 55;
|
|
120 public static final int DB_I1 = 56;
|
|
121 public static final int DB_I2 = 57;
|
|
122 public static final int DB_I3 = 58;
|
|
123 public static final int DB_I4 = 59;
|
|
124 public static final int DB_I5 = 60;
|
|
125 public static final int DB_I6 = 61;
|
|
126 public static final int DB_I7 = 62;
|
|
127
|
|
128 public static final int DB_D0 = 63;
|
|
129 public static final int DB_D1 = 64;
|
|
130 public static final int DB_D2 = 65;
|
|
131 public static final int DB_D3 = 66;
|
|
132 public static final int DB_D4 = 67;
|
|
133 public static final int DB_D5 = 68;
|
|
134 public static final int DB_D6 = 69;
|
|
135 public static final int DB_D7 = 70;
|
|
136
|
|
137 public static final int NPRGREG = 71;
|
|
138
|
|
139 private static final String[] regNames = {
|
|
140 "GR0", "GR1", "GR2", "GR3", "GR4", "GR5", "GR6", "GR7", "GR8",
|
|
141 "GR9", "GR10", "GR11", "GR12", "GR13", "GR14", "GR15", "GR16",
|
|
142 "GR17","GR18", "GR19", "GR20", "GR21", "GR22", "GR23", "GR24",
|
|
143 "GR25","GR26", "GR27", "GR28", "GR29", "GR30", "GR31",
|
|
144 "INT_NATS", "PREDS",
|
|
145 "BR0", "BR1", "BR2", "BR3", "BR4", "BR5", "BR6", "BR7",
|
|
146 "AP_UNAT", "AP_LC", "AP_EC", "AP_CCV", "AP_DCR",
|
|
147 "RS_FPS", "RS_BSP", "RS_BSPSTORE", "RS_RSC", "RS_RNAT",
|
|
148 "ST_IPSR", "ST_IIP", "ST_IFS",
|
|
149 "DB_I0", "DB_I1", "DB_I2", "DB_I3", "DB_I4", "DB_I5", "DB_I6", "DB_I7",
|
|
150 "DB_D0", "DB_D1", "DB_D2", "DB_D3", "DB_D4", "DB_D5", "DB_D6", "DB_D7"
|
|
151 };
|
|
152
|
|
153 private long[] data;
|
|
154
|
|
155 public IA64ThreadContext() {
|
|
156 data = new long[NPRGREG];
|
|
157 }
|
|
158
|
|
159 public int getNumRegisters() {
|
|
160 return NPRGREG;
|
|
161 }
|
|
162
|
|
163 public String getRegisterName(int index) {
|
|
164 return regNames[index];
|
|
165 }
|
|
166
|
|
167 public void setRegister(int index, long value) {
|
|
168 data[index] = value;
|
|
169 }
|
|
170
|
|
171 public long getRegister(int index) {
|
|
172 return data[index];
|
|
173 }
|
|
174
|
|
175 /** This can't be implemented in this class since we would have to
|
|
176 tie the implementation to, for example, the debugging system */
|
|
177 public abstract void setRegisterAsAddress(int index, Address value);
|
|
178
|
|
179 /** This can't be implemented in this class since we would have to
|
|
180 tie the implementation to, for example, the debugging system */
|
|
181 public abstract Address getRegisterAsAddress(int index);
|
|
182 }
|