comparison agent/src/share/classes/sun/jvm/hotspot/debugger/amd64/AMD64ThreadContext.java @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c18cbe5936b8
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
1 /*
2 * Copyright 2003-2004 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.amd64;
26
27 import sun.jvm.hotspot.debugger.*;
28
29 /** Specifies the thread context on amd64 platforms; only a sub-portion
30 * of the context is guaranteed to be present on all operating
31 * systems. */
32
33 public abstract class AMD64ThreadContext implements ThreadContext {
34 // Taken from /usr/include/sys/regset.h on Solaris/AMD64.
35
36 // NOTE: the indices for the various registers must be maintained as
37 // listed across various operating systems. However, only a small
38 // subset of the registers' values are guaranteed to be present (and
39 // must be present for the SA's stack walking to work)
40
41 public static final int R15 = 0;
42 public static final int R14 = 1;
43 public static final int R13 = 2;
44 public static final int R12 = 3;
45 public static final int R11 = 4;
46 public static final int R10 = 5;
47 public static final int R9 = 6;
48 public static final int R8 = 7;
49 public static final int RDI = 8;
50 public static final int RSI = 9;
51 public static final int RBP = 10;
52 public static final int RBX = 11;
53 public static final int RDX = 12;
54 public static final int RCX = 13;
55 public static final int RAX = 14;
56 public static final int TRAPNO = 15;
57 public static final int ERR = 16;
58 public static final int RIP = 17;
59 public static final int CS = 18;
60 public static final int RFL = 19;
61 public static final int RSP = 20;
62 public static final int SS = 21;
63 public static final int FS = 22;
64 public static final int GS = 23;
65 public static final int ES = 24;
66 public static final int DS = 25;
67 public static final int FSBASE = 26;
68 public static final int GSBASE = 27;
69
70 public static final int NPRGREG = 28;
71
72 private static final String[] regNames = {
73 "r15", "r14", "r13", "r12", "r11", "r10", "r9", "r8",
74 "rdi", "rsi", "rbp", "rbx", "rdx", "rcx", "rax", "trapno",
75 "err", "rip", "cs", "rfl", "rsp", "ss", "fs", "gs",
76 "es", "ds", "fsbase", "gsbase"
77 };
78
79 private long[] data;
80
81 public AMD64ThreadContext() {
82 data = new long[NPRGREG];
83 }
84
85 public int getNumRegisters() {
86 return NPRGREG;
87 }
88
89 public String getRegisterName(int index) {
90 return regNames[index];
91 }
92
93 public void setRegister(int index, long value) {
94 data[index] = value;
95 }
96
97 public long getRegister(int index) {
98 return data[index];
99 }
100
101 /** This can't be implemented in this class since we would have to
102 * tie the implementation to, for example, the debugging system */
103 public abstract void setRegisterAsAddress(int index, Address value);
104
105 /** This can't be implemented in this class since we would have to
106 * tie the implementation to, for example, the debugging system */
107 public abstract Address getRegisterAsAddress(int index);
108 }