annotate agent/src/share/classes/sun/jvm/hotspot/asm/x86/FloatGRPDecoder.java @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c18cbe5936b8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
a61af66fc99e Initial load
duke
parents:
diff changeset
2 * Copyright 2002-2003 Sun Microsystems, Inc. All Rights Reserved.
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.asm.x86;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import sun.jvm.hotspot.asm.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
28
a61af66fc99e Initial load
duke
parents:
diff changeset
29 public class FloatGRPDecoder extends FPInstructionDecoder {
a61af66fc99e Initial load
duke
parents:
diff changeset
30
a61af66fc99e Initial load
duke
parents:
diff changeset
31 final private int number;
a61af66fc99e Initial load
duke
parents:
diff changeset
32
a61af66fc99e Initial load
duke
parents:
diff changeset
33 //Please refer to IA-32 Intel Architecture Software Developer's Manual Volume 2
a61af66fc99e Initial load
duke
parents:
diff changeset
34 //APPENDIX A - Escape opcodes
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 private static final FPInstructionDecoder floatGRPMap[][] = {
a61af66fc99e Initial load
duke
parents:
diff changeset
37 /* d9_2 */
a61af66fc99e Initial load
duke
parents:
diff changeset
38 {
a61af66fc99e Initial load
duke
parents:
diff changeset
39 new FPInstructionDecoder("fnop"),
a61af66fc99e Initial load
duke
parents:
diff changeset
40 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
41 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
42 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
43 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
44 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
45 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
46 null
a61af66fc99e Initial load
duke
parents:
diff changeset
47 },
a61af66fc99e Initial load
duke
parents:
diff changeset
48 /* d9_4 */
a61af66fc99e Initial load
duke
parents:
diff changeset
49 {
a61af66fc99e Initial load
duke
parents:
diff changeset
50 new FPInstructionDecoder("fchs"),
a61af66fc99e Initial load
duke
parents:
diff changeset
51 new FPInstructionDecoder("fabs"),
a61af66fc99e Initial load
duke
parents:
diff changeset
52 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
53 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
54 new FPInstructionDecoder("ftst"),
a61af66fc99e Initial load
duke
parents:
diff changeset
55 new FPInstructionDecoder("fxam"),
a61af66fc99e Initial load
duke
parents:
diff changeset
56 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
57 null
a61af66fc99e Initial load
duke
parents:
diff changeset
58 },
a61af66fc99e Initial load
duke
parents:
diff changeset
59 /* d9_5 */
a61af66fc99e Initial load
duke
parents:
diff changeset
60 {
a61af66fc99e Initial load
duke
parents:
diff changeset
61 new FPInstructionDecoder("fld1"),
a61af66fc99e Initial load
duke
parents:
diff changeset
62 new FPInstructionDecoder("fldl2t"),
a61af66fc99e Initial load
duke
parents:
diff changeset
63 new FPInstructionDecoder("fldl2e"),
a61af66fc99e Initial load
duke
parents:
diff changeset
64 new FPInstructionDecoder("fldpi"),
a61af66fc99e Initial load
duke
parents:
diff changeset
65 new FPInstructionDecoder("fldlg2"),
a61af66fc99e Initial load
duke
parents:
diff changeset
66 new FPInstructionDecoder("fldln2"),
a61af66fc99e Initial load
duke
parents:
diff changeset
67 new FPInstructionDecoder("fldz"),
a61af66fc99e Initial load
duke
parents:
diff changeset
68 null
a61af66fc99e Initial load
duke
parents:
diff changeset
69 },
a61af66fc99e Initial load
duke
parents:
diff changeset
70 /* d9_6 */
a61af66fc99e Initial load
duke
parents:
diff changeset
71 {
a61af66fc99e Initial load
duke
parents:
diff changeset
72 new FPInstructionDecoder("f2xm1"),
a61af66fc99e Initial load
duke
parents:
diff changeset
73 new FPInstructionDecoder("fyl2x"),
a61af66fc99e Initial load
duke
parents:
diff changeset
74 new FPInstructionDecoder("fptan"),
a61af66fc99e Initial load
duke
parents:
diff changeset
75 new FPInstructionDecoder("fpatan"),
a61af66fc99e Initial load
duke
parents:
diff changeset
76 new FPInstructionDecoder("fxtract"),
a61af66fc99e Initial load
duke
parents:
diff changeset
77 new FPInstructionDecoder("fprem1"),
a61af66fc99e Initial load
duke
parents:
diff changeset
78 new FPInstructionDecoder("fdecstp"),
a61af66fc99e Initial load
duke
parents:
diff changeset
79 new FPInstructionDecoder("fincstp")
a61af66fc99e Initial load
duke
parents:
diff changeset
80 },
a61af66fc99e Initial load
duke
parents:
diff changeset
81 /* d9_7 */
a61af66fc99e Initial load
duke
parents:
diff changeset
82 {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 new FPInstructionDecoder("fprem"),
a61af66fc99e Initial load
duke
parents:
diff changeset
84 new FPInstructionDecoder("fyl2xp1"),
a61af66fc99e Initial load
duke
parents:
diff changeset
85 new FPInstructionDecoder("fsqrt"),
a61af66fc99e Initial load
duke
parents:
diff changeset
86 new FPInstructionDecoder("fsincos"),
a61af66fc99e Initial load
duke
parents:
diff changeset
87 new FPInstructionDecoder("frndint"),
a61af66fc99e Initial load
duke
parents:
diff changeset
88 new FPInstructionDecoder("fscale"),
a61af66fc99e Initial load
duke
parents:
diff changeset
89 new FPInstructionDecoder("fsin"),
a61af66fc99e Initial load
duke
parents:
diff changeset
90 new FPInstructionDecoder("fcos")
a61af66fc99e Initial load
duke
parents:
diff changeset
91 },
a61af66fc99e Initial load
duke
parents:
diff changeset
92 /* da_5 */
a61af66fc99e Initial load
duke
parents:
diff changeset
93 {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
95 new FPInstructionDecoder("fucompp"),
a61af66fc99e Initial load
duke
parents:
diff changeset
96 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
97 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
98 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
99 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
100 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
101 null
a61af66fc99e Initial load
duke
parents:
diff changeset
102 },
a61af66fc99e Initial load
duke
parents:
diff changeset
103 /* db_4 */
a61af66fc99e Initial load
duke
parents:
diff changeset
104 {
a61af66fc99e Initial load
duke
parents:
diff changeset
105 new FPInstructionDecoder("feni(287 only)"),
a61af66fc99e Initial load
duke
parents:
diff changeset
106 new FPInstructionDecoder("fdisi(287 only)"),
a61af66fc99e Initial load
duke
parents:
diff changeset
107 new FPInstructionDecoder("fNclex"),
a61af66fc99e Initial load
duke
parents:
diff changeset
108 new FPInstructionDecoder("fNinit"),
a61af66fc99e Initial load
duke
parents:
diff changeset
109 new FPInstructionDecoder("fNsetpm(287 only)"),
a61af66fc99e Initial load
duke
parents:
diff changeset
110 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
111 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
112 null
a61af66fc99e Initial load
duke
parents:
diff changeset
113 },
a61af66fc99e Initial load
duke
parents:
diff changeset
114 /* de_3 */
a61af66fc99e Initial load
duke
parents:
diff changeset
115 {
a61af66fc99e Initial load
duke
parents:
diff changeset
116 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
117 new FPInstructionDecoder("fcompp"),
a61af66fc99e Initial load
duke
parents:
diff changeset
118 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
119 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
120 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
121 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
122 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
123 null
a61af66fc99e Initial load
duke
parents:
diff changeset
124 },
a61af66fc99e Initial load
duke
parents:
diff changeset
125 /* df_4 */
a61af66fc99e Initial load
duke
parents:
diff changeset
126 {
a61af66fc99e Initial load
duke
parents:
diff changeset
127 new FPInstructionDecoder("fNstsw"),
a61af66fc99e Initial load
duke
parents:
diff changeset
128 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
129 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
130 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
131 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
132 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
133 null,
a61af66fc99e Initial load
duke
parents:
diff changeset
134 null
a61af66fc99e Initial load
duke
parents:
diff changeset
135 }
a61af66fc99e Initial load
duke
parents:
diff changeset
136 };
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 public FloatGRPDecoder(String name, int number) {
a61af66fc99e Initial load
duke
parents:
diff changeset
139 super(name);
a61af66fc99e Initial load
duke
parents:
diff changeset
140 this.number = number;
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 public Instruction decode(byte[] bytesArray, int index, int instrStartIndex, int segmentOverride, int prefixes, X86InstructionFactory factory) {
a61af66fc99e Initial load
duke
parents:
diff changeset
144 this.byteIndex = index;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 this.instrStartIndex = instrStartIndex;
a61af66fc99e Initial load
duke
parents:
diff changeset
146 this.prefixes = prefixes;
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 int ModRM = readByte(bytesArray, byteIndex);
a61af66fc99e Initial load
duke
parents:
diff changeset
149 int rm = ModRM & 7;
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 FPInstructionDecoder instrDecoder = null;
a61af66fc99e Initial load
duke
parents:
diff changeset
152 instrDecoder = floatGRPMap[number][rm];
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 Instruction instr = null;
a61af66fc99e Initial load
duke
parents:
diff changeset
155 if(instrDecoder != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 instr = instrDecoder.decode(bytesArray, byteIndex, instrStartIndex, segmentOverride, prefixes, factory);
a61af66fc99e Initial load
duke
parents:
diff changeset
157 byteIndex = instrDecoder.getCurrentIndex();
a61af66fc99e Initial load
duke
parents:
diff changeset
158 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
159 instr = factory.newIllegalInstruction();
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161 return instr;
a61af66fc99e Initial load
duke
parents:
diff changeset
162 }
a61af66fc99e Initial load
duke
parents:
diff changeset
163 }