0N/A/*
1472N/A * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
0N/Apackage sun.jvm.hotspot.asm.sparc;
0N/A
0N/Aimport sun.jvm.hotspot.asm.*;
0N/Aimport java.io.*;
0N/Aimport java.util.*;
0N/A
0N/A// Please refer to "The SPARC Architecture Manual - Version 8"
0N/A
0N/Apublic class SPARCV8Disassembler extends SPARCDisassembler {
0N/A
0N/A public SPARCV8Disassembler(long startPc, byte[] code, SPARCInstructionFactory factory) {
0N/A super(startPc, code, factory);
0N/A }
0N/A
0N/A public SPARCV8Disassembler(long startPc, byte[] code) {
0N/A this(startPc, code, new SPARCInstructionFactoryImpl());
0N/A }
0N/A
0N/A // decoders for format 2 instructions
0N/A private static InstructionDecoder format2Decoders[] = {
0N/A new UnimpDecoder(),
0N/A illegalDecoder,
0N/A new IntegerBranchDecoder(),
0N/A illegalDecoder,
0N/A new SethiDecoder(),
0N/A illegalDecoder,
0N/A new FloatBranchDecoder(),
0N/A new CoprocessorBranchDecoder()
0N/A };
0N/A
0N/A protected InstructionDecoder getFormat2Decoder(int op2) {
0N/A return format2Decoders[op2];
0N/A }
0N/A
0N/A // op3 decoder table for op=3 (FORMAT_3) instructions - (memory instructions)
0N/A // Appendix F - Opcodes and Condition Codes - Page 229 - Table F-4
0N/A
0N/A private static final InstructionDecoder format3Decoders[][] = {
0N/A {
0N/A new LoadDecoder(LD, "ld", RTLDT_UNSIGNED_WORD), new AlternateSpaceLoadDecoder(LDA, "lda", RTLDT_UNSIGNED_WORD),
0N/A new LoadDecoder(LDF,"ld", RTLDT_FL_SINGLE), new SpecialLoadDecoder(LDC,"ld", SPARCSpecialRegisters.CREG)
0N/A },
0N/A {
0N/A new LoadDecoder(LDUB, "ldub", RTLDT_UNSIGNED_BYTE), new AlternateSpaceLoadDecoder(LDUBA, "lduba", RTLDT_UNSIGNED_BYTE),
0N/A new SpecialLoadDecoder(LDFSR, "ld", SPARCSpecialRegisters.FSR), new SpecialLoadDecoder(LDCSR, "ld", SPARCSpecialRegisters.CSR)
0N/A },
0N/A {
0N/A new LoadDecoder(LDUH, "lduh", RTLDT_UNSIGNED_HALF), new AlternateSpaceLoadDecoder(LDUHA, "lduha", RTLDT_UNSIGNED_HALF),
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A new LoadDecoder(LDD, "ldd", RTLDT_UNSIGNED_DWORD), new AlternateSpaceLoadDecoder(LDDA, "ldda", RTLDT_UNSIGNED_DWORD),
0N/A new LoadDecoder(LDDF, "ldd", RTLDT_FL_DOUBLE), new SpecialLoadDecoder(LDDC, "ldd", SPARCSpecialRegisters.CREG)
0N/A },
0N/A {
0N/A new StoreDecoder(ST, "st", RTLDT_UNSIGNED_WORD), new AlternateSpaceStoreDecoder(STA, "sta", RTLDT_UNSIGNED_WORD),
0N/A new StoreDecoder(STF, "st", RTLDT_FL_SINGLE), new SpecialStoreDecoder(STC, "st", SPARCSpecialRegisters.CREG)
0N/A },
0N/A {
0N/A new StoreDecoder(STB, "stb", RTLDT_UNSIGNED_BYTE), new AlternateSpaceStoreDecoder(STBA, "stba", RTLDT_UNSIGNED_BYTE),
0N/A new SpecialStoreDecoder(STFSR, "st", SPARCSpecialRegisters.FSR), new SpecialStoreDecoder(STCSR, "st", SPARCSpecialRegisters.CSR),
0N/A },
0N/A {
0N/A new StoreDecoder(STH, "sth", RTLDT_UNSIGNED_HALF), new AlternateSpaceStoreDecoder(STHA, "stha", RTLDT_UNSIGNED_HALF),
0N/A new SpecialStoreDecoder(STDFQ, "std", SPARCSpecialRegisters.FQ), new SpecialStoreDecoder(STDCQ, "std", SPARCSpecialRegisters.CQ),
0N/A },
0N/A {
0N/A new StoreDecoder(STD, "std", RTLDT_UNSIGNED_DWORD), new AlternateSpaceStoreDecoder(STDA, "stda", RTLDT_UNSIGNED_DWORD),
0N/A new StoreDecoder(STDF, "std", RTLDT_FL_DOUBLE), new SpecialStoreDecoder(STDC, "std", SPARCSpecialRegisters.CREG)
0N/A },
0N/A {
0N/A illegalDecoder, illegalDecoder,
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A new LoadDecoder(LDSB, "ldsb", RTLDT_SIGNED_BYTE), new AlternateSpaceLoadDecoder(LDSBA, "ldsba", RTLDT_UNSIGNED_BYTE),
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A new LoadDecoder(LDSH, "ldsh", RTLDT_SIGNED_HALF), new AlternateSpaceLoadDecoder(LDSHA, "ldsha", RTLDT_UNSIGNED_HALF),
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A illegalDecoder, illegalDecoder,
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A illegalDecoder, illegalDecoder,
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A new LdstubDecoder(LDSTUB, "ldstub", RTLDT_UNSIGNED_BYTE), new AlternateSpaceLdstubDecoder(LDSTUBA, "ldstuba", RTLDT_UNSIGNED_BYTE),
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A illegalDecoder, illegalDecoder,
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A new SwapDecoder(SWAP, "swap", RTLDT_UNSIGNED_WORD), new AlternateSpaceSwapDecoder(SWAPA, "swapa", RTLDT_UNSIGNED_WORD),
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A };
0N/A
0N/A protected InstructionDecoder getFormat3Decoder(int row, int column) {
0N/A return format3Decoders[row][column];
0N/A }
0N/A
0N/A // op3 decoder table for op=2 (FORMAT_3A) instructions
0N/A // Appendix F - Opcodes and Condition Codes - Page 228 - Table F-3
0N/A protected static final InstructionDecoder format3ADecoders[][] = {
0N/A {
0N/A new ArithmeticDecoder(ADD, "add", RTLOP_ADD), new ArithmeticDecoder(ADDcc, "addcc", RTLOP_ADD),
0N/A new ArithmeticDecoder(TADDcc, "taddcc", RTLOP_ADD), new WriteDecoder(SPARCSpecialRegisters.ASR)
0N/A },
0N/A {
0N/A new LogicDecoder(AND, "and", RTLOP_AND), new LogicDecoder(ANDcc, "andcc", RTLOP_AND),
0N/A new ArithmeticDecoder(TSUBcc, "tsubcc", RTLOP_ADD), new WriteDecoder(SPARCSpecialRegisters.PSR)
0N/A },
0N/A {
0N/A new LogicDecoder(OR, "or", RTLOP_OR), new LogicDecoder(ORcc, "orcc", RTLOP_OR),
0N/A new ArithmeticDecoder(TADDccTV, "taddcctv", RTLOP_ADD), new WriteDecoder(SPARCSpecialRegisters.WIM)
0N/A },
0N/A {
0N/A new LogicDecoder(XOR, "xor", RTLOP_XOR), new LogicDecoder(XORcc, "xorcc", RTLOP_XOR),
0N/A new ArithmeticDecoder(TSUBccTV, "tsubcctv", RTLOP_SUB), new WriteDecoder(SPARCSpecialRegisters.TBR)
0N/A },
0N/A {
0N/A new ArithmeticDecoder(SUB, "sub", RTLOP_SUB), new ArithmeticDecoder(SUBcc, "subcc", RTLOP_SUB),
0N/A new ArithmeticDecoder(MULScc, "mulscc", RTLOP_SMUL), new V8FPop1Decoder()
0N/A },
0N/A {
0N/A new LogicDecoder(ANDN, "andn", RTLOP_NAND), new LogicDecoder(ANDNcc, "andncc", RTLOP_NAND),
0N/A new ShiftDecoder(SLL, "sll", RTLOP_SLL), new V8FPop2Decoder()
0N/A },
0N/A {
0N/A new LogicDecoder(ORN, "orn", RTLOP_NOR), new LogicDecoder(ORNcc, "orncc", RTLOP_NOR),
0N/A new ShiftDecoder(SRL, "srl", RTLOP_SRL), new CoprocessorDecoder(CPop1)
0N/A },
0N/A {
0N/A new LogicDecoder(XNOR, "xnor", RTLOP_XNOR), new LogicDecoder(XNORcc, "xnorcc", RTLOP_XNOR),
0N/A new ShiftDecoder(SRA, "sra", RTLOP_SRA), new CoprocessorDecoder(CPop2)
0N/A },
0N/A {
0N/A new ArithmeticDecoder(ADDX, "addx", RTLOP_ADDC), new ArithmeticDecoder(ADDXcc, "addxcc", RTLOP_ADDC),
0N/A new ReadDecoder(SPARCSpecialRegisters.ASR), new JmplDecoder()
0N/A },
0N/A {
0N/A illegalDecoder, illegalDecoder,
0N/A new ReadDecoder(SPARCSpecialRegisters.PSR), new RettDecoder()
0N/A },
0N/A {
0N/A new ArithmeticDecoder(UMUL, "umul", RTLOP_UMUL), new ArithmeticDecoder(UMULcc, "umulcc", RTLOP_UMUL),
0N/A new ReadDecoder(SPARCSpecialRegisters.WIM), new TrapDecoder()
0N/A },
0N/A {
0N/A new ArithmeticDecoder(SMUL, "smul", RTLOP_SMUL), new ArithmeticDecoder(SMULcc, "smulcc", RTLOP_SMUL),
0N/A new ReadDecoder(SPARCSpecialRegisters.TBR), new FlushDecoder()
0N/A },
0N/A {
0N/A new ArithmeticDecoder(SUBX, "subx", RTLOP_SUBC), new ArithmeticDecoder(SUBXcc, "subxcc", RTLOP_SUBC),
0N/A illegalDecoder, new SaveDecoder()
0N/A },
0N/A {
0N/A illegalDecoder, illegalDecoder,
0N/A illegalDecoder, new RestoreDecoder()
0N/A },
0N/A {
0N/A new ArithmeticDecoder(UDIV, "udiv", RTLOP_UDIV), new ArithmeticDecoder(UDIVcc, "udivcc", RTLOP_UDIV),
0N/A illegalDecoder, illegalDecoder
0N/A },
0N/A {
0N/A new ArithmeticDecoder(SDIV, "sdiv", RTLOP_SDIV), new ArithmeticDecoder(SDIVcc, "sdivcc", RTLOP_SDIV),
0N/A illegalDecoder, illegalDecoder
0N/A }
0N/A };
0N/A
0N/A protected InstructionDecoder getFormat3ADecoder(int row, int column) {
0N/A return format3ADecoders[row][column];
0N/A }
0N/A}