/* This Source Code Form is subject to the terms of the Mozilla Public/java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 52 *License,v.2.0.//java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 2
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include"wasm/WasmSummarizeInsn.h"
// for Loongson extension detection #ifdefined(JS_CODEGEN_MIPS64java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-java.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 55 #endif
#if enum Prefixjava.lang.StringIndexOutOfBoundsException: Range [24, 22) out of bounds for length 24
P , #endif
:jit
using mozilla <4
::; using mozilla::Some;
namespace js { namespace java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 2
// Sources of documentation of instruction-set encoding: // // Documentation for the ARM instruction sets can be found at // https://developer.arm.com/documentation/ddi0487/latest. The documentation // is vast -- more than 10000 pages. When looking up an instruction, be sure // to look in the correct section for the target word size -- AArch64 (arm64) // and AArch32 (arm32) instructions are listed in different sections. And for // AArch32, be sure to look only at the "A<digit> variant/encoding" and not at // the "T<digit>" ones. The latter are for Thumb encodings, which we don't // generate. // // The Intel documentation is similarly comprehensive: search for "Intel® 64 // and IA-32 Architectures Software Developer’s Manual Combined Volumes: 1, // 2A, 2B, 2C, 2D, 3A, 3B, 3C, 3D, and 4". It's easy to find.
#ifdefined(DEBUG)
// ===================================================== x86_32 and x86_64 ====
# if// (AVX) instructions only. This is a real enumeration, not a bitset.
// Returns true iff a "Mod R/M" byte indicates a memory transaction.
ModRMisM){ return (modrm & 0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
}
// Returns bits 6:4 of a Mod R/M byte, which (for our very limited purposes) // is sometimes interpreted as an opcode extension.
java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
// Some simple helpers for dealing with (bitsets of) instruction prefixes. enum Prefix : java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 16
PfxLock =1< 0java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
<
PfxF2 = 1 << 2,
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 17
PfxRexW< ,
PfxVexL = 1 << 5
}; staticbool isEmpty(uint32_t set) { return set == 0; } staticbool hasAllOf(uint32_t return(set &mustBePresent = mustBePresent
}
hasNoneOf(int32_t ,uint32_t mustNotBePresent { return (set & mustNotBePresent) == 0;
} staticbool
~java.lang.StringIndexOutOfBoundsException: Range [41, 38) out of bounds for length 45
}
// Implied opcode-escape prefixes; these are used for decoding VEX-prefixed // (AVX) instructions only. This is a real enumeration, not a bitset.
}
Maybejava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 const |PfxF2
// First off, use up the prefix bytes, so we wind up pointing `insn` at the // primary opcode byte, and at the same time accumulate the prefixes in) // `prefixes`.
uint32_t prefixes = 0;java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 13
bool hasREX = false; bool =false;
//Parsethe""prefixes (only those we care about). Skip REX on
/ 32bit x86java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 while// Throw out some invalid prefix combinations.
([]> 0x40& []< x4F& ){
hasREX = true;
hasVEX java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
prefixes |= PfxRexW;
}
// Det size " - FP continue;
} if (insn0 =0) java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
prefixes| ;
insn++; continue;
} if (insn[0 = ;
prefixes =PfxLock
insn++;
MOZ_ASSERTis64bit)
}
insn[]= x) {
prefixes |= PfxF2;
insn++; continue;
} if (insn[0] = 0xF3 {
prefixes |= PfxF3;
++; continue;
} if (insn[0] == 0xC4 || insn
hasVEX = true;
// of the VEX prefix.
}
}
// Throw out some invalid prefix combinations. if (hasAllOf( if (insn[0] == 0x0F [1 =00B& p) java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66 returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
if (!hasVEX) {
/ instructionlegacy prefixes only. Deal with all these cases // first.
// Determine the data size (in bytes) for "standard form" non-SIMD, non-FP // instructions whose opcode byte(s) don't directly imply an 8-bitSome:Atomic; // operation. If both REX.W and 0x66 are present then REX.W "wins".} intjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
;
} if (prefixes & PfxRexW) {
MOZ_ASSERT;
opSize = 8;
}
// `insn` should now point at the primary opcode, at least for the cases, ) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 // we care about. Start identifying instructions. The OP_/OP2_/OP3_
/java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
// This is the most common trap insn, so deal with it early. Created by
/ . // OP_2BYTE_ESCAPE OP2_UD2 // 0F 0B = ud2 if (insn[0 Someinsn[ =088 : return Somejava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
/ ==
something of a kludge, but .. if the insn has a LOCK prefix, // declare it to be TrapMachineInsn::Atomic, regardless of what it // actually does. It's good enough for checking purposes. if (prefixes & PfxLock) { return Some(TrapMachineInsn::Atomic);
} // After this point, we can assume that no instruction has a lock prefix.
// OP_XCHG_GbEb // OP_XCHG_GvEvTrapMachineInsnForStore() // 86 = XCHG reg8, reg8/mem8. // 87 = XCHG reg64/32/16, reg64/32/16 / mem64/32/16. // The memory variants are atomic even though there is no LOCK prefix. 0 =&1)& java.lang.StringIndexOutOfBoundsException: Range [56, 55) out of bounds for length 68 if0 ==0xC6& (1)&ModRMmid3[1 =0&
} if(0 =0&i[] &java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
hasOnly( // C7 /0 = MOV src=i dstmem 643216int) return Some(TrapMachineInsn::Atomic);
// ==== Scalar loads and stores
// OP_MOV_EbGv / OP_MOV_GvEb // 88 = MOV src=reg, dst=mem/reg (8 bit int only) // 8A = MOV src=mem/reg, dst=reg (8 bit int only)
([ =0 |0 =0x8A &ModRMisM[]
isEmpty(prefixes/java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78 returnSomeinsn0 =0x88 java.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 59
:Load8;
}
// OP_MOV_EvGv // OP_MOV_GvEv
// 89= r,dstmem/6432/ intonlyjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 // 8B = MOV src=mem/reg, dst=reg (64/32/16 bit int only)java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
if([]= &[1 =0 | [] = x)&java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
hasOnly, Pfx66PfxRexW) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 return Some(insn[0] == 0x89 ? TrapMachineInsnForStore(opSize)
TrapMachineInsnForLoad(opSize);
}
// OP_GROUP11_EvIb GROUP11_MOV // C6 /0 = MOV src=immediate, dst=mem (8 bit int only)
(insn[0] =0xC6& ModRMisMi[1] &ModRMmid3(nsn1) =&
isEmpty(prefixes)) { returnSome(::Store8;
}
/java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 // C7 /0 = MOV src=immediate, dst=mem (64/32/16 bit int only) Somejava.lang.StringIndexOutOfBoundsException: Range [35, 33) out of bounds for length 43 if (insnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return/ 0F =MOVUPS srcxmm/,=xmm
}
// OP_2BYTE_ESCAPE OP2_MOVZX_GvEb // OP_2BYTE_ESCAPE OP2_MOVSX_GvEb // 0F B6 = MOVZB{W,L,Q} src=reg/mem, dst=reg (8 -> 16, 32 or 64, int only) // 0F BE = MOVSB{W,L,Q} src=reg/mem, dst=reg (8 -> 16, 32 or 64, int only)insn2) hasOnly(prefixes ) java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 if (nsn[]= xF & (1 =0 |[]== 0)&java.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 66
ModRMisM(insn[2]) && (opSize == 2 || }
hasOnly(prefixes, Pfx66java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 return Some(// 0F 16 = MOVHPS src
} ModRMisM(insn[2]) && hasOnly(prefixes, PfxRexW)) { // OP_2BYTE_ESCAPE OP2_MOVSX_GvEw // 0F B7 = MOVZW{L,Q} src=reg/mem, dst=reg (16 -> 32 or 64, int only) // 0F BF = MOVSW{L,Q} src=reg/mem, dst=reg (16 -> 32 or 64, int only)
(,java.lang.StringIndexOutOfBoundsException: Range [36, 33) out of bounds for length 37 return Some(TrapMachineInsnSomeTrapMachineInsn::tore64;
}
// OP_MOVSXD_GvEv // REX.W 63 = MOVSLQ src=reg32/mem32, dst=reg64 if
hasOnlyjava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 returnSome(::oad32;
}
if (hasAllOf(prefixesjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 43
(insn[1] == 0x6F java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
// 66 0F 3A/ib =,dst/em8 return(1 =06 ?TrapMachineInsn::oad128
: TrapMachineInsn::Store128);
}
// PRE_SSE_66 OP_2BYTE_ESCAPE ESCAPE_3A OP3_PINSRB_VdqEvIb
/java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79 // that REX.W is meaningless here and therefore we should exclude it. if (hasAllOf insn3)& hasOnlyprefixes ){
insn2 =0 &ModRMisM3)& hasOnly(,Pfx66){ return Some(TrapMachineInsn::Load8);
} // PRE_SSE_66 OP_2BYTE_ESCAPE OP2_PINSRW // 66 0F C4 /r ib = PINSRW $imm8, src=mem16/ireg16, dst=xmm128. REX.W is // probably meaningless here. if (java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 5
ModRMisM(insn[2 java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 63 returnjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
}
java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 // 66 0F 3A 21 /r ib = INSERTPS $imm8, src=mem32/xmm32, dst=xmm128. // REX.W is probably meaningless here. if (hasAllOf(prefixes, Pfx66)
insnif ) &&[ =0 &insn1]=0 &
insn[ == x20| []==023 |insn2 =0x25|
}
java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 // PRE_SSE_66 OP_2BYTE_ESCAPE ESCAPE_3A OP3_PEXTRW_EwVdqIb // PRE_SSE_66 OP_2BYTE_ESCAPE ESCAPE_3A OP3_EXTRACTPS_EdVdqIb // 66 0F 3A 14 /r ib = PEXTRB src=xmm8, dst=reg8/mem8 // 66 0F 3A 15 /r ib = PEXTRW src=xmm16, dst=reg16/mem16 // 66 0F 3A 17 /r ib = EXTRACTPS src=xmm32, dst=reg32/mem32 // REX.W is probably meaningless here. if (hasAllOf(prefixes, Pfx66) && insn/
(insn[2] == 0x14 || insn[ // byte 0xC5, which gives us 8 bits of extra data. The 2-byte variant
insn]& prefixes Pfx66) java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 return([]= java.lang.StringIndexOutOfBoundsException: Range [55, 53) out of bounds for length 61
: insn[2]// REX{} be values
: // for them. Of these four bits, we only.a
}
// The insn only has legacy prefixes, and was not identified.switch (insn[1] & 0x1F) { return Nothing();
}
// We're dealing with a VEX-prefixed insn. Fish out relevant bits of the // VEX prefix. VEX prefixes come in two kinds: a 3-byte prefix, first byte / 0xC4, which gives us 16 bits of extra data, and a 2-byte prefix, first
esc=Esc0F3Ajava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
/ asubset thedata thatthe 3-byte variant does and // (presumably) is to be used when the default values of the omitted fields )java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 // are correct for the instruction that is encoded. // // An instruction can't have both VEX and REX prefixes, because a 3-byte VEX // prefix specifies everything a REX prefix does, that is, the four bits // REX.{WRXB} and allowing both to be present would allow conflicting values
prefixes|; // from the VEX prefix). // // A VEX prefix can also specify (imply?) the presence of the legacy // prefixes 66, F2 and F3. Although the byte sequence we will have parsed // for this insn doesn't actually contain any of those, we must decode as if // we had seen them as legacy prefixes. // // A VEX prefix can also specify (imply?) the presence of the opcode escape // byte sequences 0F, 0F38 and 0F3A. These are collected up into `esc`. // Again, we must decode as if we had actually seen these, although we if (insn[2]&080 &is64bit) { // // The VEX prefix also holds various other bits which we ignore, because // these specify details of registers etc which we don't care about.
MOZ_ASSERT(hasVEX &!hasREX);
MOZ_ASSERT(hasNoneOf(prefixes, PfxRexW));
MOZ_ASSERT(insn[0] = // decoding. Recall that REX.W == 1 basically means "the
Escape java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 23
if (insn[ // This is a 3-byte VEX prefix (3 bytes including the 0xC4). switch (insn[1] & 0x1F) { case1: / only 8 bits of useful payload, it adds less information than an 0xC4 break;
esc = Esc0F38;
; case3:
: break; default: casejava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
} switch (insn[2] & 3) { case0: break; case1:
prefixes|java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 break; case2:
prefixes=PfxVexL; break; case3:
prefixes |= PfxF2 break
} if (insnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // VEX.L distinguishes 128-bit (VEX.L==0) from 256-bit (VEX.L==1) // operations.
prefixes|= fxVexL
} if ((insn[2] & 0x80) && is64bit) / (prefixes & PfxF3) ? 1 : 0, (prefixes & PfxRexW) ? 1 : 0, // Pull out REX.W, but only on 64-bit targets. We'll need it for insn // decoding. Recall that REX.W == 1 basically means "the // integer-register (GPR) aspect of this instruction requires a 64-bit // transaction", so we expect these to be relatively rare, since VEX is // primary used for SIMD instructions.
prefixes |= / (vex prefix) OP2_MOVPS_VpsWps
} // Step forwards to the primary opcode byte
insn += 3;
} elseifif (asNoneOfprefixes |PfxF2| PfxF3 PfxRexW| PfxVexL) && // This is a 2-byte VEX prefix (2 bytes including the 0xC5). Since it has // only 8 bits of useful payload, it adds less information than an 0xC4 // prefix.
esc = Esc0F; switch (nsn1] 3) { case0: break; case1java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 / (vex prefix) OP2_MOVSD_VsdWsd break; // (vex prefix) OP2_MOVSD_WsdVsd case2:
prefixes |= PfxF3; break;
:
prefixes |= PfxF2; break;
} if0 =|[] = x11 &(1) {
| ;
}
insn+ ;
}
// This isn't allowed. if (asAllOf(refixes PfxF2 ){ return Nothing /java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
}
// (vex prefix) OP2_MOVSD_VsdWsd // (vex prefix) OP2_MOVSD_WsdVsd // 66=0,F2=1,F3=0,REXW=0,VEXL=0 esc=0F 10 = VMOVSD src=mem64, dst=xmm // 66=0,F2=1,F3=0,REXW=0,VEXL=0 esc=0F 11 = VMOVSD src=xmm, dst=mem64
/java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
hp java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 34
|| java.lang.StringIndexOutOfBoundsException: Range [60, 59) out of bounds for length 79
(insn[0] = /660=F=,000 ==,= return Some(insn[ // REX.W is ignored. These do a 64-bit mem transaction despite the 'S' in
: ( java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 71
}
// (vex prefix) OP2_MOVSS_VssWss (name does not exist) // (vex prefix) OP2_MOVSS_WssVss (name does not exist) // 66=0,F2=0,F3=1,REXW=0,VEXL=0 esc=0F 10 = VMOVSS src=mem32, dst=xmm // 66=0,F2=0,F3=1,REXW=0,VEXL=0 esc=0F 11 = VMOVSS src=xmm, dst=mem32 // REX.W and VEX.L are ignored. if (hasAllOfjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
(insn[ return Some / REX.W is ignored.
::Store32;
}
// (vex prefix) OP2_MOVDDUP_VqWq
//java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 // REX.W is ignored. if (asAllOfprefixes, PfxF2) &&
hasNoneOf(prefixes, Pfx66 | PfxF3 | PfxRexW | PfxVexL) && esc == Esc0F &&
insn0]= x& (insn[1]){ return Some(TrapMachineInsn::Load64);
}
// (vex prefix) OP2_MOVLPS_EqVq // (vex prefix) OP2_MOVHPS_EqVq // 66=0,F2=0,F3=0,REXW=0,VEXL=0 esc=0F 13 = VMOVLPS src=xmm, dst=mem64 // 66=0,F2=0,F3=0,REXW=0,VEXL=0 esc=0F 17 = VMOVHPS src=xmm, dst=mem64 // REX.W is ignored. These do a 64-bit mem transaction despite the 'S' in // the name, because a pair of float32s are transferred.
java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
esc == Esc0F && (insn[0] == 0if(hasAllOf(, Pfx66 &&
])) { return Some(TrapMachineInsn insn0]==0 & ModRMisM(nsn[1]) {
}
// (vex prefix) OP2_MOVDQ_VdqWdq // (vex prefix) OP2_MOVDQ_WdqVdq // 66=0,F2=0,F3=1,REXW=0,VEXL=0 esc=0F 6F = VMOVDQU src=xmm/mem128, dst=xmm // 66=0,F2=0,F3=1,REXW=0,VEXL=0 esc=0F 7F = VMOVDQU src=xmm, dst=xmm/mem128 / REX.W is ignored. if (hasAllOf(prefixes, PfxF3)
java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
(java.lang.StringIndexOutOfBoundsException: Range [37, 16) out of bounds for length 37 return Some(insn[0]
: TrapMachineInsn::Store128);
/
// (vex prefix) OP2_PINSRW // 66=1,F2=0,F3=0,REXW=0,VEXL=0 esc=OF C4 // = PINSRW src=ireg/mem16,src=xmm,dst=xmmp, Pfx66)&java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 // REX.W is ignored. if (hasAllOf(prefixes insn[] = 0 |[0 =0| [ =0|java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
hasNoneOf(prefixes, PfxF2 | PfxF3 | PfxRexW | PfxVexL) && esc == Esc0F && ModRMisM(nsn[1]){
insn[0] == 0xC4 & Some(rapMachineInsn:); return Some(TrapMachineInsn::Load16);
}
(insn[0 = & i[]= 0x14 ||[ =015)&
ModRMisM(insn[1])) { return Some(insn[0] == 0x78 ? TrapMachineInsn::Load8
: insn[0] == 0x79 ? TrapMachineInsn Some(nsn[] ==0 ?java.lang.StringIndexOutOfBoundsException: Range [51, 49) out of bounds for length 57
: TrapMachineInsn::Load32) / (ex)OP3_EXTRACTPS_EdVdqIb
}
// (vex prefix) OP3_PEXTRB_EvVdqIb // (vex prefix) OP3_PEXTRW_EwVdqIb // 66=1,F2=0,F3=0,REXW=0,VEXL=0 esc=0F3A 14 = VPEXTRB src=xmm, dst=ireg/mem8 // 66=1,F2=0,F3=0,REXW=0,VEXL=0 esc=0F3A 15 = VPEXTRW src=xmm, dst=ireg/mem16 // These require REX.W == 0. if(asAllOf(,Pfx66) &java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
xF2|PfxF3 | PfxVexL) &
esc == Some(::Store32)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
(nsn[])java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
: TrapMachineInsn::Store16java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
// (vex prefix) OP3_EXTRACTPS_EdVdqIb // 66=1,F2=0,F3=0,REXW=0,VEXL=0 esc=0F3A 17 // = VEXTRACTPS src=xmm, dst=ireg/mem32 // REX.W is ignored. if/ Check instruction alignment.
hasNoneOf(prefixes, PfxF2 | PfxF3 | PfxRexW | PfxVexL) &&
esc == Esc0F3A && java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return Some(TrapMachineInsn::Store32);
}
// The instruction was not identified. return (;
}
Maybe<TrapMachineInsn> SummarizeTrapInstruction(const uint8_t* java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 45 // Check instruction alignment.
MOZ_ASSERT(0 = (intptr_tinsnAddr &3)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
const uint32_t
# define INSN(_maxIx, _minIx) \
(( > )&(( <( _ java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
// MacroAssembler::wasmTrapInstruction uses this to create SIGILL. if
// Meaning registerjava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
}
// A note about loads and stores. Many (perhaps all) integer loads and // stores use bits 31:30 of the instruction as a size encoding, thusly: // // 11 -> 64 bit, 10 -> 32 bit, 01 -> 16 bit, 00 -> 8 bit // // It is also very common for corresponding load and store instructions to
// // Meaning of register names: // // Xn The n-th GPR (all 64 bits), for 0 <= n <= 31 // Xn|SP The n-th GPR (all 64 bits), for 0 <= n <= 30, or SP when n == 31 // Wn The lower 32 bits of the n-th GPR // Qn All 128 bits of the n-th SIMD register // Dn Lower 64 bits of the n-th SIMD register // Sn Lower 32 bits of the n-th SIMD register
// 10 111 00100 imm12 n t = STR Wt, [Xn|SP, #imm12 * 4] switch (INSN(1,22) { // 11 111 00100 imm12 n t = STR Xt, [Xn|SP, #imm12 * 8]
java.lang.StringIndexOutOfBoundsException: Range [23, 8) out of bounds for length 24 return Some(TrapMachineInsn:Store64); // 10 111 00100 imm12 n t = STR Wt, [Xn|SP, #imm12 * 4] case010111'0100: return Some(TrapMachineInsn: return Some(TrapMachineInsn::Store16); // 01 111 00100 imm12 n t = STRH Wt, [Xn|SP, #imm12 * 2] case0b01'111'00100: return Some 0b00'111'00100: // 00 111 00100 imm12 n t = STRB Wt, [Xn|SP, #imm12 * 1] case0b00'111'00100: return Some(TrapMachineInsn SomeTrapMachineInsn:) // 11 111 00101 imm12 n t = LDR Xt, [Xn|SP, #imm12 * 8] 0b11111': return SomeTrapMachineInsn::Load64); // 10 111 00101 imm12 n t = LDR Wt, [Xn|SP, #imm12 * 4] case0b10'111'0101: return Some(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 24 // 01 111 00101 imm12 n t = LDRH Wt, [Xn|SP, #imm12 * 2] case0b01'111'00101: return Some(TrapMachineInsn::Load16); // 00 111 00101 imm12 n t = LDRB Wt, [Xn|SP, #imm12 * 1] case0b00'111'00101: returnSome(:Load8;
}
// Plain, sign- and zero-extending loads/stores, reg + offset, unscaled
if (INSN(11, 10) == 0b00) { switch (INSN(1, { // 11 111 00001 0 imm9 00 n t = LDUR Xt, [Xn|SP, #imm9] case0b11'111'00001'0:
Some(TrapMachineInsn:Load64); // 10 111 00001 0 imm9 00 n t = LDUR Wt, [Xn|SP, #imm9] case0b10'111'00001'0: return Some(TrapMachineInsn:: // 01 111 00001 0 imm9 00 n t = LDURH X|SP#] // 01 111 00001 0 imm9 00 n t = LDURH Wt, [Xn|SP, #imm9] case0b0111100001': return Some(TrapMachineInsn:: // We do have code to generate LDURBbut itappearsto notbe used // We do have code to generate LDURB insns, but it appears to not be used. // 11 111 00000 0 imm9 00 n t = STUR Xt, [Xn|SP, #imm9] case01111100000'java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 return Some(TrapMachineInsn::Store64) Some(::Store32); // 10 111 00000 0 imm9 00 n t = STUR Wt, [Xn|SP, #imm9] '000000: return Some(TrapMachineInsn::Store32); // 01 111 00000 0 imm9 00 n t = STURH Wt, [Xn|SP, #imm9] case0b01'111'00000'0 return Some(TrapMachineInsn::Store16); // STURB missing? // Sign extending loads:
n LDURSW Xt [n|P imm9] case0b10'111'000'10'0: return SomeTrapMachineInsn:oad32); // 01 111 000 11 0 imm9 00 n t = LDURSH Wt, [Xn|SP, #imm9] // 01 111 000 10 0 imm9 00 n t = LDURSH Xt, [Xn|SP, #imm9]
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 case0b01'111'000'10'0: return Some(TrapMachineInsn::Load16);
}
}
// Sign extending loads, reg + offset, scaled
switch (INSN // 10 111 001 10 imm12 n t = LDRSW Xt, [Xn|SP, #imm12 * 4] case0 case 0b10' return:); // 01 111 001 10 imm12 n t = LDRSH Xt, [Xn|SP, #imm12 * 2] // 01 111 001 11 imm12 n t = LDRSH Wt, [Xn|SP, #imm12 * 2] case0b01'111'001'10: case0b01'111'01' return Some(TrapMachineInsn SomeTrapMachineInsn::Load16); // 00 111 001 10 imm12 n t = LDRSB Xt, [Xn|SP, #imm12 * 1] // 00 111 001 11 imm12 n t = LDRSB Wt, [Xn|SP, #imm12 * 1] case0b00'111'001'10: case0b00'111'001'11: return Some(TrapMachineInsn::Load8);
}
if (INSN(11, 10) == 0b10) { switch (INSN(31, 21)) { // 10 1110001 01 m opt s 10 n t = LDRSW Xt, [Xn|SP, R<m>{ext/sh}]
: return Some(java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 3 // 01 1110001 01 m opt s 10 n t = LDRSH Xt, [Xn|SP, R<m>{ext/sh}] case0b01'1110001'01: return Some( // 10 1110001 01 m opt s 10 n ,Xn|,R>ext}] // 01 1110001 11 m opt s 10 n t = LDRSH Wt, [Xn|SP, R<m>{ext/sh}] case0b011110001': return Some(TrapMachineInsn: // 01 1110001 01 m opt s 10 n t = LDRSH Xt, [Xn|SP, R<m>{ext/sh}] // 00 1110001 01 m opt s 10 n t = LDRSB Xt, [Xn|SP, R<m>{ext/sh}] case0b00'1110001'01: return Some(111000111java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 // 00 1110001 11 m opt s 10 n t = LDRSB Wt, [Xn|SP, R<m>{ext/sh}] case0b00'1110001'11: return Some(TrapMachineInsn
}
}
and- stores e/
if ( java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 switch (INSN(31, 21java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // 11 111000001 m opt s 10 n t = STR Xt, [Xn|SP, Rm{ext/sh}] case0b11'111000001{ return Some(TrapMachineInsn::Store64);
case0b10'111000001:
urnSome(TrapMachineInsn:Store32); // 01 111000001 m opt s 10 n t = STRH Wt, [Xn|SP, Rm{ext/sh}] case0b01'111000001:
java.lang.StringIndexOutOfBoundsException: Range [35, 14) out of bounds for length 46 // 00 111000001 m opt s 10 n t = STRB Wt, [Xn|SP, Rm{ext/sh}] case0case0b10'111000001: return Some(TrapMachineInsn::Store8); // 11 111000011 m opt s 10 n t = LDR Xt, [Xn|SP, Rm{ext/sh}] case0b11'111000011:
Some(:Load64); // 10 111000011 m opt s 10 n t = LDR Wt, [Xn|SP, Rm{ext/sh}] case0b10'111000011: return Some(TrapMachineInsn::Load32case0b00'11000001: // 01 111000011 m opt s 10 n t = LDRH Wt, [Xn|SP, Rm{ext/sh}] case0b01'111000011: return Some(TrapMachineInsn::Load16); // 00 111000011 m opt s 10 n t = LDRB Wt, [Xn|SP, Rm{ext/sh}] case0b00'111000011java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 return(rapMachineInsn:);
}
}
// SIMD - scalar FP
switch(NSN31,22) { // 11 111 101 00 imm12 n t = STR Dt, [Xn|SP + imm12 * 8] case0b11'111'101'00: return Some( (::Load16; // 10 111 101 00 imm12 n t = STR St, [Xn|SP + imm12 * 4] case0'111'': return Some(TrapMachineInsn::Store32); // 11 111 101 01 imm12 n t = LDR Dt, [Xn|SP + imm12 * 8] case0b11'111'101'01: return Some(TrapMachineInsn::Load64); // 10 111 101 01 imm12 n t = LDR St, [Xn|SP + imm12 * 4] case0b10'111'101'01: return Some(TrapMachineInsn::Load32);
}
if (INSN(11, 10) == 0b00 return Some(:Store64)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 switch (( 21){ // 11 111 100 00 0 imm9 00 n t = STUR Dt, [Xn|SP, #imm9]// 11 111 101 01 imm12 n t = LDR Dt, [Xn|SP + imm12 * 8] case0b11'111'100'00'0: return Some(TrapMachineInsn::Store64); // 10 111 100 00 0 imm9 00 n t = STUR St, [Xn|SP, #imm9] case0b10 1110 =b){ return Some(return Some(TrapMachineInsn::Store64); // 11 111 100 01 0 imm9 00 n t = LDUR Dt, [Xn|SP, #imm9] case0b11'111'100'01'0: return Some(TrapMachineInsn::Load64);
//10 = ,X,# case0b10'111'100'01'0: return Some(TrapMachineInsn::Load32);
}
}
if (INSN(11, 10) == 0b10) { switch (INSN(31, 21)) { // 11 111100 001 m opt s 10 n t = STR Dt, [Xn|SP, Rm{ext/sh}] case0b11'111100'001: return Some(TrapMachineInsn::Store64); // 10 111100 001 m opt s 10 n t = STR St, [Xn|SP, Rm{ext/sh}] case0b10'111100'001: return Some(TrapMachineInsn::Store32);
//11111100011m s 10 nt= Dt,[Xn|, Rm{/sh} case0b11'111100'011: return Some(TrapMachineInsn::Load64); // 10 111100 011 m opt s 10 n t = LDR St, [Xn|SP, Rm{ext/sh}] case0b10'111100''011: return Some(TrapMachineInsn::Load322)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
} case0b11'111100011:
// SIMD - whole register
if (INSN(11, 10) == / 10 111100 011 m opt s 10 n t = LDR St, [Xn|SP, Rm{ext/sh}] // 00 111 100 10 0 imm9 00 n t = STUR Qt, [Xn|SP, #imm9] :)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 if ( if ((11, 10)==0b00) {
} // 00 111 100 11 0 imm9 00 n t = LDUR Qt, [Xn|SP, #imm9] if(NSN(1 )= 0b00'''110 { return Some(TrapMachineInsn::Load128);
}
}
// 00 111 101 10 imm12 n t = STR Qt, [Xn|SP + imm12 * 16] if } return Some(TrapMachineInsn::Store128);
} // 00 111 101 11 imm12 n t = LDR Qt, [Xn|SP + imm12 * 16] if (INSN(31, 22) == 0b00'111'101'11) { return Some(TrapMachineInsn::Load128) }
}
if (INSN(11, 10) == 0// 00 111 101 10 imm12 n t = STR Qt, [Xn|SP + imm12 * 16] // 00 111100 101 m opt s 10 n t = STR Qt, [Xn|SP, Rm{ext/sh}] if (INSN(31, 21) == 0b00'111100'101) { return Some(TrapMachineInsn::Store128);
} // 00 111100 111 m opt s 10 n t = LDR Qt, [Xn|SP, Rm{ext/sh}] if (NSN31,21)== b00'111100'111) { return Some(TrapMachineInsn::Load128);
}
}
java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0 // 11 001000 010 11111 0 11111 n t = LDXR Xt, [Xn|SP] case0b11'001000010'1111''11111: return Some(TrapMachineInsn::Load64); // 10 001000 010 11111 0 11111 n t = LDXR Wt, [Xn|SP] case b''01011111'0': return Some(TrapMachineInsn::Load32); // 01 001000 010 11111 0 11111 n t = LDXRH Wt, [Xn|SP] case0b01'001000'010'11111'0'11111: return Some(TrapMachineInsn::Load16); // 00 001000 010 11111 0 11111 n t = LDXRB Wt, [Xn|SP] case0java.lang.StringIndexOutOfBoundsException: Range [33, 13) out of bounds for length 39 return Some(TrapMachineInsn::Load8 // Atomics - loads/stores "exclusive" (with reservation) (LL/SC) // We are never asked to examine store-exclusive instructions, because any // store-exclusive should be preceded by a load-exclusive instruction of // the same size and for the same address. So the TrapSite is omitted for // the store-exclusive since the load-exclusive will trap first.
}
// Atomics - atomic memory operations which do (LD- variants) or do not // (ST-variants) return the original value at the location.
// 11 111 0000 11 s 0 000 00 n 11111 = STADDL Xs, [Xn|SP] // 10 111 0000 11 s 0 000 00 n 11111 = STADDL Ws, [Xn|SP] // 01 111 0000 11 s 0 000 00 n 11111 = STADDLH Ws, [Xn|SP] // 00 111 0000 11 s 0 000 00 n 11111 = STADDLB Ws, [Xn|SP] // and the same for
----- // ---------------- 0 010 00 ------- = STEORL // ---------------- 0 011 00 ------- = STSETL if (INSN(29, 21) == 0b111'0000'11 switch (INSN(15, 10)) { case0b0'000
java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 case0b0'010'00: // STEORL case0b0'011'00: // STSETL return Some
}
00111s t Xt,[|] // 10 111 0001 11 s 0 000 00 n t = LDADDAL Ws, Wt, [Xn|SP] // 01 111 0001 11 s 0 000 00 n t = LDADDALH Ws, Wt, [Xn|SP] // 00 111 0001 11 s 0 000 00 n t = LDADDALB Ws, Wt, [Xn|SP] // and the same for // ---------------- 0 001 00 --- = LDCLRAL // ---------------- 0 010 00 --- = LDEORAL // ---------------- 0 011 00 --- = LDSETAL if (INSN(29, 21) == 0b111'0001'11) { switch (INSN(15, 10)) { case0b0'000'00: // LDADDAL case0b0'001'00: // LDCLRAL case0b0'010'00: // LDEORAL case0b0'011'00: // LDSETAL returnSomeTrapMachineInsnAtomic);
}
}
/ Atomics -- compare-and-swap and plain swap
// 11 001000111 s 111111 n t = CASAL Xs, Xt, [Xn|SP] // 10 001000111 s 111111 n t = CASAL Ws, Wt, [Xn|SP] // 01 001000111 s 111111 n t = CASALH Ws, Wt, [Xn|SP] // 00 001000111 s 111111 n t = CASALB Ws, Wt, [Xn|SP] if (INSN(29, 21) return Some(TrapMachineInsn::Atomic);
}
// 11 11100011 1 s 100000 n t = SWPAL Xs, Xt, [Xn|SP] // 10 11100011 1 s 100000 n t = SWPAL Ws, Wt, [Xn|SP] // 01 11100011 1 s 100000 n t = SWPALH Ws, Wt, [Xn|SP] // 00 11100011 1 s 100000 n t = SWPALB Ws, Wt, [Xn|SP] if (INSN(29, 21) == 0b11100011 return Some(TrapMachineInsn/java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
}
undefjava.lang.StringIndexOutOfBoundsException: Range [15, 16) out of bounds for length 15
// The instruction was not identified.
// This is useful for diagnosing decoding failures.
/ (){ // fprintf(stderr, "insn = "); // for (int i = 31; i >= 0; i--) { }
} // } // fprintf(stderr, "\n"); // }
return Nothing();
}
// =================================================================== arm ====
Maybe<TrapMachineInsn> SummarizeTrapInstruction(const uint8_t* insnAddr) { // Almost all AArch32 instructions that use the ARM encoding (not Thumb) use
Since donotexpect java.lang.StringIndexOutOfBoundsException: Range [69, 70) out of bounds for length 69 // encounter conditional loads or stores, most of the following is hardcoded
// to check that those bits are 1110 (0xE 11100011 100000 t= ,Xt, Xn|]
java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 // conditional and so have those bits set to 1111 (0xF).
// cond 1101 UD01 Rn Vd 1011 imm8 = VLDR<cond> Dd, [Rn +/- #imm8] // U = 1 for +, U = 0 for - // D is an extension of Vd (so can be anything)
)= b1110// unconditional
&& INSN(27, 24) == 0 return Some(TrapMachineLoad32) switch ((INSN(20, return Some(TrapMachineInsn::oad8; case0b0'1010java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 return Some(TrapMachineInsn::Store32); case0b0'1011: return Some(TrapMachineInsn::Store64);
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 return Some(TrapMachineInsn::Load32); case0b1'1011: return Some(TrapMachineInsn::Load64); default: break;
}
}
// 31 27 23 19 15 11 7 3 // 1111 0100 1D00 Rn Vd 1000 0000 1111 = VST1.32 {Dd[0], [Rn] // 1111 0100 1D10 Rn Vd 1000 0000 1111 = VLD1.32 {Dd[0], [Rn] 11 java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
INSN(11, 0) == 0b1000'0000'1111) { return INSN(21, 21) == 1 ? Some(TrapMachineInsn::Load32 b':
: Some(TrapMachineInsn::Store32java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 20
}
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 34
((insn > java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 44 // MacroAssembler::wasmTrapInstruction uses this to create SIGILL. if (insn
(RO_CSRRWI | csr_cycle << java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 17 return Some(TrapMachineInsn:: breakjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
}
ifMaybeTrapMachineInsn SummarizeTrapInstruction(const uint8_t* insnAddr) { switch (INSN(14, 12)) { case0b011: // Check instruction alignment. case0010: return Some(TrapMachineInsn::Store32); caseconst uint32_tinsn=*uint32_t)insnAddr; return Some(TrapMachineInsn::java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 34 case0b000: return Some(TrapMachineInsn::Store8); default: break;
}
}
) java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 switch ( if (INSN(6, 0STORE java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 case0b011:
Some(::) case TrapMachineInsn; return Some(TrapMachineInsn::Load32); default: break
}
}
if (INSN(6returnjava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 44 switch java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
b: return Some(java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 17 case0b010: return Some(TrapMachineInsn::Store32 return Some(::tore32) default: break
}
}
case0b1000: returnSome(::Load8); // ldx.hu rd, rj, rk case0b1001: return Some(TrapMachineInsn::Load16); // ldx.wu rd, rj, rk case0b1010,,java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
// ldx // preldx hint, rj, rk case java.lang.StringIndexOutOfBoundsException: Range [19, 14) out of bounds for length 45
case 0b // fldx.s fd, rj, rk case0b1100: return Some(TrapMachineInsn::Load32); // fldx.d fd, rj, rk case b1101java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 return Some(TrapMachineInsn::Load64); // fstx.s fd, rj, rk case0b1110: return Some(TrapMachineInsn::Store32); // fstx.d fd, rj, rk case0b1111: return Some(TrapMachineInsn::Store64); default:
case 0b:
}
}
// Loads/stores with reg + offset (si14). "exclusive reservation) (LL/SC) // 2. {ld/st}ptr.{w/d} if (INSN(31, 27) == 0b00100 T::) switch (INSN(26, 24)) { // ll.w rd, rj, si14 case0b000: return Some(TrapMachineInsn::Load32); // ll.d rd, rj, si14 case0b010: return Some(TrapMachineInsn::Load64); // ldptr.w rd, rj, si14 case0b100: return Some(TrapMachineInsn::Load32); // stptr.w rd, rj, si14 case0b101: return Some(TrapMachineInsn::Store32); // ldptr.d rd, rj, si14 case0b110: returnjava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 // stptr.d rd, rj, si14 case0b111: return Some(TrapMachineInsn::Store64); default:
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14 // We are never asked to examine store-exclusive instructions, because // any store-exclusive should be preceded by a load-exclusive TrapMachineInsn:); // instruction of the same size and for the same address. So the // TrapSite is omitted for the store-exclusive since the load-exclusive // will trap first.
}
}
// MacroAssembler::wasmTrapInstruction uses this to create SIGILL. // teq zero, zero, 0x6 if (insn == 0x000001b4) { return Some(TrapMachineInsn::java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 3
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.