agent/src/share/classes/sun/jvm/hotspot/debugger/amd64/AMD64ThreadContext.java

Wed, 19 Sep 2012 17:22:49 -0400

author
bpittore
date
Wed, 19 Sep 2012 17:22:49 -0400
changeset 4074
fac3dd92ebaf
parent 4028
a9fed06c01d2
child 6876
710a3c8b516e
permissions
-rw-r--r--

7195372: Wrong copyright in new files
Summary: Fixed copyrights
Reviewed-by: dholmes
Contributed-by: Bill Pittore <bill.pittore@oracle.com>

duke@435 1 /*
bpittore@4074 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 package sun.jvm.hotspot.debugger.amd64;
duke@435 26
duke@435 27 import sun.jvm.hotspot.debugger.*;
bpittore@4028 28 import sun.jvm.hotspot.debugger.cdbg.*;
duke@435 29
duke@435 30 /** Specifies the thread context on amd64 platforms; only a sub-portion
duke@435 31 * of the context is guaranteed to be present on all operating
duke@435 32 * systems. */
duke@435 33
duke@435 34 public abstract class AMD64ThreadContext implements ThreadContext {
duke@435 35 // Taken from /usr/include/sys/regset.h on Solaris/AMD64.
duke@435 36
duke@435 37 // NOTE: the indices for the various registers must be maintained as
duke@435 38 // listed across various operating systems. However, only a small
duke@435 39 // subset of the registers' values are guaranteed to be present (and
duke@435 40 // must be present for the SA's stack walking to work)
duke@435 41
duke@435 42 public static final int R15 = 0;
duke@435 43 public static final int R14 = 1;
duke@435 44 public static final int R13 = 2;
duke@435 45 public static final int R12 = 3;
duke@435 46 public static final int R11 = 4;
duke@435 47 public static final int R10 = 5;
duke@435 48 public static final int R9 = 6;
duke@435 49 public static final int R8 = 7;
duke@435 50 public static final int RDI = 8;
duke@435 51 public static final int RSI = 9;
duke@435 52 public static final int RBP = 10;
duke@435 53 public static final int RBX = 11;
duke@435 54 public static final int RDX = 12;
duke@435 55 public static final int RCX = 13;
duke@435 56 public static final int RAX = 14;
duke@435 57 public static final int TRAPNO = 15;
duke@435 58 public static final int ERR = 16;
duke@435 59 public static final int RIP = 17;
duke@435 60 public static final int CS = 18;
duke@435 61 public static final int RFL = 19;
duke@435 62 public static final int RSP = 20;
duke@435 63 public static final int SS = 21;
duke@435 64 public static final int FS = 22;
duke@435 65 public static final int GS = 23;
duke@435 66 public static final int ES = 24;
duke@435 67 public static final int DS = 25;
duke@435 68 public static final int FSBASE = 26;
duke@435 69 public static final int GSBASE = 27;
duke@435 70
duke@435 71 public static final int NPRGREG = 28;
duke@435 72
duke@435 73 private static final String[] regNames = {
duke@435 74 "r15", "r14", "r13", "r12", "r11", "r10", "r9", "r8",
duke@435 75 "rdi", "rsi", "rbp", "rbx", "rdx", "rcx", "rax", "trapno",
duke@435 76 "err", "rip", "cs", "rfl", "rsp", "ss", "fs", "gs",
duke@435 77 "es", "ds", "fsbase", "gsbase"
duke@435 78 };
duke@435 79
duke@435 80 private long[] data;
duke@435 81
duke@435 82 public AMD64ThreadContext() {
duke@435 83 data = new long[NPRGREG];
duke@435 84 }
duke@435 85
duke@435 86 public int getNumRegisters() {
duke@435 87 return NPRGREG;
duke@435 88 }
duke@435 89
duke@435 90 public String getRegisterName(int index) {
duke@435 91 return regNames[index];
duke@435 92 }
duke@435 93
duke@435 94 public void setRegister(int index, long value) {
duke@435 95 data[index] = value;
duke@435 96 }
duke@435 97
duke@435 98 public long getRegister(int index) {
duke@435 99 return data[index];
duke@435 100 }
duke@435 101
bpittore@4028 102 public CFrame getTopFrame(Debugger dbg) {
bpittore@4028 103 return null;
bpittore@4028 104 }
bpittore@4028 105
duke@435 106 /** This can't be implemented in this class since we would have to
duke@435 107 * tie the implementation to, for example, the debugging system */
duke@435 108 public abstract void setRegisterAsAddress(int index, Address value);
duke@435 109
duke@435 110 /** This can't be implemented in this class since we would have to
duke@435 111 * tie the implementation to, for example, the debugging system */
duke@435 112 public abstract Address getRegisterAsAddress(int index);
duke@435 113 }

mercurial