thumb.isa revision 7104
1// -*- mode:c++ -*- 2 3// Copyright (c) 2010 ARM Limited 4// All rights reserved 5// 6// The license below extends only to copyright in the software and shall 7// not be construed as granting a license to any other intellectual 8// property including but not limited to intellectual property relating 9// to a hardware implementation of the functionality of the software 10// licensed hereunder. You may use the software subject to the license 11// terms below provided that you ensure that this notice is replicated 12// unmodified and in its entirety in all distributions of the software, 13// modified or unmodified, in source code or in binary form. 14// 15// Copyright (c) 2009 The Regents of The University of Michigan 16// All rights reserved. 17// 18// Redistribution and use in source and binary forms, with or without 19// modification, are permitted provided that the following conditions are 20// met: redistributions of source code must retain the above copyright 21// notice, this list of conditions and the following disclaimer; 22// redistributions in binary form must reproduce the above copyright 23// notice, this list of conditions and the following disclaimer in the 24// documentation and/or other materials provided with the distribution; 25// neither the name of the copyright holders nor the names of its 26// contributors may be used to endorse or promote products derived from 27// this software without specific prior written permission. 28// 29// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40// 41// Authors: Gabe Black 42 431: decode BIGTHUMB { 44 // 16 bit thumb instructions. 45 0: decode TOPCODE_15_13 { 46 0x0, 0x1: decode TOPCODE_13_11 { 47 0x0: WarnUnimpl::lsl(); //immediate 48 0x1: WarnUnimpl::lsr(); //immediate 49 0x2: WarnUnimpl::asr(); //immediate 50 0x3: decode TOPCODE_10_9 { 51 0x0: WarnUnimpl::add(); //register 52 0x1: WarnUnimpl::sub(); //register 53 0x2: WarnUnimpl::add(); //3 bit immediate 54 0x3: WarnUnimpl::sub(); //3 bit immediate 55 } 56 0x4: WarnUnimpl::mov(); //immediate 57 0x5: WarnUnimpl::cmp(); //immediate 58 0x6: WarnUnimpl::add(); //8 bit immediate, thumb 59 0x7: WarnUnimpl::sub(); //8 bit immediate, thumb 60 } 61 0x2: decode TOPCODE_12_10 { 62 // Data processing 63 0x0: decode TOPCODE_9_6 { 64 0x0: WarnUnimpl::and(); //register 65 0x1: WarnUnimpl::eor(); //register 66 0x2: WarnUnimpl::lsl(); //register 67 0x3: WarnUnimpl::lsr(); //register 68 0x4: WarnUnimpl::asr(); //register 69 0x5: WarnUnimpl::adc(); //register 70 0x6: WarnUnimpl::sbc(); //register 71 0x7: WarnUnimpl::ror(); //register 72 0x8: WarnUnimpl::tst(); //register 73 0x9: WarnUnimpl::rsb(); //immediate 74 0xa: WarnUnimpl::cmp(); //register (high registers) 75 0xb: WarnUnimpl::cmn(); //register 76 0xc: WarnUnimpl::orr(); //register 77 0xd: WarnUnimpl::mul(); 78 0xe: WarnUnimpl::bic(); //register 79 0xf: WarnUnimpl::mvn(); //register 80 } 81 // Special data instructions and branch and exchange 82 0x1: decode TOPCODE_9_6 { 83 0x0: WarnUnimpl::add(); //register (low registers) 84 0x1, 0x2, 0x3: WarnUnimpl::add(); //register (high registers) 85 0x4: WarnUnimpl::unpredictable(); //? 86 0x5, 0x6, 0x7: WarnUnimpl::cmp(); //register 87 0x8: WarnUnimpl::mov(); //register (low registers) 88 0x9, 0xa, 0xb: WarnUnimpl::mov(); //register (high registers) 89 0xc, 0xd: WarnUnimpl::bx(); 90 0xe, 0xf: WarnUnimpl::blx(); //register 91 } 92 0x2, 0x3: WarnUnimpl::ldr(); 93 default: decode TOPCODE_11_9 { 94 0x0: WarnUnimpl::str(); //register 95 0x1: WarnUnimpl::strh(); //register 96 0x2: WarnUnimpl::strb(); //register 97 0x3: WarnUnimpl::ldrsb(); //register 98 0x4: WarnUnimpl::ldr(); //register 99 0x5: WarnUnimpl::ldrh(); //register 100 0x6: WarnUnimpl::ldrb(); //register 101 0x7: WarnUnimpl::ldrsh(); //register 102 } 103 } 104 0x3: decode TOPCODE_12_11 { 105 0x0: WarnUnimpl::str(); //immediate, thumb 106 0x1: WarnUnimpl::ldr(); //immediate, thumb 107 0x2: WarnUnimpl::strb(); //immediate, thumb 108 0x3: WarnUnimpl::ldrb(); //immediate, thumb 109 } 110 0x4: decode TOPCODE_12_11 { 111 0x0: WarnUnimpl::strh(); //immediate, thumb 112 0x1: WarnUnimpl::ldrh(); //immediate, thumb 113 0x2: WarnUnimpl::str(); //immediate, thumb 114 0x3: WarnUnimpl::ldr(); //immediate, thumb 115 } 116 0x5: decode TOPCODE_12_11 { 117 0x0: WarnUnimpl::adr(); 118 0x1: WarnUnimpl::add(); //sp, immediate 119 0x2: decode TOPCODE_10_8 { 120 0x0: decode TOPCODE_7 { 121 0x0: WarnUnimpl::add(); //sp, immediate 122 0x1: WarnUnimpl::sub(); //sp, immediate 123 } 124 0x1, 0x3: WarnUnimpl::cbz(); //cbnz too... 125 0x2: decode TOPCODE_7_6 { 126 0x0: WarnUnimpl::sxth(); 127 0x1: WarnUnimpl::sxtb(); 128 0x2: WarnUnimpl::uxth(); 129 0x3: WarnUnimpl::uxtb(); 130 } 131 0x4, 0x5: WarnUnimpl::pop(); 132 0x6: decode TOPCODE_7_5 { 133 0x2: WarnUnimpl::setend(); 134 0x3: WarnUnimpl::cps(); 135 } 136 } 137 0x3: decode TOPCODE_10_8 { 138 0x1, 0x3: WarnUnimpl::cbz(); //cbnz too... 139 0x2: decode TOPCODE_7_6 { 140 0x0: WarnUnimpl::rev(); 141 0x1: WarnUnimpl::rev16(); 142 0x3: WarnUnimpl::revsh(); 143 } 144 0x4, 0x5: WarnUnimpl::pop(); 145 0x6: WarnUnimpl::bkpt(); 146 0x7: decode TOPCODE_3_0 { 147 0x0: WarnUnimpl::it(); 148 default: decode TOPCODE_7_4 { 149 0x0: WarnUnimpl::nop(); 150 0x1: WarnUnimpl::yield(); 151 0x2: WarnUnimpl::wfe(); 152 0x3: WarnUnimpl::wfi(); 153 0x4: WarnUnimpl::sev(); 154 default: WarnUnimpl::unallocated_hint(); 155 } 156 } 157 } 158 } 159 0x6: decode TOPCODE_12_11 { 160 0x0: WarnUnimpl::stm(); // also stmia, stmea 161 0x1: WarnUnimpl::ldm(); // also ldmia, ldmea 162 default: decode TOPCODE_11_8 { 163 0xe: WarnUnimpl::undefined(); // permanently undefined 164 0xf: WarnUnimpl::svc(); // formerly swi 165 default: WarnUnimpl::b(); // conditional 166 } 167 } 168 0x7: decode TOPCODE_12_11 { 169 0x0: WarnUnimpl::b(); // unconditional 170 } 171 } 172 1: Unknown::unknown(); 173} 174