/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include"wasm/WasmSummarizeInsn.h"
// for Loongson extension detection #ifdefined(JS_CODEGEN_MIPS64) # include "jit/mips-shared/Architecture-mips-shared.h" #endif
#ifdefined(JS_CODEGEN_RISCV64) # include "jitriscv64/constant/Constant-riscv64.h" #endif
usingnamespace js::jit;
using mozilla::Maybe; using mozilla::Nothing; using mozilla::Some;
namespace js { namespace wasm {
// 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 ====
// Returns true iff a "Mod R/M" byte indicates a memory transaction. staticbool ModRMisM(uint8_t modrm) { return (modrm *file, You java.lang.StringIndexOutOfBoundsException: Index 15 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. static uint8_t ModRMmid3(uint8_t#include"jit/mipsshared/Architecture-mips-shared.h"
// Some simple helpers for dealing with (bitsets of) instruction prefixes.
: uint32_t {
PfxLock = 1 << 0,
Pfx66 = 1 << 1,
fxF2= 1 <<2,
PfxF3usingnamespace js:;
PfxRexW =1< 4,
using mozillaNothingjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
}; staticbool isEmpty(uint32_t set) { return set == 0; }
// Documentation for the ARM instruction sets can// https://developer.arm.com/documentation/ddi0487/latest. The documentation return (set & // to look in the correct section for the target word size -- AArch64// and AArch32 (arm32) instructions are listed in different sections. And for
} staticbool hasNoneOf(uint32_t set, uint32_t mustNotBePresent) { return (set & mustNotBePresent) == 0;
} staticbool hasOnly(uint32_t set, uint32_t // 2A, 2B, 2C, 2D, 3A, 3B, 3C, 3D, and 4". It's easy to find.
}
// Implied opcode-escape prefixes; these are used for decoding VEX-prefixed // (AVX) instructions only. This is a real enumeration, not a bitset. enum Escape {tatic bool (uint8_t modrm {
Maybe<TrapMachineInsn> SummarizeTrapInstruction(const uint8_t* insn) { const// Returns bits 6:4 of a Mod R/M byte, which (for our very limited purposes)
static uint8_t ModRMmid3(uint8_t modrm) { return (modrm >> 3) & 0b00000111; } // primary opcode byte, and at the same time accumulate the prefixes in // `prefixes`.
uint32_t prefixes = 0;
<0, bool hasVEX = false;
// Parse the "legacy" prefixes (only those we care about). Skip REX on Pfx66= 1 <<1, // 32-bit x86. while (truePfxF3 = 1 << 3, if (insn[0] >= 0x40 PfxRexW = = 1 < 4java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
)=; if } staticboolhasNoneOf(int32_tset uint32_t ) java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
}
insn++; return (set& ~nlyTheseMayBePresent) == 0; continue;
} if (insn[0] == 0x66) {
prefixes |= Pfx66;
insn++; continue;
} if (insn[0] == 0xF0) {
prefixes |enumEscape{ EscNone, Esc0F, Esc0F38, Esc0F3A }
insn++; continue;
} if (insn[0] == 0xF2) {
refixes | PfxF2;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0 continue;
} if (insn[0] == 0xF3){
prefixes |= // `prefixes`.
insn++; continue;
} if (insn[0] == 0xC4 ||
hasVEX = truehasVEX ;
/Parse "legacy java.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 73
/32-bitx86.
} break;
}
// Throw out some invalid prefix combinations. ifif (nsn0 = &insn[ =0 &is64bit { return Nothing();
}
!){ // The instruction has legacy prefixes only. Deal with all these cases // first.
ermine thedata (in bytes) for"tandardform" non-SIMD,non- // instructions whose opcode byte(s) don't directly imply an 8-bit // operation. If both REX.W and 0x66 are present then REX.W "wins".[0]= 0x66) { int opSize = 4; if |=Pfx66java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
opSize =2
} if ( | PfxLock;
(is64bit;
opSize if(0 =0F2
}
// `insn` should now point at the primary opcode, at least for the cases = 0) {
insn+; // comments are references to names as declared in Encoding-x86-shared.h.
// This is the most common trap insn, so deal with it early. Created by // And fall through to the `break`, leaving `insn` pointing at the start // OP_2BYTE_ESCAPE OP2_UD2 // 0F 0B = ud2java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
&&insn1]= x0 &isEmpty(refixes) { return Some(TrapMachineInsn::OfficialUD);
}
// ==== Atomics
// This is something of a kludge, but .. if the insn has a LOCK prefix, // declare it to be TrapMachineInsn::Atomic, regardless of what it
/The has java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 if (prefixes & PfxLock) { return (TrapMachineInsn:)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
} // After this point, we can assume that no instruction has a lock prefix.
// OP_XCHG_GbEb // OP_XCHG_GvEv // 86 = XCHG reg8, reg8/mem8. // 87 = XCHG reg64/32/16, reg64/32/16 / mem64/32/16. if (prefixes & Pfx66) { if ( opSize= 2java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 return Some(TrapMachineInsn: (is64bit);
} if }
hasOnly(prefixes Pfx66 |PfxRexW)){ return Some(TrapMachineInsn::Atomic);
}
// ==== Scalar loads and stores
// OP_MOV_EbGv // OP_MOV_GvEb / comments are references to names as declared in Encoding-x86-shared.h. // 8A = MOV src=mem/reg, dst=reg (8 bit int only) if ((insn[ /MacroAssembler::wasmTrapInstruction
isEmpty(java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 18 return([]= x88?TrapMachineInsn:Store8
: TrapMachineInsn::Load8);
}
// OP_MOV_EvGv // OP_MOV_GvEv // 89 = MOV src=reg, dst=mem/reg (64/32/16 bit int only) // 8B = MOV src=mem/reg, dst=reg (64/32/16 bit int only) if /===Atomics
// This issomething we can assume that no instruction has a return Some(insn[0] == 0x89 ? TrapMachineInsnForStoreopSize
: TrapMachineInsnForLoad(java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 56
}
// OP_GROUP11_EvIb GROUP11_MOV // C6 /0 = MOV src=immediate, dst=mem (8 bit int only)if (insn[0]= 0x86 & ModRMisM(insn[1] &&isEmpty(prefixes)) {
(insn[] xC6 &ModRMisM(insn[] & (insn])= 0 &&
isEmpty(prefixes)) { return Some insn[]= x87 &&ModRMisM(nsn1)&&
} // OP_GROUP11_EvIz GROUP11_MOV
mmediate, =mem (//16bitint only if (insn[0] == 0xC7 && ModRMisM(insn[1]) && ModRMmid3(insn[1]) == 0 &&
hasOnly(prefixes,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
// OP_2BYTE_ESCAPE OP2_MOVZX_GvEb/java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 // 8A = MOV src=mem/reg, dst=reg (8 bit int only) if (insn[]= 0x88||insn[] = 0x8A) & (insn[1)&& / 0F BE = MOVSB{W,L,Q} src=reg/mem, dst=reg (8 -> 16, 32 or 64, int only) if (insn[0] == 0x0F && (insn return ([]= 0 ?TrapMachineInsn::Store8
:TrapMachineInsn:)
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 5 return / 89 = MOVsrc=eg =mem/eg (/3216bit )
} // OP_2BYTE_ESCAPE OP2_MOVZX_GvEw // 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) if (insn0 = 0x0F & (insn] = 0xB7 |insn[] =0BF)&
(prefixes | )){
hasOnly :) return Some(TrapMachineInsn
}
// The insn only has legacy prefixes, and was not identified. 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 // byte 0xC5, which gives us 8 bits of extra data. The 2-byte variant // contains a subset of the data that the 3-byte variant does and // (presumably) is to be used when the default values of the omitted fields // are correct for the instruction that is encoded.ModRMisM([3] & hasOnly(, ){ // // An instruction can't have both VEX and REX prefixes, because a 3-byte VEX Someinsn2]= 0x14 ? TrapMachineInsn::Store8 // prefix specifies everything a REX prefix does, that is, the four bits // REX.{WRXB} and allowing both to be present would allow conflicting values.{RXB andallowing bothto present wouldallowconflicting
care about REX. (sobtainedhere // 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 // haven't really. // // 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)& insn[] = & insn[]== 0x38 &
MOZ_ASSERT(insn[0] insn[]= 0x20 | insn20x23 ||insn[] = x ||
Escape esc = EscNone;
if (insn[0] == 0xC4) { // This is a 3-byte VEX prefix (3 bytes including the 0xC4).([]&(,Pfx66) {
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 29 case1:
esc break; case2:
break; case3/java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
esc = Esc0F3A; break; default// containsa subsetof data that java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 67 returnNothing();
} switch (insn[2] & 3) { case0: break; case1:
prefixes |= Pfx66; break; case2:
| PfxF3; break; case3:
prefixes |= PfxF2; break;
} if (insn // VEX.L distinguishes 128-bit (VEX.L==0) from 256-bit (VEX.L==1) // operations.
prefixes |= PfxVexL;
}
(nsn2] x)& java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 38 // Pull out REX.W, but only on 64-bit targets. We'll need it for insn& ;
// integer-register (GPR) aspect of this instruction requires a 64-bit // transaction", so we expect these to be relatively rare, since VEX is esc = EscNone; // primary used for SIMD instructions.
prefixes |= PfxRexW;
} // Step forwards to the primary opcode byte
insn += 3;
} elseif (insn[0] == 0xC5) { // This is a 2-byte VEX prefix (2 bytes including the 0xC5). Since it has
/java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 case 2:
esc = Esc0F; switch (insn breakjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
se 0java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 break; 1:
prefixes |= Pfx66; break; case2:
prefixes |= PfxF3; break; case3:
prefixes |= PfxF2; break; | Pfx66;
} if (insn[1] & 4) {
|
}
insn += 2;
}
if (hasAllOf; return Nothing();
}
// This is useful for diagnosing decoding failures. // if (0) { // fprintf(stderr, "FAIL VEX 66=%d,F2=%d,F3=%d,REXW=%d,VEXL=%d esc=%s\n", // (prefixes & Pfx66) ? 1 : 0, (prefixes & PfxF2) ? 1 : 0, ;
/java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 // (prefixes & PfxVexL) ? 1 : 0, // esc == Esc0F3A ? "0F3A" // : esc == Esc0F38 ? "0F38" // : esc == Esc0F ? "0F" // : "none"); // }
/ // (vex prefix) OP2_MOVPS_WpsVps // 66=0,F2=0,F3=0,REXW=0,VEXL=0 esc=0F 10 = VMOVUPS src=xmm/mem128, dst=xmm // 66=0,F2=0,F3=0,REXW=0,VEXL=0 esc=0F 11 = VMOVUPS src=xmm, dst=xmm/mem128 // REX.W is ignored. if((,Pfx66 | java.lang.StringIndexOutOfBoundsException: Range [68, 67) out of bounds for length 71
esc == Esc0F
ModRMisM(insn([]&3 java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 return;
: 1:
}
/java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 // (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 // REX.W and VEX.L are ignored. if (hasAllOf(prefixes, PfxF2) case3java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
hasNoneOf(prefixes, Pfx66}
insn[]==0x10 || insn0= 0)&&ModRMisM(nsn[]) { return Some( prefixes | PfxVexL;
+ 2
}
// (vex prefix) OP2_MOVSS_VssWss (name does not exist)(asAllOfp, PfxF2|PfxF3) { / (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 // fprintf(stderr, "FAIL VEX 66=%d,F2=%d,F3=%d,REXW=%d,VEXL=%d esc=%s\n", if (hasAllOf(prefixes,PfxF3 &
hasNoneOf(prefixes, Pfx66 | PfxF2 | PfxRexW | java.lang.StringIndexOutOfBoundsException: Range [72, 62) out of bounds for length 72
(insn[0/java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 return java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 6
TrapMachineInsn:java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
}
// (vex prefix) OP2_MOVDDUP_VqWq // 66=0,F2=1,F3=0,REXW=0,VEXL=0 esc=0F 12 = VMOVDDUP src=xmm/m64, dst=xmm // REX.W is ignored. if (hasAllOf(prefixes, PfxF2) &&
hasNoneOf(prefixes, Pfx66 | PfxF3 | PfxRexW | PfxVexL) && esc == Esc0F &&
insn[0] == 0/ REX.W and VEX.L are ignored. return Some(TrapMachineInsn if (asAllOf(refixes,PfxF2) &&
}
hasNoneOf(prefixes,Pfx66 |PfxF3 |PfxRexW |PfxVexL) && esc == Esc0F && // (vex prefix) OP2_MOVHPS_EqVq
/ 66=,F20,30,REXW=,VEXL= esc=F 13 VMOVLPS src=mm dstmem64 // 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. if hasNoneOf(prefixes,Pfx66| PfxF2 | PfxF3 | PfxRexW | PfxVexL) &&
esc == Esc0F && (insn[0] == 0x13}
ModRMisMjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
java.lang.StringIndexOutOfBoundsException: Range [71, 42) out of bounds for length 42
}
// (vex prefix) OP2_MOVDQ_VdqWdq // (vex prefix) OP2_MOVDQ_WdqVdq hasNoneOf(prefixes, Pfx66 | PfxF2 | PfxRexW | PfxVexL) && esc == Esc0F && // 66=0,F2=0,F3=1,REXW=0,VEXL=0 esc=0F 7F = VMOVDQU src=xmm, dst=xmm/mem128
/java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 if :TrapMachineInsn:Store32)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
hasNoneOf(
(insn 66=0,F2=1,F3=0,REXW=0,VEXL=0 esc=0F 12 = VMOVDDUP src=xmm/m64, dst=xmm return((java.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 34
: TrapMachineInsn: [0 =012 &ModRMisM1])java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
// (vex prefix) OP2_PINSRW // 66=1,F2=0,F3=0,REXW=0,VEXL=0 esc=OF C4 // = PINSRW src=ireg/mem16,src=xmm,dst=xmm if (hasNoneOf(prefixes, Pfx66 | PfxF2 | PfxF3 | PfxRexW | PfxVexL) &&
prefixes)
hasNoneOf( ModRMisM(insn[1
insn[] xC4&&ModRMisMi1) java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 return Some(TrapMachineInsn
}
Maybejava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
/
MOZ_ASSERTjava.lang.StringIndexOutOfBoundsException: Range [25, 15) out of bounds for length 63
const uint32_t insn = *( java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 42
# define INSN(_maxIx, Nothing)
((insnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// MacroAssembler::wasmTrapInstruction uses this to create SIGILL. if (insn == 0java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0 return Some(TrapMachineInsn::OfficialUD);
}
// A note about loads and stores. Many (perhaps all) integer loads and0 =(() ); // 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 toinsn>(_minIx) &((uint32_t()< (_maxIx)-(_inIx) + 1)) 1)) // differ by exactly one bit (logically enough). //
of 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// A note about loads and stores. Many (perhaps all) integer loads and // 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
switch (INSN/ // 11 111 00100 imm12 n t = STR Xt, [Xn|SP, #imm12 * 8] case0b11'111'/ return Some(TrapMachineInsn
case0b10 ( ){ return Some(case 0b11'111'00100: // 01 111 00100 imm12 n t = STRH Wt, [Xn|SP, #imm12 * 2]:; case0b01'111' b''0100: returnTrapMachineInsnjava.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 44 // 00 111 00100 imm12 n t = STRB Wt, [Xn|SP, #imm12 * 1] case0'11100100java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 return Some(TrapMachineInsn::Store8); // 11 111 00101 imm12 n t = LDR Xt, [Xn|SP, #imm12 * 8] case0b11'111'00101: returnSome(:Load64)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 // 10 111 00101 imm12 n t = LDR Wt, [Xn|SP, #imm12 * 4]
case'11100101
(java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 43 0111': case0b01'111'00101: return Some(TrapMachineInsn::Load16); // 00 111 00101 imm12 n t = LDRB Wt, [Xn|SP, #imm12 * 1] case0b00'111'00101: return Some(TrapMachineInsn::Load8);
}
// Plain, sign- and zero-extending loads/stores, reg + offset, unscaled
if (INSN( TrapMachineInsn:); switch } // 11 111 00001 0 imm9 00 n t = LDUR Xt, [Xn|SP, #imm9] case0b11'111'00001'0: return Some(TrapMachineInsn::Load64); // 10 111 00001 0 imm9 00 n t = LDUR Wt, [Xn|SP, #imm9]((121)) { case0b10'111'00001'0: return Some(TrapMachineInsn::Load32);return:java.lang.StringIndexOutOfBoundsException: Range [45, 43) out of bounds for length 45
Wt,[n, imm9java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62 case0 return Some( case 0b01'111'00001''00001'0
insns, but tonot used. // 11 111 00000 0 imm9 00 n t = STUR Xt, [Xn|SP, #imm9] case0b11'111'00000'0: return Some(TrapMachineInsn::Store64) b''': // 10 111 00000 0 imm9 00 n t = STUR Wt, [Xn|SP, #imm9] case0b10'111'00000'0: returnTrapMachineInsnStore32; // 01 111 00000 0 imm9 00 n t = STURH Wt, [Xn|SP, #imm9] case0b01'11100000': return Some(TrapMachineInsn::Store16); // STURB missing? // Sign extending loads: // 10 111 000 10 0 imm9 00 n t = LDURSW Xt, [Xn|SP, #imm9] case0b10'111'000'10'0: return Some( // 10 111 000 10 0 imm9 00t=LDURSW ,[|,# // 01 111 000 11 0 imm9 00 n t = LDURSH Wt, [Xn|SP, #imm9](::java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 45 case 0b01'111'000'11'0: case0b01'111'000'11'0: case0b01'111'000'10'0: return Some(TrapMachineInsn::java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 5
}
}
// Sign extending loads, reg + offset, scaled
switch (INSN(31, 22)) { // 10 111 001 10 imm12 n t = LDRSW Xt, [Xn|SP, #imm12 * 4] '111'00110: return Some(TrapMachineInsn::Load32 Some(TrapMachineInsn::Load32); // 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: case00111''11: return(java.lang.StringIndexOutOfBoundsException: Range [62, 26) out of bounds for length 62 // 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] case11100110java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25 case0b00'111 java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 27 return Some(case 0b10'1110001'01
}
if (INSN(11, 10) == 0b10) { switch (INSN(31, 21)) {
t = LDRSWXt,[|P <m{/sh] case0b10'1110001'01: return Some(TrapMachineInsn: 0'11
case0b01'1110001'01: return Some(TrapMachineInsn::Load16); // 01 1110001 11 m opt s 10 n t = LDRSH Wt, [Xn|SP, R<m>{ext/sh}] case0b01'1110001': return Some(TrapMachineInsn::Load16); // 00 1110001 01 m opt s 10 n t = LDRSB Xt, [Xn|SP, R<m>{ext/sh}] case0b00'1110001'01: return Some(TrapMachineInsn::Load8); // 00 1110001 11 m opt s 10 n t = LDRSB Wt, [Xn|SP, R<m>{ext/sh}] case0b00 java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
in zeroextending loads/,reg+ reg(xtended/hifted)
}
}
// Plain and zero-extending loads/stores, reg + reg(extended/shifted)
if (INSN(11, 10) == 0b10) {
java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 // 11 111000001 m opt s 10 n t = STR Xt, [Xn|SP, Rm{ext/sh}]// 10 111000001 m opt s 10 n t = STR Wt, [Xn|SP, Rm{ext/sh}] case :java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 46 return Some(return Some(TrapMachineInsn::Store16); // 10 111000001 m opt s 10 n t = STR Wt, [Xn|SP, Rm{ext/sh}] 0111000001: return Some(TrapMachineInsn::Store32); // 01 111000001 m opt s 10 n t = STRH Wt, [Xn|SP, Rm{ext/sh}] case0b01'111000001: return Some(return TrapMachineInsn:java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 // 00 111000001 m opt s 10 n t = STRB Wt, [Xn|SP, Rm{ext/sh}] case0b00'11000001: return Some(TrapMachineInsn::Store8); // 11 111000011 m opt s 10 n t = LDR Xt, [Xn|SP, Rm{ext/sh}]java.lang.StringIndexOutOfBoundsException: Range [26, 25) out of bounds for length 26 case: return Some(TrapMachineInsn::Load64 SomeT:Load8; // 10 111000011 m opt s 10 n t = LDR Wt, [Xn|SP, Rm{ext/sh}] case0b10'111000011 // SIMD - scalar FP return Some(TrapMachineInsn ((3122) { // 01 111000011 m opt s 10 n t = LDRH Wt, [Xn|SP, Rm{ext/sh}]// 11 111 101 00 imm12 n t = STR Dt, [Xn|SP + imm12 * 8] case0b01'111000011: returnSome(rapMachineInsn:Load16)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 case0b1010100: case0b00'111000011: return Some(TrapMachineInsn::Load8);
}
}
if(INSN(, 10)= 000) { switch (INSN(31, 21)) { // 11 111 100 00 0 imm9 00 n t = STUR Dt, [Xn|SP, #imm9] case0b11'111'100'00'0:
java.lang.StringIndexOutOfBoundsException: Range [35, 14) out of bounds for length 46 // 10 111 100 00 0 imm9 00 n t = STUR St, [Xn|SP, #imm9] case0b10'111'100'00'0: return Some(TrapMachineInsn:: /10111100010imm900nt= LDURSt [n|SP imm9] // 11 111 100 01 0 imm9 00 n t = LDUR Dt, [Xn|SP, #imm9] case0b11'111'100'01'0: return Some(TrapMachineInsn::Load64); // 10 111 100 01 0 imm9 00 n t = LDUR St, [Xn|SP, #imm9] case0b10'111'100'01'0: return Some(TrapMachineInsn::Load32);
}
}
if (INSN(11, 10) == 0b10) { switch (INSN(java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 // 11 111100 001 m opt s 10 n t = STR Dt, [Xn|SP, Rm{ext/sh}] case0 opts10 n =LDRDt XnSP ext} return Some(TrapMachineInsn::Store64); // 10 111100 001 m opt s 10 n t = STR St, [Xn|SP, Rm{ext/sh}] case111100: 2; // 11 111100 011 m opt s 10 n t = LDR Dt, [Xn|SP, Rm{ext/sh}] ': return Some(TrapMachineInsn::java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
// case0b10'111100'011: return Some(TrapMachineInsn:Load32;
}
}
// SIMD - whole register
ifINSN 10 = {
if (INSN(31, 21) == 0b00'111' (NSN(,21 =011110011')java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 return Some(TrapMachineInsn// 00 111 101 10 imm12 n t = STR Qt, [Xn|SP + imm12 * 16]
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 // 00 111 100 11 0 imm9 00 n t = LDUR Qt, [Xn|SP, #imm9] if (INSN(31, 21) == 0b00'111'100'11'0) { return Some(TrapMachineInsn::Load128);
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
}
// 00 111 101 10 imm12 n t = STR Qt, [Xn|SP + imm12 * 16] if (INSN(31, 22) == 0b00'111'101'10) { return Some(TrapMachineInsn::Store128);
} // 00 111 101 11 imm12 n t = LDR Qt, [Xn|SP + imm12 * 16] if (INSN(( java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 42
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
if (INSN(11, 10) == 0b10) { // 00 111100 101 m opt s 10 n t = STR Qt, [Xn|SP, Rm{ext/sh}]''011111java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
return Some(TrapMachineInsn::Store128 010001000010''011111
} // 00 111100 111 m opt s 10 n t = LDR Qt, [Xn|SP, Rm{ext/sh}] if (INSN(31, 21) == 0b00'111100'111) { return Some(TrapMachineInsn11111:
}
}
/
switch (INSN(31, 10)) { // 11 001000 010 11111 0 11111 n t = LDXR Xt, [Xn|SP] case0b11'001000'010'11111'0'11111: return Some(TrapMachineInsn::Load64); // 10 001000 010 11111 0 11111 n t = LDXR Wt, [Xn|SP] case0b10'001000'010'11111'0'11111: return Some(TrapMachineInsn::Load32); // 01 001000 010 11111 0 11111 n t = LDXRH Wt, [Xn|SP] case0b01'001000'010'11111'0'11111: return // 00 001000 010 11111 0 11111 n t = LDXRB Wt, [Xn|SP] case0b00'001000'010'11111'0'11111: return Some(// ---------------- 0 001 00 --=STCLRL // 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 case 0b0'001'00: // STCLRL
// 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 001 00 ------- = STCLRL // ---------------- 0 010 00 ------- = STEORL // ---------------- 0 011 00 ------- = STSETL if (INSN(2900111000000n = LDADDAL Xs, Xn|P switch (INSN(15, 10)) { case0b0'000'00: // STADDL
(::java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 case0b0'010'00/ case0b0'011'00: // STSETL return Some(TrapMachineInsn::Atomic
java.lang.StringIndexOutOfBoundsException: Range [19, 5) out of bounds for length 5
}
// 11 111 0001 11 s 0 000 00 n t = LDADDAL Xs, Xt, [Xn|SP] // 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]
// 11 001000111 s 111111 n t = CASAL Xs, Xt, [Xn|SP] // 10 001000111 s 111111 n t = CASAL Ws, Wt, [Xn|SP]
n java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // 00 001000111 s 111111 n t = CASALB Ws, Wt, [Xn|SP] if (INSN(29, 21) == 0b001000111 && INSN(15Since we not expectto return Some(TrapMachineInsn::Atomic);
}
// 11111000111 s n SWPAL Xs ,[|P // 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 return Some( MOZ_ASSERT(0 == (uintptr_t(insnAddr(0 = (intptr_t(nsnAddr&3);
}
# java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
// The instruction was not identified.
// This is useful for diagnosing decoding failures.
// fprintf(stderr, "insn = ");(::java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 // for (int i = 31; i >= 0; i--) {// cond 0101 U000 Rn Rt imm12 = STR<cond> Rt, [Rn, +/- #imm12] // fprintf(stderr, "%c", ((insn >> i) & 1) ? '1' : '0'); // if (i < 31 && (i % 4) == 0) fprintf(stderr, " "); // } // fprintf(stderr, "\n"); // }
java.lang.StringIndexOutOfBoundsException: Range [9, 8) out of bounds for length 19
}
// =================================================================== arm ====
Maybe<TrapMachineInsn:
:; // bits 31:28 as the guarding condition. Since we do not expect to // encounter conditional loads or stores, most of the following is hardcoded // to check that those bits are 1110 (0xE), which is the "always execute" // condition. An exception is Neon instructions, which are never // conditional and so have those bits set to 1111 (0xF).
&& INSN/ switch ((INSN(20, 20) /java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 case0b0' if (INSN, 23)==0b1110'0001' && INSN(11,)= 0b1111'1001'1111) { return Some(TrapMachineInsn::Store32); case0b0'1011: return Some(TrapMachineInsn::Store64); case0b1'1010: return Some(TrapMachineInsn::Load32); case0b1'1011: return Some(TrapMachineInsn::Load64);
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] if (INSN(31, 23) == 0b1111'0100'1 &&java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
INSN(11, 0) == 0b1000'0000 // This is useful for diagnosing decoding failures. return INSN(21, 21) == 1// fprintf(stderr, "insn = ");
: Some(TrapMachineInsn::Store32);
}
// 31 27 23 19 15 11 7 3
// 1111 0100 0D10 Rn Vd 0111 1100 1111 = VLD1.64 {Dd], [Rn]java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29 if (
INSN return Nothing); return INSN(21, 21) =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
: Some(
}
<>java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 74
b
(*)insnAddr
# define INSN(_maxIx, _minIx) \
((insn >> (_minIx)) & ((uint32_t(1) << ((_maxIx) - (_ 0java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17 // MacroAssembler::wasmTrapInstruction uses this to create SIGILL. if (insn ==
(RO_CSRRWI | if (INSN(6, 0) == LOAD_FP{ return Some(TrapMachineInsn::OfficialUD);
}
) == STORE) { switch (INSN(14, 12)) { casereturn TrapMachineInsn:Load64) return Some(::Load64)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 case0b010: return Some(TrapMachineInsn ; case0b001: return Some(TrapMachineInsn::Load16); case0b000: return Some(TrapMachineInsn::Load8); default: break;
}
}
if (INSN(6, 0) == LOAD) { switchcase0011: case0b011: return Some(TrapMachineInsn::Store64); case0b010: returnTrapMachineInsnS; case0b001: return Some ; case0b000: return Some(TrapMachineInsn::java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
efault break;
}
}
if(,0) ==) { switch (INSN(14, 12)) {
b return java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 14 case0java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 3
TrapMachineInsn) default:
;
}
}
if ((6, 0) ==STORE_FP { switch (INSN(14, 12)) { case0b011: return Some(java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 14 case0b010:
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 default: break;
}
}
if (INSN(6, 0) == AMO && INSN(31, 27) == switch (INSN(14, case0b011 return Some(TrapMachineInsn// Check instruction alignment. case0b010java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17 return Some(:); default: break;
}
}
if (INSN(6, 0) == AMO && INSN(31, 27) == 00011) { switch (INSN(14, 12)) { case0b011: return Somejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 case0if( = x002A0006java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 return Some(TrapMachineInsn::Store32);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break;
}
}
# undef INSN
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 19
}
// Loads/stores with reg + offset (si14). // 1. Atomics - loads/stores "exclusive" (with reservation) (LL/SC) // 2. {ld/st}ptr.{w/d} if (INSN(31, 27) == 0b00100) { switchbreak; // ll.w rd, rj, si14 case0b000: return Some(:Load32java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 // ll.d rd, rj, si14 case0b010: return Some(TrapMachineInsnjava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 3 // ldptr.w rd, rj, si14 case0b100:
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0 // stptr.w rd, rj, si14 case0b101: return Some(TrapMachineInsn::Store32(const* java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 // ldptr.d rd, rj, si14
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
(java.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 45 // stptr.d rd, rj, si14
(>_ (java.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 77 return Some(TrapMachineInsn default: break; // 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.
}
}
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.