mirror of
https://github.com/Ed94/perfaware.git
synced 2026-09-17 21:23:48 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4264e19b37 | ||
|
|
be55514e93 | ||
|
|
d08709128a | ||
|
|
e24b68028c | ||
|
|
6bb1386995 | ||
|
|
2a89a342df | ||
|
|
7daa333a71 | ||
|
|
f2a8f6d2cf | ||
|
|
8912f3e0e9 | ||
|
|
21334b48d8 | ||
|
|
b973b0cd41 | ||
|
|
95e67a8c1a | ||
|
|
588fa20778 |
+108
-76
@@ -35,22 +35,24 @@ typedef Struct_(X8616_DecodePlex) {
|
|||||||
U1 plan_idx;
|
U1 plan_idx;
|
||||||
X8616_DecodePlan* plan;
|
X8616_DecodePlan* plan;
|
||||||
|
|
||||||
U1 opcode;
|
U1 header;
|
||||||
U1 post_opcode;
|
U1 post_opcode;
|
||||||
U1 mod_rm;
|
U1 mod_rm;
|
||||||
|
|
||||||
U1 d;
|
X8616_Direction d;
|
||||||
U1 w;
|
X8616_Width w;
|
||||||
U1 s;
|
X8616_Sign s;
|
||||||
U1 v;
|
X8616_VariableShift v;
|
||||||
U1 z;
|
X8616_Repeat z;
|
||||||
U1 reg_opcode;
|
X8616_ALU alu;
|
||||||
U1 sr_opcode;
|
X8616_Condition cc;
|
||||||
|
X8616_DecodedReg reg_opcode;
|
||||||
|
X8616_Segment sr_opcode;
|
||||||
|
|
||||||
U1 mod;
|
X8616_Mod mod;
|
||||||
U1 reg;
|
X8616_DecodedReg reg;
|
||||||
U1 rm;
|
X8616_EA rm;
|
||||||
U1 sr_modrm;
|
X8616_Segment sr_modrm;
|
||||||
|
|
||||||
X8616_WidthMode width;
|
X8616_WidthMode width;
|
||||||
|
|
||||||
@@ -80,34 +82,36 @@ typedef Struct_(X8616_DecodePlex) {
|
|||||||
|
|
||||||
FI_ U2 x8616_decode_u2(U1_R bytes) { return C_(U2, bytes[0] | u2_(bytes[1] << 8)); }
|
FI_ U2 x8616_decode_u2(U1_R bytes) { return C_(U2, bytes[0] | u2_(bytes[1] << 8)); }
|
||||||
|
|
||||||
internal X8616_OpcodePrefix
|
internal X8616_Opcode
|
||||||
x8616_decode_opcode(X8616_DecodePlan const* plan, U1 opcode)
|
x8616_decode_opcode(X8616_DecodePlan const* plan, U1 header)
|
||||||
{
|
{
|
||||||
U1 field_mask = 0;
|
U1 field_mask = 0;
|
||||||
if (plan->flags & x8616_plan_has_d) field_mask |= u1_(1u << plan->d_shift);
|
if (plan->flags & x8616_plan_has_d) field_mask |= x8616_field_mask(plan->d_shift, X8616_OPCODE_BIT_WIDTH);
|
||||||
if (plan->flags & x8616_plan_has_w) field_mask |= u1_(1u << plan->w_shift);
|
if (plan->flags & x8616_plan_has_w) field_mask |= x8616_field_mask(plan->w_shift, X8616_OPCODE_BIT_WIDTH);
|
||||||
if (plan->flags & x8616_plan_has_s) field_mask |= u1_(1u << plan->s_shift);
|
if (plan->flags & x8616_plan_has_s) field_mask |= x8616_field_mask(plan->s_shift, X8616_OPCODE_BIT_WIDTH);
|
||||||
if (plan->flags & x8616_plan_has_v) field_mask |= u1_(1u << plan->v_shift);
|
if (plan->flags & x8616_plan_has_v) field_mask |= x8616_field_mask(plan->v_shift, X8616_OPCODE_BIT_WIDTH);
|
||||||
if (plan->flags & x8616_plan_has_z) field_mask |= u1_(1u << plan->z_shift);
|
if (plan->flags & x8616_plan_has_z) field_mask |= x8616_field_mask(plan->z_shift, X8616_OPCODE_BIT_WIDTH);
|
||||||
if (plan->flags & x8616_plan_has_reg) field_mask |= u1_(0b111u << plan->reg_shift);
|
if (plan->flags & x8616_plan_has_reg) field_mask |= x8616_field_mask(plan->reg_shift, X8616_OPCODE_REG_REG_WIDTH);
|
||||||
if (plan->flags & x8616_plan_has_sr) field_mask |= u1_(0b11u << plan->sr_shift);
|
if (plan->flags & x8616_plan_has_sr) field_mask |= x8616_field_mask(plan->sr_shift, X8616_OPCODE_SR_WIDTH);
|
||||||
if (field_mask == 0) return 0;
|
if (plan->flags & x8616_plan_has_alu) field_mask |= x8616_field_mask(plan->alu_shift, X8616_OPCODE_ALU_TTT_WIDTH);
|
||||||
U1 stem_mask = u1_(~field_mask);
|
if (plan->flags & x8616_plan_has_cc) field_mask |= x8616_field_mask(plan->cc_shift, X8616_OPCODE_CC_WIDTH);
|
||||||
if (stem_mask == 0) return 0;
|
if (field_mask == 0) return C_(X8616_Opcode, header);
|
||||||
return C_(X8616_OpcodePrefix, (opcode & stem_mask) >> count_trailing_zeros_u4(stem_mask));
|
U1 opcode_mask = u1_(~field_mask);
|
||||||
|
if (opcode_mask == 0) return C_(X8616_Opcode, header);
|
||||||
|
return C_(X8616_Opcode, (header & opcode_mask) >> count_trailing_zeros_u4(opcode_mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
x8616_decode_apply_prefix(X8616_DecodePlex_R plex, X8616_DecodePlan_R plan, U1 opcode) {
|
x8616_decode_apply_prefix(X8616_DecodePlex_R plex, X8616_DecodePlan_R plan, U1 header) {
|
||||||
plex->prefixes.count += 1;
|
plex->prefixes.count += 1;
|
||||||
plex->prefixes.lock |= plan->prefix_kind == x8616_prefix_lock;
|
plex->prefixes.lock |= plan->prefix_kind == x8616_prefix_lock;
|
||||||
if (plan->prefix_kind == x8616_prefix_repeat) {
|
if (plan->prefix_kind == x8616_prefix_repeat) {
|
||||||
plex->prefixes.has_repeat = 1;
|
plex->prefixes.has_repeat = 1;
|
||||||
plex->prefixes.repeat = (opcode >> plan->z_shift) & 0b1;
|
plex->prefixes.repeat = C_(X8616_Repeat, x8616_bit_field_extract(header, (X8616_BitField){ plan->z_shift, X8616_OPCODE_BIT_WIDTH }));
|
||||||
}
|
}
|
||||||
if (plan->prefix_kind == x8616_prefix_segment) {
|
if (plan->prefix_kind == x8616_prefix_segment) {
|
||||||
plex->prefixes.has_segment = 1;
|
plex->prefixes.has_segment = 1;
|
||||||
plex->prefixes.segment = (opcode >> plan->sr_shift) & 0b11;
|
plex->prefixes.segment = C_(X8616_Segment, x8616_bit_field_extract(header, (X8616_BitField){ plan->sr_shift, X8616_OPCODE_SR_WIDTH }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,18 +120,18 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
{
|
{
|
||||||
U4 prefix_at = 0;
|
U4 prefix_at = 0;
|
||||||
|
|
||||||
// Prefix pass. Ambiguous/group opcodes are never prefixes, so only direct
|
// Prefix pass. LOCK / REP / segment are prior bytes. Encodings that need a
|
||||||
// dispatch entries participate in this loop.
|
// second byte (aux dispatch) are never prefixes.
|
||||||
while (prefix_at < plex->source_size)
|
while (prefix_at < plex->source_size)
|
||||||
{
|
{
|
||||||
U1 prefix_opcode = plex->source[prefix_at];
|
U1 prefix_header = plex->source[prefix_at];
|
||||||
U2 prefix_dispatch = x8616_decode_dispatch[prefix_opcode];
|
U2 prefix_dispatch = x8616_decode_dispatch[prefix_header];
|
||||||
if (prefix_dispatch == false || (prefix_dispatch & X8616_DECODE_AUX_BIT)) break;
|
if (prefix_dispatch == false || (prefix_dispatch & X8616_DECODE_AUX_BIT)) break;
|
||||||
|
|
||||||
X8616_DecodePlan_R prefix_plan = x8616_decode_plans + prefix_dispatch;
|
X8616_DecodePlan_R prefix_plan = x8616_decode_plans + prefix_dispatch;
|
||||||
if ((prefix_plan->flags & x8616_plan_is_prefix) == false) break;
|
if ((prefix_plan->flags & x8616_plan_is_prefix) == false) break;
|
||||||
|
|
||||||
x8616_decode_apply_prefix(plex, prefix_plan, prefix_opcode);
|
x8616_decode_apply_prefix(plex, prefix_plan, prefix_header);
|
||||||
++ prefix_at;
|
++ prefix_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,8 +140,8 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
|
|
||||||
for (U1 idx = 0; idx < plex->body_available; ++ idx) plex->body[idx] = plex->source[prefix_at + idx];
|
for (U1 idx = 0; idx < plex->body_available; ++ idx) plex->body[idx] = plex->source[prefix_at + idx];
|
||||||
|
|
||||||
plex->opcode = plex->body[0];
|
plex->header = plex->body[0];
|
||||||
plex->dispatch = x8616_decode_dispatch[plex->opcode];
|
plex->dispatch = x8616_decode_dispatch[plex->header];
|
||||||
|
|
||||||
if (body_source_size == 0) {
|
if (body_source_size == 0) {
|
||||||
plex->classification_truncated = 1;
|
plex->classification_truncated = 1;
|
||||||
@@ -179,7 +183,7 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plex->plan_idx = C_(U1, plex->dispatch);
|
plex->plan_idx = u1_(plex->dispatch);
|
||||||
if (plex->plan_idx == 0) {
|
if (plex->plan_idx == 0) {
|
||||||
plex->encoding_invalid = 1;
|
plex->encoding_invalid = 1;
|
||||||
x8616_info_push(plex->info_arena, plex->msgs, x8616_info_error
|
x8616_info_push(plex->info_arena, plex->msgs, x8616_info_error
|
||||||
@@ -187,7 +191,7 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
, plex->source_offset + prefix_at
|
, plex->source_offset + prefix_at
|
||||||
, 1
|
, 1
|
||||||
, 0
|
, 0
|
||||||
, plex->opcode
|
, plex->header
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +199,7 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
plex->plan = x8616_decode_plans + plex->plan_idx;
|
plex->plan = x8616_decode_plans + plex->plan_idx;
|
||||||
|
|
||||||
// A direct-dispatch plan may still have a constrained second byte.
|
// A direct-dispatch plan may still have a constrained second byte.
|
||||||
// Group opcodes with multiple candidates were already resolved through aux.
|
// Headers with multiple catalog rows were already resolved through aux.
|
||||||
if (plex->plan_idx && (plex->plan->flags & (x8616_plan_has_modrm | x8616_plan_has_post_opcode)))
|
if (plex->plan_idx && (plex->plan->flags & (x8616_plan_has_modrm | x8616_plan_has_post_opcode)))
|
||||||
{
|
{
|
||||||
if (body_source_size < 2)
|
if (body_source_size < 2)
|
||||||
@@ -250,14 +254,14 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
return plex->instruction.size;
|
return plex->instruction.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
X8616_DecodePlan const* plan = plex->plan;
|
X8616_DecodePlan_R plan = plex->plan;
|
||||||
plex->d = (plex->opcode >> plan->d_shift) & 0b1;
|
plex->d = C_(X8616_Direction, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->d_shift, X8616_OPCODE_BIT_WIDTH }));
|
||||||
plex->w = (plex->opcode >> plan->w_shift) & 0b1;
|
plex->w = C_(X8616_Width, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->w_shift, X8616_OPCODE_BIT_WIDTH }));
|
||||||
plex->s = (plex->opcode >> plan->s_shift) & 0b1;
|
plex->s = C_(X8616_Sign, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->s_shift, X8616_OPCODE_BIT_WIDTH }));
|
||||||
plex->v = (plex->opcode >> plan->v_shift) & 0b1;
|
plex->v = C_(X8616_VariableShift, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->v_shift, X8616_OPCODE_BIT_WIDTH }));
|
||||||
plex->z = (plex->opcode >> plan->z_shift) & 0b1;
|
plex->z = C_(X8616_Repeat, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->z_shift, X8616_OPCODE_BIT_WIDTH }));
|
||||||
plex->reg_opcode = (plex->opcode >> plan->reg_shift) & 0b111;
|
plex->reg_opcode.r16 = C_(X8616_Reg16, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->reg_shift, X8616_OPCODE_REG_REG_WIDTH }));
|
||||||
plex->sr_opcode = (plex->opcode >> plan->sr_shift) & 0b11;
|
plex->sr_opcode = C_(X8616_Segment, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->sr_shift, X8616_OPCODE_SR_WIDTH }));
|
||||||
|
|
||||||
plex->width = plan->width;
|
plex->width = plan->width;
|
||||||
if (plex->width == x8616_width_dynamic && (plan->flags & x8616_plan_has_w))
|
if (plex->width == x8616_width_dynamic && (plan->flags & x8616_plan_has_w))
|
||||||
@@ -272,16 +276,23 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
|
|
||||||
if (plan->flags & x8616_plan_has_modrm) {
|
if (plan->flags & x8616_plan_has_modrm) {
|
||||||
plex->mod_rm = plex->body[plex->body_at];
|
plex->mod_rm = plex->body[plex->body_at];
|
||||||
plex->mod = x8616_modrm_mod(plex->mod_rm);
|
plex->mod = C_(X8616_Mod, x8616_modrm_mod(plex->mod_rm));
|
||||||
plex->reg = x8616_modrm_reg(plex->mod_rm);
|
plex->reg.r16 = C_(X8616_Reg16, x8616_modrm_reg(plex->mod_rm));
|
||||||
plex->rm = x8616_modrm_rm(plex->mod_rm);
|
plex->rm = C_(X8616_EA, x8616_modrm_rm(plex->mod_rm));
|
||||||
plex->sr_modrm = x8616_modrm_sr(plex->mod_rm);
|
plex->sr_modrm = C_(X8616_Segment, x8616_modrm_sr(plex->mod_rm));
|
||||||
plex->body_at += 1;
|
plex->body_at += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (plan->flags & x8616_plan_has_alu) {
|
||||||
|
plex->alu = C_(X8616_ALU, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->alu_shift, X8616_OPCODE_ALU_TTT_WIDTH }));
|
||||||
|
}
|
||||||
|
if (plan->flags & x8616_plan_has_cc) {
|
||||||
|
plex->cc = C_(X8616_Condition, x8616_bit_field_extract(plex->header, (X8616_BitField){ plan->cc_shift, X8616_OPCODE_CC_WIDTH }));
|
||||||
|
}
|
||||||
|
|
||||||
plex->displacement_at = plex->body_at;
|
plex->displacement_at = plex->body_at;
|
||||||
|
|
||||||
if (plan->flags & x8616_plan_uses_rm) plex->displacement_bytes = x8616_decode_disp_bytes[(plex->mod << 3) | plex->rm];
|
if (plan->flags & x8616_plan_uses_rm) plex->displacement_bytes = x8616_decode_disp_bytes[(u1_(plex->mod) << 3) | u1_(plex->rm)];
|
||||||
|
|
||||||
plex->direct_memory = (plan->flags & x8616_plan_uses_rm) && plex->mod == x8616_mod_mem && plex->rm == x8616_ea_direct;
|
plex->direct_memory = (plan->flags & x8616_plan_uses_rm) && plex->mod == x8616_mod_mem && plex->rm == x8616_ea_direct;
|
||||||
|
|
||||||
@@ -319,21 +330,21 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
|
|
||||||
X8616_DecodedOperand* source = plex->operand_source;
|
X8616_DecodedOperand* source = plex->operand_source;
|
||||||
|
|
||||||
source[x8616_operand_reg_modrm].flags = x8616_decoded_operand_register;
|
source[x8616_operand_reg_modrm].flags = x8616_decoded_operand_register;
|
||||||
source[x8616_operand_reg_modrm].width = plex->width;
|
source[x8616_operand_reg_modrm].width = plex->width;
|
||||||
source[x8616_operand_reg_modrm].reg.r16 = C_(X8616_Reg16, plex->reg);
|
source[x8616_operand_reg_modrm].reg = plex->reg;
|
||||||
|
|
||||||
source[x8616_operand_reg_opcode].flags = x8616_decoded_operand_register;
|
source[x8616_operand_reg_opcode].flags = x8616_decoded_operand_register;
|
||||||
source[x8616_operand_reg_opcode].width = plex->width;
|
source[x8616_operand_reg_opcode].width = plex->width;
|
||||||
source[x8616_operand_reg_opcode].reg.r16 = C_(X8616_Reg16, plex->reg_opcode);
|
source[x8616_operand_reg_opcode].reg = plex->reg_opcode;
|
||||||
|
|
||||||
source[x8616_operand_segment_modrm].flags = x8616_decoded_operand_segment;
|
source[x8616_operand_segment_modrm].flags = x8616_decoded_operand_segment;
|
||||||
source[x8616_operand_segment_modrm].width = x8616_width_word;
|
source[x8616_operand_segment_modrm].width = x8616_width_word;
|
||||||
source[x8616_operand_segment_modrm].segment = C_(X8616_Segment, plex->sr_modrm);
|
source[x8616_operand_segment_modrm].segment = plex->sr_modrm;
|
||||||
|
|
||||||
source[x8616_operand_segment_opcode].flags = x8616_decoded_operand_segment;
|
source[x8616_operand_segment_opcode].flags = x8616_decoded_operand_segment;
|
||||||
source[x8616_operand_segment_opcode].width = x8616_width_word;
|
source[x8616_operand_segment_opcode].width = x8616_width_word;
|
||||||
source[x8616_operand_segment_opcode].segment = C_(X8616_Segment, plex->sr_opcode);
|
source[x8616_operand_segment_opcode].segment = plex->sr_opcode;
|
||||||
|
|
||||||
source[x8616_operand_acc].flags = x8616_decoded_operand_register | x8616_decoded_operand_implicit;
|
source[x8616_operand_acc].flags = x8616_decoded_operand_register | x8616_decoded_operand_implicit;
|
||||||
source[x8616_operand_acc].width = plex->width;
|
source[x8616_operand_acc].width = plex->width;
|
||||||
@@ -350,8 +361,8 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
source[x8616_operand_rm].flags = x8616_decoded_operand_memory;
|
source[x8616_operand_rm].flags = x8616_decoded_operand_memory;
|
||||||
source[x8616_operand_rm].mod = C_(X8616_Mod, plex->mod);
|
source[x8616_operand_rm].mod = plex->mod;
|
||||||
source[x8616_operand_rm].ea = C_(X8616_EA, plex->rm);
|
source[x8616_operand_rm].ea = plex->rm;
|
||||||
source[x8616_operand_rm].displacement = plex->displacement;
|
source[x8616_operand_rm].displacement = plex->displacement;
|
||||||
source[x8616_operand_rm].displacement_bytes = plex->displacement_bytes;
|
source[x8616_operand_rm].displacement_bytes = plex->displacement_bytes;
|
||||||
if (plex->direct_memory) {
|
if (plex->direct_memory) {
|
||||||
@@ -368,7 +379,7 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
|
|
||||||
source[x8616_operand_imm8].flags = x8616_decoded_operand_immediate;
|
source[x8616_operand_imm8].flags = x8616_decoded_operand_immediate;
|
||||||
source[x8616_operand_imm8].width = x8616_width_byte;
|
source[x8616_operand_imm8].width = x8616_width_byte;
|
||||||
source[x8616_operand_imm8].immediate = C_(U1, plex->payload_u16);
|
source[x8616_operand_imm8].immediate = u1_(plex->payload_u16);
|
||||||
source[x8616_operand_imm8].immediate_bytes = 1;
|
source[x8616_operand_imm8].immediate_bytes = 1;
|
||||||
|
|
||||||
source[x8616_operand_imm16].flags = x8616_decoded_operand_immediate;
|
source[x8616_operand_imm16].flags = x8616_decoded_operand_immediate;
|
||||||
@@ -382,12 +393,12 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
|
|
||||||
source[x8616_operand_rel8].flags = x8616_decoded_operand_relative;
|
source[x8616_operand_rel8].flags = x8616_decoded_operand_relative;
|
||||||
source[x8616_operand_rel8].width = x8616_width_byte;
|
source[x8616_operand_rel8].width = x8616_width_byte;
|
||||||
source[x8616_operand_rel8].displacement = C_(S2, C_(S1, plex->payload_u16));
|
source[x8616_operand_rel8].displacement = C_(S2, s1_(plex->payload_u16));
|
||||||
source[x8616_operand_rel8].displacement_bytes = 1;
|
source[x8616_operand_rel8].displacement_bytes = 1;
|
||||||
|
|
||||||
source[x8616_operand_rel16].flags = x8616_decoded_operand_relative;
|
source[x8616_operand_rel16].flags = x8616_decoded_operand_relative;
|
||||||
source[x8616_operand_rel16].width = x8616_width_word;
|
source[x8616_operand_rel16].width = x8616_width_word;
|
||||||
source[x8616_operand_rel16].displacement = C_(S2, plex->payload_u16);
|
source[x8616_operand_rel16].displacement = s2_(plex->payload_u16);
|
||||||
source[x8616_operand_rel16].displacement_bytes = 2;
|
source[x8616_operand_rel16].displacement_bytes = 2;
|
||||||
|
|
||||||
source[x8616_operand_far_ptr].flags = x8616_decoded_operand_far_ptr;
|
source[x8616_operand_far_ptr].flags = x8616_decoded_operand_far_ptr;
|
||||||
@@ -407,20 +418,40 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Final projection. Authored operand order is d=0; d=1 exchanges the two source slots without introducing a separate decoder path.
|
// Final projection. Authored operand order is d=0; d=1 exchanges the two source slots without introducing a separate decoder path.
|
||||||
U1 swap = C_(U1, ((plan->flags & x8616_plan_has_d) != 0) & plex->d);
|
U1 swap = C_(U1, ((plan->flags & x8616_plan_has_d) != 0) & u1_(plex->d));
|
||||||
plex->instruction.operands[swap] = source[plan->operands[0]];
|
plex->instruction.operands[swap] = source[plan->operands[0]];
|
||||||
plex->instruction.operands[swap ^ 1] = source[plan->operands[1]];
|
plex->instruction.operands[swap ^ 1] = source[plan->operands[1]];
|
||||||
|
|
||||||
plex->instruction.op = plan->op;
|
plex->instruction.op = plan->op;
|
||||||
|
if (plan->flags & x8616_plan_has_alu) {
|
||||||
|
plex->instruction.alu = plex->alu;
|
||||||
|
plex->instruction.op = x8616_op_from_alu[plex->alu];
|
||||||
|
}
|
||||||
|
if (plan->flags & x8616_plan_has_cc) {
|
||||||
|
plex->instruction.cc = plex->cc;
|
||||||
|
plex->instruction.op = x8616_op_from_cc[plex->cc];
|
||||||
|
}
|
||||||
|
if (plan->digit_kind != x8616_digit_none) {
|
||||||
|
U1 digit = u1_(plex->reg.r16);
|
||||||
|
if (plan->digit_kind == x8616_digit_alu) {
|
||||||
|
plex->alu = C_(X8616_ALU, digit);
|
||||||
|
plex->instruction.alu = plex->alu;
|
||||||
|
plex->instruction.op = x8616_op_from_alu[digit];
|
||||||
|
}
|
||||||
|
else if (plan->digit_kind == x8616_digit_shift) plex->instruction.op = x8616_op_from_shift[digit];
|
||||||
|
}
|
||||||
plex->instruction.flags = plan->encoding_flags;
|
plex->instruction.flags = plan->encoding_flags;
|
||||||
plex->instruction.decode_flags = (plex->encoding_invalid ? x8616_decode_invalid : 0) | (plex->classification_truncated ? x8616_decode_truncated : 0);
|
plex->instruction.decode_flags = (plex->encoding_invalid ? x8616_decode_invalid : 0) | (plex->classification_truncated ? x8616_decode_truncated : 0);
|
||||||
plex->instruction.width = plex->width;
|
plex->instruction.width = plex->width;
|
||||||
plex->instruction.prefixes = plex->prefixes;
|
plex->instruction.prefixes = plex->prefixes;
|
||||||
plex->instruction.operand_count = plan->operand_count;
|
plex->instruction.operand_count = plan->operand_count;
|
||||||
plex->instruction.opcode = x8616_decode_opcode(plan, plex->opcode);
|
plex->instruction.opcode = x8616_decode_opcode(plan, plex->header);
|
||||||
plex->instruction.d = C_(X8616_Direction, (plan->flags & x8616_plan_has_d) ? plex->d : 0);
|
plex->instruction.d = (plan->flags & x8616_plan_has_d) ? plex->d : x8616_d_rm_dst;
|
||||||
plex->instruction.w = C_(X8616_Width, (plan->flags & x8616_plan_has_w) ? plex->w : 0);
|
plex->instruction.w = (plan->flags & x8616_plan_has_w) ? plex->w : x8616_w_byte;
|
||||||
plex->instruction.has_mod_rm = (plan->flags & x8616_plan_has_modrm) != 0;
|
plex->instruction.has_mod_rm = (plan->flags & x8616_plan_has_modrm) != 0;
|
||||||
|
plex->instruction.header = plex->header;
|
||||||
|
plex->instruction.mod_rm = plex->mod_rm;
|
||||||
|
plex->instruction.post_opcode = plex->post_opcode;
|
||||||
|
|
||||||
U4 total_required = prefix_at + plex->body_required;
|
U4 total_required = prefix_at + plex->body_required;
|
||||||
U4 total_available = plex->source_size;
|
U4 total_available = plex->source_size;
|
||||||
@@ -435,27 +466,28 @@ x8616_decode_one_plex(X8616_DecodePlex* plex)
|
|||||||
X8616_DecodeInfo x8616_decode(X8616_DecodeRequest request)
|
X8616_DecodeInfo x8616_decode(X8616_DecodeRequest request)
|
||||||
{
|
{
|
||||||
X8616_DecodeInfo result = {0};
|
X8616_DecodeInfo result = {0};
|
||||||
result.instruction_capacity = request.instruction_capacity;
|
result.instruction_cap = request.instruction_cap;
|
||||||
|
|
||||||
while (result.source_consumed < request.source_size && result.instruction_count < request.instruction_capacity) {
|
while (result.source_consumed < request.source_len && result.instruction_count < request.instruction_cap) {
|
||||||
X8616_DecodePlex plex = {0};
|
X8616_DecodePlex plex = {0};
|
||||||
plex.source = request.source + result.source_consumed;
|
plex.source = request.source + result.source_consumed;
|
||||||
plex.source_size = request.source_size - result.source_consumed;
|
plex.source_size = request.source_len - result.source_consumed;
|
||||||
plex.source_offset = result.source_consumed;
|
plex.source_offset = result.source_consumed;
|
||||||
plex.info_arena = request.info_arena;
|
plex.info_arena = request.info_arena;
|
||||||
plex.msgs = & result.msgs;
|
plex.msgs = & result.msgs;
|
||||||
U4 consumed = x8616_decode_one_plex(& plex);
|
U4 consumed = x8616_decode_one_plex(& plex);
|
||||||
request.instructions[result.instruction_count++] = plex.instruction;
|
request.out_instructions[result.instruction_count] = plex.instruction;
|
||||||
|
result.instruction_count += 1;
|
||||||
if (consumed == false) consumed = 1;
|
if (consumed == false) consumed = 1;
|
||||||
result.source_consumed += consumed;
|
result.source_consumed += consumed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.source_consumed < request.source_size && result.instruction_count == request.instruction_capacity) {
|
if (result.source_consumed < request.source_len && result.instruction_count == request.instruction_cap) {
|
||||||
x8616_info_push(request.info_arena, & result.msgs, x8616_info_warning
|
x8616_info_push(request.info_arena, & result.msgs, x8616_info_warning
|
||||||
, x8616_info_output_full
|
, x8616_info_output_full
|
||||||
, result.source_consumed
|
, result.source_consumed
|
||||||
, 0
|
, 0
|
||||||
, request.instruction_capacity
|
, request.instruction_cap
|
||||||
, result.instruction_count
|
, result.instruction_count
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-13
@@ -67,12 +67,16 @@ typedef Struct_(X8616_DecodedInstruction) {
|
|||||||
X8616_DecodeFlags decode_flags;
|
X8616_DecodeFlags decode_flags;
|
||||||
X8616_WidthMode width;
|
X8616_WidthMode width;
|
||||||
X8616_DecodedPrefixes prefixes;
|
X8616_DecodedPrefixes prefixes;
|
||||||
X8616_DecodedOperand operands[2];
|
X8616_DecodedOperand operands[2]; U1 operand_count;
|
||||||
U1 operand_count;
|
X8616_Opcode opcode;
|
||||||
X8616_OpcodePrefix opcode;
|
X8616_Direction d;
|
||||||
X8616_Direction d;
|
X8616_Width w;
|
||||||
X8616_Width w;
|
X8616_ALU alu;
|
||||||
|
X8616_Condition cc;
|
||||||
B1 has_mod_rm;
|
B1 has_mod_rm;
|
||||||
|
U1 header;
|
||||||
|
U1 mod_rm;
|
||||||
|
U1 post_opcode;
|
||||||
U1 size;
|
U1 size;
|
||||||
U1 size_required;
|
U1 size_required;
|
||||||
};
|
};
|
||||||
@@ -90,6 +94,8 @@ typedef Enum_(U2, X8616_DecodePlanFlags) {
|
|||||||
Bit_(x8616_plan_has_sr, 9),
|
Bit_(x8616_plan_has_sr, 9),
|
||||||
Bit_(x8616_plan_uses_rm, 10),
|
Bit_(x8616_plan_uses_rm, 10),
|
||||||
Bit_(x8616_plan_is_prefix, 11),
|
Bit_(x8616_plan_is_prefix, 11),
|
||||||
|
Bit_(x8616_plan_has_alu, 12),
|
||||||
|
Bit_(x8616_plan_has_cc, 13),
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_DecodePayload) {
|
typedef Enum_(U1, X8616_DecodePayload) {
|
||||||
@@ -133,6 +139,10 @@ typedef Struct_(X8616_DecodePlan) {
|
|||||||
|
|
||||||
X8616_BytePattern mod_rm;
|
X8616_BytePattern mod_rm;
|
||||||
X8616_BytePattern post_opcode;
|
X8616_BytePattern post_opcode;
|
||||||
|
|
||||||
|
U1 alu_shift;
|
||||||
|
U1 cc_shift;
|
||||||
|
X8616_DigitKind digit_kind;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -142,20 +152,18 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
typedef Struct_(X8616_DecodeRequest) {
|
typedef Struct_(X8616_DecodeRequest) {
|
||||||
U1* source;
|
U1* source;
|
||||||
U4 source_size;
|
X8616_DecodedInstruction* out_instructions;
|
||||||
|
U4 source_len;
|
||||||
X8616_DecodedInstruction* instructions;
|
U4 instruction_cap;
|
||||||
U4 instruction_capacity;
|
|
||||||
|
|
||||||
FArena* info_arena;
|
FArena* info_arena;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Struct_(X8616_DecodeInfo) {
|
typedef Struct_(X8616_DecodeInfo) {
|
||||||
|
X8616_InfoList msgs;
|
||||||
U4 source_consumed;
|
U4 source_consumed;
|
||||||
U4 instruction_count;
|
U4 instruction_count;
|
||||||
U4 instruction_capacity;
|
U4 instruction_cap;
|
||||||
X8616_InfoList msgs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
X8616_DecodeInfo x8616_decode(X8616_DecodeRequest request);
|
X8616_DecodeInfo x8616_decode(X8616_DecodeRequest request);
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ typedef Struct_(X8616_DecodeGen) {
|
|||||||
U1 aux[X8616_DECODE_GEN_MAX_AUX];
|
U1 aux[X8616_DECODE_GEN_MAX_AUX];
|
||||||
|
|
||||||
U4 aux_count;
|
U4 aux_count;
|
||||||
U4 ambiguous_opcode_count;
|
U4 ambiguous_header_count;
|
||||||
U4 verified_count;
|
U4 verified_count;
|
||||||
|
|
||||||
X8616_InfoList msgs;
|
X8616_InfoList msgs;
|
||||||
@@ -35,7 +35,7 @@ typedef Struct_(X8616_DecodeGen) {
|
|||||||
typedef Struct_(X8616_DecodeGenInfo) {
|
typedef Struct_(X8616_DecodeGenInfo) {
|
||||||
U4 plan_count;
|
U4 plan_count;
|
||||||
U4 aux_count;
|
U4 aux_count;
|
||||||
U4 ambiguous_opcode_count;
|
U4 ambiguous_header_count;
|
||||||
U4 verified_count;
|
U4 verified_count;
|
||||||
|
|
||||||
X8616_InfoList msgs;
|
X8616_InfoList msgs;
|
||||||
@@ -97,6 +97,9 @@ x8616_decode_gen_plan(X8616_Encoding_R encoding, U4 encoding_idx, X8616_InfoList
|
|||||||
if (encoding->fields.z.width) { plan.flags |= x8616_plan_has_z; plan.z_shift = encoding->fields.z.shift; }
|
if (encoding->fields.z.width) { plan.flags |= x8616_plan_has_z; plan.z_shift = encoding->fields.z.shift; }
|
||||||
if (encoding->fields.reg.width) { plan.flags |= x8616_plan_has_reg; plan.reg_shift = encoding->fields.reg.shift; }
|
if (encoding->fields.reg.width) { plan.flags |= x8616_plan_has_reg; plan.reg_shift = encoding->fields.reg.shift; }
|
||||||
if (encoding->fields.sr.width) { plan.flags |= x8616_plan_has_sr; plan.sr_shift = encoding->fields.sr.shift; }
|
if (encoding->fields.sr.width) { plan.flags |= x8616_plan_has_sr; plan.sr_shift = encoding->fields.sr.shift; }
|
||||||
|
if (encoding->fields.alu.width) { plan.flags |= x8616_plan_has_alu; plan.alu_shift = encoding->fields.alu.shift; }
|
||||||
|
if (encoding->fields.cc.width) { plan.flags |= x8616_plan_has_cc; plan.cc_shift = encoding->fields.cc.shift; }
|
||||||
|
plan.digit_kind = encoding->digit_kind;
|
||||||
|
|
||||||
if (x8616_decode_gen_operand_uses_rm(encoding->operands[0]) || x8616_decode_gen_operand_uses_rm(encoding->operands[1]))
|
if (x8616_decode_gen_operand_uses_rm(encoding->operands[0]) || x8616_decode_gen_operand_uses_rm(encoding->operands[1]))
|
||||||
plan.flags |= x8616_plan_uses_rm;
|
plan.flags |= x8616_plan_uses_rm;
|
||||||
@@ -140,8 +143,8 @@ x8616_decode_gen_plan(X8616_Encoding_R encoding, U4 encoding_idx, X8616_InfoList
|
|||||||
return plan;
|
return plan;
|
||||||
}
|
}
|
||||||
|
|
||||||
FI_ B4 x8616_decode_gen_encoding_matches_opcode(X8616_Encoding_R encoding, U1 opcode) {
|
FI_ B4 x8616_decode_gen_encoding_matches_header(X8616_Encoding_R encoding, U1 header) {
|
||||||
return (opcode & encoding->opcode.mask) == encoding->opcode.bits;
|
return (header & encoding->header.mask) == encoding->header.bits;
|
||||||
}
|
}
|
||||||
|
|
||||||
FI_ B4 x8616_decode_gen_plan_matches_second(X8616_DecodePlan_R plan, U1 byte) {
|
FI_ B4 x8616_decode_gen_plan_matches_second(X8616_DecodePlan_R plan, U1 byte) {
|
||||||
@@ -158,22 +161,22 @@ internal void x8616_decode_gen_pass_plans(X8616_DecodeGen* gen, FArena_R info_sc
|
|||||||
internal void
|
internal void
|
||||||
x8616_decode_gen_pass_dispatch(X8616_DecodeGen* gen, FArena_R info_scratch)
|
x8616_decode_gen_pass_dispatch(X8616_DecodeGen* gen, FArena_R info_scratch)
|
||||||
{
|
{
|
||||||
for (U4 opcode = 0; opcode < 256; ++ opcode)
|
for (U4 header = 0; header < 256; ++ header)
|
||||||
{
|
{
|
||||||
U1 candidates[X8616_ENCODING_COUNT];
|
U1 candidates[X8616_ENCODING_COUNT];
|
||||||
U4 candidate_count = 0;
|
U4 candidate_count = 0;
|
||||||
|
|
||||||
for (U4 encoding_idx = 0; encoding_idx < X8616_ENCODING_COUNT; ++ encoding_idx)
|
for (U4 encoding_idx = 0; encoding_idx < X8616_ENCODING_COUNT; ++ encoding_idx)
|
||||||
if (x8616_decode_gen_encoding_matches_opcode(x8616_encodings + encoding_idx, C_(U1, opcode)))
|
if (x8616_decode_gen_encoding_matches_header(x8616_encodings + encoding_idx, C_(U1, header)))
|
||||||
candidates[candidate_count ++] = C_(U1, encoding_idx + 1);
|
candidates[candidate_count ++] = C_(U1, encoding_idx + 1);
|
||||||
|
|
||||||
if (candidate_count == 0) continue;
|
if (candidate_count == 0) continue;
|
||||||
if (candidate_count == 1) { gen->dispatch[opcode] = candidates[0]; continue; }
|
if (candidate_count == 1) { gen->dispatch[header] = candidates[0]; continue; }
|
||||||
|
|
||||||
if (gen->aux_count + 256 > X8616_DECODE_GEN_MAX_AUX) {
|
if (gen->aux_count + 256 > X8616_DECODE_GEN_MAX_AUX) {
|
||||||
x8616_info_push(info_scratch, & gen->msgs, x8616_info_error
|
x8616_info_push(info_scratch, & gen->msgs, x8616_info_error
|
||||||
, x8616_info_gen_aux_cap_exceeded
|
, x8616_info_gen_aux_cap_exceeded
|
||||||
, opcode
|
, header
|
||||||
, 0
|
, 0
|
||||||
, X8616_DECODE_GEN_MAX_AUX
|
, X8616_DECODE_GEN_MAX_AUX
|
||||||
, gen->aux_count + 256
|
, gen->aux_count + 256
|
||||||
@@ -182,9 +185,9 @@ x8616_decode_gen_pass_dispatch(X8616_DecodeGen* gen, FArena_R info_scratch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
U4 base = gen->aux_count;
|
U4 base = gen->aux_count;
|
||||||
gen->dispatch[opcode] = C_(U2, X8616_DECODE_AUX_BIT | base);
|
gen->dispatch[header] = C_(U2, X8616_DECODE_AUX_BIT | base);
|
||||||
gen->aux_count += 256;
|
gen->aux_count += 256;
|
||||||
gen->ambiguous_opcode_count += 1;
|
gen->ambiguous_header_count += 1;
|
||||||
|
|
||||||
for (U4 second = 0; second < 256; ++ second)
|
for (U4 second = 0; second < 256; ++ second)
|
||||||
{
|
{
|
||||||
@@ -197,7 +200,7 @@ x8616_decode_gen_pass_dispatch(X8616_DecodeGen* gen, FArena_R info_scratch)
|
|||||||
|
|
||||||
if (selected) x8616_info_push(info_scratch, & gen->msgs, x8616_info_error
|
if (selected) x8616_info_push(info_scratch, & gen->msgs, x8616_info_error
|
||||||
, x8616_info_gen_ambiguous_decode
|
, x8616_info_gen_ambiguous_decode
|
||||||
, (opcode << 8) | second
|
, (header << 8) | second
|
||||||
, 0
|
, 0
|
||||||
, selected
|
, selected
|
||||||
, plan_idx
|
, plan_idx
|
||||||
@@ -213,27 +216,27 @@ x8616_decode_gen_pass_dispatch(X8616_DecodeGen* gen, FArena_R info_scratch)
|
|||||||
internal void
|
internal void
|
||||||
x8616_decode_gen_pass_validate(X8616_DecodeGen_R gen, FArena_R info_scratch)
|
x8616_decode_gen_pass_validate(X8616_DecodeGen_R gen, FArena_R info_scratch)
|
||||||
{
|
{
|
||||||
for (U4 opcode = 0; opcode < 256; ++ opcode)
|
for (U4 header = 0; header < 256; ++ header)
|
||||||
for (U4 second = 0; second < 256; ++ second)
|
for (U4 second = 0; second < 256; ++ second)
|
||||||
{
|
{
|
||||||
U1 expected = 0;
|
U1 expected = 0;
|
||||||
for (U4 encoding_idx = 0; encoding_idx < X8616_ENCODING_COUNT; ++ encoding_idx)
|
for (U4 encoding_idx = 0; encoding_idx < X8616_ENCODING_COUNT; ++ encoding_idx)
|
||||||
{
|
{
|
||||||
X8616_Encoding_R encoding = x8616_encodings + encoding_idx;
|
X8616_Encoding_R encoding = x8616_encodings + encoding_idx;
|
||||||
if (x8616_decode_gen_encoding_matches_opcode(encoding, C_(U1, opcode)) == false) continue;
|
if (x8616_decode_gen_encoding_matches_header(encoding, C_(U1, header)) == false) continue;
|
||||||
|
|
||||||
X8616_DecodePlan_R plan = gen->plans + encoding_idx + 1;
|
X8616_DecodePlan_R plan = gen->plans + encoding_idx + 1;
|
||||||
if (x8616_decode_gen_plan_matches_second(plan, C_(U1, second)) == false) continue;
|
if (x8616_decode_gen_plan_matches_second(plan, C_(U1, second)) == false) continue;
|
||||||
|
|
||||||
if (expected) x8616_info_push(info_scratch, & gen->msgs, x8616_info_error
|
if (expected) x8616_info_push(info_scratch, & gen->msgs, x8616_info_error
|
||||||
, x8616_info_gen_ambiguous_decode
|
, x8616_info_gen_ambiguous_decode
|
||||||
, (opcode << 8) | second, 0
|
, (header << 8) | second, 0
|
||||||
, expected, encoding_idx + 1
|
, expected, encoding_idx + 1
|
||||||
);
|
);
|
||||||
expected = C_(U1, encoding_idx + 1);
|
expected = C_(U1, encoding_idx + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
U2 dispatch = gen->dispatch[opcode];
|
U2 dispatch = gen->dispatch[header];
|
||||||
U1 actual = 0;
|
U1 actual = 0;
|
||||||
|
|
||||||
if (dispatch & X8616_DECODE_AUX_BIT) {
|
if (dispatch & X8616_DECODE_AUX_BIT) {
|
||||||
@@ -248,7 +251,7 @@ x8616_decode_gen_pass_validate(X8616_DecodeGen_R gen, FArena_R info_scratch)
|
|||||||
|
|
||||||
if (actual != expected) x8616_info_push(info_scratch, & gen->msgs, x8616_info_error
|
if (actual != expected) x8616_info_push(info_scratch, & gen->msgs, x8616_info_error
|
||||||
, x8616_info_gen_dispatch_mismatch
|
, x8616_info_gen_dispatch_mismatch
|
||||||
, (opcode << 8) | second, 0
|
, (header << 8) | second, 0
|
||||||
, expected, actual
|
, expected, actual
|
||||||
);
|
);
|
||||||
++ gen->verified_count;
|
++ gen->verified_count;
|
||||||
@@ -265,7 +268,7 @@ x8616_decode_table_generate(X8616_DecodeGen* gen, FArena_R info_scratch) {
|
|||||||
X8616_DecodeGenInfo result = {
|
X8616_DecodeGenInfo result = {
|
||||||
.plan_count = X8616_ENCODING_COUNT + 1,
|
.plan_count = X8616_ENCODING_COUNT + 1,
|
||||||
.aux_count = gen->aux_count,
|
.aux_count = gen->aux_count,
|
||||||
.ambiguous_opcode_count = gen->ambiguous_opcode_count,
|
.ambiguous_header_count = gen->ambiguous_header_count,
|
||||||
.verified_count = gen->verified_count,
|
.verified_count = gen->verified_count,
|
||||||
.msgs = gen->msgs,
|
.msgs = gen->msgs,
|
||||||
};
|
};
|
||||||
@@ -328,7 +331,8 @@ x8616_decode_gen_emit_plan(Str8Gen_R out, X8616_DecodePlan_R plan) { defer_rewin
|
|||||||
<payload>, <prefix_kind>,
|
<payload>, <prefix_kind>,
|
||||||
<d_shift>, <w_shift>, <s_shift>, <v_shift>, <z_shift>, <reg_shift>, <sr_shift>,
|
<d_shift>, <w_shift>, <s_shift>, <v_shift>, <z_shift>, <reg_shift>, <sr_shift>,
|
||||||
{<mod_rm.bits>, <mod_rm.mask>},
|
{<mod_rm.bits>, <mod_rm.mask>},
|
||||||
{<post_opcode.bits>, <post_opcode.mask>},
|
{<post_opcode.bits>, <post_opcode.mask>},
|
||||||
|
<alu_shift>, <cc_shift>, <digit_kind>,
|
||||||
},\n
|
},\n
|
||||||
);
|
);
|
||||||
KTL_Slot_Str8 tbl[] = {
|
KTL_Slot_Str8 tbl[] = {
|
||||||
@@ -352,6 +356,9 @@ x8616_decode_gen_emit_plan(Str8Gen_R out, X8616_DecodePlan_R plan) { defer_rewin
|
|||||||
entry("mod_rm.mask", hex_u1(plan->mod_rm.mask)),
|
entry("mod_rm.mask", hex_u1(plan->mod_rm.mask)),
|
||||||
entry("post_opcode.bits", hex_u1(plan->post_opcode.bits)),
|
entry("post_opcode.bits", hex_u1(plan->post_opcode.bits)),
|
||||||
entry("post_opcode.mask", hex_u1(plan->post_opcode.mask)),
|
entry("post_opcode.mask", hex_u1(plan->post_opcode.mask)),
|
||||||
|
entry("alu_shift", dec(plan->alu_shift)),
|
||||||
|
entry("cc_shift", dec(plan->cc_shift)),
|
||||||
|
entry("digit_kind", dec(plan->digit_kind)),
|
||||||
};
|
};
|
||||||
str8gen_append_fmt(out, template, ktl_str8_from_arr(tbl));
|
str8gen_append_fmt(out, template, ktl_str8_from_arr(tbl));
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -0,0 +1,318 @@
|
|||||||
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
|
# include "encode.h"
|
||||||
|
# include "encoder_table.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
internal void
|
||||||
|
x8616_encode_push(FArena_R arena, X8616_InfoList_R msgs, X8616_EncodeStatus status, U4 id, U2 size, U4 expected, U4 actual) {
|
||||||
|
if (status == x8616_encode_ok || arena == 0) return;
|
||||||
|
X8616_InfoKind kind = x8616_info_error;
|
||||||
|
X8616_InfoCode code = x8616_info_encode_invalid_record;
|
||||||
|
if (status == x8616_encode_output_full) code = x8616_info_encode_output_full;
|
||||||
|
else if (status == x8616_encode_bad_request) code = x8616_info_encode_bad_request;
|
||||||
|
x8616_info_push(arena, msgs, kind, code, id, size, expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ void x8616_encode_buf_u1(U1_R buf, U1_R n, U1 value) { buf[n[0]] = value; n[0] += 1; }
|
||||||
|
FI_ void x8616_encode_buf_u2(U1_R buf, U1_R n, U2 value) {
|
||||||
|
x8616_encode_buf_u1(buf, n, u1_(value));
|
||||||
|
x8616_encode_buf_u1(buf, n, u1_(value >> 8));
|
||||||
|
}
|
||||||
|
FI_ void x8616_encode_buf_disp(U1_R buf, U1_R n, S2 value, U1 bytes) {
|
||||||
|
if (bytes == 1) x8616_encode_buf_u1(buf, n, u1_(value));
|
||||||
|
if (bytes == 2) x8616_encode_buf_u2(buf, n, u2_(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
I_ B4 x8616_encode_is_alu (X8616_Op op) { return op >= x8616_op_add && op <= x8616_op_cmp; }
|
||||||
|
I_ B4 x8616_encode_is_shift (X8616_Op op) { return op >= x8616_op_shl && op <= x8616_op_rcr; }
|
||||||
|
I_ B4 x8616_encode_is_jcc (X8616_Op op) { return op >= x8616_op_je && op <= x8616_op_jns; }
|
||||||
|
I_ U1 x8616_encode_alu_from_op(X8616_Op op) { return u1_(op - x8616_op_add); }
|
||||||
|
I_ U1 x8616_encode_cc_from_op (X8616_Op op) {
|
||||||
|
for (U1 i = 0; i < Array_len(x8616_op_from_cc); ++i) if (x8616_op_from_cc[i] == op) return i;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
I_ U1 x8616_encode_shift_from_op(X8616_Op op) {
|
||||||
|
for (U1 i = 0; i < Array_len(x8616_op_from_shift); ++i) if (x8616_op_from_shift[i] == op) return i;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
I_ void x8616_encode_or_field(U1_R header, X8616_BitField f, U1 value) {
|
||||||
|
header[0] |= (value << f.shift) & x8616_field_mask(f.shift, f.width);
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ U1 x8616_encode_prefix_count(X8616_DecodedInstruction_R inst) {
|
||||||
|
return u1_(inst->prefixes.lock) + u1_(inst->prefixes.has_repeat) + u1_(inst->prefixes.has_segment);
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ B4 x8616_encode_is_acc(X8616_DecodedOperand_R op) {
|
||||||
|
if ((op->flags & x8616_decoded_operand_register) == 0) return 0;
|
||||||
|
if (op->width == x8616_width_byte) return op->reg.r8 == x8616_al;
|
||||||
|
return op->reg.r16 == x8616_ax;
|
||||||
|
}
|
||||||
|
|
||||||
|
RO_ global U2 x8616_encode_slot_any[] = {
|
||||||
|
[x8616_operand_none] = 0,
|
||||||
|
[x8616_operand_rm] = x8616_decoded_operand_register | x8616_decoded_operand_memory,
|
||||||
|
[x8616_operand_reg_modrm] = x8616_decoded_operand_register,
|
||||||
|
[x8616_operand_reg_opcode] = x8616_decoded_operand_register,
|
||||||
|
[x8616_operand_segment_modrm] = x8616_decoded_operand_segment,
|
||||||
|
[x8616_operand_segment_opcode] = x8616_decoded_operand_segment,
|
||||||
|
[x8616_operand_acc] = x8616_decoded_operand_register,
|
||||||
|
[x8616_operand_imm] = x8616_decoded_operand_immediate,
|
||||||
|
[x8616_operand_imm8] = x8616_decoded_operand_immediate,
|
||||||
|
[x8616_operand_imm16] = x8616_decoded_operand_immediate,
|
||||||
|
[x8616_operand_mem_direct] = x8616_decoded_operand_memory,
|
||||||
|
[x8616_operand_rel8] = x8616_decoded_operand_relative,
|
||||||
|
[x8616_operand_rel16] = x8616_decoded_operand_relative,
|
||||||
|
[x8616_operand_far_ptr] = x8616_decoded_operand_far_ptr,
|
||||||
|
[x8616_operand_dx] = x8616_decoded_operand_register,
|
||||||
|
[x8616_operand_shift_count] = x8616_decoded_operand_register | x8616_decoded_operand_immediate,
|
||||||
|
};
|
||||||
|
|
||||||
|
I_ B4 x8616_encode_slot_match(X8616_Operand slot, X8616_DecodedOperand_R op, X8616_DecodedInstruction_R inst) {
|
||||||
|
B4 ok = (op->flags & x8616_encode_slot_any[slot]) != 0;
|
||||||
|
ok &= (slot != x8616_operand_acc) || x8616_encode_is_acc(op);
|
||||||
|
ok &= (slot != x8616_operand_dx) || (op->reg.r16 == x8616_dx);
|
||||||
|
ok &= (slot != x8616_operand_imm8) || (op->immediate <= 0xFF);
|
||||||
|
ok &= (slot != x8616_operand_mem_direct) || ((op->flags & x8616_decoded_operand_direct) != 0);
|
||||||
|
ok &= (slot != x8616_operand_shift_count) || ((op->flags & x8616_decoded_operand_register) && op->reg.r8 == x8616_cl) || (op->immediate == 1);
|
||||||
|
if (slot == x8616_operand_rel8 && ok) {
|
||||||
|
S2 machine = s2_(op->displacement - s2_(x8616_encode_prefix_count(inst) + 2));
|
||||||
|
ok = machine >= -128 && machine <= 127;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ U1 x8616_encode_enc_count(X8616_Encoding_R enc) { return u1_(enc->operands[0] != x8616_operand_none) + u1_(enc->operands[1] != x8616_operand_none); }
|
||||||
|
|
||||||
|
I_ B4 x8616_encode_op_match(X8616_Encoding_R enc, X8616_Op op) {
|
||||||
|
B4 prefix = (enc->flags & x8616_encoding_prefix) != 0;
|
||||||
|
B4 exact = enc->op == op;
|
||||||
|
B4 family = enc->op == x8616_op_invalid;
|
||||||
|
B4 alu = family && (enc->fields.alu.width || enc->digit_kind == x8616_digit_alu) && x8616_encode_is_alu(op);
|
||||||
|
B4 cc = family && enc->fields.cc.width && x8616_encode_is_jcc(op);
|
||||||
|
B4 shift = family && enc->digit_kind == x8616_digit_shift && x8616_encode_is_shift(op);
|
||||||
|
return prefix == 0 && (exact || alu || cc || shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
I_ B4 x8616_encode_row_match(X8616_Encoding_R enc, X8616_DecodedInstruction_R inst, U1 d) {
|
||||||
|
B4 op_ok = x8616_encode_op_match(enc, inst->op);
|
||||||
|
B4 enc_far = (enc->flags & x8616_encoding_far) != 0;
|
||||||
|
B4 inst_far = (inst->flags & x8616_encoding_far) != 0;
|
||||||
|
inst_far |= (inst->operands[0].flags & x8616_decoded_operand_far_ptr) != 0;
|
||||||
|
inst_far |= (inst->operands[1].flags & x8616_decoded_operand_far_ptr) != 0;
|
||||||
|
B4 far_ok = enc_far == inst_far;
|
||||||
|
B4 width_any = enc->width == x8616_width_dynamic || inst->width == x8616_width_dynamic;
|
||||||
|
B4 width_ok = width_any || enc->width == inst->width;
|
||||||
|
B4 count_ok = x8616_encode_enc_count(enc) == inst->operand_count;
|
||||||
|
B4 d_ok = enc->fields.d.width || d == 0;
|
||||||
|
B4 slots_ok = 1;
|
||||||
|
for (U1 i = 0; i < inst->operand_count; ++i) {
|
||||||
|
U1 slot_i = d ? (i ^ 1) : i;
|
||||||
|
slots_ok &= x8616_encode_slot_match(enc->operands[slot_i], inst->operands + i, inst);
|
||||||
|
}
|
||||||
|
return op_ok && far_ok && width_ok && count_ok && d_ok && slots_ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ U1 x8616_encode_row_score(X8616_Encoding const* enc) {
|
||||||
|
U1 score = 0;
|
||||||
|
for (U1 i = 0; i < 2; ++i) {
|
||||||
|
X8616_Operand s = enc->operands[i];
|
||||||
|
if (s == x8616_operand_reg_opcode || s == x8616_operand_acc || s == x8616_operand_mem_direct) score += 2;
|
||||||
|
if (s == x8616_operand_rel8 || s == x8616_operand_imm8) score += 1;
|
||||||
|
}
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
|
||||||
|
I_ B4 x8616_encode_slot_modrm(X8616_Operand s) { return s == x8616_operand_rm || s == x8616_operand_reg_modrm || s == x8616_operand_segment_modrm; }
|
||||||
|
I_ B4 x8616_encode_needs_modrm(X8616_Encoding const* enc) {
|
||||||
|
B4 masked = enc->mod_rm.mask != 0;
|
||||||
|
B4 digit = enc->digit_kind != x8616_digit_none;
|
||||||
|
B4 slots = x8616_encode_slot_modrm(enc->operands[0]) || x8616_encode_slot_modrm(enc->operands[1]);
|
||||||
|
return masked || digit || slots;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal B4
|
||||||
|
x8616_encode_assemble(X8616_DecodedInstruction_R inst)
|
||||||
|
{
|
||||||
|
X8616_Encoding const* best = 0;
|
||||||
|
U1 best_d = 0;
|
||||||
|
U1 best_score = 0;
|
||||||
|
B4 found = 0;
|
||||||
|
for (U4 id = 0; id < Array_len(x8616_encodings); ++id)
|
||||||
|
{
|
||||||
|
X8616_Encoding_R enc = x8616_encodings + id;
|
||||||
|
U1 d_hi = enc->fields.d.width ? 1 : 0;
|
||||||
|
for (U1 d = 0; d <= d_hi; ++d) {
|
||||||
|
if (x8616_encode_row_match(enc, inst, d) == 0) continue;
|
||||||
|
U1 score = x8616_encode_row_score(enc);
|
||||||
|
B4 not_bested = found && (score < best_score || (score == best_score && d < best_d));
|
||||||
|
if (not_bested) continue;
|
||||||
|
best = enc; best_d = d; best_score = score; found = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found == 0) return 0;
|
||||||
|
|
||||||
|
X8616_DecodedOperand_R slot[X8616_OPERAND_SOURCE_COUNT] = {0};
|
||||||
|
for (U1 op_id = 0; op_id < inst->operand_count; ++op_id) {
|
||||||
|
U1 slot_id = best_d ? (op_id ^ 1) : op_id;
|
||||||
|
slot[best->operands[slot_id]] = inst->operands + op_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
X8616_DecodedOperand_R operand_acc = slot[x8616_operand_acc];
|
||||||
|
X8616_Width w = inst->width == x8616_width_word ? x8616_w_word : x8616_w_byte;
|
||||||
|
if (operand_acc) w = operand_acc->width == x8616_width_word ? x8616_w_word : x8616_w_byte;
|
||||||
|
|
||||||
|
U1 header = best->header.bits;
|
||||||
|
X8616_DecodedOperand_R sc = slot[x8616_operand_shift_count];
|
||||||
|
X8616_DecodedOperand_R imm = slot[x8616_operand_imm];
|
||||||
|
if (imm == 0) imm = slot[x8616_operand_imm8];
|
||||||
|
if (imm == 0) imm = slot[x8616_operand_imm16];
|
||||||
|
U1 s = 0;
|
||||||
|
if (best->fields.s.width && imm) {
|
||||||
|
s = (inst->width == x8616_width_word && imm->immediate_bytes <= 1) || (imm->flags & x8616_decoded_operand_sign_extended);
|
||||||
|
}
|
||||||
|
U1 v = sc && (sc->flags & x8616_decoded_operand_register);
|
||||||
|
U1 reg_op = slot[x8616_operand_reg_opcode] ? u1_(slot[x8616_operand_reg_opcode ]->reg.r16) : 0;
|
||||||
|
U1 sr_op = slot[x8616_operand_segment_opcode] ? u1_(slot[x8616_operand_segment_opcode]->segment) : 0;
|
||||||
|
x8616_encode_or_field(& header, best->fields.w, u1_(w));
|
||||||
|
x8616_encode_or_field(& header, best->fields.d, best_d);
|
||||||
|
x8616_encode_or_field(& header, best->fields.alu, x8616_encode_alu_from_op(inst->op));
|
||||||
|
x8616_encode_or_field(& header, best->fields.cc, x8616_encode_cc_from_op(inst->op));
|
||||||
|
x8616_encode_or_field(& header, best->fields.reg, reg_op);
|
||||||
|
x8616_encode_or_field(& header, best->fields.sr, sr_op);
|
||||||
|
x8616_encode_or_field(& header, best->fields.v, v);
|
||||||
|
x8616_encode_or_field(& header, best->fields.s, s);
|
||||||
|
header = (header & ~best->header.mask) | (best->header.bits & best->header.mask);
|
||||||
|
if (sc && (sc->flags & x8616_decoded_operand_immediate) && sc->immediate == 1) sc->immediate_bytes = 0;
|
||||||
|
|
||||||
|
U1 modrm = 0;
|
||||||
|
B4 has_modrm = x8616_encode_needs_modrm(best);
|
||||||
|
X8616_DecodedOperand_R rm_op = slot[x8616_operand_rm];
|
||||||
|
U1 mod = x8616_mod_reg;
|
||||||
|
U1 rm = 0;
|
||||||
|
if (rm_op) {
|
||||||
|
B4 mem = (rm_op->flags & x8616_decoded_operand_memory) != 0;
|
||||||
|
B4 dir = (rm_op->flags & x8616_decoded_operand_direct) != 0;
|
||||||
|
B4 bp0 = mem && dir == 0 && rm_op->displacement_bytes == 0 && rm_op->ea == x8616_ea_bp;
|
||||||
|
if (bp0) { rm_op->displacement_bytes = 1; rm_op->displacement = 0; }
|
||||||
|
U1 db = rm_op->displacement_bytes;
|
||||||
|
mod = mem ? (dir ? x8616_mod_mem : (db > 2 ? 2 : db)) : x8616_mod_reg;
|
||||||
|
rm = dir ? u1_(x8616_ea_direct) : (mem ? u1_(rm_op->ea) : u1_(rm_op->reg.r16));
|
||||||
|
}
|
||||||
|
U1 kind_digit[3] = { 0, x8616_encode_alu_from_op(inst->op), x8616_encode_shift_from_op(inst->op) };
|
||||||
|
U1 reg = slot[x8616_operand_reg_modrm] ? u1_(slot[x8616_operand_reg_modrm]->reg.r16) : 0;
|
||||||
|
if (best->digit_kind) reg = kind_digit[best->digit_kind];
|
||||||
|
X8616_DecodedOperand_R sr_m = slot[x8616_operand_segment_modrm];
|
||||||
|
modrm = sr_m ? x8616_enc_modrm_seg(mod, sr_m->segment, rm) : x8616_enc_modrm(mod, reg, rm);
|
||||||
|
modrm = (modrm & ~best->mod_rm.mask) | (best->mod_rm.bits & best->mod_rm.mask);
|
||||||
|
|
||||||
|
X8616_DecodedOperand_R rel = slot[x8616_operand_rel8];
|
||||||
|
U1 rel_bytes = 1;
|
||||||
|
if (rel == 0) { rel = slot[x8616_operand_rel16]; rel_bytes = 2; }
|
||||||
|
if (imm) {
|
||||||
|
U1 imm16 = slot[x8616_operand_imm16] != 0;
|
||||||
|
U1 imm8 = slot[x8616_operand_imm8] != 0;
|
||||||
|
imm->immediate_bytes = imm16 ? 2 : (imm8 || w == x8616_w_byte || s ? 1 : 2);
|
||||||
|
}
|
||||||
|
if (rel) {
|
||||||
|
U1 size = x8616_encode_prefix_count(inst) + 1 + rel_bytes;
|
||||||
|
rel->displacement = s2_(rel->displacement - s2_(size));
|
||||||
|
rel->displacement_bytes = rel_bytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
inst->header = header;
|
||||||
|
inst->mod_rm = modrm;
|
||||||
|
inst->has_mod_rm = has_modrm;
|
||||||
|
inst->post_opcode = best->post_opcode.mask ? best->post_opcode.bits : 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal X8616_EncodeStatus
|
||||||
|
x8616_encode_instruction(Str8Gen_R gen, X8616_DecodedInstruction_R inst)
|
||||||
|
{
|
||||||
|
if (inst->decode_flags & (x8616_decode_invalid | x8616_decode_truncated)) return x8616_encode_invalid_record;
|
||||||
|
X8616_DecodedInstruction local = *inst;
|
||||||
|
if (local.size == 0) {
|
||||||
|
if (x8616_encode_assemble(& local) == 0) return x8616_encode_invalid_record;
|
||||||
|
}
|
||||||
|
|
||||||
|
U1 buf[16];
|
||||||
|
U1 n = 0;
|
||||||
|
U1 rep = local.prefixes.repeat == x8616_rep ? x8616_rep_prefix() : x8616_repne_prefix();
|
||||||
|
if (local.prefixes.lock) { x8616_encode_buf_u1(buf, & n, x8616_lock_prefix()); }
|
||||||
|
if (local.prefixes.has_repeat) { x8616_encode_buf_u1(buf, & n, rep); }
|
||||||
|
if (local.prefixes.has_segment) { x8616_encode_buf_u1(buf, & n, x8616_segment_prefix(local.prefixes.segment)); }
|
||||||
|
x8616_encode_buf_u1(buf, & n, local.header);
|
||||||
|
if (local.post_opcode) { x8616_encode_buf_u1(buf, & n, local.post_opcode); }
|
||||||
|
if (local.has_mod_rm) { x8616_encode_buf_u1(buf, & n, local.mod_rm); }
|
||||||
|
|
||||||
|
for (U1 id = 0; id < local.operand_count; ++id) {
|
||||||
|
X8616_DecodedOperand_R op = local.operands + id;
|
||||||
|
if ((op->flags & x8616_decoded_operand_memory) == 0) continue;
|
||||||
|
if ( op->flags & x8616_decoded_operand_direct) x8616_encode_buf_u2(buf, & n, op->address);
|
||||||
|
else x8616_encode_buf_disp(buf, & n, op->displacement, op->displacement_bytes);
|
||||||
|
}
|
||||||
|
for (U1 id = 0; id < local.operand_count; ++id) {
|
||||||
|
X8616_DecodedOperand_R op = local.operands + id;
|
||||||
|
B4 op_rel = op->flags & x8616_decoded_operand_relative;
|
||||||
|
B4 op_imm = (op->flags & x8616_decoded_operand_immediate) && op->immediate_bytes;
|
||||||
|
B4 op_far = op->flags & x8616_decoded_operand_far_ptr;
|
||||||
|
if (op_rel) { x8616_encode_buf_disp(buf, & n, op->displacement, op->displacement_bytes); }
|
||||||
|
else if (op_imm) { x8616_encode_buf_disp(buf, & n, s2_(op->immediate), op->immediate_bytes); }
|
||||||
|
else if (op_far) {
|
||||||
|
x8616_encode_buf_u2(buf, & n, op->far_offset);
|
||||||
|
x8616_encode_buf_u2(buf, & n, op->far_segment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n > gen->cap - gen->len) return x8616_encode_output_full;
|
||||||
|
mem_copy(u8_(gen->ptr + gen->len), u8_(buf), n);
|
||||||
|
gen->len += n;
|
||||||
|
return x8616_encode_ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
X8616_EncodeInfo x8616_encode_instructions(X8616_EncodeRequest request)
|
||||||
|
{
|
||||||
|
X8616_EncodeInfo result = {0};
|
||||||
|
X8616_InfoList local = {0};
|
||||||
|
X8616_InfoList_R msgs = request.msgs ? request.msgs : & local;
|
||||||
|
Str8Gen gen = {0};
|
||||||
|
|
||||||
|
B4 bad =
|
||||||
|
(request.instruction_count && request.instructions == 0)
|
||||||
|
|| (request.output.len && request.output.ptr == 0)
|
||||||
|
|| (request.info_arena == 0);
|
||||||
|
if (bad) {
|
||||||
|
if (request.info_arena) {
|
||||||
|
x8616_encode_push(request.info_arena, msgs, x8616_encode_bad_request, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
gen = str8gen_make(request.output);
|
||||||
|
result.bytes.ptr = u8_(gen.ptr);
|
||||||
|
|
||||||
|
for (U4 id = 0; id < request.instruction_count; ++id)
|
||||||
|
{
|
||||||
|
X8616_DecodedInstruction_R inst = & request.instructions[id];
|
||||||
|
U8 at = gen.len;
|
||||||
|
X8616_EncodeStatus st = x8616_encode_instruction(& gen, inst);
|
||||||
|
if (st == x8616_encode_invalid_record) {
|
||||||
|
gen.len = at;
|
||||||
|
x8616_encode_push(request.info_arena, msgs, st, id, inst->size, 0, u4_(inst->op));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (st == x8616_encode_output_full) {
|
||||||
|
gen.len = at;
|
||||||
|
x8616_encode_push(request.info_arena, msgs, st
|
||||||
|
, id, inst->size, u4_(request.output.len), u4_(at));
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
result.instructions_written += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
result.bytes.len = gen.len;
|
||||||
|
result.msgs = *msgs;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
|
# pragma once
|
||||||
|
# include "decoder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef Enum_(U1, X8616_EncodeStatus) {
|
||||||
|
x8616_encode_ok = 0x00,
|
||||||
|
x8616_encode_output_full = 0x01,
|
||||||
|
x8616_encode_invalid_record = 0x02,
|
||||||
|
x8616_encode_bad_request = 0x03,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Struct_(X8616_EncodeRequest) {
|
||||||
|
X8616_DecodedInstruction* instructions;
|
||||||
|
U4 instruction_count; byte_pad(4);
|
||||||
|
Slice output;
|
||||||
|
FArena* info_arena;
|
||||||
|
X8616_InfoList_R msgs;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Struct_(X8616_EncodeInfo) {
|
||||||
|
X8616_InfoList msgs;
|
||||||
|
Slice bytes;
|
||||||
|
U4 instructions_written;
|
||||||
|
byte_pad(4);
|
||||||
|
};
|
||||||
|
|
||||||
|
X8616_EncodeInfo x8616_encode_instructions(X8616_EncodeRequest request);
|
||||||
+414
-320
@@ -3,10 +3,36 @@
|
|||||||
# include "duffle/dsl.h"
|
# include "duffle/dsl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Intel 8086 Family User's Manual, Oct 1979 (9800722-03) ch.4 p.4-18,
|
||||||
|
Figure 4-20, Table 4-11, Table 4-12.
|
||||||
|
|
||||||
|
Figure 4-20 byte 1:
|
||||||
|
|
||||||
|
7 hole 0
|
||||||
|
+------------+-------------+
|
||||||
|
| OPCODE | fields |
|
||||||
|
+------------+-------------+
|
||||||
|
^ ^
|
||||||
|
| d, w, s, v, z, reg, cccc (Table 4-11)
|
||||||
|
Table 4-12 identifying bits (width 4..8)
|
||||||
|
|
||||||
|
Construction:
|
||||||
|
header = (opcode << hole) | fields
|
||||||
|
X8616_Opcode = the unshifted identifying bits
|
||||||
|
X8616_Encoding.header = BytePattern for that packed byte
|
||||||
|
|
||||||
|
INC AX:
|
||||||
|
Table 4-12: 0 1 0 0 0 reg
|
||||||
|
opcode = 01000, hole = 3, reg = AX
|
||||||
|
header = (01000 << 3) | 000 = 0x40
|
||||||
|
|
||||||
|
BytePattern.mask = bits that must match (opcode bits + any fixed literals). */
|
||||||
typedef Struct_(X8616_BytePattern) { U1 bits; U1 mask; };
|
typedef Struct_(X8616_BytePattern) { U1 bits; U1 mask; };
|
||||||
typedef Struct_(X8616_BitField) { U1 shift; U1 width; };
|
typedef Struct_(X8616_BitField) { U1 shift; U1 width; };
|
||||||
|
|
||||||
typedef Struct_(X8616_OpcodeFields) {
|
// width field size in bits; 0 means this encoding skips it.
|
||||||
|
// d w s v z reg sr = Table 4-11. alu = ttt, cc = cccc (catalog).
|
||||||
|
typedef Struct_(X8616_HeaderFields) {
|
||||||
X8616_BitField d;
|
X8616_BitField d;
|
||||||
X8616_BitField w;
|
X8616_BitField w;
|
||||||
X8616_BitField s;
|
X8616_BitField s;
|
||||||
@@ -14,8 +40,16 @@ typedef Struct_(X8616_OpcodeFields) {
|
|||||||
X8616_BitField z;
|
X8616_BitField z;
|
||||||
X8616_BitField reg;
|
X8616_BitField reg;
|
||||||
X8616_BitField sr;
|
X8616_BitField sr;
|
||||||
|
X8616_BitField alu;
|
||||||
|
X8616_BitField cc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define x8616_field_mask(shift, width) u1_(((1u << (width)) - 1u) << (shift))
|
||||||
|
#define x8616_header_opcode_mask(field_width) u1_(~((1u << (field_width)) - 1u))
|
||||||
|
#define x8616_opc(opcode, field_width) ((X8616_BytePattern){ u1_((opcode) << (field_width)), x8616_header_opcode_mask(field_width) })
|
||||||
|
#define x8616_opc_byte(opcode) x8616_opc((opcode), 0)
|
||||||
|
#define x8616_opcode_in(header, hole) ((header) >> (hole)) /* fields-zeroed byte 1 → identifying bits */
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Op) {
|
typedef Enum_(U1, X8616_Op) {
|
||||||
x8616_op_invalid = 0x00,
|
x8616_op_invalid = 0x00,
|
||||||
x8616_op_nop = 0x01,
|
x8616_op_nop = 0x01,
|
||||||
@@ -143,48 +177,48 @@ typedef Enum_(U1, X8616_EncodingFlags) {
|
|||||||
x8616_encoding_prefix = 0b00000010,
|
x8616_encoding_prefix = 0b00000010,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* mod_rm (Optional): Fixed constraint on the ModR/M byte.
|
typedef Enum_(U1, X8616_DigitKind) {
|
||||||
post_opcode (Optional): Fixed byte immediately following the opcode.
|
x8616_digit_none = 0x0,
|
||||||
fields: Variable fields carried by the opcode byte. width == 0: field is absent.
|
x8616_digit_alu = 0x1,
|
||||||
operands: Operand order describes d == 0.
|
x8616_digit_shift = 0x2,
|
||||||
If d exists and decodes to 1, operands[0] and operands[1] are swapped.
|
};
|
||||||
width: Explicit width only when the encoding has no w field.
|
|
||||||
flags: Encoding metadata not represented by an explicit operand. */
|
|
||||||
typedef Struct_(X8616_Encoding) {
|
typedef Struct_(X8616_Encoding) {
|
||||||
X8616_BytePattern opcode;
|
X8616_BytePattern header;
|
||||||
X8616_BytePattern mod_rm;
|
X8616_BytePattern mod_rm;
|
||||||
X8616_BytePattern post_opcode;
|
X8616_BytePattern post_opcode;
|
||||||
X8616_OpcodeFields fields;
|
X8616_HeaderFields fields;
|
||||||
X8616_Operand operands[2];
|
X8616_Operand operands[2];
|
||||||
X8616_WidthMode width;
|
X8616_WidthMode width;
|
||||||
X8616_EncodingFlags flags;
|
X8616_EncodingFlags flags;
|
||||||
|
X8616_DigitKind digit_kind;
|
||||||
X8616_Op op;
|
X8616_Op op;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Width) {
|
typedef Enum_(U1, X8616_Width) { // Table 4-7 W
|
||||||
x8616_w_byte = 0b0,
|
x8616_w_byte = 0b0,
|
||||||
x8616_w_word = 0b1,
|
x8616_w_word = 0b1,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Direction) {
|
typedef Enum_(U1, X8616_Direction) { // Table 4-7 D: REG is dest when 1
|
||||||
x8616_d_rm_dst = 0b0,
|
x8616_d_rm_dst = 0b0,
|
||||||
x8616_d_reg_dst = 0b1,
|
x8616_d_reg_dst = 0b1,
|
||||||
x8616_d_acc_dst = 0b0,
|
x8616_d_acc_dst = x8616_d_rm_dst,
|
||||||
x8616_d_mem_dst = 0b1,
|
x8616_d_mem_dst = x8616_d_reg_dst,
|
||||||
x8616_d_seg_dst = 0b1,
|
x8616_d_seg_dst = x8616_d_reg_dst,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Sign) {
|
typedef Enum_(U1, X8616_Sign) { // Table 4-7 S
|
||||||
x8616_s_full = 0b0,
|
x8616_s_full = 0b0,
|
||||||
x8616_s_extend = 0b1,
|
x8616_s_extend = 0b1,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_VariableShift) {
|
typedef Enum_(U1, X8616_VariableShift) { // Table 4-7 V
|
||||||
x8616_v_one = 0b0,
|
x8616_v_one = 0b0,
|
||||||
x8616_v_cl = 0b1,
|
x8616_v_cl = 0b1,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Repeat) {
|
typedef Enum_(U1, X8616_Repeat) { // Table 4-7 Z
|
||||||
x8616_repne = 0b0,
|
x8616_repne = 0b0,
|
||||||
x8616_rep = 0b1,
|
x8616_rep = 0b1,
|
||||||
};
|
};
|
||||||
@@ -225,6 +259,12 @@ typedef Enum_(U1, X8616_Segment) {
|
|||||||
x8616_ds = 0b11,
|
x8616_ds = 0b11,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Table 4-12 B(110) / B(111) beside SR.
|
||||||
|
typedef Enum_(U1, X8616_SRLow) {
|
||||||
|
x8616_sr_low_push = 0b110,
|
||||||
|
x8616_sr_low_pop = 0b111,
|
||||||
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_EA) {
|
typedef Enum_(U1, X8616_EA) {
|
||||||
x8616_ea_bx_si = 0b000,
|
x8616_ea_bx_si = 0b000,
|
||||||
x8616_ea_bx_di = 0b001,
|
x8616_ea_bx_di = 0b001,
|
||||||
@@ -237,7 +277,7 @@ typedef Enum_(U1, X8616_EA) {
|
|||||||
x8616_ea_bx = 0b111,
|
x8616_ea_bx = 0b111,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_ALU) {
|
typedef Enum_(U1, X8616_ALU) { // ttt in 00 ttt 0 d w and 00 ttt 10 w
|
||||||
x8616_add = 0b000,
|
x8616_add = 0b000,
|
||||||
x8616_or = 0b001,
|
x8616_or = 0b001,
|
||||||
x8616_adc = 0b010,
|
x8616_adc = 0b010,
|
||||||
@@ -248,7 +288,18 @@ typedef Enum_(U1, X8616_ALU) {
|
|||||||
x8616_cmp = 0b111,
|
x8616_cmp = 0b111,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Group3) {
|
RO_ global X8616_Op x8616_op_from_alu[] = {
|
||||||
|
[x8616_add] = x8616_op_add,
|
||||||
|
[x8616_or] = x8616_op_or,
|
||||||
|
[x8616_adc] = x8616_op_adc,
|
||||||
|
[x8616_sbb] = x8616_op_sbb,
|
||||||
|
[x8616_and] = x8616_op_and,
|
||||||
|
[x8616_sub] = x8616_op_sub,
|
||||||
|
[x8616_xor] = x8616_op_xor,
|
||||||
|
[x8616_cmp] = x8616_op_cmp,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Enum_(U1, X8616_Group3) { // ModR/M /digit of 1111011 w
|
||||||
x8616_g3_test = 0b000,
|
x8616_g3_test = 0b000,
|
||||||
x8616_g3_not = 0b010,
|
x8616_g3_not = 0b010,
|
||||||
x8616_g3_neg = 0b011,
|
x8616_g3_neg = 0b011,
|
||||||
@@ -258,12 +309,12 @@ typedef Enum_(U1, X8616_Group3) {
|
|||||||
x8616_g3_idiv = 0b111,
|
x8616_g3_idiv = 0b111,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_IncDec) {
|
typedef Enum_(U1, X8616_IncDec) { // /0 /1 of 1111111 w
|
||||||
x8616_inc = 0b000,
|
x8616_inc = 0b000,
|
||||||
x8616_dec = 0b001,
|
x8616_dec = 0b001,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_GroupFF) {
|
typedef Enum_(U1, X8616_GroupFF) { // /2../6 of 1111111 w=1
|
||||||
x8616_ff_call_near = 0b010,
|
x8616_ff_call_near = 0b010,
|
||||||
x8616_ff_call_far = 0b011,
|
x8616_ff_call_far = 0b011,
|
||||||
x8616_ff_jmp_near = 0b100,
|
x8616_ff_jmp_near = 0b100,
|
||||||
@@ -271,7 +322,7 @@ typedef Enum_(U1, X8616_GroupFF) {
|
|||||||
x8616_ff_push = 0b110,
|
x8616_ff_push = 0b110,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Shift) {
|
typedef Enum_(U1, X8616_Shift) { // /digit of 110100 v w
|
||||||
x8616_rol = 0b000,
|
x8616_rol = 0b000,
|
||||||
x8616_ror = 0b001,
|
x8616_ror = 0b001,
|
||||||
x8616_rcl = 0b010,
|
x8616_rcl = 0b010,
|
||||||
@@ -281,7 +332,18 @@ typedef Enum_(U1, X8616_Shift) {
|
|||||||
x8616_sar = 0b111,
|
x8616_sar = 0b111,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Condition) {
|
RO_ global X8616_Op x8616_op_from_shift[] = {
|
||||||
|
[x8616_rol] = x8616_op_rol,
|
||||||
|
[x8616_ror] = x8616_op_ror,
|
||||||
|
[x8616_rcl] = x8616_op_rcl,
|
||||||
|
[x8616_rcr] = x8616_op_rcr,
|
||||||
|
[x8616_shl] = x8616_op_shl,
|
||||||
|
[x8616_shr] = x8616_op_shr,
|
||||||
|
[0b110] = x8616_op_invalid,
|
||||||
|
[x8616_sar] = x8616_op_sar,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Enum_(U1, X8616_Condition) { // cccc of 0111 cccc
|
||||||
x8616_cc_o = 0b0000,
|
x8616_cc_o = 0b0000,
|
||||||
x8616_cc_no = 0b0001,
|
x8616_cc_no = 0b0001,
|
||||||
x8616_cc_b = 0b0010,
|
x8616_cc_b = 0b0010,
|
||||||
@@ -300,103 +362,165 @@ typedef Enum_(U1, X8616_Condition) {
|
|||||||
x8616_cc_g = 0b1111,
|
x8616_cc_g = 0b1111,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_OpcodePrefix) {
|
RO_ global X8616_Op x8616_op_from_cc[] = {
|
||||||
x8616_opcode_mov_rm_r = 0b100010,
|
[x8616_cc_o] = x8616_op_jo,
|
||||||
x8616_opcode_mov_rm_i = 0b1100011,
|
[x8616_cc_no] = x8616_op_jno,
|
||||||
x8616_opcode_mov_r_i = 0b1011,
|
[x8616_cc_b] = x8616_op_jb,
|
||||||
x8616_opcode_mov_acc_mem = 0b101000,
|
[x8616_cc_nb] = x8616_op_jnb,
|
||||||
x8616_opcode_mov_seg_rm = 0b100011,
|
[x8616_cc_e] = x8616_op_je,
|
||||||
|
[x8616_cc_ne] = x8616_op_jne,
|
||||||
x8616_opcode_push_reg = 0b01010,
|
[x8616_cc_be] = x8616_op_jbe,
|
||||||
x8616_opcode_pop_reg = 0b01011,
|
[x8616_cc_a] = x8616_op_ja,
|
||||||
x8616_opcode_xchg_rm_r = 0b1000011,
|
[x8616_cc_s] = x8616_op_js,
|
||||||
x8616_opcode_xchg_ax_reg = 0b10010,
|
[x8616_cc_ns] = x8616_op_jns,
|
||||||
|
[x8616_cc_p] = x8616_op_jp,
|
||||||
x8616_opcode_in_i = 0b1110010,
|
[x8616_cc_np] = x8616_op_jnp,
|
||||||
x8616_opcode_in_dx = 0b1110110,
|
[x8616_cc_l] = x8616_op_jl,
|
||||||
x8616_opcode_out_i = 0b1110011,
|
[x8616_cc_nl] = x8616_op_jnl,
|
||||||
x8616_opcode_out_dx = 0b1110111,
|
[x8616_cc_le] = x8616_op_jle,
|
||||||
|
[x8616_cc_g] = x8616_op_jg,
|
||||||
x8616_opcode_alu_rm_i = 0b100000,
|
|
||||||
x8616_opcode_logic_rm_i = 0b1000000,
|
|
||||||
x8616_opcode_incdec_rm = 0b1111111,
|
|
||||||
x8616_opcode_inc_reg = 0b01000,
|
|
||||||
x8616_opcode_dec_reg = 0b01001,
|
|
||||||
x8616_opcode_group3 = 0b1111011,
|
|
||||||
x8616_opcode_shift_rm = 0b110100,
|
|
||||||
x8616_opcode_test_rm_r = 0b1000010,
|
|
||||||
x8616_opcode_test_acc_i = 0b1010100,
|
|
||||||
|
|
||||||
x8616_opcode_rep = 0b1111001,
|
|
||||||
x8616_opcode_movs = 0b1010010,
|
|
||||||
x8616_opcode_cmps = 0b1010011,
|
|
||||||
x8616_opcode_scas = 0b1010111,
|
|
||||||
x8616_opcode_lods = 0b1010110,
|
|
||||||
x8616_opcode_stos = 0b1010101,
|
|
||||||
|
|
||||||
x8616_opcode_jcc = 0b0111,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_Opcode) {
|
typedef Enum_(U1, X8616_Digit) {
|
||||||
x8616_opcode_group_ff = 0b11111111,
|
x8616_digit_0 = 0b000,
|
||||||
x8616_opcode_pop_rm = 0b10001111,
|
};
|
||||||
x8616_opcode_xlat = 0b11010111,
|
|
||||||
x8616_opcode_lea = 0b10001101,
|
|
||||||
x8616_opcode_lds = 0b11000101,
|
|
||||||
x8616_opcode_les = 0b11000100,
|
|
||||||
x8616_opcode_lahf = 0b10011111,
|
|
||||||
x8616_opcode_sahf = 0b10011110,
|
|
||||||
x8616_opcode_pushf = 0b10011100,
|
|
||||||
x8616_opcode_popf = 0b10011101,
|
|
||||||
|
|
||||||
x8616_opcode_aaa = 0b00110111,
|
enum { // hole = low-bit field width in byte 1
|
||||||
x8616_opcode_daa = 0b00100111,
|
X8616_OPCODE_DW_W_SHIFT = 0,
|
||||||
x8616_opcode_aas = 0b00111111,
|
X8616_OPCODE_DW_D_SHIFT = 1,
|
||||||
x8616_opcode_das = 0b00101111,
|
X8616_OPCODE_DW_HOLE = X8616_OPCODE_DW_D_SHIFT + 1,
|
||||||
x8616_opcode_aam = 0b11010100,
|
|
||||||
x8616_opcode_aad = 0b11010101,
|
|
||||||
x8616_opcode_cbw = 0b10011000,
|
|
||||||
x8616_opcode_cwd = 0b10011001,
|
|
||||||
|
|
||||||
x8616_opcode_call_rel16 = 0b11101000,
|
X8616_OPCODE_SW_W_SHIFT = 0,
|
||||||
x8616_opcode_call_far = 0b10011010,
|
X8616_OPCODE_SW_S_SHIFT = 1,
|
||||||
x8616_opcode_jmp_rel16 = 0b11101001,
|
X8616_OPCODE_SW_HOLE = X8616_OPCODE_SW_S_SHIFT + 1,
|
||||||
x8616_opcode_jmp_rel8 = 0b11101011,
|
|
||||||
x8616_opcode_jmp_far = 0b11101010,
|
|
||||||
x8616_opcode_ret = 0b11000011,
|
|
||||||
x8616_opcode_ret_i = 0b11000010,
|
|
||||||
x8616_opcode_retf = 0b11001011,
|
|
||||||
x8616_opcode_retf_i = 0b11001010,
|
|
||||||
|
|
||||||
x8616_opcode_loopnz = 0b11100000,
|
X8616_OPCODE_VW_W_SHIFT = 0,
|
||||||
x8616_opcode_loopz = 0b11100001,
|
X8616_OPCODE_VW_V_SHIFT = 1,
|
||||||
x8616_opcode_loop = 0b11100010,
|
X8616_OPCODE_VW_HOLE = X8616_OPCODE_VW_V_SHIFT + 1,
|
||||||
x8616_opcode_jcxz = 0b11100011,
|
|
||||||
|
|
||||||
x8616_opcode_int = 0b11001101,
|
X8616_OPCODE_Z_Z_SHIFT = 0,
|
||||||
x8616_opcode_int3 = 0b11001100,
|
X8616_OPCODE_Z_HOLE = X8616_OPCODE_Z_Z_SHIFT + 1,
|
||||||
x8616_opcode_into = 0b11001110,
|
|
||||||
x8616_opcode_iret = 0b11001111,
|
|
||||||
|
|
||||||
x8616_opcode_clc = 0b11111000,
|
X8616_OPCODE_W_W_SHIFT = 0,
|
||||||
x8616_opcode_cmc = 0b11110101,
|
X8616_OPCODE_W_HOLE = X8616_OPCODE_W_W_SHIFT + 1,
|
||||||
x8616_opcode_stc = 0b11111001,
|
|
||||||
x8616_opcode_cld = 0b11111100,
|
|
||||||
x8616_opcode_std = 0b11111101,
|
|
||||||
x8616_opcode_cli = 0b11111010,
|
|
||||||
x8616_opcode_sti = 0b11111011,
|
|
||||||
x8616_opcode_hlt = 0b11110100,
|
|
||||||
x8616_opcode_wait = 0b10011011,
|
|
||||||
x8616_opcode_lock = 0b11110000,
|
|
||||||
|
|
||||||
x8616_opcode_nop = 0b10010000,
|
X8616_OPCODE_REG_REG_SHIFT = 0,
|
||||||
|
X8616_OPCODE_REG_REG_WIDTH = 3,
|
||||||
|
X8616_OPCODE_REG_HOLE = X8616_OPCODE_REG_REG_SHIFT + X8616_OPCODE_REG_REG_WIDTH,
|
||||||
|
|
||||||
|
X8616_OPCODE_WREG_REG_SHIFT = 0,
|
||||||
|
X8616_OPCODE_WREG_REG_WIDTH = 3,
|
||||||
|
X8616_OPCODE_WREG_W_SHIFT = X8616_OPCODE_WREG_REG_SHIFT + X8616_OPCODE_WREG_REG_WIDTH,
|
||||||
|
X8616_OPCODE_WREG_HOLE = X8616_OPCODE_WREG_W_SHIFT + 1,
|
||||||
|
|
||||||
|
X8616_OPCODE_D0_D_SHIFT = 1,
|
||||||
|
X8616_OPCODE_D0_HOLE = X8616_OPCODE_D0_D_SHIFT + 1,
|
||||||
|
|
||||||
|
X8616_OPCODE_SR_CLASS_SHIFT = 5,
|
||||||
|
|
||||||
|
X8616_OPCODE_CC_WIDTH = 4,
|
||||||
|
X8616_OPCODE_CC_HOLE = X8616_OPCODE_CC_WIDTH,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Enum_(U1, X8616_Opcode) { /* identifying bits: fields-zeroed header >> hole */
|
||||||
|
x8616_opcode_mov_rm_r = x8616_opcode_in(0b10001000, X8616_OPCODE_DW_HOLE), // 100010 d w
|
||||||
|
x8616_opcode_mov_rm_i = x8616_opcode_in(0b11000110, X8616_OPCODE_W_HOLE), // 1100011 w
|
||||||
|
x8616_opcode_mov_r_i = x8616_opcode_in(0b10110000, X8616_OPCODE_WREG_HOLE), // 1011 w reg
|
||||||
|
x8616_opcode_mov_acc_mem = x8616_opcode_in(0b10100000, X8616_OPCODE_DW_HOLE), // 101000 d w
|
||||||
|
x8616_opcode_mov_seg_rm = x8616_opcode_in(0b10001100, X8616_OPCODE_D0_HOLE), // 100011 d 0
|
||||||
|
|
||||||
|
x8616_opcode_push_reg = x8616_opcode_in(0b01010000, X8616_OPCODE_REG_HOLE), // 01010 reg
|
||||||
|
x8616_opcode_pop_reg = x8616_opcode_in(0b01011000, X8616_OPCODE_REG_HOLE), // 01011 reg
|
||||||
|
x8616_opcode_xchg_rm_r = x8616_opcode_in(0b10000110, X8616_OPCODE_W_HOLE), // 1000011 w
|
||||||
|
x8616_opcode_xchg_ax_reg = x8616_opcode_in(0b10010000, X8616_OPCODE_REG_HOLE), // 10010 reg
|
||||||
|
|
||||||
|
x8616_opcode_in_i = x8616_opcode_in(0b11100100, X8616_OPCODE_W_HOLE), // 1110010 w
|
||||||
|
x8616_opcode_in_dx = x8616_opcode_in(0b11101100, X8616_OPCODE_W_HOLE), // 1110110 w
|
||||||
|
x8616_opcode_out_i = x8616_opcode_in(0b11100110, X8616_OPCODE_W_HOLE), // 1110011 w
|
||||||
|
x8616_opcode_out_dx = x8616_opcode_in(0b11101110, X8616_OPCODE_W_HOLE), // 1110111 w
|
||||||
|
|
||||||
|
x8616_opcode_alu_rm_i = x8616_opcode_in(0b10000000, X8616_OPCODE_SW_HOLE), // 100000 s w
|
||||||
|
x8616_opcode_incdec_rm = x8616_opcode_in(0b11111110, X8616_OPCODE_W_HOLE), // 1111111 w
|
||||||
|
x8616_opcode_inc_reg = x8616_opcode_in(0b01000000, X8616_OPCODE_REG_HOLE), // 01000 reg
|
||||||
|
x8616_opcode_dec_reg = x8616_opcode_in(0b01001000, X8616_OPCODE_REG_HOLE), // 01001 reg
|
||||||
|
x8616_opcode_group3 = x8616_opcode_in(0b11110110, X8616_OPCODE_W_HOLE), // 1111011 w
|
||||||
|
x8616_opcode_shift_rm = x8616_opcode_in(0b11010000, X8616_OPCODE_VW_HOLE), // 110100 v w
|
||||||
|
x8616_opcode_test_rm_r = x8616_opcode_in(0b10000100, X8616_OPCODE_W_HOLE), // 1000010 w
|
||||||
|
x8616_opcode_test_acc_i = x8616_opcode_in(0b10101000, X8616_OPCODE_W_HOLE), // 1010100 w
|
||||||
|
|
||||||
|
x8616_opcode_rep = x8616_opcode_in(0b11110010, X8616_OPCODE_Z_HOLE), // 1111001 z
|
||||||
|
x8616_opcode_movs = x8616_opcode_in(0b10100100, X8616_OPCODE_W_HOLE), // 1010010 w
|
||||||
|
x8616_opcode_cmps = x8616_opcode_in(0b10100110, X8616_OPCODE_W_HOLE),
|
||||||
|
x8616_opcode_scas = x8616_opcode_in(0b10101110, X8616_OPCODE_W_HOLE),
|
||||||
|
x8616_opcode_lods = x8616_opcode_in(0b10101100, X8616_OPCODE_W_HOLE),
|
||||||
|
x8616_opcode_stos = x8616_opcode_in(0b10101010, X8616_OPCODE_W_HOLE),
|
||||||
|
|
||||||
|
x8616_opcode_jcc = x8616_opcode_in(0b01110000, X8616_OPCODE_CC_HOLE), // 0111 cccc
|
||||||
|
|
||||||
|
x8616_opcode_sr_stack = x8616_opcode_in(0b00000110, X8616_OPCODE_SR_CLASS_SHIFT), // 000 sr 110
|
||||||
|
x8616_opcode_sr_override = x8616_opcode_in(0b00100110, X8616_OPCODE_SR_CLASS_SHIFT), // 001 sr 110
|
||||||
|
|
||||||
|
x8616_opcode_pop_rm = x8616_opcode_in(0b10001111, 0),
|
||||||
|
x8616_opcode_xlat = x8616_opcode_in(0b11010111, 0),
|
||||||
|
x8616_opcode_lea = x8616_opcode_in(0b10001101, 0),
|
||||||
|
x8616_opcode_lds = x8616_opcode_in(0b11000101, 0),
|
||||||
|
x8616_opcode_les = x8616_opcode_in(0b11000100, 0),
|
||||||
|
x8616_opcode_lahf = x8616_opcode_in(0b10011111, 0),
|
||||||
|
x8616_opcode_sahf = x8616_opcode_in(0b10011110, 0),
|
||||||
|
x8616_opcode_pushf = x8616_opcode_in(0b10011100, 0),
|
||||||
|
x8616_opcode_popf = x8616_opcode_in(0b10011101, 0),
|
||||||
|
|
||||||
|
x8616_opcode_aaa = x8616_opcode_in(0b00110111, 0),
|
||||||
|
x8616_opcode_daa = x8616_opcode_in(0b00100111, 0),
|
||||||
|
x8616_opcode_aas = x8616_opcode_in(0b00111111, 0),
|
||||||
|
x8616_opcode_das = x8616_opcode_in(0b00101111, 0),
|
||||||
|
x8616_opcode_aam = x8616_opcode_in(0b11010100, 0),
|
||||||
|
x8616_opcode_aad = x8616_opcode_in(0b11010101, 0),
|
||||||
|
x8616_opcode_cbw = x8616_opcode_in(0b10011000, 0),
|
||||||
|
x8616_opcode_cwd = x8616_opcode_in(0b10011001, 0),
|
||||||
|
|
||||||
|
x8616_opcode_call_rel16 = x8616_opcode_in(0b11101000, 0),
|
||||||
|
x8616_opcode_call_far = x8616_opcode_in(0b10011010, 0),
|
||||||
|
x8616_opcode_jmp_rel16 = x8616_opcode_in(0b11101001, 0),
|
||||||
|
x8616_opcode_jmp_rel8 = x8616_opcode_in(0b11101011, 0),
|
||||||
|
x8616_opcode_jmp_far = x8616_opcode_in(0b11101010, 0),
|
||||||
|
x8616_opcode_ret = x8616_opcode_in(0b11000011, 0),
|
||||||
|
x8616_opcode_ret_i = x8616_opcode_in(0b11000010, 0),
|
||||||
|
x8616_opcode_retf = x8616_opcode_in(0b11001011, 0),
|
||||||
|
x8616_opcode_retf_i = x8616_opcode_in(0b11001010, 0),
|
||||||
|
|
||||||
|
x8616_opcode_loopnz = x8616_opcode_in(0b11100000, 0),
|
||||||
|
x8616_opcode_loopz = x8616_opcode_in(0b11100001, 0),
|
||||||
|
x8616_opcode_loop = x8616_opcode_in(0b11100010, 0),
|
||||||
|
x8616_opcode_jcxz = x8616_opcode_in(0b11100011, 0),
|
||||||
|
|
||||||
|
x8616_opcode_int = x8616_opcode_in(0b11001101, 0),
|
||||||
|
x8616_opcode_int3 = x8616_opcode_in(0b11001100, 0),
|
||||||
|
x8616_opcode_into = x8616_opcode_in(0b11001110, 0),
|
||||||
|
x8616_opcode_iret = x8616_opcode_in(0b11001111, 0),
|
||||||
|
|
||||||
|
x8616_opcode_clc = x8616_opcode_in(0b11111000, 0),
|
||||||
|
x8616_opcode_cmc = x8616_opcode_in(0b11110101, 0),
|
||||||
|
x8616_opcode_stc = x8616_opcode_in(0b11111001, 0),
|
||||||
|
x8616_opcode_cld = x8616_opcode_in(0b11111100, 0),
|
||||||
|
x8616_opcode_std = x8616_opcode_in(0b11111101, 0),
|
||||||
|
x8616_opcode_cli = x8616_opcode_in(0b11111010, 0),
|
||||||
|
x8616_opcode_sti = x8616_opcode_in(0b11111011, 0),
|
||||||
|
x8616_opcode_hlt = x8616_opcode_in(0b11110100, 0),
|
||||||
|
x8616_opcode_wait = x8616_opcode_in(0b10011011, 0),
|
||||||
|
x8616_opcode_lock = x8616_opcode_in(0b11110000, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
X8616_OPCODE_MASK = 0b11111111,
|
X8616_OPCODE_BIT_WIDTH = 1,
|
||||||
|
X8616_BYTE_MASK = x8616_field_mask(0, 8),
|
||||||
|
|
||||||
X8616_OPCODE_ALU_ACC_I_FIXED = 0b10,
|
X8616_POST_OPCODE_AAM_AAD = 0b00001010, // AAM/AAD immediate 00001010
|
||||||
X8616_POST_OPCODE_AAM_AAD = 0b00001010,
|
|
||||||
|
/* Hole = field width in the low bits of byte 1.
|
||||||
|
header = (opcode << HOLE) | fields
|
||||||
|
OPCODE_MASK = bits of the header that are opcode.
|
||||||
|
*/
|
||||||
|
|
||||||
// ModR/M:
|
// ModR/M:
|
||||||
// 7 6 5 4 3 2 1 0
|
// 7 6 5 4 3 2 1 0
|
||||||
@@ -405,95 +529,56 @@ enum {
|
|||||||
// +-----+-------+-------+
|
// +-----+-------+-------+
|
||||||
|
|
||||||
X8616_MODRM_RM_SHIFT = 0,
|
X8616_MODRM_RM_SHIFT = 0,
|
||||||
|
X8616_MODRM_RM_WIDTH = 3,
|
||||||
X8616_MODRM_REG_SHIFT = 3,
|
X8616_MODRM_REG_SHIFT = 3,
|
||||||
|
X8616_MODRM_REG_WIDTH = 3,
|
||||||
X8616_MODRM_MOD_SHIFT = 6,
|
X8616_MODRM_MOD_SHIFT = 6,
|
||||||
X8616_MODRM_RM_MASK = 0b00000111,
|
X8616_MODRM_MOD_WIDTH = 2,
|
||||||
X8616_MODRM_REG_MASK = 0b00111000,
|
X8616_MODRM_RM_MASK = x8616_field_mask(X8616_MODRM_RM_SHIFT, X8616_MODRM_RM_WIDTH),
|
||||||
X8616_MODRM_MOD_MASK = 0b11000000,
|
X8616_MODRM_REG_MASK = x8616_field_mask(X8616_MODRM_REG_SHIFT, X8616_MODRM_REG_WIDTH),
|
||||||
|
X8616_MODRM_MOD_MASK = x8616_field_mask(X8616_MODRM_MOD_SHIFT, X8616_MODRM_MOD_WIDTH),
|
||||||
|
|
||||||
// Segment register occupies bits 4..3 in the segment-register MOV form.
|
X8616_MODRM_SR_SHIFT = 3,
|
||||||
|
X8616_MODRM_SR_WIDTH = 2,
|
||||||
|
X8616_MODRM_SR_MASK = x8616_field_mask(X8616_MODRM_SR_SHIFT, X8616_MODRM_SR_WIDTH),
|
||||||
|
X8616_MODRM_SEG_FIXED_BIT = 5,
|
||||||
|
X8616_MODRM_SEG_FIXED_MASK = x8616_field_mask(X8616_MODRM_SEG_FIXED_BIT, 1),
|
||||||
|
|
||||||
X8616_MODRM_SR_SHIFT = 3,
|
X8616_OPCODE_DW_OPCODE_MASK = x8616_header_opcode_mask(X8616_OPCODE_DW_HOLE),
|
||||||
X8616_MODRM_SR_MASK = 0b00011000,
|
X8616_OPCODE_SW_OPCODE_MASK = x8616_header_opcode_mask(X8616_OPCODE_SW_HOLE),
|
||||||
X8616_MODRM_SEG_FIXED_MASK = 0b00100000,
|
X8616_OPCODE_VW_OPCODE_MASK = x8616_header_opcode_mask(X8616_OPCODE_VW_HOLE),
|
||||||
|
X8616_OPCODE_Z_OPCODE_MASK = x8616_header_opcode_mask(X8616_OPCODE_Z_HOLE),
|
||||||
// ... d w
|
X8616_OPCODE_W_OPCODE_MASK = x8616_header_opcode_mask(X8616_OPCODE_W_HOLE),
|
||||||
|
X8616_OPCODE_REG_REG_MASK = x8616_field_mask(X8616_OPCODE_REG_REG_SHIFT, X8616_OPCODE_REG_REG_WIDTH),
|
||||||
X8616_OPCODE_DW_W_SHIFT = 0,
|
X8616_OPCODE_REG_OPCODE_MASK = x8616_header_opcode_mask(X8616_OPCODE_REG_HOLE),
|
||||||
X8616_OPCODE_DW_D_SHIFT = 1,
|
X8616_OPCODE_WREG_REG_MASK = x8616_field_mask(X8616_OPCODE_WREG_REG_SHIFT, X8616_OPCODE_WREG_REG_WIDTH),
|
||||||
X8616_OPCODE_DW_PREFIX_SHIFT = X8616_OPCODE_DW_D_SHIFT + 1,
|
X8616_OPCODE_WREG_W_MASK = x8616_field_mask(X8616_OPCODE_WREG_W_SHIFT, 1),
|
||||||
X8616_OPCODE_DW_PREFIX_MASK = 0b11111100,
|
X8616_OPCODE_WREG_OPCODE_MASK = x8616_header_opcode_mask(X8616_OPCODE_WREG_HOLE),
|
||||||
|
X8616_OPCODE_D0_OPCODE_MASK = x8616_header_opcode_mask(X8616_OPCODE_D0_HOLE) | x8616_field_mask(0, 1),
|
||||||
// ... s w
|
|
||||||
|
|
||||||
X8616_OPCODE_SW_W_SHIFT = 0,
|
|
||||||
X8616_OPCODE_SW_S_SHIFT = 1,
|
|
||||||
X8616_OPCODE_SW_PREFIX_SHIFT = X8616_OPCODE_SW_S_SHIFT + 1,
|
|
||||||
X8616_OPCODE_SW_PREFIX_MASK = 0b11111100,
|
|
||||||
|
|
||||||
// ... v w
|
|
||||||
|
|
||||||
X8616_OPCODE_VW_W_SHIFT = 0,
|
|
||||||
X8616_OPCODE_VW_V_SHIFT = 1,
|
|
||||||
X8616_OPCODE_VW_PREFIX_SHIFT = X8616_OPCODE_VW_V_SHIFT + 1,
|
|
||||||
X8616_OPCODE_VW_PREFIX_MASK = 0b11111100,
|
|
||||||
|
|
||||||
// ... z
|
|
||||||
|
|
||||||
X8616_OPCODE_Z_Z_SHIFT = 0,
|
|
||||||
X8616_OPCODE_Z_PREFIX_SHIFT = X8616_OPCODE_Z_Z_SHIFT + 1,
|
|
||||||
X8616_OPCODE_Z_PREFIX_MASK = 0b11111110,
|
|
||||||
|
|
||||||
// ... w
|
|
||||||
|
|
||||||
X8616_OPCODE_W_W_SHIFT = 0,
|
|
||||||
X8616_OPCODE_W_PREFIX_SHIFT = X8616_OPCODE_W_W_SHIFT + 1,
|
|
||||||
X8616_OPCODE_W_PREFIX_MASK = 0b11111110,
|
|
||||||
|
|
||||||
// ... reg
|
|
||||||
|
|
||||||
X8616_OPCODE_REG_REG_SHIFT = 0,
|
|
||||||
X8616_OPCODE_REG_REG_WIDTH = 3,
|
|
||||||
X8616_OPCODE_REG_REG_MASK = 0b00000111,
|
|
||||||
X8616_OPCODE_REG_PREFIX_SHIFT = X8616_OPCODE_REG_REG_SHIFT + X8616_OPCODE_REG_REG_WIDTH,
|
|
||||||
X8616_OPCODE_REG_PREFIX_MASK = 0b11111000,
|
|
||||||
|
|
||||||
// ... w reg
|
|
||||||
|
|
||||||
X8616_OPCODE_WREG_REG_SHIFT = 0,
|
|
||||||
X8616_OPCODE_WREG_REG_WIDTH = 3,
|
|
||||||
X8616_OPCODE_WREG_REG_MASK = 0b00000111,
|
|
||||||
X8616_OPCODE_WREG_W_SHIFT = X8616_OPCODE_WREG_REG_SHIFT + X8616_OPCODE_WREG_REG_WIDTH,
|
|
||||||
X8616_OPCODE_WREG_W_MASK = 0b00001000,
|
|
||||||
X8616_OPCODE_WREG_PREFIX_SHIFT = X8616_OPCODE_WREG_W_SHIFT + 1,
|
|
||||||
X8616_OPCODE_WREG_PREFIX_MASK = 0b11110000,
|
|
||||||
|
|
||||||
// ... d 0
|
|
||||||
|
|
||||||
X8616_OPCODE_D0_D_SHIFT = 1,
|
|
||||||
X8616_OPCODE_D0_PREFIX_SHIFT = X8616_OPCODE_D0_D_SHIFT + 1,
|
|
||||||
X8616_OPCODE_D0_PREFIX_MASK = 0b11111101,
|
|
||||||
|
|
||||||
// xxx sr xxx
|
|
||||||
|
|
||||||
|
X8616_OPCODE_SR_LOW_SHIFT = 0,
|
||||||
|
X8616_OPCODE_SR_LOW_WIDTH = 3,
|
||||||
X8616_OPCODE_SR_SHIFT = 3,
|
X8616_OPCODE_SR_SHIFT = 3,
|
||||||
X8616_OPCODE_SR_WIDTH = 2,
|
X8616_OPCODE_SR_WIDTH = 2,
|
||||||
X8616_OPCODE_SR_MASK = 0b00011000,
|
X8616_OPCODE_SR_CLASS_WIDTH = 3,
|
||||||
X8616_OPCODE_SR_PATTERN_MASK = 0b11100111,
|
X8616_OPCODE_SR_MASK = x8616_field_mask(X8616_OPCODE_SR_SHIFT, X8616_OPCODE_SR_WIDTH),
|
||||||
X8616_OPCODE_PUSH_SR_FIXED = 0b00000110,
|
X8616_OPCODE_SR_PATTERN_MASK = u1_(~X8616_OPCODE_SR_MASK),
|
||||||
X8616_OPCODE_POP_SR_FIXED = 0b00000111,
|
|
||||||
X8616_OPCODE_SEG_FIXED = 0b00100110,
|
|
||||||
|
|
||||||
// 0111 cccc
|
|
||||||
|
|
||||||
X8616_OPCODE_CC_SHIFT = 0,
|
X8616_OPCODE_CC_SHIFT = 0,
|
||||||
X8616_OPCODE_CC_WIDTH = 4,
|
X8616_OPCODE_CC_MASK = x8616_field_mask(X8616_OPCODE_CC_SHIFT, X8616_OPCODE_CC_WIDTH),
|
||||||
X8616_OPCODE_CC_MASK = 0b00001111,
|
|
||||||
X8616_OPCODE_CC_PREFIX_SHIFT = X8616_OPCODE_CC_WIDTH,
|
|
||||||
|
|
||||||
// 00 op ...
|
// 00 ttt ... class + form live in the matcher
|
||||||
|
|
||||||
X8616_OPCODE_ALU_OP_SHIFT = 3,
|
X8616_OPCODE_ALU_CLASS = 0b00,
|
||||||
|
X8616_OPCODE_ALU_CLASS_SHIFT = 6,
|
||||||
|
X8616_OPCODE_ALU_CLASS_WIDTH = 2,
|
||||||
|
X8616_OPCODE_ALU_TTT_SHIFT = 3,
|
||||||
|
X8616_OPCODE_ALU_TTT_WIDTH = 3,
|
||||||
|
X8616_OPCODE_ALU_OP_SHIFT = X8616_OPCODE_ALU_TTT_SHIFT,
|
||||||
|
X8616_OPCODE_ALU_BIT2_SHIFT = 2,
|
||||||
|
X8616_OPCODE_ALU_RM_FORM = 0b0,
|
||||||
|
X8616_OPCODE_ALU_ACC_FORM = 0b10,
|
||||||
|
X8616_OPCODE_ALU_ACC_FORM_SHIFT = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -521,16 +606,17 @@ FI_ U1 x8616_modrm_sr (U1 modrm) { return (
|
|||||||
// };
|
// };
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
// Byte fields
|
// Shift opcode into the hole, then OR fields:
|
||||||
|
// x8616_enc_dw(mov_rm_r, d, w) → 100010 d w
|
||||||
|
|
||||||
#define x8616_enc_dw_prefix(prefix) ((prefix) << X8616_OPCODE_DW_PREFIX_SHIFT)
|
#define x8616_enc_dw_opcode(opcode) ((opcode) << X8616_OPCODE_DW_HOLE)
|
||||||
#define x8616_enc_sw_prefix(prefix) ((prefix) << X8616_OPCODE_SW_PREFIX_SHIFT)
|
#define x8616_enc_sw_opcode(opcode) ((opcode) << X8616_OPCODE_SW_HOLE)
|
||||||
#define x8616_enc_vw_prefix(prefix) ((prefix) << X8616_OPCODE_VW_PREFIX_SHIFT)
|
#define x8616_enc_vw_opcode(opcode) ((opcode) << X8616_OPCODE_VW_HOLE)
|
||||||
#define x8616_enc_z_prefix(prefix) ((prefix) << X8616_OPCODE_Z_PREFIX_SHIFT)
|
#define x8616_enc_z_opcode(opcode) ((opcode) << X8616_OPCODE_Z_HOLE)
|
||||||
#define x8616_enc_w_prefix(prefix) ((prefix) << X8616_OPCODE_W_PREFIX_SHIFT)
|
#define x8616_enc_w_opcode(opcode) ((opcode) << X8616_OPCODE_W_HOLE)
|
||||||
#define x8616_enc_reg_prefix(prefix) ((prefix) << X8616_OPCODE_REG_PREFIX_SHIFT)
|
#define x8616_enc_reg_opcode(opcode) ((opcode) << X8616_OPCODE_REG_HOLE)
|
||||||
#define x8616_enc_wreg_prefix(prefix) ((prefix) << X8616_OPCODE_WREG_PREFIX_SHIFT)
|
#define x8616_enc_wreg_opcode(opcode) ((opcode) << X8616_OPCODE_WREG_HOLE)
|
||||||
#define x8616_enc_d0_prefix(prefix) ((prefix) << X8616_OPCODE_D0_PREFIX_SHIFT)
|
#define x8616_enc_d0_opcode(opcode) ((opcode) << X8616_OPCODE_D0_HOLE)
|
||||||
|
|
||||||
#define x8616_enc_d(d) ((d) << X8616_OPCODE_DW_D_SHIFT)
|
#define x8616_enc_d(d) ((d) << X8616_OPCODE_DW_D_SHIFT)
|
||||||
#define x8616_enc_s(s) ((s) << X8616_OPCODE_SW_S_SHIFT)
|
#define x8616_enc_s(s) ((s) << X8616_OPCODE_SW_S_SHIFT)
|
||||||
@@ -538,8 +624,8 @@ FI_ U1 x8616_modrm_sr (U1 modrm) { return (
|
|||||||
#define x8616_enc_z(z) ((z) << X8616_OPCODE_Z_Z_SHIFT)
|
#define x8616_enc_z(z) ((z) << X8616_OPCODE_Z_Z_SHIFT)
|
||||||
#define x8616_enc_width(w) ((w) << X8616_OPCODE_W_W_SHIFT)
|
#define x8616_enc_width(w) ((w) << X8616_OPCODE_W_W_SHIFT)
|
||||||
#define x8616_enc_wreg_width(w) ((w) << X8616_OPCODE_WREG_W_SHIFT)
|
#define x8616_enc_wreg_width(w) ((w) << X8616_OPCODE_WREG_W_SHIFT)
|
||||||
#define x8616_enc_opcode_reg(r) ((r) << X8616_OPCODE_REG_REG_SHIFT)
|
#define x8616_enc_reg_field(r) ((r) << X8616_OPCODE_REG_REG_SHIFT)
|
||||||
#define x8616_enc_opcode_sr(sr) ((sr) << X8616_OPCODE_SR_SHIFT)
|
#define x8616_enc_sr_field(sr) ((sr) << X8616_OPCODE_SR_SHIFT)
|
||||||
#define x8616_enc_cc(cc) ((cc) << X8616_OPCODE_CC_SHIFT)
|
#define x8616_enc_cc(cc) ((cc) << X8616_OPCODE_CC_SHIFT)
|
||||||
|
|
||||||
#define x8616_enc_modrm_mod(mod) ((mod) << X8616_MODRM_MOD_SHIFT)
|
#define x8616_enc_modrm_mod(mod) ((mod) << X8616_MODRM_MOD_SHIFT)
|
||||||
@@ -547,94 +633,102 @@ FI_ U1 x8616_modrm_sr (U1 modrm) { return (
|
|||||||
#define x8616_enc_modrm_rm(rm) ((rm) << X8616_MODRM_RM_SHIFT)
|
#define x8616_enc_modrm_rm(rm) ((rm) << X8616_MODRM_RM_SHIFT)
|
||||||
#define x8616_enc_modrm_sr(sr) ((sr) << X8616_MODRM_SR_SHIFT)
|
#define x8616_enc_modrm_sr(sr) ((sr) << X8616_MODRM_SR_SHIFT)
|
||||||
|
|
||||||
#define x8616_enc_dw(prefix,d,w) C_(U1, x8616_enc_dw_prefix(prefix) | x8616_enc_d(d) | x8616_enc_width(w))
|
#define x8616_enc_dw(opcode,d,w) C_(U1, x8616_enc_dw_opcode(opcode) | x8616_enc_d(d) | x8616_enc_width(w))
|
||||||
#define x8616_enc_sw(prefix,s,w) C_(U1, x8616_enc_sw_prefix(prefix) | x8616_enc_s(s) | x8616_enc_width(w))
|
#define x8616_enc_sw(opcode,s,w) C_(U1, x8616_enc_sw_opcode(opcode) | x8616_enc_s(s) | x8616_enc_width(w))
|
||||||
#define x8616_enc_vw(prefix,v,w) C_(U1, x8616_enc_vw_prefix(prefix) | x8616_enc_v(v) | x8616_enc_width(w))
|
#define x8616_enc_vw(opcode,v,w) C_(U1, x8616_enc_vw_opcode(opcode) | x8616_enc_v(v) | x8616_enc_width(w))
|
||||||
#define x8616_enc_zp(prefix,z) C_(U1, x8616_enc_z_prefix(prefix) | x8616_enc_z(z))
|
#define x8616_enc_zp(opcode,z) C_(U1, x8616_enc_z_opcode(opcode) | x8616_enc_z(z))
|
||||||
#define x8616_enc_w(prefix,w) C_(U1, x8616_enc_w_prefix(prefix) | x8616_enc_width(w))
|
#define x8616_enc_w(opcode,w) C_(U1, x8616_enc_w_opcode(opcode) | x8616_enc_width(w))
|
||||||
#define x8616_enc_reg(prefix,reg) C_(U1, x8616_enc_reg_prefix(prefix) | x8616_enc_opcode_reg(reg))
|
#define x8616_enc_reg(opcode,reg) C_(U1, x8616_enc_reg_opcode(opcode) | x8616_enc_reg_field(reg))
|
||||||
#define x8616_enc_wreg(prefix,w,reg) C_(U1, x8616_enc_wreg_prefix(prefix) | x8616_enc_wreg_width(w) | x8616_enc_opcode_reg(reg))
|
#define x8616_enc_wreg(opcode,w,reg) C_(U1, x8616_enc_wreg_opcode(opcode) | x8616_enc_wreg_width(w) | x8616_enc_reg_field(reg))
|
||||||
#define x8616_enc_d0(prefix,d) C_(U1, x8616_enc_d0_prefix(prefix) | x8616_enc_d(d))
|
#define x8616_enc_d0(opcode,d) C_(U1, x8616_enc_d0_opcode(opcode) | x8616_enc_d(d))
|
||||||
#define x8616_enc_sr(fixed,sr) C_(U1, fixed | x8616_enc_opcode_sr(sr))
|
#define x8616_enc_sr(class,sr,low) C_(U1, ((class) << X8616_OPCODE_SR_CLASS_SHIFT) | x8616_enc_sr_field(sr) | (low))
|
||||||
#define x8616_enc_jcc(cc) C_(U1, (x8616_opcode_jcc << X8616_OPCODE_CC_PREFIX_SHIFT) | x8616_enc_cc(cc))
|
#define x8616_enc_jcc(cc) C_(U1, (x8616_opcode_jcc << X8616_OPCODE_CC_HOLE) | x8616_enc_cc(cc))
|
||||||
#define x8616_enc_modrm(mod,reg,rm) C_(U1, x8616_enc_modrm_mod(mod) | x8616_enc_modrm_reg(reg) | x8616_enc_modrm_rm(rm))
|
#define x8616_enc_modrm(mod,reg,rm) C_(U1, x8616_enc_modrm_mod(mod) | x8616_enc_modrm_reg(reg) | x8616_enc_modrm_rm(rm))
|
||||||
#define x8616_enc_modrm_seg(mod,sr,rm) C_(U1, x8616_enc_modrm_mod(mod) | x8616_enc_modrm_sr(sr) | x8616_enc_modrm_rm(rm))
|
#define x8616_enc_modrm_seg(mod,sr,rm) C_(U1, x8616_enc_modrm_mod(mod) | x8616_enc_modrm_sr(sr) | x8616_enc_modrm_rm(rm))
|
||||||
|
|
||||||
#define x8616_enc_alu_op(alu) ((alu) << X8616_OPCODE_ALU_OP_SHIFT)
|
// Catalog matchers. header_w: PUSH r/m is incdec_rm + w=1.
|
||||||
#define x8616_enc_alu_acc_i_fixed (X8616_OPCODE_ALU_ACC_I_FIXED << X8616_OPCODE_W_PREFIX_SHIFT)
|
// header_d0: MOV sreg 100011 d 0. header_sr: 000 sr 110.
|
||||||
#define x8616_enc_alu_rm_r(alu,d,w) C_(U1, x8616_enc_alu_op(alu) | x8616_enc_d(d) | x8616_enc_width(w))
|
#define x8616_header_w(opcode,w) ((X8616_BytePattern){ x8616_enc_w((opcode), (w)), X8616_BYTE_MASK })
|
||||||
#define x8616_enc_alu_acc_i(alu,w) C_(U1, x8616_enc_alu_op(alu) | x8616_enc_alu_acc_i_fixed | x8616_enc_width(w))
|
#define x8616_header_sr(class,low) ((X8616_BytePattern){ u1_(((class) << X8616_OPCODE_SR_CLASS_SHIFT) | (low)), X8616_OPCODE_SR_PATTERN_MASK })
|
||||||
|
#define x8616_header_d0(opcode) ((X8616_BytePattern){ u1_((opcode) << X8616_OPCODE_D0_HOLE), X8616_OPCODE_D0_OPCODE_MASK })
|
||||||
|
|
||||||
|
// 00 ttt 0 d w and 00 ttt 10 w. Class + ttt + form.
|
||||||
|
#define x8616_enc_alu_class() (X8616_OPCODE_ALU_CLASS << X8616_OPCODE_ALU_CLASS_SHIFT)
|
||||||
|
#define x8616_enc_alu_ttt(ttt) ((ttt) << X8616_OPCODE_ALU_TTT_SHIFT)
|
||||||
|
#define x8616_enc_alu_op(alu) x8616_enc_alu_ttt(alu)
|
||||||
|
#define x8616_enc_alu_rm_r(ttt,d,w) C_(U1, x8616_enc_alu_class() | x8616_enc_alu_ttt(ttt) | (X8616_OPCODE_ALU_RM_FORM << X8616_OPCODE_ALU_BIT2_SHIFT) | x8616_enc_d(d) | x8616_enc_width(w))
|
||||||
|
#define x8616_enc_alu_acc_i(ttt,w) C_(U1, x8616_enc_alu_class() | x8616_enc_alu_ttt(ttt) | (X8616_OPCODE_ALU_ACC_FORM << X8616_OPCODE_ALU_ACC_FORM_SHIFT) | x8616_enc_width(w))
|
||||||
|
|
||||||
// Scalar / generic packets
|
// Scalar / generic packets
|
||||||
|
|
||||||
#define x8616_emit_u2(value) u1_(u2_(value) >> 0), u1_(u2_(value) >> 8)
|
#define x8616_emit_u2(value) u2_lo(value), u2_hi(value)
|
||||||
#define x8616_emit_s2(value) x8616_emit_u2(value)
|
#define x8616_emit_s2(value) x8616_emit_u2(value)
|
||||||
#define x8616_emit_op(opcode) u1_(opcode)
|
#define x8616_emit_op(opcode) u1_(opcode)
|
||||||
#define x8616_emit_op_i8(opcode,imm) u1_(opcode), u1_(imm)
|
#define x8616_emit_op_i8(opcode,imm) u1_(opcode), u1_(imm)
|
||||||
#define x8616_emit_op_i16(opcode,imm) u1_(opcode), x8616_emit_u2(imm)
|
#define x8616_emit_op_i16(opcode,imm) u1_(opcode), x8616_emit_u2(imm)
|
||||||
#define x8616_emit_op_far(opcode,seg,off) u1_(opcode), x8616_emit_u2(off), x8616_emit_u2(seg)
|
#define x8616_emit_op_far(opcode,seg,off) u1_(opcode), x8616_emit_u2(off), x8616_emit_u2(seg)
|
||||||
|
|
||||||
#define x8616_emit_modrm(opcode,mod,reg,rm) u1_(opcode), x8616_enc_modrm(mod,reg,rm)
|
#define x8616_emit_modrm(header,mod,reg,rm) u1_(header), x8616_enc_modrm(mod,reg,rm)
|
||||||
#define x8616_emit_modrm_d8(opcode,reg,rm,disp) x8616_emit_modrm(opcode,x8616_mod_mem_d8,reg,rm), u1_(disp)
|
#define x8616_emit_modrm_d8(header,reg,rm,disp) x8616_emit_modrm (header,x8616_mod_mem_d8,reg,rm), u1_(disp)
|
||||||
#define x8616_emit_modrm_d16(opcode,reg,rm,disp) x8616_emit_modrm(opcode,x8616_mod_mem_d16,reg,rm), x8616_emit_s2(disp)
|
#define x8616_emit_modrm_d16(header,reg,rm,disp) x8616_emit_modrm (header,x8616_mod_mem_d16,reg,rm), x8616_emit_s2(disp)
|
||||||
#define x8616_emit_modrm_direct(opcode,reg,addr) x8616_emit_modrm(opcode,x8616_mod_mem,reg,x8616_ea_direct), x8616_emit_u2(addr)
|
#define x8616_emit_modrm_direct(header,reg,addr) x8616_emit_modrm (header,x8616_mod_mem,reg,x8616_ea_direct), x8616_emit_u2(addr)
|
||||||
#define x8616_emit_modrm_i8(opcode,mod,reg,rm,imm) x8616_emit_modrm(opcode,mod,reg,rm), u1_(imm)
|
#define x8616_emit_modrm_i8(header,mod,reg,rm,imm) x8616_emit_modrm (header,mod,reg,rm), u1_(imm)
|
||||||
#define x8616_emit_modrm_i16(opcode,mod,reg,rm,imm) x8616_emit_modrm(opcode,mod,reg,rm), x8616_emit_u2(imm)
|
#define x8616_emit_modrm_i16(header,mod,reg,rm,imm) x8616_emit_modrm (header,mod,reg,rm), x8616_emit_u2(imm)
|
||||||
#define x8616_emit_modrm_d8_i8(opcode,reg,rm,disp,imm) x8616_emit_modrm_d8(opcode,reg,rm,disp), u1_(imm)
|
#define x8616_emit_modrm_d8_i8(header,reg,rm,disp,imm) x8616_emit_modrm_d8 (header,reg,rm,disp), u1_(imm)
|
||||||
#define x8616_emit_modrm_d8_i16(opcode,reg,rm,disp,imm) x8616_emit_modrm_d8(opcode,reg,rm,disp), x8616_emit_u2(imm)
|
#define x8616_emit_modrm_d8_i16(header,reg,rm,disp,imm) x8616_emit_modrm_d8 (header,reg,rm,disp), x8616_emit_u2(imm)
|
||||||
#define x8616_emit_modrm_d16_i8(opcode,reg,rm,disp,imm) x8616_emit_modrm_d16(opcode,reg,rm,disp), u1_(imm)
|
#define x8616_emit_modrm_d16_i8(header,reg,rm,disp,imm) x8616_emit_modrm_d16(header,reg,rm,disp), u1_(imm)
|
||||||
#define x8616_emit_modrm_d16_i16(opcode,reg,rm,disp,imm) x8616_emit_modrm_d16(opcode,reg,rm,disp), x8616_emit_u2(imm)
|
#define x8616_emit_modrm_d16_i16(header,reg,rm,disp,imm) x8616_emit_modrm_d16(header,reg,rm,disp), x8616_emit_u2(imm)
|
||||||
|
|
||||||
// r/m + register / immediate packets
|
// r/m + register / immediate packets
|
||||||
|
|
||||||
#define x8616_emit_rm_r(prefix,d,w,mod,reg,rm) x8616_enc_dw(prefix,d,w), x8616_enc_modrm(mod,reg,rm)
|
#define x8616_emit_rm_r(opcode,d,w,mod,reg,rm) x8616_enc_dw (opcode,d,w), x8616_enc_modrm(mod,reg,rm)
|
||||||
#define x8616_emit_rm_r_d8(prefix,d,w,reg,rm,disp) x8616_emit_rm_r(prefix,d,w,x8616_mod_mem_d8,reg,rm), u1_(disp)
|
#define x8616_emit_rm_r_d8(opcode,d,w,reg,rm,disp) x8616_emit_rm_r(opcode,d,w,x8616_mod_mem_d8, reg,rm), u1_(disp)
|
||||||
#define x8616_emit_rm_r_d16(prefix,d,w,reg,rm,disp) x8616_emit_rm_r(prefix,d,w,x8616_mod_mem_d16,reg,rm), x8616_emit_s2(disp)
|
#define x8616_emit_rm_r_d16(opcode,d,w,reg,rm,disp) x8616_emit_rm_r(opcode,d,w,x8616_mod_mem_d16,reg,rm), x8616_emit_s2(disp)
|
||||||
#define x8616_emit_rm_r_direct(prefix,d,w,reg,addr) x8616_emit_rm_r(prefix,d,w,x8616_mod_mem,reg,x8616_ea_direct), x8616_emit_u2(addr)
|
#define x8616_emit_rm_r_direct(opcode,d,w,reg,addr) x8616_emit_rm_r(opcode,d,w,x8616_mod_mem,reg,x8616_ea_direct), x8616_emit_u2(addr)
|
||||||
|
|
||||||
#define x8616_emit_rm_i8_w(prefix,ext,mod,rm,imm) x8616_enc_w(prefix,x8616_w_byte), x8616_enc_modrm(mod,ext,rm), u1_(imm)
|
#define x8616_emit_rm_i8_w(opcode,ext,mod,rm,imm) x8616_enc_w(opcode,x8616_w_byte), x8616_enc_modrm(mod,ext,rm), u1_(imm)
|
||||||
#define x8616_emit_rm_i16_w(prefix,ext,mod,rm,imm) x8616_enc_w(prefix,x8616_w_word), x8616_enc_modrm(mod,ext,rm), x8616_emit_u2(imm)
|
#define x8616_emit_rm_i16_w(opcode,ext,mod,rm,imm) x8616_enc_w(opcode,x8616_w_word), x8616_enc_modrm(mod,ext,rm), x8616_emit_u2(imm)
|
||||||
#define x8616_emit_rm_i8_w_d8(prefix,ext,rm,disp,imm) x8616_enc_w(prefix,x8616_w_byte), x8616_enc_modrm(x8616_mod_mem_d8,ext,rm), u1_(disp), u1_(imm)
|
#define x8616_emit_rm_i8_w_d8(opcode,ext,rm,disp,imm) x8616_enc_w(opcode,x8616_w_byte), x8616_enc_modrm(x8616_mod_mem_d8,ext,rm), u1_(disp), u1_(imm)
|
||||||
#define x8616_emit_rm_i16_w_d8(prefix,ext,rm,disp,imm) x8616_enc_w(prefix,x8616_w_word), x8616_enc_modrm(x8616_mod_mem_d8,ext,rm), u1_(disp), x8616_emit_u2(imm)
|
#define x8616_emit_rm_i16_w_d8(opcode,ext,rm,disp,imm) x8616_enc_w(opcode,x8616_w_word), x8616_enc_modrm(x8616_mod_mem_d8,ext,rm), u1_(disp), x8616_emit_u2(imm)
|
||||||
#define x8616_emit_rm_i8_w_d16(prefix,ext,rm,disp,imm) x8616_enc_w(prefix,x8616_w_byte), x8616_enc_modrm(x8616_mod_mem_d16,ext,rm), x8616_emit_s2(disp), u1_(imm)
|
#define x8616_emit_rm_i8_w_d16(opcode,ext,rm,disp,imm) x8616_enc_w(opcode,x8616_w_byte), x8616_enc_modrm(x8616_mod_mem_d16,ext,rm), x8616_emit_s2(disp), u1_(imm)
|
||||||
#define x8616_emit_rm_i16_w_d16(prefix,ext,rm,disp,imm) x8616_enc_w(prefix,x8616_w_word), x8616_enc_modrm(x8616_mod_mem_d16,ext,rm), x8616_emit_s2(disp), x8616_emit_u2(imm)
|
#define x8616_emit_rm_i16_w_d16(opcode,ext,rm,disp,imm) x8616_enc_w(opcode,x8616_w_word), x8616_enc_modrm(x8616_mod_mem_d16,ext,rm), x8616_emit_s2(disp), x8616_emit_u2(imm)
|
||||||
|
|
||||||
#define x8616_emit_rm_i8(prefix,s,w,ext,mod,rm,imm) x8616_enc_sw(prefix,s,w), x8616_enc_modrm(mod,ext,rm), u1_(imm)
|
#define x8616_emit_rm_i8(opcode,s,w,ext,mod,rm,imm) x8616_enc_sw(opcode,s,w), x8616_enc_modrm(mod,ext,rm), u1_(imm)
|
||||||
#define x8616_emit_rm_i16(prefix,ext,mod,rm,imm) x8616_enc_sw(prefix,x8616_s_full,x8616_w_word), x8616_enc_modrm(mod,ext,rm), x8616_emit_u2(imm)
|
#define x8616_emit_rm_i16(opcode,ext,mod,rm,imm) x8616_enc_sw(opcode,x8616_s_full,x8616_w_word), x8616_enc_modrm(mod,ext,rm), x8616_emit_u2(imm)
|
||||||
#define x8616_emit_rm_i8_d8(prefix,s,w,ext,rm,disp,imm) x8616_enc_sw(prefix,s,w), x8616_enc_modrm(x8616_mod_mem_d8,ext,rm), u1_(disp), u1_(imm)
|
#define x8616_emit_rm_i8_d8(opcode,s,w,ext,rm,disp,imm) x8616_enc_sw(opcode,s,w), x8616_enc_modrm(x8616_mod_mem_d8,ext,rm), u1_(disp), u1_(imm)
|
||||||
#define x8616_emit_rm_i16_d8(prefix,ext,rm,disp,imm) x8616_enc_sw(prefix,x8616_s_full,x8616_w_word), x8616_enc_modrm(x8616_mod_mem_d8,ext,rm), u1_(disp), x8616_emit_u2(imm)
|
#define x8616_emit_rm_i16_d8(opcode,ext,rm,disp,imm) x8616_enc_sw(opcode,x8616_s_full,x8616_w_word), x8616_enc_modrm(x8616_mod_mem_d8,ext,rm), u1_(disp), x8616_emit_u2(imm)
|
||||||
#define x8616_emit_rm_i8_d16(prefix,s,w,ext,rm,disp,imm) x8616_enc_sw(prefix,s,w), x8616_enc_modrm(x8616_mod_mem_d16,ext,rm), x8616_emit_s2(disp), u1_(imm)
|
#define x8616_emit_rm_i8_d16(opcode,s,w,ext,rm,disp,imm) x8616_enc_sw(opcode,s,w), x8616_enc_modrm(x8616_mod_mem_d16,ext,rm), x8616_emit_s2(disp), u1_(imm)
|
||||||
#define x8616_emit_rm_i16_d16(prefix,ext,rm,disp,imm) x8616_enc_sw(prefix,x8616_s_full,x8616_w_word), x8616_enc_modrm(x8616_mod_mem_d16,ext,rm), x8616_emit_s2(disp), x8616_emit_u2(imm)
|
#define x8616_emit_rm_i16_d16(opcode,ext,rm,disp,imm) x8616_enc_sw(opcode,x8616_s_full,x8616_w_word), x8616_enc_modrm(x8616_mod_mem_d16,ext,rm), x8616_emit_s2(disp), x8616_emit_u2(imm)
|
||||||
|
|
||||||
// Segment-register packet
|
// Segment-register packet
|
||||||
|
|
||||||
#define x8616_emit_seg_rm(d,mod,sr,rm) x8616_enc_d0(x8616_opcode_mov_seg_rm,d), x8616_enc_modrm_seg(mod,sr,rm)
|
#define x8616_emit_seg_rm(d,mod,sr,rm) x8616_enc_d0(x8616_opcode_mov_seg_rm,d), x8616_enc_modrm_seg(mod,sr,rm)
|
||||||
#define x8616_emit_seg_rm_d8(d,sr,rm,disp) x8616_emit_seg_rm(d,x8616_mod_mem_d8,sr,rm), u1_(disp)
|
#define x8616_emit_seg_rm_d8(d,sr,rm,disp) x8616_emit_seg_rm(d,x8616_mod_mem_d8,sr,rm), u1_(disp)
|
||||||
#define x8616_emit_seg_rm_d16(d,sr,rm,disp) x8616_emit_seg_rm(d,x8616_mod_mem_d16,sr,rm), x8616_emit_s2(disp)
|
#define x8616_emit_seg_rm_d16(d,sr,rm,disp) x8616_emit_seg_rm(d,x8616_mod_mem_d16,sr,rm), x8616_emit_s2(disp)
|
||||||
#define x8616_emit_seg_rm_direct(d,sr,addr) x8616_emit_seg_rm(d,x8616_mod_mem,sr,x8616_ea_direct), x8616_emit_u2(addr)
|
#define x8616_emit_seg_rm_direct(d,sr,addr) x8616_emit_seg_rm(d,x8616_mod_mem,sr,x8616_ea_direct), x8616_emit_u2(addr)
|
||||||
|
|
||||||
// MOV
|
// MOV — Table 4-12 100010 d w / 1011 w reg / 101000 d w / 100011 d 0
|
||||||
|
|
||||||
#define x8616_nop() x8616_emit_op(x8616_opcode_nop)
|
#define x8616_nop() x8616_enc_reg (x8616_opcode_xchg_ax_reg, x8616_ax) /* 10010 000 */
|
||||||
#define x8616_mov_r8_r8(dst,src) x8616_emit_rm_r(x8616_opcode_mov_rm_r,x8616_d_reg_dst,x8616_w_byte,x8616_mod_reg,dst,src)
|
#define x8616_mov_r8_r8(dst,src) x8616_emit_rm_r (x8616_opcode_mov_rm_r,x8616_d_reg_dst,x8616_w_byte,x8616_mod_reg,dst,src)
|
||||||
#define x8616_mov_r16_r16(dst,src) x8616_emit_rm_r(x8616_opcode_mov_rm_r,x8616_d_reg_dst,x8616_w_word,x8616_mod_reg,dst,src)
|
#define x8616_mov_r16_r16(dst,src) x8616_emit_rm_r (x8616_opcode_mov_rm_r,x8616_d_reg_dst,x8616_w_word,x8616_mod_reg,dst,src)
|
||||||
#define x8616_mov_r8_i(dst,imm) x8616_enc_wreg(x8616_opcode_mov_r_i,x8616_w_byte,dst), u1_(imm)
|
#define x8616_mov_r8_i(dst,imm) x8616_enc_wreg (x8616_opcode_mov_r_i,x8616_w_byte,dst), u1_(imm)
|
||||||
#define x8616_mov_r16_i(dst,imm) x8616_enc_wreg(x8616_opcode_mov_r_i,x8616_w_word,dst), x8616_emit_u2(imm)
|
#define x8616_mov_r16_i(dst,imm) x8616_enc_wreg (x8616_opcode_mov_r_i,x8616_w_word,dst), x8616_emit_u2(imm)
|
||||||
#define x8616_mov_al_moffs(addr) x8616_enc_dw(x8616_opcode_mov_acc_mem,x8616_d_acc_dst,x8616_w_byte), x8616_emit_u2(addr)
|
#define x8616_mov_al_moffs(addr) x8616_enc_dw (x8616_opcode_mov_acc_mem,x8616_d_acc_dst,x8616_w_byte), x8616_emit_u2(addr)
|
||||||
#define x8616_mov_ax_moffs(addr) x8616_enc_dw(x8616_opcode_mov_acc_mem,x8616_d_acc_dst,x8616_w_word), x8616_emit_u2(addr)
|
#define x8616_mov_ax_moffs(addr) x8616_enc_dw (x8616_opcode_mov_acc_mem,x8616_d_acc_dst,x8616_w_word), x8616_emit_u2(addr)
|
||||||
#define x8616_mov_moffs_al(addr) x8616_enc_dw(x8616_opcode_mov_acc_mem,x8616_d_mem_dst,x8616_w_byte), x8616_emit_u2(addr)
|
#define x8616_mov_moffs_al(addr) x8616_enc_dw (x8616_opcode_mov_acc_mem,x8616_d_mem_dst,x8616_w_byte), x8616_emit_u2(addr)
|
||||||
#define x8616_mov_moffs_ax(addr) x8616_enc_dw(x8616_opcode_mov_acc_mem,x8616_d_mem_dst,x8616_w_word), x8616_emit_u2(addr)
|
#define x8616_mov_moffs_ax(addr) x8616_enc_dw (x8616_opcode_mov_acc_mem,x8616_d_mem_dst,x8616_w_word), x8616_emit_u2(addr)
|
||||||
#define x8616_mov_rm_seg(mod,rm,sr) x8616_emit_seg_rm(x8616_d_rm_dst,mod,sr,rm)
|
#define x8616_mov_rm_seg(mod,rm,sr) x8616_emit_seg_rm(x8616_d_rm_dst,mod,sr,rm)
|
||||||
#define x8616_mov_seg_rm(sr,mod,rm) x8616_emit_seg_rm(x8616_d_seg_dst,mod,sr,rm)
|
#define x8616_mov_seg_rm(sr,mod,rm) x8616_emit_seg_rm(x8616_d_seg_dst,mod,sr,rm)
|
||||||
|
|
||||||
// Stack / exchange
|
// Stack — 01010 reg / 000 sr 110 / PUSH r/m = 1111111 w=1 /6
|
||||||
|
|
||||||
#define x8616_push_r16(reg) x8616_enc_reg(x8616_opcode_push_reg,reg)
|
#define x8616_push_r16(reg) x8616_enc_reg (x8616_opcode_push_reg,reg)
|
||||||
#define x8616_pop_r16(reg) x8616_enc_reg(x8616_opcode_pop_reg,reg)
|
#define x8616_pop_r16(reg) x8616_enc_reg (x8616_opcode_pop_reg,reg)
|
||||||
#define x8616_push_seg(seg) x8616_enc_sr(X8616_OPCODE_PUSH_SR_FIXED,seg)
|
#define x8616_push_seg(seg) x8616_enc_sr (x8616_opcode_sr_stack,seg,x8616_sr_low_push)
|
||||||
#define x8616_pop_seg(seg) x8616_enc_sr(X8616_OPCODE_POP_SR_FIXED,seg)
|
#define x8616_pop_seg(seg) x8616_enc_sr (x8616_opcode_sr_stack,seg,x8616_sr_low_pop)
|
||||||
#define x8616_push_rm(mod,rm) x8616_emit_modrm(x8616_opcode_group_ff,mod,x8616_ff_push,rm)
|
#define x8616_push_rm(mod,rm) x8616_emit_modrm(x8616_enc_w(x8616_opcode_incdec_rm,x8616_w_word),mod,x8616_ff_push,rm)
|
||||||
#define x8616_pop_rm(mod,rm) x8616_emit_modrm(x8616_opcode_pop_rm,mod,0b000,rm)
|
#define x8616_pop_rm(mod,rm) x8616_emit_modrm(x8616_opcode_pop_rm,mod,x8616_digit_0,rm)
|
||||||
|
|
||||||
#define x8616_xchg_r8_r8(a,b) x8616_enc_w(x8616_opcode_xchg_rm_r,x8616_w_byte), x8616_enc_modrm(x8616_mod_reg,a,b)
|
#define x8616_xchg_r8_r8(a,b) x8616_enc_w(x8616_opcode_xchg_rm_r,x8616_w_byte), x8616_enc_modrm(x8616_mod_reg,a,b)
|
||||||
#define x8616_xchg_r16_r16(a,b) x8616_enc_w(x8616_opcode_xchg_rm_r,x8616_w_word), x8616_enc_modrm(x8616_mod_reg,a,b)
|
#define x8616_xchg_r16_r16(a,b) x8616_enc_w(x8616_opcode_xchg_rm_r,x8616_w_word), x8616_enc_modrm(x8616_mod_reg,a,b)
|
||||||
@@ -660,58 +754,58 @@ FI_ U1 x8616_modrm_sr (U1 modrm) { return (
|
|||||||
#define x8616_pushf() x8616_emit_op(x8616_opcode_pushf)
|
#define x8616_pushf() x8616_emit_op(x8616_opcode_pushf)
|
||||||
#define x8616_popf() x8616_emit_op(x8616_opcode_popf)
|
#define x8616_popf() x8616_emit_op(x8616_opcode_popf)
|
||||||
|
|
||||||
// Arithmetic / logical
|
// Arithmetic — 00 ttt 0 d w / 00 ttt 10 w / 100000 s w /ttt
|
||||||
|
|
||||||
#define x8616_emit_alu_r8_r8(alu,dst,src) x8616_enc_alu_rm_r(alu,x8616_d_reg_dst,x8616_w_byte), x8616_enc_modrm(x8616_mod_reg,dst,src)
|
#define x8616_emit_alu_r8_r8(alu,dst,src) x8616_enc_alu_rm_r (alu,x8616_d_reg_dst,x8616_w_byte), x8616_enc_modrm(x8616_mod_reg,dst,src)
|
||||||
#define x8616_emit_alu_r16_r16(alu,dst,src) x8616_enc_alu_rm_r(alu,x8616_d_reg_dst,x8616_w_word), x8616_enc_modrm(x8616_mod_reg,dst,src)
|
#define x8616_emit_alu_r16_r16(alu,dst,src) x8616_enc_alu_rm_r (alu,x8616_d_reg_dst,x8616_w_word), x8616_enc_modrm(x8616_mod_reg,dst,src)
|
||||||
#define x8616_emit_alu_r8_i(alu,dst,imm) x8616_emit_rm_i8(x8616_opcode_alu_rm_i,x8616_s_full,x8616_w_byte,alu,x8616_mod_reg,dst,imm)
|
#define x8616_emit_alu_r8_i(alu,dst,imm) x8616_emit_rm_i8 (x8616_opcode_alu_rm_i,x8616_s_full,x8616_w_byte,alu,x8616_mod_reg,dst,imm)
|
||||||
#define x8616_emit_alu_r16_i(alu,dst,imm) x8616_emit_rm_i16(x8616_opcode_alu_rm_i,alu,x8616_mod_reg,dst,imm)
|
#define x8616_emit_alu_r16_i(alu,dst,imm) x8616_emit_rm_i16 (x8616_opcode_alu_rm_i,alu,x8616_mod_reg,dst,imm)
|
||||||
#define x8616_emit_alu_r16_i8s(alu,dst,imm) x8616_emit_rm_i8(x8616_opcode_alu_rm_i,x8616_s_extend,x8616_w_word,alu,x8616_mod_reg,dst,imm)
|
#define x8616_emit_alu_r16_i8s(alu,dst,imm) x8616_emit_rm_i8 (x8616_opcode_alu_rm_i,x8616_s_extend,x8616_w_word,alu,x8616_mod_reg,dst,imm)
|
||||||
#define x8616_emit_logic_r8_i(alu,dst,imm) x8616_emit_rm_i8_w(x8616_opcode_logic_rm_i,alu,x8616_mod_reg,dst,imm)
|
#define x8616_emit_logic_r8_i(alu,dst,imm) x8616_emit_rm_i8 (x8616_opcode_alu_rm_i,x8616_s_full,x8616_w_byte,alu,x8616_mod_reg,dst,imm)
|
||||||
#define x8616_emit_logic_r16_i(alu,dst,imm) x8616_emit_rm_i16_w(x8616_opcode_logic_rm_i,alu,x8616_mod_reg,dst,imm)
|
#define x8616_emit_logic_r16_i(alu,dst,imm) x8616_emit_rm_i16 (x8616_opcode_alu_rm_i,alu,x8616_mod_reg,dst,imm)
|
||||||
#define x8616_emit_alu_al_i(alu,imm) x8616_enc_alu_acc_i(alu,x8616_w_byte), u1_(imm)
|
#define x8616_emit_alu_al_i(alu,imm) x8616_enc_alu_acc_i(alu,x8616_w_byte), u1_(imm)
|
||||||
#define x8616_emit_alu_ax_i(alu,imm) x8616_enc_alu_acc_i(alu,x8616_w_word), x8616_emit_u2(imm)
|
#define x8616_emit_alu_ax_i(alu,imm) x8616_enc_alu_acc_i(alu,x8616_w_word), x8616_emit_u2(imm)
|
||||||
|
|
||||||
#define x8616_add_r8_r8(dst,src) x8616_emit_alu_r8_r8(x8616_add,dst,src)
|
#define x8616_add_r8_r8(dst,src) x8616_emit_alu_r8_r8 (x8616_add,dst,src)
|
||||||
#define x8616_add_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_add,dst,src)
|
#define x8616_add_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_add,dst,src)
|
||||||
#define x8616_or_r8_r8(dst,src) x8616_emit_alu_r8_r8(x8616_or,dst,src)
|
#define x8616_or_r8_r8(dst,src) x8616_emit_alu_r8_r8 (x8616_or,dst,src)
|
||||||
#define x8616_or_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_or,dst,src)
|
#define x8616_or_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_or,dst,src)
|
||||||
#define x8616_adc_r8_r8(dst,src) x8616_emit_alu_r8_r8(x8616_adc,dst,src)
|
#define x8616_adc_r8_r8(dst,src) x8616_emit_alu_r8_r8 (x8616_adc,dst,src)
|
||||||
#define x8616_adc_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_adc,dst,src)
|
#define x8616_adc_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_adc,dst,src)
|
||||||
#define x8616_sbb_r8_r8(dst,src) x8616_emit_alu_r8_r8(x8616_sbb,dst,src)
|
#define x8616_sbb_r8_r8(dst,src) x8616_emit_alu_r8_r8 (x8616_sbb,dst,src)
|
||||||
#define x8616_sbb_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_sbb,dst,src)
|
#define x8616_sbb_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_sbb,dst,src)
|
||||||
#define x8616_and_r8_r8(dst,src) x8616_emit_alu_r8_r8(x8616_and,dst,src)
|
#define x8616_and_r8_r8(dst,src) x8616_emit_alu_r8_r8 (x8616_and,dst,src)
|
||||||
#define x8616_and_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_and,dst,src)
|
#define x8616_and_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_and,dst,src)
|
||||||
#define x8616_sub_r8_r8(dst,src) x8616_emit_alu_r8_r8(x8616_sub,dst,src)
|
#define x8616_sub_r8_r8(dst,src) x8616_emit_alu_r8_r8 (x8616_sub,dst,src)
|
||||||
#define x8616_sub_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_sub,dst,src)
|
#define x8616_sub_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_sub,dst,src)
|
||||||
#define x8616_xor_r8_r8(dst,src) x8616_emit_alu_r8_r8(x8616_xor,dst,src)
|
#define x8616_xor_r8_r8(dst,src) x8616_emit_alu_r8_r8 (x8616_xor,dst,src)
|
||||||
#define x8616_xor_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_xor,dst,src)
|
#define x8616_xor_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_xor,dst,src)
|
||||||
#define x8616_cmp_r8_r8(dst,src) x8616_emit_alu_r8_r8(x8616_cmp,dst,src)
|
#define x8616_cmp_r8_r8(dst,src) x8616_emit_alu_r8_r8 (x8616_cmp,dst,src)
|
||||||
#define x8616_cmp_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_cmp,dst,src)
|
#define x8616_cmp_r16_r16(dst,src) x8616_emit_alu_r16_r16(x8616_cmp,dst,src)
|
||||||
|
|
||||||
#define x8616_add_r8_i(dst,imm) x8616_emit_alu_r8_i(x8616_add,dst,imm)
|
#define x8616_add_r8_i(dst,imm) x8616_emit_alu_r8_i (x8616_add,dst,imm)
|
||||||
#define x8616_add_r16_i(dst,imm) x8616_emit_alu_r16_i(x8616_add,dst,imm)
|
#define x8616_add_r16_i(dst,imm) x8616_emit_alu_r16_i (x8616_add,dst,imm)
|
||||||
#define x8616_add_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_add,dst,imm)
|
#define x8616_add_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_add,dst,imm)
|
||||||
#define x8616_or_r8_i(dst,imm) x8616_emit_logic_r8_i(x8616_or,dst,imm)
|
#define x8616_or_r8_i(dst,imm) x8616_emit_logic_r8_i (x8616_or, dst,imm)
|
||||||
#define x8616_or_r16_i(dst,imm) x8616_emit_logic_r16_i(x8616_or,dst,imm)
|
#define x8616_or_r16_i(dst,imm) x8616_emit_logic_r16_i(x8616_or, dst,imm)
|
||||||
#define x8616_adc_r8_i(dst,imm) x8616_emit_alu_r8_i(x8616_adc,dst,imm)
|
#define x8616_adc_r8_i(dst,imm) x8616_emit_alu_r8_i (x8616_adc,dst,imm)
|
||||||
#define x8616_adc_r16_i(dst,imm) x8616_emit_alu_r16_i(x8616_adc,dst,imm)
|
#define x8616_adc_r16_i(dst,imm) x8616_emit_alu_r16_i (x8616_adc,dst,imm)
|
||||||
#define x8616_adc_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_adc,dst,imm)
|
#define x8616_adc_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_adc,dst,imm)
|
||||||
#define x8616_sbb_r8_i(dst,imm) x8616_emit_alu_r8_i(x8616_sbb,dst,imm)
|
#define x8616_sbb_r8_i(dst,imm) x8616_emit_alu_r8_i (x8616_sbb,dst,imm)
|
||||||
#define x8616_sbb_r16_i(dst,imm) x8616_emit_alu_r16_i(x8616_sbb,dst,imm)
|
#define x8616_sbb_r16_i(dst,imm) x8616_emit_alu_r16_i (x8616_sbb,dst,imm)
|
||||||
#define x8616_sbb_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_sbb,dst,imm)
|
#define x8616_sbb_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_sbb,dst,imm)
|
||||||
#define x8616_and_r8_i(dst,imm) x8616_emit_logic_r8_i(x8616_and,dst,imm)
|
#define x8616_and_r8_i(dst,imm) x8616_emit_logic_r8_i (x8616_and,dst,imm)
|
||||||
#define x8616_and_r16_i(dst,imm) x8616_emit_logic_r16_i(x8616_and,dst,imm)
|
#define x8616_and_r16_i(dst,imm) x8616_emit_logic_r16_i(x8616_and,dst,imm)
|
||||||
#define x8616_sub_r8_i(dst,imm) x8616_emit_alu_r8_i(x8616_sub,dst,imm)
|
#define x8616_sub_r8_i(dst,imm) x8616_emit_alu_r8_i (x8616_sub,dst,imm)
|
||||||
#define x8616_sub_r16_i(dst,imm) x8616_emit_alu_r16_i(x8616_sub,dst,imm)
|
#define x8616_sub_r16_i(dst,imm) x8616_emit_alu_r16_i (x8616_sub,dst,imm)
|
||||||
#define x8616_sub_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_sub,dst,imm)
|
#define x8616_sub_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_sub,dst,imm)
|
||||||
#define x8616_xor_r8_i(dst,imm) x8616_emit_logic_r8_i(x8616_xor,dst,imm)
|
#define x8616_xor_r8_i(dst,imm) x8616_emit_logic_r8_i (x8616_xor,dst,imm)
|
||||||
#define x8616_xor_r16_i(dst,imm) x8616_emit_logic_r16_i(x8616_xor,dst,imm)
|
#define x8616_xor_r16_i(dst,imm) x8616_emit_logic_r16_i(x8616_xor,dst,imm)
|
||||||
#define x8616_cmp_r8_i(dst,imm) x8616_emit_alu_r8_i(x8616_cmp,dst,imm)
|
#define x8616_cmp_r8_i(dst,imm) x8616_emit_alu_r8_i (x8616_cmp,dst,imm)
|
||||||
#define x8616_cmp_r16_i(dst,imm) x8616_emit_alu_r16_i(x8616_cmp,dst,imm)
|
#define x8616_cmp_r16_i(dst,imm) x8616_emit_alu_r16_i (x8616_cmp,dst,imm)
|
||||||
#define x8616_cmp_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_cmp,dst,imm)
|
#define x8616_cmp_r16_i8s(dst,imm) x8616_emit_alu_r16_i8s(x8616_cmp,dst,imm)
|
||||||
|
|
||||||
// INC / DEC / unary
|
// INC/DEC — 01000 reg / 1111111 w /0 /1. Unary — 1111011 w /digit
|
||||||
|
|
||||||
#define x8616_inc_r16(reg) x8616_enc_reg(x8616_opcode_inc_reg,reg)
|
#define x8616_inc_r16(reg) x8616_enc_reg(x8616_opcode_inc_reg,reg)
|
||||||
#define x8616_dec_r16(reg) x8616_enc_reg(x8616_opcode_dec_reg,reg)
|
#define x8616_dec_r16(reg) x8616_enc_reg(x8616_opcode_dec_reg,reg)
|
||||||
@@ -726,16 +820,16 @@ FI_ U1 x8616_modrm_sr (U1 modrm) { return (
|
|||||||
#define x8616_div_rm(w,mod,rm) x8616_unary_rm(x8616_g3_div,w,mod,rm)
|
#define x8616_div_rm(w,mod,rm) x8616_unary_rm(x8616_g3_div,w,mod,rm)
|
||||||
#define x8616_idiv_rm(w,mod,rm) x8616_unary_rm(x8616_g3_idiv,w,mod,rm)
|
#define x8616_idiv_rm(w,mod,rm) x8616_unary_rm(x8616_g3_idiv,w,mod,rm)
|
||||||
|
|
||||||
#define x8616_aaa() x8616_emit_op(x8616_opcode_aaa)
|
#define x8616_aaa() x8616_emit_op (x8616_opcode_aaa)
|
||||||
#define x8616_daa() x8616_emit_op(x8616_opcode_daa)
|
#define x8616_daa() x8616_emit_op (x8616_opcode_daa)
|
||||||
#define x8616_aas() x8616_emit_op(x8616_opcode_aas)
|
#define x8616_aas() x8616_emit_op (x8616_opcode_aas)
|
||||||
#define x8616_das() x8616_emit_op(x8616_opcode_das)
|
#define x8616_das() x8616_emit_op (x8616_opcode_das)
|
||||||
#define x8616_aam() x8616_emit_op_i8(x8616_opcode_aam,X8616_POST_OPCODE_AAM_AAD)
|
#define x8616_aam() x8616_emit_op_i8(x8616_opcode_aam,X8616_POST_OPCODE_AAM_AAD)
|
||||||
#define x8616_aad() x8616_emit_op_i8(x8616_opcode_aad,X8616_POST_OPCODE_AAM_AAD)
|
#define x8616_aad() x8616_emit_op_i8(x8616_opcode_aad,X8616_POST_OPCODE_AAM_AAD)
|
||||||
#define x8616_cbw() x8616_emit_op(x8616_opcode_cbw)
|
#define x8616_cbw() x8616_emit_op (x8616_opcode_cbw)
|
||||||
#define x8616_cwd() x8616_emit_op(x8616_opcode_cwd)
|
#define x8616_cwd() x8616_emit_op (x8616_opcode_cwd)
|
||||||
|
|
||||||
// Shift / rotate / TEST
|
// Shift — 110100 v w /ttt. TEST r/m,imm is group3 /0
|
||||||
|
|
||||||
#define x8616_shift_rm(shift,v,w,mod,rm) x8616_emit_modrm(x8616_enc_vw(x8616_opcode_shift_rm,v,w),mod,shift,rm)
|
#define x8616_shift_rm(shift,v,w,mod,rm) x8616_emit_modrm(x8616_enc_vw(x8616_opcode_shift_rm,v,w),mod,shift,rm)
|
||||||
#define x8616_shl_r8_1(reg) x8616_shift_rm(x8616_shl,x8616_v_one,x8616_w_byte,x8616_mod_reg,reg)
|
#define x8616_shl_r8_1(reg) x8616_shift_rm(x8616_shl,x8616_v_one,x8616_w_byte,x8616_mod_reg,reg)
|
||||||
@@ -750,39 +844,39 @@ FI_ U1 x8616_modrm_sr (U1 modrm) { return (
|
|||||||
#define x8616_test_al_i(imm) x8616_enc_w(x8616_opcode_test_acc_i,x8616_w_byte), u1_(imm)
|
#define x8616_test_al_i(imm) x8616_enc_w(x8616_opcode_test_acc_i,x8616_w_byte), u1_(imm)
|
||||||
#define x8616_test_ax_i(imm) x8616_enc_w(x8616_opcode_test_acc_i,x8616_w_word), x8616_emit_u2(imm)
|
#define x8616_test_ax_i(imm) x8616_enc_w(x8616_opcode_test_acc_i,x8616_w_word), x8616_emit_u2(imm)
|
||||||
|
|
||||||
// String / prefixes
|
// Prefix = prior byte: 1111001 z / 11110000 / 001 sr 110
|
||||||
|
|
||||||
#define x8616_rep_prefix() x8616_enc_zp(x8616_opcode_rep,x8616_rep)
|
#define x8616_rep_prefix() x8616_enc_zp (x8616_opcode_rep,x8616_rep)
|
||||||
#define x8616_repne_prefix() x8616_enc_zp(x8616_opcode_rep,x8616_repne)
|
#define x8616_repne_prefix() x8616_enc_zp (x8616_opcode_rep,x8616_repne)
|
||||||
#define x8616_movsb() x8616_enc_w(x8616_opcode_movs,x8616_w_byte)
|
#define x8616_movsb() x8616_enc_w (x8616_opcode_movs,x8616_w_byte)
|
||||||
#define x8616_movsw() x8616_enc_w(x8616_opcode_movs,x8616_w_word)
|
#define x8616_movsw() x8616_enc_w (x8616_opcode_movs,x8616_w_word)
|
||||||
#define x8616_cmpsb() x8616_enc_w(x8616_opcode_cmps,x8616_w_byte)
|
#define x8616_cmpsb() x8616_enc_w (x8616_opcode_cmps,x8616_w_byte)
|
||||||
#define x8616_cmpsw() x8616_enc_w(x8616_opcode_cmps,x8616_w_word)
|
#define x8616_cmpsw() x8616_enc_w (x8616_opcode_cmps,x8616_w_word)
|
||||||
#define x8616_scasb() x8616_enc_w(x8616_opcode_scas,x8616_w_byte)
|
#define x8616_scasb() x8616_enc_w (x8616_opcode_scas,x8616_w_byte)
|
||||||
#define x8616_scasw() x8616_enc_w(x8616_opcode_scas,x8616_w_word)
|
#define x8616_scasw() x8616_enc_w (x8616_opcode_scas,x8616_w_word)
|
||||||
#define x8616_lodsb() x8616_enc_w(x8616_opcode_lods,x8616_w_byte)
|
#define x8616_lodsb() x8616_enc_w (x8616_opcode_lods,x8616_w_byte)
|
||||||
#define x8616_lodsw() x8616_enc_w(x8616_opcode_lods,x8616_w_word)
|
#define x8616_lodsw() x8616_enc_w (x8616_opcode_lods,x8616_w_word)
|
||||||
#define x8616_stosb() x8616_enc_w(x8616_opcode_stos,x8616_w_byte)
|
#define x8616_stosb() x8616_enc_w (x8616_opcode_stos,x8616_w_byte)
|
||||||
#define x8616_stosw() x8616_enc_w(x8616_opcode_stos,x8616_w_word)
|
#define x8616_stosw() x8616_enc_w (x8616_opcode_stos,x8616_w_word)
|
||||||
#define x8616_lock_prefix() x8616_emit_op(x8616_opcode_lock)
|
#define x8616_lock_prefix() x8616_emit_op(x8616_opcode_lock)
|
||||||
#define x8616_segment_prefix(seg) x8616_enc_sr(X8616_OPCODE_SEG_FIXED,seg)
|
#define x8616_segment_prefix(seg) x8616_enc_sr (x8616_opcode_sr_override,seg,x8616_sr_low_push)
|
||||||
|
|
||||||
// Control transfer
|
// CALL/JMP r/m — same 1111111 w=1 as INC r/m, /digit 010..101
|
||||||
|
|
||||||
#define x8616_call_rel16(rel) x8616_emit_op_i16(x8616_opcode_call_rel16,rel)
|
#define x8616_call_rel16(rel) x8616_emit_op_i16(x8616_opcode_call_rel16,rel)
|
||||||
#define x8616_call_far(seg,off) x8616_emit_op_far(x8616_opcode_call_far,seg,off)
|
#define x8616_call_far(seg,off) x8616_emit_op_far(x8616_opcode_call_far,seg,off)
|
||||||
#define x8616_call_rm(mod,rm) x8616_emit_modrm(x8616_opcode_group_ff,mod,x8616_ff_call_near,rm)
|
#define x8616_call_rm(mod,rm) x8616_emit_modrm(x8616_enc_w(x8616_opcode_incdec_rm,x8616_w_word),mod,x8616_ff_call_near,rm)
|
||||||
#define x8616_call_far_rm(mod,rm) x8616_emit_modrm(x8616_opcode_group_ff,mod,x8616_ff_call_far,rm)
|
#define x8616_call_far_rm(mod,rm) x8616_emit_modrm(x8616_enc_w(x8616_opcode_incdec_rm,x8616_w_word),mod,x8616_ff_call_far,rm)
|
||||||
|
|
||||||
#define x8616_jmp_rel16(rel) x8616_emit_op_i16(x8616_opcode_jmp_rel16,rel)
|
#define x8616_jmp_rel16(rel) x8616_emit_op_i16(x8616_opcode_jmp_rel16,rel)
|
||||||
#define x8616_jmp_rel8(rel) x8616_emit_op_i8(x8616_opcode_jmp_rel8,rel)
|
#define x8616_jmp_rel8(rel) x8616_emit_op_i8 (x8616_opcode_jmp_rel8,rel)
|
||||||
#define x8616_jmp_far(seg,off) x8616_emit_op_far(x8616_opcode_jmp_far,seg,off)
|
#define x8616_jmp_far(seg,off) x8616_emit_op_far(x8616_opcode_jmp_far,seg,off)
|
||||||
#define x8616_jmp_rm(mod,rm) x8616_emit_modrm(x8616_opcode_group_ff,mod,x8616_ff_jmp_near,rm)
|
#define x8616_jmp_rm(mod,rm) x8616_emit_modrm(x8616_enc_w(x8616_opcode_incdec_rm,x8616_w_word),mod,x8616_ff_jmp_near,rm)
|
||||||
#define x8616_jmp_far_rm(mod,rm) x8616_emit_modrm(x8616_opcode_group_ff,mod,x8616_ff_jmp_far,rm)
|
#define x8616_jmp_far_rm(mod,rm) x8616_emit_modrm(x8616_enc_w(x8616_opcode_incdec_rm,x8616_w_word),mod,x8616_ff_jmp_far,rm)
|
||||||
|
|
||||||
#define x8616_ret() x8616_emit_op(x8616_opcode_ret)
|
#define x8616_ret() x8616_emit_op (x8616_opcode_ret)
|
||||||
#define x8616_ret_i(bytes) x8616_emit_op_i16(x8616_opcode_ret_i,bytes)
|
#define x8616_ret_i(bytes) x8616_emit_op_i16(x8616_opcode_ret_i,bytes)
|
||||||
#define x8616_retf() x8616_emit_op(x8616_opcode_retf)
|
#define x8616_retf() x8616_emit_op (x8616_opcode_retf)
|
||||||
#define x8616_retf_i(bytes) x8616_emit_op_i16(x8616_opcode_retf_i,bytes)
|
#define x8616_retf_i(bytes) x8616_emit_op_i16(x8616_opcode_retf_i,bytes)
|
||||||
|
|
||||||
#define x8616_jcc(cc,rel) x8616_enc_jcc(cc), u1_(rel)
|
#define x8616_jcc(cc,rel) x8616_enc_jcc(cc), u1_(rel)
|
||||||
|
|||||||
+177
-940
File diff suppressed because it is too large
Load Diff
+156
-326
@@ -4,359 +4,189 @@
|
|||||||
# include "dsl.h"
|
# include "dsl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RO_ global X8616_DecodePlan x8616_decode_plans[132] =
|
RO_ global X8616_DecodePlan x8616_decode_plans[90] =
|
||||||
{
|
{
|
||||||
{ 0x0000, 0x00, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x00, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x041a, 0x02, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x041a, 0x02, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x02, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, },
|
{ 0x0412, 0x02, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0110, 0x02, 0x00, 0x00, {0x03, 0x07}, 2, 1, 0, 0, 3, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0110, 0x02, 0x00, 0x00, {0x03, 0x07}, 2, 1, 0, 0, 3, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0018, 0x02, 0x00, 0x00, {0x06, 0x0a}, 2, 4, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0018, 0x02, 0x00, 0x00, {0x06, 0x0a}, 2, 4, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x040a, 0x02, 0x00, 0x02, {0x01, 0x04}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x20}, {0x00, 0x00}, },
|
{ 0x040a, 0x02, 0x00, 0x02, {0x01, 0x04}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x20}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0402, 0x0b, 0x00, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x30, 0x38}, {0x00, 0x00}, },
|
{ 0x0412, 0x0b, 0x00, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x30, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0100, 0x0b, 0x00, 0x02, {0x03, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0100, 0x0b, 0x00, 0x02, {0x03, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0200, 0x0b, 0x00, 0x02, {0x05, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0100, 0x0c, 0x00, 0x02, {0x03, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0402, 0x0c, 0x00, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, },
|
{ 0x0200, 0x0b, 0x00, 0x02, {0x05, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0100, 0x0c, 0x00, 0x02, {0x03, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0402, 0x0c, 0x00, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0200, 0x0c, 0x00, 0x02, {0x05, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0200, 0x0c, 0x00, 0x02, {0x05, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x0d, 0x00, 0x00, {0x02, 0x01}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x0d, 0x00, 0x00, {0x02, 0x01}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0100, 0x0d, 0x00, 0x02, {0x06, 0x03}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0100, 0x0d, 0x00, 0x02, {0x06, 0x03}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x0e, 0x00, 0x00, {0x06, 0x08}, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0010, 0x0e, 0x00, 0x00, {0x06, 0x08}, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x0e, 0x00, 0x00, {0x06, 0x0e}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0010, 0x0e, 0x00, 0x00, {0x06, 0x0e}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x0f, 0x00, 0x00, {0x08, 0x06}, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0010, 0x0f, 0x00, 0x00, {0x08, 0x06}, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x0f, 0x00, 0x00, {0x0e, 0x06}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0010, 0x0f, 0x00, 0x00, {0x0e, 0x06}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x10, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x10, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0402, 0x11, 0x00, 0x02, {0x02, 0x01}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0402, 0x11, 0x00, 0x02, {0x02, 0x01}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0402, 0x12, 0x00, 0x02, {0x02, 0x01}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0402, 0x12, 0x00, 0x02, {0x02, 0x01}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0402, 0x13, 0x00, 0x02, {0x02, 0x01}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0402, 0x13, 0x00, 0x02, {0x02, 0x01}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x14, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x14, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x15, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x15, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x16, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x16, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x17, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x17, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x041a, 0x03, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x141a, 0x00, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 3, 0, 0, },
|
||||||
{ 0x0432, 0x03, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 1, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, },
|
{ 0x1010, 0x00, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 3, 0, 0, },
|
||||||
{ 0x0010, 0x03, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0432, 0x00, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 1, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 1, },
|
||||||
{ 0x041a, 0x04, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x18, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x04, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x08, 0x38}, {0x00, 0x00}, },
|
{ 0x0100, 0x18, 0x00, 0x02, {0x03, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x04, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0100, 0x1b, 0x00, 0x02, {0x03, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x041a, 0x05, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x19, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0432, 0x05, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 1, 0, 0, 0, 0, {0x10, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x1a, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x05, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x1b, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x08, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x041a, 0x06, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x1c, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x18, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0432, 0x06, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 1, 0, 0, 0, 0, {0x18, 0x38}, {0x00, 0x00}, },
|
{ 0x0412, 0x1f, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x20, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x06, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x20, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x28, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x041a, 0x07, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x22, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x30, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x07, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x20, 0x38}, {0x00, 0x00}, },
|
{ 0x0412, 0x23, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x38, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x07, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x27, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x10, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x041a, 0x08, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x1d, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0432, 0x08, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 1, 0, 0, 0, 0, {0x28, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x1e, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x08, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0004, 0x21, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x0a, 0xff}, 0, 0, 0, },
|
||||||
{ 0x041a, 0x09, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0004, 0x24, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x0a, 0xff}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x09, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x30, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x25, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x09, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x26, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x041a, 0x0a, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0452, 0x00, 0x00, 0x00, {0x01, 0x0f}, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 2, },
|
||||||
{ 0x0432, 0x0a, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 1, 0, 0, 0, 0, {0x38, 0x38}, {0x00, 0x00}, },
|
{ 0x0412, 0x2f, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x0a, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x2f, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x18, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, },
|
{ 0x0010, 0x2f, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0100, 0x18, 0x00, 0x02, {0x03, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0880, 0x30, 0x02, 0x00, {0x00, 0x00}, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x19, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0010, 0x31, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x1a, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0010, 0x32, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x1b, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x08, 0x38}, {0x00, 0x00}, },
|
{ 0x0010, 0x33, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0100, 0x1b, 0x00, 0x02, {0x03, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0010, 0x34, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x1c, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x18, 0x38}, {0x00, 0x00}, },
|
{ 0x0010, 0x35, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x1f, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x20, 0x38}, {0x00, 0x00}, },
|
{ 0x0800, 0x5b, 0x02, 0x00, {0x00, 0x00}, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x20, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x28, 0x38}, {0x00, 0x00}, },
|
{ 0x0a00, 0x5c, 0x02, 0x00, {0x00, 0x00}, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x22, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x30, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x36, 0x00, 0x00, {0x0c, 0x00}, 1, 6, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x23, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x38, 0x38}, {0x00, 0x00}, },
|
{ 0x0412, 0x36, 0x00, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x10, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x27, 0x00, 0x00, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x10, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x36, 0x01, 0x00, {0x0d, 0x00}, 1, 7, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x1d, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x36, 0x01, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x18, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x1e, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x37, 0x00, 0x00, {0x0c, 0x00}, 1, 6, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0004, 0x21, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x0a, 0xff}, },
|
{ 0x0000, 0x37, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0004, 0x24, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x0a, 0xff}, },
|
{ 0x0412, 0x37, 0x00, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x20, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x25, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x37, 0x01, 0x00, {0x0d, 0x00}, 1, 7, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x26, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0412, 0x37, 0x01, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x28, 0x38}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0452, 0x2b, 0x00, 0x00, {0x01, 0x0f}, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x38, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0452, 0x2c, 0x00, 0x00, {0x01, 0x0f}, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, {0x08, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x38, 0x00, 0x00, {0x09, 0x00}, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0452, 0x2d, 0x00, 0x00, {0x01, 0x0f}, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, {0x10, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x39, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0452, 0x2e, 0x00, 0x00, {0x01, 0x0f}, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, {0x18, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x39, 0x00, 0x00, {0x09, 0x00}, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0452, 0x28, 0x00, 0x00, {0x01, 0x0f}, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, {0x20, 0x38}, {0x00, 0x00}, },
|
{ 0x2000, 0x00, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0452, 0x29, 0x00, 0x00, {0x01, 0x0f}, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, {0x28, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x4c, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0452, 0x2a, 0x00, 0x00, {0x01, 0x0f}, 2, 0, 0, 0, 0, 0, 1, 0, 0, 0, {0x38, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x4b, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x2f, 0x00, 0x00, {0x01, 0x02}, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x4a, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0412, 0x2f, 0x00, 0x00, {0x01, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x4d, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x2f, 0x00, 0x00, {0x06, 0x07}, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x4e, 0x00, 0x00, {0x08, 0x00}, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0880, 0x30, 0x02, 0x00, {0x00, 0x00}, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x4f, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x31, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x50, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x32, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x51, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x33, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x52, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x34, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x53, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0010, 0x35, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x54, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0800, 0x5b, 0x02, 0x00, {0x00, 0x00}, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x55, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0a00, 0x5c, 0x02, 0x00, {0x00, 0x00}, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x56, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x36, 0x00, 0x00, {0x0c, 0x00}, 1, 6, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x57, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0402, 0x36, 0x00, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x10, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x58, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x36, 0x01, 0x00, {0x0d, 0x00}, 1, 7, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
{ 0x0000, 0x59, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0402, 0x36, 0x01, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x18, 0x38}, {0x00, 0x00}, },
|
{ 0x0000, 0x5a, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, 0, 0, 0, },
|
||||||
{ 0x0000, 0x37, 0x00, 0x00, {0x0c, 0x00}, 1, 6, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x37, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0402, 0x37, 0x00, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x20, 0x38}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x37, 0x01, 0x00, {0x0d, 0x00}, 1, 7, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0402, 0x37, 0x01, 0x02, {0x01, 0x00}, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x28, 0x38}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x38, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x38, 0x00, 0x00, {0x09, 0x00}, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x39, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x39, 0x00, 0x00, {0x09, 0x00}, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x40, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x48, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x3d, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x45, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x3a, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x42, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x3e, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x46, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x41, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x49, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x3f, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x47, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x3b, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x43, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x3c, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x44, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x4c, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x4b, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x4a, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x4d, 0x00, 0x00, {0x0b, 0x00}, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x4e, 0x00, 0x00, {0x08, 0x00}, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x4f, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x50, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x51, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x52, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x53, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x54, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x55, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x56, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x57, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x58, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x59, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
{ 0x0000, 0x5a, 0x00, 0x00, {0x00, 0x00}, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0x00, 0x00}, {0x00, 0x00}, },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RO_ global U2 x8616_decode_dispatch[256] =
|
RO_ global U2 x8616_decode_dispatch[256] =
|
||||||
{
|
{
|
||||||
0x001a, 0x001a, 0x001a, 0x001a, 0x001c, 0x001c, 0x0008, 0x000b, 0x001d, 0x001d, 0x001d, 0x001d, 0x001f, 0x001f, 0x0008, 0x000b,
|
0x001a, 0x001a, 0x001a, 0x001a, 0x001b, 0x001b, 0x0009, 0x000b, 0x001a, 0x001a, 0x001a, 0x001a, 0x001b, 0x001b, 0x0009, 0x000b,
|
||||||
0x0020, 0x0020, 0x0020, 0x0020, 0x0022, 0x0022, 0x0008, 0x000b, 0x0023, 0x0023, 0x0023, 0x0023, 0x0025, 0x0025, 0x0008, 0x000b,
|
0x001a, 0x001a, 0x001a, 0x001a, 0x001b, 0x001b, 0x0009, 0x000b, 0x001a, 0x001a, 0x001a, 0x001a, 0x001b, 0x001b, 0x0009, 0x000b,
|
||||||
0x0026, 0x0026, 0x0026, 0x0026, 0x0028, 0x0028, 0x0055, 0x0035, 0x0029, 0x0029, 0x0029, 0x0029, 0x002b, 0x002b, 0x0055, 0x003f,
|
0x001a, 0x001a, 0x001a, 0x001a, 0x001b, 0x001b, 0x003a, 0x0021, 0x001a, 0x001a, 0x001a, 0x001a, 0x001b, 0x001b, 0x003a, 0x002a,
|
||||||
0x002c, 0x002c, 0x002c, 0x002c, 0x002e, 0x002e, 0x0055, 0x0034, 0x002f, 0x002f, 0x002f, 0x002f, 0x0031, 0x0031, 0x0055, 0x003e,
|
0x001a, 0x001a, 0x001a, 0x001a, 0x001b, 0x001b, 0x003a, 0x0020, 0x001a, 0x001a, 0x001a, 0x001a, 0x001b, 0x001b, 0x003a, 0x0029,
|
||||||
0x0033, 0x0033, 0x0033, 0x0033, 0x0033, 0x0033, 0x0033, 0x0033, 0x0037, 0x0037, 0x0037, 0x0037, 0x0037, 0x0037, 0x0037, 0x0037,
|
0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001e, 0x001f, 0x001f, 0x001f, 0x001f, 0x001f, 0x001f, 0x001f, 0x001f,
|
||||||
0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a, 0x000a,
|
0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008,
|
||||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072,
|
0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048, 0x0048,
|
||||||
0x8000, 0x8100, 0x8200, 0x8300, 0x004b, 0x004b, 0x000c, 0x000c, 0x0001, 0x0001, 0x0001, 0x0001, 0x0005, 0x0013, 0x0005, 0x0009,
|
0x001c, 0x001c, 0x001c, 0x001c, 0x0030, 0x0030, 0x000c, 0x000c, 0x0001, 0x0001, 0x0001, 0x0001, 0x0005, 0x0013, 0x0005, 0x000a,
|
||||||
0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x0042, 0x0043, 0x0058, 0x0083, 0x0018, 0x0019, 0x0017, 0x0016,
|
0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x000d, 0x002d, 0x002e, 0x003d, 0x0059, 0x0018, 0x0019, 0x0017, 0x0016,
|
||||||
0x0004, 0x0004, 0x0004, 0x0004, 0x004f, 0x004f, 0x0050, 0x0050, 0x004d, 0x004d, 0x0053, 0x0053, 0x0052, 0x0052, 0x0051, 0x0051,
|
0x0004, 0x0004, 0x0004, 0x0004, 0x0034, 0x0034, 0x0035, 0x0035, 0x0032, 0x0032, 0x0038, 0x0038, 0x0037, 0x0037, 0x0036, 0x0036,
|
||||||
0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003,
|
0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003, 0x0003,
|
||||||
0x0000, 0x0000, 0x0060, 0x005f, 0x0015, 0x0014, 0x0002, 0x0002, 0x0000, 0x0000, 0x0062, 0x0061, 0x0078, 0x0077, 0x0079, 0x007a,
|
0x0000, 0x0000, 0x0045, 0x0044, 0x0015, 0x0014, 0x0002, 0x0002, 0x0000, 0x0000, 0x0047, 0x0046, 0x004e, 0x004d, 0x004f, 0x0050,
|
||||||
0x8400, 0x8500, 0x8600, 0x8700, 0x0040, 0x0041, 0x0000, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
0x002f, 0x002f, 0x002f, 0x002f, 0x002b, 0x002c, 0x0000, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||||
0x0073, 0x0074, 0x0075, 0x0076, 0x000e, 0x000e, 0x0010, 0x0010, 0x0056, 0x005a, 0x005d, 0x005b, 0x000f, 0x000f, 0x0011, 0x0011,
|
0x0049, 0x004a, 0x004b, 0x004c, 0x000e, 0x000e, 0x0010, 0x0010, 0x003b, 0x003f, 0x0042, 0x0040, 0x000f, 0x000f, 0x0011, 0x0011,
|
||||||
0x0054, 0x0000, 0x004e, 0x004e, 0x0082, 0x007c, 0x8800, 0x8900, 0x007b, 0x007d, 0x0080, 0x0081, 0x007e, 0x007f, 0x8a00, 0x8b00,
|
0x0039, 0x0000, 0x0033, 0x0033, 0x0058, 0x0052, 0x8000, 0x8100, 0x0051, 0x0053, 0x0056, 0x0057, 0x0054, 0x0055, 0x8200, 0x8300,
|
||||||
};
|
};
|
||||||
|
|
||||||
RO_ global U1 x8616_decode_aux[3072] =
|
RO_ global U1 x8616_decode_aux[1024] =
|
||||||
{
|
{
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
|
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
|
||||||
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
|
||||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
|
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
|
||||||
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
|
||||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
|
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
|
||||||
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
|
||||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
|
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
|
||||||
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
|
||||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
|
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
|
||||||
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
|
||||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
|
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
|
||||||
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
|
||||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
|
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
|
||||||
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
|
||||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e,
|
0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23, 0x23,
|
||||||
0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
|
||||||
0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
|
||||||
0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
|
|
||||||
0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x46, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47,
|
|
||||||
0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x48, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x49,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a,
|
|
||||||
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
|
|
||||||
0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
|
|
||||||
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
|
|
||||||
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
|
|
||||||
0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
|
|
||||||
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
|
|
||||||
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
|
|
||||||
0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
|
|
||||||
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
|
|
||||||
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
|
|
||||||
0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
|
|
||||||
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
|
|
||||||
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
|
|
||||||
0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
|
|
||||||
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
|
|
||||||
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
|
|
||||||
0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
|
|
||||||
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
|
|
||||||
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
|
|
||||||
0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
|
|
||||||
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
|
|
||||||
0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38,
|
|
||||||
0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a, 0x3a,
|
|
||||||
0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
|
|
||||||
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||||
0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,
|
0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
|
||||||
0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e,
|
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43,
|
||||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||||
0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,
|
0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
|
||||||
0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e,
|
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43,
|
||||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||||
0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,
|
0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
|
||||||
0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e,
|
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43,
|
||||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x32, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
|
0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x1d, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
|
||||||
0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59, 0x59,
|
0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e, 0x3e,
|
||||||
0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5c, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e, 0x5e,
|
0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43, 0x43,
|
||||||
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
X8616_DECODE_PLAN_COUNT = 132,
|
X8616_DECODE_PLAN_COUNT = 90,
|
||||||
X8616_DECODE_AUX_COUNT = 3072,
|
X8616_DECODE_AUX_COUNT = 1024,
|
||||||
};
|
};
|
||||||
|
|||||||
+53
-12
@@ -26,6 +26,22 @@ typedef Enum_(U1, X8616_InfoCode) {
|
|||||||
x8616_info_gen_ambiguous_decode = 0x09,
|
x8616_info_gen_ambiguous_decode = 0x09,
|
||||||
x8616_info_gen_dispatch_mismatch = 0x0A,
|
x8616_info_gen_dispatch_mismatch = 0x0A,
|
||||||
|
|
||||||
|
x8616_info_serialize_bad_request = 0x0B,
|
||||||
|
x8616_info_serialize_invalid_record = 0x0C,
|
||||||
|
x8616_info_serialize_unsupported_form = 0x0D,
|
||||||
|
x8616_info_serialize_output_full = 0x0E,
|
||||||
|
|
||||||
|
x8616_info_parse_bad_request = 0x0F,
|
||||||
|
x8616_info_parse_syntax = 0x10,
|
||||||
|
x8616_info_parse_unknown_mnemonic = 0x11,
|
||||||
|
x8616_info_parse_output_full = 0x12,
|
||||||
|
x8616_info_parse_invalid_record = 0x13,
|
||||||
|
x8616_info_parse_unsupported_form = 0x14,
|
||||||
|
|
||||||
|
x8616_info_encode_bad_request = 0x15,
|
||||||
|
x8616_info_encode_invalid_record = 0x16,
|
||||||
|
x8616_info_encode_output_full = 0x17,
|
||||||
|
|
||||||
x8616_info_count,
|
x8616_info_count,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,8 +51,8 @@ typedef Struct_(X8616_InfoMsg) {
|
|||||||
X8616_InfoMsg* next;
|
X8616_InfoMsg* next;
|
||||||
X8616_InfoKind kind;
|
X8616_InfoKind kind;
|
||||||
X8616_InfoCode code;
|
X8616_InfoCode code;
|
||||||
U4 source_offset;
|
|
||||||
U2 source_size;
|
U2 source_size;
|
||||||
|
U4 source_offset;
|
||||||
U4 expected;
|
U4 expected;
|
||||||
U4 actual;
|
U4 actual;
|
||||||
Str8 text;
|
Str8 text;
|
||||||
@@ -45,17 +61,30 @@ typedef Struct_(X8616_InfoMsg) {
|
|||||||
/* Static templates use the same <identifier> vocabulary as Duffle's str8_fmt_ktl_buf path.
|
/* Static templates use the same <identifier> vocabulary as Duffle's str8_fmt_ktl_buf path.
|
||||||
The decoder itself never expands these. */
|
The decoder itself never expands these. */
|
||||||
RO_ global Str8 x8616_info_templates[x8616_info_count] = {
|
RO_ global Str8 x8616_info_templates[x8616_info_count] = {
|
||||||
[x8616_info_none] = slit8(""),
|
[x8616_info_none] = slit8(""),
|
||||||
[x8616_info_invalid_opcode] = slit8("Opcode <actual> is not in the Part 1 8086 decode table at <offset>."),
|
[x8616_info_invalid_opcode] = slit8("Header <actual> is not in the Part 1 8086 decode table at <offset>."),
|
||||||
[x8616_info_invalid_opcode_extension] = slit8("Opcode extension <actual> does not match the selected encoding at <offset>."),
|
[x8616_info_invalid_opcode_extension] = slit8("Opcode extension <actual> does not match the selected encoding at <offset>."),
|
||||||
[x8616_info_invalid_post_opcode] = slit8("Post-opcode byte <actual> does not match expected <expected> at <offset>."),
|
[x8616_info_invalid_post_opcode] = slit8("Post-opcode byte <actual> does not match expected <expected> at <offset>."),
|
||||||
[x8616_info_truncated_instruction] = slit8("Instruction at <offset> needs <expected> bytes; <actual> are available."),
|
[x8616_info_truncated_instruction] = slit8("Instruction at <offset> needs <expected> bytes; <actual> are available."),
|
||||||
[x8616_info_output_full] = slit8("Decoded-instruction output is full: capacity <expected>, produced <actual>."),
|
[x8616_info_output_full] = slit8("Decoded-instruction output is full: capacity <expected>, produced <actual>."),
|
||||||
[x8616_info_gen_multiple_payloads] = slit8("Encoding <offset> describes more than one stream payload."),
|
[x8616_info_gen_multiple_payloads] = slit8("Encoding <offset> describes more than one stream payload."),
|
||||||
[x8616_info_gen_body_cap_exceeded] = slit8("Encoding <offset> requires <actual> body bytes; decoder body capacity is <expected>."),
|
[x8616_info_gen_body_cap_exceeded] = slit8("Encoding <offset> requires <actual> body bytes; decoder body capacity is <expected>."),
|
||||||
[x8616_info_gen_aux_cap_exceeded] = slit8("Generated auxiliary decode table exceeds capacity <expected>."),
|
[x8616_info_gen_aux_cap_exceeded] = slit8("Generated auxiliary decode table exceeds capacity <expected>."),
|
||||||
[x8616_info_gen_ambiguous_decode] = slit8("Decode is ambiguous for opcode/second-byte key <offset>: plans <expected> and <actual>."),
|
[x8616_info_gen_ambiguous_decode] = slit8("Decode is ambiguous for header/second-byte key <offset>: plans <expected> and <actual>."),
|
||||||
[x8616_info_gen_dispatch_mismatch] = slit8("Generated dispatch mismatch for opcode/second-byte key <offset>: expected <expected>, actual <actual>."),
|
[x8616_info_gen_dispatch_mismatch] = slit8("Generated dispatch mismatch for header/second-byte key <offset>: expected <expected>, actual <actual>."),
|
||||||
|
[x8616_info_serialize_bad_request] = slit8("Serialize request is missing instructions, output, scratch, or info arena."),
|
||||||
|
[x8616_info_serialize_invalid_record] = slit8("Serialize record <offset> is not printable (op <actual>)."),
|
||||||
|
[x8616_info_serialize_unsupported_form] = slit8("Serialize record <offset> has an unsupported display form (op <actual>)."),
|
||||||
|
[x8616_info_serialize_output_full] = slit8("Serialize output is full at record <offset>: capacity <expected>, produced <actual>."),
|
||||||
|
[x8616_info_parse_bad_request] = slit8("Parse request is missing source, output, or info arena."),
|
||||||
|
[x8616_info_parse_syntax] = slit8("Parse syntax error at <offset>."),
|
||||||
|
[x8616_info_parse_unknown_mnemonic] = slit8("Unknown mnemonic at <offset>."),
|
||||||
|
[x8616_info_parse_output_full] = slit8("Parse output is full: capacity <expected>, produced <actual>."),
|
||||||
|
[x8616_info_parse_invalid_record] = slit8("Parse record at <offset> is not a valid instruction (op <actual>)."),
|
||||||
|
[x8616_info_parse_unsupported_form] = slit8("Parse record at <offset> has an unsupported form (op <actual>)."),
|
||||||
|
[x8616_info_encode_bad_request] = slit8("Encode request is missing instructions, output, or info arena."),
|
||||||
|
[x8616_info_encode_invalid_record] = slit8("Encode record <offset> is invalid or truncated (op <actual>)."),
|
||||||
|
[x8616_info_encode_output_full] = slit8("Encode output is full at record <offset>: capacity <expected>, produced <actual>."),
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Struct_(X8616_InfoList) {
|
typedef Struct_(X8616_InfoList) {
|
||||||
@@ -98,3 +127,15 @@ FI_ void x8616_info_push(FArena_R scratch
|
|||||||
msg->text = x8616_info_template(code);
|
msg->text = x8616_info_template(code);
|
||||||
sll_queue_push_n(msgs->first, msgs->last, msg, next);
|
sll_queue_push_n(msgs->first, msgs->last, msg, next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef Struct_(X8616_InfoTextValues) { Str8 offset; Str8 expected; Str8 actual; };
|
||||||
|
|
||||||
|
FI_ Str8
|
||||||
|
x8616_info_render(Slice output, X8616_InfoMsg_R msg, X8616_InfoTextValues values) {
|
||||||
|
KTL_Slot_Str8 slots[] = {
|
||||||
|
{ ktl_str8_key("offset"), values.offset },
|
||||||
|
{ ktl_str8_key("expected"), values.expected },
|
||||||
|
{ ktl_str8_key("actual"), values.actual },
|
||||||
|
};
|
||||||
|
return str8_fmt_ktl_buf(output, ktl_str8_from_arr(slots), msg->text);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
#ifdef INTELLISENSE_DIRECTIVES
|
|
||||||
# pragma once
|
|
||||||
# include "duffle/tables.h"
|
|
||||||
# include "duffle/text.h"
|
|
||||||
# include "info.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Numeric representation remains a presentation decision.
|
|
||||||
Feed whatever Duffle-formatted Str8 values you want here (hex for opcode
|
|
||||||
facts, decimal for capacities, etc.) and the existing <key> formatter does
|
|
||||||
the composition. */
|
|
||||||
typedef Struct_(X8616_InfoTextValues) { Str8 offset; Str8 expected; Str8 actual; };
|
|
||||||
|
|
||||||
FI_ Str8
|
|
||||||
x8616_info_render(Slice output, X8616_InfoMsg_R msg, X8616_InfoTextValues values) {
|
|
||||||
KTL_Slot_Str8 slots[] = {
|
|
||||||
{ ktl_str8_key("offset"), values.offset },
|
|
||||||
{ ktl_str8_key("expected"), values.expected },
|
|
||||||
{ ktl_str8_key("actual"), values.actual },
|
|
||||||
};
|
|
||||||
return str8_fmt_ktl_buf(output, ktl_str8_from_arr(slots), msg->text);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,420 @@
|
|||||||
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
|
# include "parser.h"
|
||||||
|
# include "serializer_tables.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FI_ void x8616_parse_skip_ws(Str8_R cur) {
|
||||||
|
while (cur->len && char_is_space(cur->ptr[0])) { cur->ptr += 1; cur->len -= 1; }
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ B4 x8616_parse_walk(Str8_R cur, Str8 lit) {
|
||||||
|
B4 too_big = cur->len < lit.len;
|
||||||
|
B4 miss = too_big || mem_match(u8_(cur->ptr), u8_(lit.ptr), lit.len) == 0;
|
||||||
|
if (miss) return 0;
|
||||||
|
cur->ptr += lit.len;
|
||||||
|
cur->len -= lit.len;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ U4 x8616_parse_lookup(Str8_R cur, Str8* table, U4 table_len) {
|
||||||
|
U4 best = table_len;
|
||||||
|
U8 best_len = 0;
|
||||||
|
for (U4 i = 0; i < table_len; ++i)
|
||||||
|
{
|
||||||
|
Str8 lit = table[i];
|
||||||
|
B4 empty = lit.len == 0;
|
||||||
|
B4 too_big = lit.len > cur->len;
|
||||||
|
B4 worse = lit.len <= best_len;
|
||||||
|
B4 skip = empty || too_big || worse;
|
||||||
|
B4 miss = skip || mem_match(u8_(cur->ptr), u8_(lit.ptr), lit.len) == 0;
|
||||||
|
if (miss) continue;
|
||||||
|
best = i;
|
||||||
|
best_len = lit.len;
|
||||||
|
}
|
||||||
|
if (best < table_len) {
|
||||||
|
cur->ptr += best_len;
|
||||||
|
cur->len -= best_len;
|
||||||
|
}
|
||||||
|
return best;
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ B4 x8616_parse_number(Str8_R cur, U2_R value, B4_R neg_out) {
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
B4 neg = 0;
|
||||||
|
if (x8616_parse_walk(cur, slit8("-"))) neg = 1;
|
||||||
|
if (cur->len == 0 || char_is_digit(cur->ptr[0], 10) == 0) return 0;
|
||||||
|
U8 start = 0;
|
||||||
|
while (start < cur->len && char_is_digit(cur->ptr[start], 10)) start += 1;
|
||||||
|
U8 mag = u8_from_str8(str8(cur->ptr, start), 10);
|
||||||
|
cur->ptr += start;
|
||||||
|
cur->len -= start;
|
||||||
|
value[0] = u2_(mag);
|
||||||
|
neg_out[0] = neg;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal B4 x8616_parse_memory(Str8_R cur, X8616_DecodedOperand_R op)
|
||||||
|
{
|
||||||
|
B4 ok = 1;
|
||||||
|
if (x8616_parse_walk(cur, slit8("[")) == 0) { ok = 0; goto exit; }
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
|
||||||
|
U4 ea_n = Array_len(x8616_serialize_ea);
|
||||||
|
U4 ea = x8616_parse_lookup(cur, x8616_serialize_ea, ea_n);
|
||||||
|
if (ea < ea_n)
|
||||||
|
{
|
||||||
|
op->flags = x8616_decoded_operand_memory;
|
||||||
|
op->ea = C_(X8616_EA, ea);
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
if (x8616_parse_walk(cur, slit8("+"))) {
|
||||||
|
U2 mag = 0; B4 neg = 0;
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
if (x8616_parse_number(cur, & mag, & neg) == 0) { ok = 0; goto exit; }
|
||||||
|
op->displacement = neg ? s2_(-s4_(mag)) : s2_(mag);
|
||||||
|
op->displacement_bytes = (u2_(op->displacement) > 0x7F && op->displacement >= 0) || op->displacement < -128 ? 2 : (op->displacement ? 1 : 0);
|
||||||
|
}
|
||||||
|
else if (x8616_parse_walk(cur, slit8("-"))) {
|
||||||
|
U2 mag = 0; B4 dummy = 0;
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
if (x8616_parse_number(cur, & mag, & dummy) == 0) { ok = 0; goto exit; }
|
||||||
|
op->displacement = s2_(-s4_(mag));
|
||||||
|
op->displacement_bytes = op->displacement < -128 ? 2 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
U2 mag = 0; B4 neg = 0;
|
||||||
|
if (x8616_parse_number(cur, & mag, & neg) == 0) { ok = 0; goto exit; }
|
||||||
|
op->flags = x8616_decoded_operand_memory | x8616_decoded_operand_direct;
|
||||||
|
op->address = mag;
|
||||||
|
op->ea = x8616_ea_direct;
|
||||||
|
}
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
if (x8616_parse_walk(cur, slit8("]")) == 0) { ok = 0; goto exit; }
|
||||||
|
exit:
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal B4
|
||||||
|
x8616_parse_operand(Str8_R cur, X8616_DecodedInstruction_R inst, X8616_DecodedOperand_R op)
|
||||||
|
{
|
||||||
|
B4 ok = 1;
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
X8616_WidthMode size = x8616_width_dynamic;
|
||||||
|
if (x8616_parse_walk(cur, slit8("byte "))) size = x8616_width_byte;
|
||||||
|
else if (x8616_parse_walk(cur, slit8("word "))) size = x8616_width_word;
|
||||||
|
if (x8616_parse_walk(cur, slit8("far "))) inst->flags |= x8616_encoding_far;
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
|
||||||
|
U4 seg_n = Array_len(x8616_serialize_seg);
|
||||||
|
Str8 save = cur[0];
|
||||||
|
U4 seg = x8616_parse_lookup(cur, x8616_serialize_seg, seg_n);
|
||||||
|
if (seg < seg_n)
|
||||||
|
{
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
if (x8616_parse_walk(cur, slit8(":"))) {
|
||||||
|
inst->prefixes.has_segment = 1;
|
||||||
|
inst->prefixes.segment = C_(X8616_Segment, seg);
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
if (x8616_parse_memory(cur, op) == 0) { ok = 0; goto exit; }
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
op->flags = x8616_decoded_operand_segment;
|
||||||
|
op->segment = C_(X8616_Segment, seg);
|
||||||
|
op->width = x8616_width_word;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cur[0] = save;
|
||||||
|
U4 r16_n = Array_len(x8616_serialize_reg16);
|
||||||
|
U4 r8_n = Array_len(x8616_serialize_reg8);
|
||||||
|
U4 r16 = x8616_parse_lookup(cur, x8616_serialize_reg16, r16_n);
|
||||||
|
if (r16 < r16_n) {
|
||||||
|
op->flags = x8616_decoded_operand_register;
|
||||||
|
op->width = x8616_width_word;
|
||||||
|
op->reg.r16 = C_(X8616_Reg16, r16);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cur[0] = save;
|
||||||
|
U4 r8 = x8616_parse_lookup(cur, x8616_serialize_reg8, r8_n);
|
||||||
|
if (r8 < r8_n) {
|
||||||
|
op->flags = x8616_decoded_operand_register;
|
||||||
|
op->width = x8616_width_byte;
|
||||||
|
op->reg.r8 = C_(X8616_Reg8, r8);
|
||||||
|
}
|
||||||
|
else if (x8616_parse_walk(cur, slit8("$"))) {
|
||||||
|
B4 neg = 0;
|
||||||
|
if (x8616_parse_walk(cur, slit8("+"))) {}
|
||||||
|
else if (x8616_parse_walk(cur, slit8("-"))) neg = 1;
|
||||||
|
else { ok = 0; goto exit; }
|
||||||
|
U2 mag = 0; B4 extra = 0;
|
||||||
|
if (x8616_parse_number(cur, & mag, & extra) == 0) { ok = 0; goto exit; }
|
||||||
|
if (extra) neg = 1;
|
||||||
|
op->flags = x8616_decoded_operand_relative;
|
||||||
|
op->displacement = neg ? s2_(-s4_(mag)) : s2_(mag);
|
||||||
|
op->width = x8616_width_byte;
|
||||||
|
}
|
||||||
|
else if (cur->len && cur->ptr[0] == '[') {
|
||||||
|
if (x8616_parse_memory(cur, op) == 0) { ok = 0; goto exit; }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
U2 mag = 0; B4 neg = 0;
|
||||||
|
Str8 before = *cur;
|
||||||
|
if (x8616_parse_number(cur, & mag, & neg) == 0) { ok = 0; goto exit; }
|
||||||
|
x8616_parse_skip_ws(cur);
|
||||||
|
if (x8616_parse_walk(cur, slit8(":"))) {
|
||||||
|
U2 off = 0; B4 off_neg = 0;
|
||||||
|
if (x8616_parse_number(cur, & off, & off_neg) == 0) { ok = 0; goto exit; }
|
||||||
|
op->flags = x8616_decoded_operand_far_ptr;
|
||||||
|
op->far_segment = mag;
|
||||||
|
op->far_offset = off;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
*cur = before;
|
||||||
|
if (x8616_parse_number(cur, & mag, & neg) == 0) { ok = 0; goto exit; }
|
||||||
|
op->flags = x8616_decoded_operand_immediate;
|
||||||
|
op->immediate = mag;
|
||||||
|
if (neg) {
|
||||||
|
op->flags |= x8616_decoded_operand_sign_extended;
|
||||||
|
op->immediate = u2_(s2_(-s4_(mag)));
|
||||||
|
}
|
||||||
|
op->immediate_bytes = mag > 0xFF ? 2 : 1;
|
||||||
|
op->width = mag > 0xFF ? x8616_width_word : x8616_width_byte;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size != x8616_width_dynamic) {
|
||||||
|
op->width = size;
|
||||||
|
if (inst->width == x8616_width_dynamic) inst->width = size;
|
||||||
|
}
|
||||||
|
exit:
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ B4 x8616_parse_is_shift(X8616_Op op) { switch (op) {
|
||||||
|
case x8616_op_shl:
|
||||||
|
case x8616_op_shr:
|
||||||
|
case x8616_op_sar:
|
||||||
|
case x8616_op_rol:
|
||||||
|
case x8616_op_ror:
|
||||||
|
case x8616_op_rcl:
|
||||||
|
case x8616_op_rcr:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}}
|
||||||
|
|
||||||
|
FI_ B4 x8616_parse_is_string(X8616_Op op) { switch (op) {
|
||||||
|
case x8616_op_movs:
|
||||||
|
case x8616_op_cmps:
|
||||||
|
case x8616_op_scas:
|
||||||
|
case x8616_op_lods:
|
||||||
|
case x8616_op_stos:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}}
|
||||||
|
|
||||||
|
FI_ B4 x8616_parse_has_memory(X8616_DecodedInstruction_R inst) {
|
||||||
|
for (U1 id = 0; id < inst->operand_count; ++id) { if (inst->operands[id].flags & x8616_decoded_operand_memory) return 1; }
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ X8616_DecodedOperandFlags x8616_parse_base_flags(X8616_DecodedOperandFlags flags) {
|
||||||
|
return flags & (
|
||||||
|
x8616_decoded_operand_register
|
||||||
|
| x8616_decoded_operand_segment
|
||||||
|
| x8616_decoded_operand_memory
|
||||||
|
| x8616_decoded_operand_immediate
|
||||||
|
| x8616_decoded_operand_relative
|
||||||
|
| x8616_decoded_operand_far_ptr
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
FI_ B4 x8616_parse_one_flag(X8616_DecodedOperandFlags flags) { U2 bits = C_(U2, flags); return (bits != 0) && ((bits & (bits - 1)) == 0); }
|
||||||
|
|
||||||
|
internal void
|
||||||
|
x8616_parse_push(FArena_R arena, X8616_InfoList_R msgs, X8616_ParseStatus status, U4 id, U2 size, U4 expected, U4 actual) {
|
||||||
|
if (status == x8616_parse_ok || arena == 0) return;
|
||||||
|
X8616_InfoKind kind = x8616_info_error;
|
||||||
|
X8616_InfoCode code = x8616_info_parse_syntax;
|
||||||
|
if (status == x8616_parse_output_full) code = x8616_info_parse_output_full;
|
||||||
|
else if (status == x8616_parse_unknown_mnemonic) code = x8616_info_parse_unknown_mnemonic;
|
||||||
|
else if (status == x8616_parse_invalid_record) code = x8616_info_parse_invalid_record;
|
||||||
|
else if (status == x8616_parse_unsupported_form) code = x8616_info_parse_unsupported_form;
|
||||||
|
x8616_info_push(arena, msgs, kind, code, id, size, expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
internal X8616_ParseStatus
|
||||||
|
x8616_parse_validate(X8616_DecodedInstruction_R inst)
|
||||||
|
{
|
||||||
|
X8616_ParseStatus status = x8616_parse_ok;
|
||||||
|
|
||||||
|
B4 invalid_sig = inst->operand_count > 2;
|
||||||
|
B4 invalid_mnemonic = u4_(inst->op) >= Array_len(x8616_serialize_mnemonic) || inst->op == x8616_op_invalid;
|
||||||
|
B4 empty_mnemonic = invalid_mnemonic == 0 && x8616_serialize_mnemonic[inst->op].len == 0;
|
||||||
|
B4 invalid_prefix_with_seg = inst->prefixes.has_segment && u1_(inst->prefixes.segment) >= Array_len(x8616_serialize_seg);
|
||||||
|
|
||||||
|
if (invalid_sig || invalid_mnemonic || invalid_prefix_with_seg) {
|
||||||
|
status = x8616_parse_invalid_record; goto status_failed;
|
||||||
|
}
|
||||||
|
if (empty_mnemonic) {
|
||||||
|
status = x8616_parse_unknown_mnemonic; goto status_failed;
|
||||||
|
}
|
||||||
|
B4 bad_prefix_segment = inst->prefixes.has_segment && (x8616_parse_has_memory(inst) == 0);
|
||||||
|
B4 bad_prefix_repeat = inst->prefixes.has_repeat && (x8616_parse_is_string(inst->op) == 0);
|
||||||
|
if (bad_prefix_segment || bad_prefix_repeat) {
|
||||||
|
status = x8616_parse_unsupported_form; goto status_failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (U1 id = 0; id < inst->operand_count; ++id)
|
||||||
|
{
|
||||||
|
X8616_DecodedOperand_R operand = & inst->operands[id];
|
||||||
|
X8616_DecodedOperandFlags base = x8616_parse_base_flags(operand->flags);
|
||||||
|
B4 invalid_flag = x8616_parse_one_flag(base) == 0;
|
||||||
|
B4 has_operand_register = base & x8616_decoded_operand_register;
|
||||||
|
B4 has_operand_segment = base & x8616_decoded_operand_segment;
|
||||||
|
B4 has_operand_memory = base & x8616_decoded_operand_memory;
|
||||||
|
B4 invalid_reg_r16 = u1_(operand->reg.r16) >= Array_len(x8616_serialize_reg16);
|
||||||
|
B4 invalid_width = operand->width != x8616_width_byte && operand->width != x8616_width_word;
|
||||||
|
B4 invalid_operand_seg = u1_(operand->segment) >= Array_len(x8616_serialize_seg);
|
||||||
|
B4 invalid_operand_ea = u1_(operand->ea) >= Array_len(x8616_serialize_ea);
|
||||||
|
B4 invalid_direct_ea = has_operand_memory && ((operand->flags & x8616_decoded_operand_direct) == 0) && invalid_operand_ea;
|
||||||
|
B4 invalid_operand = invalid_flag
|
||||||
|
|| (has_operand_register && (invalid_reg_r16 || invalid_width))
|
||||||
|
|| (has_operand_segment && invalid_operand_seg)
|
||||||
|
|| invalid_direct_ea;
|
||||||
|
if (invalid_operand) {
|
||||||
|
status = x8616_parse_invalid_record; goto status_failed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
status_failed:
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal B4 x8616_parse_line(Str8 line, X8616_DecodedInstruction_R inst)
|
||||||
|
{
|
||||||
|
B4 ok = 1;
|
||||||
|
x8616_parse_skip_ws(& line);
|
||||||
|
if (line.len == 0) { ok = 0; goto exit; }
|
||||||
|
|
||||||
|
if (x8616_parse_walk(& line, slit8("lock "))) inst->prefixes.lock = 1;
|
||||||
|
if (x8616_parse_walk(& line, slit8("repne "))) {
|
||||||
|
inst->prefixes.has_repeat = 1;
|
||||||
|
inst->prefixes.repeat = x8616_repne;
|
||||||
|
}
|
||||||
|
else if (x8616_parse_walk(& line, slit8("rep "))) {
|
||||||
|
inst->prefixes.has_repeat = 1;
|
||||||
|
inst->prefixes.repeat = x8616_rep;
|
||||||
|
}
|
||||||
|
|
||||||
|
U4 mnem_n = Array_len(x8616_serialize_mnemonic);
|
||||||
|
U4 mnem = x8616_parse_lookup(& line, x8616_serialize_mnemonic, mnem_n);
|
||||||
|
if (mnem >= mnem_n) { ok = 0; goto exit; }
|
||||||
|
inst->op = C_(X8616_Op, mnem);
|
||||||
|
|
||||||
|
if (x8616_parse_is_string(inst->op)) {
|
||||||
|
if (x8616_parse_walk(& line, slit8("b"))) inst->width = x8616_width_byte;
|
||||||
|
else if (x8616_parse_walk(& line, slit8("w"))) inst->width = x8616_width_word;
|
||||||
|
}
|
||||||
|
|
||||||
|
x8616_parse_skip_ws(& line);
|
||||||
|
if (line.len == 0) goto exit;
|
||||||
|
|
||||||
|
if (x8616_parse_operand(& line, inst, inst->operands + 0) == 0) { ok = 0; goto exit; }
|
||||||
|
inst->operand_count = 1;
|
||||||
|
x8616_parse_skip_ws(& line);
|
||||||
|
if (x8616_parse_walk(& line, slit8(","))) {
|
||||||
|
if (x8616_parse_operand(& line, inst, inst->operands + 1) == 0) { ok = 0; goto exit; }
|
||||||
|
inst->operand_count = 2;
|
||||||
|
}
|
||||||
|
x8616_parse_skip_ws(& line);
|
||||||
|
if (inst->width == x8616_width_dynamic) {
|
||||||
|
for (U1 id = 0; id < inst->operand_count; ++id) {
|
||||||
|
if (inst->operands[id].width != x8616_width_dynamic) {
|
||||||
|
inst->width = inst->operands[id].width;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inst->width != x8616_width_dynamic) {
|
||||||
|
for (U1 id = 0; id < inst->operand_count; ++id) {
|
||||||
|
X8616_DecodedOperand_R op = inst->operands + id;
|
||||||
|
B4 take = op->width == x8616_width_dynamic;
|
||||||
|
take |= (op->flags & x8616_decoded_operand_immediate) && (x8616_parse_is_shift(inst->op) == 0);
|
||||||
|
if (take) op->width = inst->width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ok = line.len == 0;
|
||||||
|
exit:
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
X8616_ParseInfo x8616_parse_instructions(X8616_ParseRequest request)
|
||||||
|
{
|
||||||
|
X8616_ParseInfo result = {0};
|
||||||
|
X8616_InfoList local = {0};
|
||||||
|
X8616_InfoList_R msgs = request.msgs ? request.msgs : & local;
|
||||||
|
U4 offset = 0;
|
||||||
|
|
||||||
|
B4 bad = request.source.ptr == 0 && request.source.len != 0;
|
||||||
|
bad |= request.instruction_cap && request.out_instructions == 0;
|
||||||
|
bad |= request.info_arena == 0;
|
||||||
|
if (bad) {
|
||||||
|
if (request.info_arena) {
|
||||||
|
x8616_info_push(request.info_arena, msgs, x8616_info_error
|
||||||
|
, x8616_info_parse_bad_request, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Str8 cur = request.source;
|
||||||
|
if (x8616_parse_walk(& cur, x8616_serialize_header)) {}
|
||||||
|
|
||||||
|
offset = u4_(request.source.len - cur.len);
|
||||||
|
while (cur.len)
|
||||||
|
{
|
||||||
|
U8 n = 0;
|
||||||
|
while (n < cur.len && cur.ptr[n] != '\n') n += 1;
|
||||||
|
Str8 line = str8(cur.ptr, n);
|
||||||
|
U8 step = n + (n < cur.len);
|
||||||
|
U4 line_at = offset;
|
||||||
|
cur.ptr += step;
|
||||||
|
cur.len -= step;
|
||||||
|
offset += u4_(step);
|
||||||
|
|
||||||
|
while (line.len && char_is_space(line.ptr[line.len - 1])) line.len -= 1;
|
||||||
|
x8616_parse_skip_ws(& line);
|
||||||
|
if (line.len == 0) continue;
|
||||||
|
|
||||||
|
if (result.instruction_count == request.instruction_cap) {
|
||||||
|
x8616_parse_push(request.info_arena, msgs, x8616_parse_output_full
|
||||||
|
, line_at, 0, request.instruction_cap, result.instruction_count);
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
X8616_DecodedInstruction inst = {0};
|
||||||
|
if (x8616_parse_line(line, & inst) == 0) {
|
||||||
|
x8616_parse_push(request.info_arena, msgs, x8616_parse_syntax
|
||||||
|
, line_at, u2_(line.len), 0, 0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
X8616_ParseStatus st = x8616_parse_validate(& inst);
|
||||||
|
if (st != x8616_parse_ok) {
|
||||||
|
x8616_parse_push(request.info_arena, msgs, st
|
||||||
|
, line_at, inst.size, 0, u4_(inst.op));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
request.out_instructions[result.instruction_count] = inst;
|
||||||
|
result.instruction_count += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
result.source_consumed = offset;
|
||||||
|
result.msgs = *msgs;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
|
# pragma once
|
||||||
|
# include "decoder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef Enum_(U1, X8616_ParseStatus) {
|
||||||
|
x8616_parse_ok = 0x00,
|
||||||
|
x8616_parse_output_full = 0x01,
|
||||||
|
x8616_parse_syntax = 0x02,
|
||||||
|
x8616_parse_invalid_record = 0x03,
|
||||||
|
x8616_parse_unsupported_form = 0x04,
|
||||||
|
x8616_parse_unknown_mnemonic = 0x05,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Struct_(X8616_ParseRequest) {
|
||||||
|
Str8 source;
|
||||||
|
X8616_DecodedInstruction* out_instructions;
|
||||||
|
U4 instruction_cap;
|
||||||
|
FArena* info_arena;
|
||||||
|
X8616_InfoList_R msgs;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef Struct_(X8616_ParseInfo) {
|
||||||
|
X8616_InfoList msgs;
|
||||||
|
U4 instruction_count;
|
||||||
|
U4 source_consumed;
|
||||||
|
};
|
||||||
|
|
||||||
|
X8616_ParseInfo x8616_parse_instructions(X8616_ParseRequest request);
|
||||||
+74
-175
@@ -1,149 +1,8 @@
|
|||||||
#ifdef INTELLISENSE_DIRECTIVES
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
# include "serializer.h"
|
# include "serializer.h"
|
||||||
|
# include "serializer_tables.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum {
|
|
||||||
X8616_SERIALIZE_HEADER_LEN = 9,
|
|
||||||
};
|
|
||||||
|
|
||||||
RO_ global Str8 x8616_serialize_header = slit8("bits 16\n\n");
|
|
||||||
|
|
||||||
RO_ global Str8 x8616_serialize_mnemonic[] = {
|
|
||||||
[x8616_op_invalid] = slit8(""),
|
|
||||||
[x8616_op_nop] = slit8("nop"),
|
|
||||||
[x8616_op_mov] = slit8("mov"),
|
|
||||||
[x8616_op_add] = slit8("add"),
|
|
||||||
[x8616_op_or] = slit8("or"),
|
|
||||||
[x8616_op_adc] = slit8("adc"),
|
|
||||||
[x8616_op_sbb] = slit8("sbb"),
|
|
||||||
[x8616_op_and] = slit8("and"),
|
|
||||||
[x8616_op_sub] = slit8("sub"),
|
|
||||||
[x8616_op_xor] = slit8("xor"),
|
|
||||||
[x8616_op_cmp] = slit8("cmp"),
|
|
||||||
[x8616_op_push] = slit8("push"),
|
|
||||||
[x8616_op_pop] = slit8("pop"),
|
|
||||||
[x8616_op_xchg] = slit8("xchg"),
|
|
||||||
[x8616_op_in] = slit8("in"),
|
|
||||||
[x8616_op_out] = slit8("out"),
|
|
||||||
[x8616_op_xlat] = slit8("xlat"),
|
|
||||||
[x8616_op_lea] = slit8("lea"),
|
|
||||||
[x8616_op_lds] = slit8("lds"),
|
|
||||||
[x8616_op_les] = slit8("les"),
|
|
||||||
[x8616_op_lahf] = slit8("lahf"),
|
|
||||||
[x8616_op_sahf] = slit8("sahf"),
|
|
||||||
[x8616_op_pushf] = slit8("pushf"),
|
|
||||||
[x8616_op_popf] = slit8("popf"),
|
|
||||||
[x8616_op_inc] = slit8("inc"),
|
|
||||||
[x8616_op_aaa] = slit8("aaa"),
|
|
||||||
[x8616_op_daa] = slit8("daa"),
|
|
||||||
[x8616_op_dec] = slit8("dec"),
|
|
||||||
[x8616_op_neg] = slit8("neg"),
|
|
||||||
[x8616_op_aas] = slit8("aas"),
|
|
||||||
[x8616_op_das] = slit8("das"),
|
|
||||||
[x8616_op_mul] = slit8("mul"),
|
|
||||||
[x8616_op_imul] = slit8("imul"),
|
|
||||||
[x8616_op_aam] = slit8("aam"),
|
|
||||||
[x8616_op_div] = slit8("div"),
|
|
||||||
[x8616_op_idiv] = slit8("idiv"),
|
|
||||||
[x8616_op_aad] = slit8("aad"),
|
|
||||||
[x8616_op_cbw] = slit8("cbw"),
|
|
||||||
[x8616_op_cwd] = slit8("cwd"),
|
|
||||||
[x8616_op_not] = slit8("not"),
|
|
||||||
[x8616_op_shl] = slit8("shl"),
|
|
||||||
[x8616_op_shr] = slit8("shr"),
|
|
||||||
[x8616_op_sar] = slit8("sar"),
|
|
||||||
[x8616_op_rol] = slit8("rol"),
|
|
||||||
[x8616_op_ror] = slit8("ror"),
|
|
||||||
[x8616_op_rcl] = slit8("rcl"),
|
|
||||||
[x8616_op_rcr] = slit8("rcr"),
|
|
||||||
[x8616_op_test] = slit8("test"),
|
|
||||||
[x8616_op_rep] = slit8(""),
|
|
||||||
[x8616_op_movs] = slit8("movs"),
|
|
||||||
[x8616_op_cmps] = slit8("cmps"),
|
|
||||||
[x8616_op_scas] = slit8("scas"),
|
|
||||||
[x8616_op_lods] = slit8("lods"),
|
|
||||||
[x8616_op_stos] = slit8("stos"),
|
|
||||||
[x8616_op_call] = slit8("call"),
|
|
||||||
[x8616_op_jmp] = slit8("jmp"),
|
|
||||||
[x8616_op_ret] = slit8("ret"),
|
|
||||||
[x8616_op_retf] = slit8("retf"),
|
|
||||||
[x8616_op_je] = slit8("je"),
|
|
||||||
[x8616_op_jl] = slit8("jl"),
|
|
||||||
[x8616_op_jle] = slit8("jle"),
|
|
||||||
[x8616_op_jb] = slit8("jb"),
|
|
||||||
[x8616_op_jbe] = slit8("jbe"),
|
|
||||||
[x8616_op_jp] = slit8("jp"),
|
|
||||||
[x8616_op_jo] = slit8("jo"),
|
|
||||||
[x8616_op_js] = slit8("js"),
|
|
||||||
[x8616_op_jne] = slit8("jne"),
|
|
||||||
[x8616_op_jnl] = slit8("jnl"),
|
|
||||||
[x8616_op_jg] = slit8("jg"),
|
|
||||||
[x8616_op_jnb] = slit8("jnb"),
|
|
||||||
[x8616_op_ja] = slit8("ja"),
|
|
||||||
[x8616_op_jnp] = slit8("jnp"),
|
|
||||||
[x8616_op_jno] = slit8("jno"),
|
|
||||||
[x8616_op_jns] = slit8("jns"),
|
|
||||||
[x8616_op_loop] = slit8("loop"),
|
|
||||||
[x8616_op_loopz] = slit8("loopz"),
|
|
||||||
[x8616_op_loopnz] = slit8("loopnz"),
|
|
||||||
[x8616_op_jcxz] = slit8("jcxz"),
|
|
||||||
[x8616_op_int] = slit8("int"),
|
|
||||||
[x8616_op_int3] = slit8("int3"),
|
|
||||||
[x8616_op_into] = slit8("into"),
|
|
||||||
[x8616_op_iret] = slit8("iret"),
|
|
||||||
[x8616_op_clc] = slit8("clc"),
|
|
||||||
[x8616_op_cmc] = slit8("cmc"),
|
|
||||||
[x8616_op_stc] = slit8("stc"),
|
|
||||||
[x8616_op_cld] = slit8("cld"),
|
|
||||||
[x8616_op_std] = slit8("std"),
|
|
||||||
[x8616_op_cli] = slit8("cli"),
|
|
||||||
[x8616_op_sti] = slit8("sti"),
|
|
||||||
[x8616_op_hlt] = slit8("hlt"),
|
|
||||||
[x8616_op_wait] = slit8("wait"),
|
|
||||||
[x8616_op_lock] = slit8(""),
|
|
||||||
[x8616_op_segment] = slit8(""),
|
|
||||||
};
|
|
||||||
|
|
||||||
RO_ global Str8 x8616_serialize_reg8[] = {
|
|
||||||
[x8616_al] = slit8("al"),
|
|
||||||
[x8616_cl] = slit8("cl"),
|
|
||||||
[x8616_dl] = slit8("dl"),
|
|
||||||
[x8616_bl] = slit8("bl"),
|
|
||||||
[x8616_ah] = slit8("ah"),
|
|
||||||
[x8616_ch] = slit8("ch"),
|
|
||||||
[x8616_dh] = slit8("dh"),
|
|
||||||
[x8616_bh] = slit8("bh"),
|
|
||||||
};
|
|
||||||
|
|
||||||
RO_ global Str8 x8616_serialize_reg16[] = {
|
|
||||||
[x8616_ax] = slit8("ax"),
|
|
||||||
[x8616_cx] = slit8("cx"),
|
|
||||||
[x8616_dx] = slit8("dx"),
|
|
||||||
[x8616_bx] = slit8("bx"),
|
|
||||||
[x8616_sp] = slit8("sp"),
|
|
||||||
[x8616_bp] = slit8("bp"),
|
|
||||||
[x8616_si] = slit8("si"),
|
|
||||||
[x8616_di] = slit8("di"),
|
|
||||||
};
|
|
||||||
|
|
||||||
RO_ global Str8 x8616_serialize_seg[] = {
|
|
||||||
[x8616_es] = slit8("es"),
|
|
||||||
[x8616_cs] = slit8("cs"),
|
|
||||||
[x8616_ss] = slit8("ss"),
|
|
||||||
[x8616_ds] = slit8("ds"),
|
|
||||||
};
|
|
||||||
|
|
||||||
RO_ global Str8 x8616_serialize_ea[] = {
|
|
||||||
[x8616_ea_bx_si] = slit8("bx + si"),
|
|
||||||
[x8616_ea_bx_di] = slit8("bx + di"),
|
|
||||||
[x8616_ea_bp_si] = slit8("bp + si"),
|
|
||||||
[x8616_ea_bp_di] = slit8("bp + di"),
|
|
||||||
[x8616_ea_si] = slit8("si"),
|
|
||||||
[x8616_ea_di] = slit8("di"),
|
|
||||||
[x8616_ea_bp] = slit8("bp"),
|
|
||||||
[x8616_ea_bx] = slit8("bx"),
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef Enum_(U1, X8616_SerializeSizeWhere) {
|
typedef Enum_(U1, X8616_SerializeSizeWhere) {
|
||||||
x8616_serialize_size_none = 0x00,
|
x8616_serialize_size_none = 0x00,
|
||||||
x8616_serialize_size_before_mem = 0x01,
|
x8616_serialize_size_before_mem = 0x01,
|
||||||
@@ -162,12 +21,11 @@ FI_ X8616_SerializeStatus x8616_serialize_put_or_full(Str8Gen_R gen, Str8 piece)
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal B4 x8616_serialize_put_u4(Str8Gen_R gen, U4 value) {
|
internal B4 x8616_serialize_put_u4(Str8Gen_R gen, U4 value) {
|
||||||
Info_str8_from_u4 info = str8_from_u4_info(value, 10, 0, 0);
|
Info_str8_from_u4 info = str8_from_u4_info(value, 10, 0, 0); UTF8 digits[16];
|
||||||
UTF8 digits[16];
|
B4 ok = info.size_required != 0 && info.size_required <= Array_len(digits) && info.size_required <= gen->cap - gen->len;
|
||||||
B4 ok = info.size_required != 0 && info.size_required <= Array_len(digits) && info.size_required <= gen->cap - gen->len;
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
Str8 text = str8_from_u4_buf(slice_ut(digits, info.size_required), value, 10, 0, 0, info);
|
Str8 text = str8_from_u4_buf(slice_ut(digits, info.size_required), value, 10, 0, 0, info);
|
||||||
ok = x8616_serialize_put(gen, text);
|
ok = x8616_serialize_put(gen, text);
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@@ -185,14 +43,8 @@ internal B4 x8616_serialize_put_s4(Str8Gen_R gen, S4 value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal S4 x8616_serialize_s4_from_bits(U2 bits, U1 byte_count) {
|
internal S4 x8616_serialize_s4_from_bits(U2 bits, U1 byte_count) {
|
||||||
if (byte_count <= 1) {
|
if (byte_count <= 1) return s4_(s1_(u1_(bits)));
|
||||||
U4 value = bits & 0xFF;
|
return s4_(s2_(bits));
|
||||||
if (value & 0x80) return C_(S4, value) - 256;
|
|
||||||
return C_(S4, value);
|
|
||||||
}
|
|
||||||
U4 value = bits;
|
|
||||||
if (value & 0x8000) return C_(S4, value) - 65536;
|
|
||||||
return C_(S4, value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FI_ B4 x8616_serialize_imm_is_signed(X8616_Op op) { switch (op) {
|
FI_ B4 x8616_serialize_imm_is_signed(X8616_Op op) { switch (op) {
|
||||||
@@ -242,7 +94,7 @@ x8616_serialize_size_where(X8616_Op op, U1 operand_count, X8616_DecodedOperand o
|
|||||||
B4 has_imm = 0;
|
B4 has_imm = 0;
|
||||||
for (U1 id = 0; id < operand_count; ++id) {
|
for (U1 id = 0; id < operand_count; ++id) {
|
||||||
X8616_DecodedOperandFlags flags = operands[id].flags;
|
X8616_DecodedOperandFlags flags = operands[id].flags;
|
||||||
if (flags & x8616_decoded_operand_memory) has_mem = 1;
|
if (flags & x8616_decoded_operand_memory) has_mem = 1;
|
||||||
if ((flags & x8616_decoded_operand_immediate) && ((flags & x8616_decoded_operand_register) == 0)) has_imm = 1;
|
if ((flags & x8616_decoded_operand_immediate) && ((flags & x8616_decoded_operand_register) == 0)) has_imm = 1;
|
||||||
}
|
}
|
||||||
switch (op) {
|
switch (op) {
|
||||||
@@ -333,13 +185,13 @@ FI_ B4 x8616_serialize_is_string(X8616_Op op) { switch (op) {
|
|||||||
return 0;
|
return 0;
|
||||||
}}
|
}}
|
||||||
|
|
||||||
FI_ B4 x8616_serialize_has_memory(X8616_DecodedInstruction* inst) {
|
FI_ B4 x8616_serialize_has_memory(X8616_DecodedInstruction_R inst) {
|
||||||
for (U1 id = 0; id < inst->operand_count; ++id) { if (inst->operands[id].flags & x8616_decoded_operand_memory) return 1; }
|
for (U1 id = 0; id < inst->operand_count; ++id) { if (inst->operands[id].flags & x8616_decoded_operand_memory) return 1; }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal X8616_SerializeStatus
|
internal X8616_SerializeStatus
|
||||||
x8616_serialize_put_operand(Str8Gen_R gen, X8616_DecodedInstruction* inst, X8616_DecodedOperand* operand)
|
x8616_serialize_put_operand(Str8Gen_R gen, X8616_DecodedInstruction_R inst, X8616_DecodedOperand_R operand)
|
||||||
{
|
{
|
||||||
X8616_SerializeStatus status = x8616_serialize_ok;
|
X8616_SerializeStatus status = x8616_serialize_ok;
|
||||||
X8616_SerializeSizeWhere where = x8616_serialize_size_where(inst->op, inst->operand_count, inst->operands);
|
X8616_SerializeSizeWhere where = x8616_serialize_size_where(inst->op, inst->operand_count, inst->operands);
|
||||||
@@ -408,6 +260,21 @@ FI_ X8616_DecodedOperandFlags x8616_serialize_base_flags(X8616_DecodedOperandFla
|
|||||||
|
|
||||||
FI_ B4 x8616_serialize_one_flag(X8616_DecodedOperandFlags flags) { U2 bits = C_(U2, flags); return (bits != 0) && ((bits & (bits - 1)) == 0); }
|
FI_ B4 x8616_serialize_one_flag(X8616_DecodedOperandFlags flags) { U2 bits = C_(U2, flags); return (bits != 0) && ((bits & (bits - 1)) == 0); }
|
||||||
|
|
||||||
|
internal void
|
||||||
|
x8616_serialize_push(FArena_R arena, X8616_InfoList_R msgs, X8616_SerializeStatus status, U4 id, U2 size, U4 expected, U4 actual) {
|
||||||
|
if (status == x8616_serialize_ok || arena == 0) return;
|
||||||
|
X8616_InfoKind kind = x8616_info_error;
|
||||||
|
X8616_InfoCode code = x8616_info_serialize_invalid_record;
|
||||||
|
if (status == x8616_serialize_output_full) {
|
||||||
|
kind = x8616_info_warning;
|
||||||
|
code = x8616_info_serialize_output_full;
|
||||||
|
}
|
||||||
|
else if (status == x8616_serialize_unsupported_form) {
|
||||||
|
code = x8616_info_serialize_unsupported_form;
|
||||||
|
}
|
||||||
|
x8616_info_push(arena, msgs, kind, code, id, size, expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
internal X8616_SerializeStatus
|
internal X8616_SerializeStatus
|
||||||
x8616_serialize_validate(X8616_DecodedInstruction_R inst)
|
x8616_serialize_validate(X8616_DecodedInstruction_R inst)
|
||||||
{
|
{
|
||||||
@@ -421,9 +288,9 @@ x8616_serialize_validate(X8616_DecodedInstruction_R inst)
|
|||||||
if (bad_decode || invalid_sig || invalid_mnemonic || invalid_prefix_with_seg) {
|
if (bad_decode || invalid_sig || invalid_mnemonic || invalid_prefix_with_seg) {
|
||||||
status = x8616_serialize_invalid_record; goto status_failed;
|
status = x8616_serialize_invalid_record; goto status_failed;
|
||||||
}
|
}
|
||||||
B4 bad_prefix_segement = inst->prefixes.has_segment && (x8616_serialize_has_memory(inst) == 0);
|
B4 bad_prefix_segment = inst->prefixes.has_segment && (x8616_serialize_has_memory(inst) == 0);
|
||||||
B4 bad_prefix_repeat = inst->prefixes.has_repeat && (x8616_serialize_is_string(inst->op) == 0);
|
B4 bad_prefix_repeat = inst->prefixes.has_repeat && (x8616_serialize_is_string(inst->op) == 0);
|
||||||
if (bad_prefix_segement || bad_prefix_repeat) {
|
if (bad_prefix_segment || bad_prefix_repeat) {
|
||||||
status = x8616_serialize_unsupported_form; goto status_failed;
|
status = x8616_serialize_unsupported_form; goto status_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,7 +319,7 @@ status_failed:
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal X8616_SerializeStatus
|
internal X8616_SerializeStatus
|
||||||
x8616_serialize_instruction_line(Str8Gen_R line, X8616_DecodedInstruction* inst)
|
x8616_serialize_instruction_line(Str8Gen_R line, X8616_DecodedInstruction* inst)
|
||||||
{
|
{
|
||||||
X8616_SerializeStatus st = x8616_serialize_ok;
|
X8616_SerializeStatus st = x8616_serialize_ok;
|
||||||
@@ -477,7 +344,7 @@ x8616_serialize_instruction_line(Str8Gen_R line, X8616_DecodedInstruction* inst)
|
|||||||
if (st == x8616_serialize_ok && inst->operand_count) {
|
if (st == x8616_serialize_ok && inst->operand_count) {
|
||||||
st = x8616_serialize_put_or_full(line, slit8(" "));
|
st = x8616_serialize_put_or_full(line, slit8(" "));
|
||||||
for (U1 id = 0; st == x8616_serialize_ok && id < inst->operand_count; ++id) {
|
for (U1 id = 0; st == x8616_serialize_ok && id < inst->operand_count; ++id) {
|
||||||
if (id) st = x8616_serialize_put_or_full(line, slit8(", "));
|
if (id) st = x8616_serialize_put_or_full(line, slit8(", "));
|
||||||
if (st == x8616_serialize_ok) st = x8616_serialize_put_operand(line, inst, & inst->operands[id]);
|
if (st == x8616_serialize_ok) st = x8616_serialize_put_operand(line, inst, & inst->operands[id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -485,38 +352,70 @@ x8616_serialize_instruction_line(Str8Gen_R line, X8616_DecodedInstruction* inst)
|
|||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
X8616_SerializeInfo
|
X8616_SerializeInfo x8616_serialize_instructions(X8616_SerializeRequest request)
|
||||||
x8616_serialize_instructions(X8616_SerializeRequest request)
|
|
||||||
{
|
{
|
||||||
X8616_SerializeInfo result = {0}; result.text.ptr = C_(UTF8*, request.output.ptr);
|
X8616_SerializeInfo result = {0}; result.text.ptr = C_(UTF8*, request.output.ptr);
|
||||||
B4 invalid_record =
|
X8616_InfoList local = {0};
|
||||||
|
X8616_InfoList_R msgs = request.msgs ? request.msgs : & local;
|
||||||
|
|
||||||
|
B4 bad_request =
|
||||||
(request.instruction_count && request.instructions == 0)
|
(request.instruction_count && request.instructions == 0)
|
||||||
|| (request.output.len && request.output.ptr == 0)
|
|| (request.output.len && request.output.ptr == 0)
|
||||||
|| (request.scratch.len && request.scratch.ptr == 0);
|
|| (request.scratch.len && request.scratch.ptr == 0)
|
||||||
if (invalid_record) { result.status = x8616_serialize_invalid_record; goto exit; }
|
|| (request.info_arena == 0);
|
||||||
if (request.output.len < X8616_SERIALIZE_HEADER_LEN) { result.status = x8616_serialize_output_full; goto exit; }
|
if (bad_request)
|
||||||
|
{
|
||||||
|
if (request.info_arena) {
|
||||||
|
x8616_info_push(request.info_arena, msgs, x8616_info_error
|
||||||
|
, x8616_info_serialize_bad_request, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
msgs->count += 1;
|
||||||
|
msgs->error_count += 1;
|
||||||
|
msgs->dropped_count += 1;
|
||||||
|
}
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if (request.output.len < x8616_serialize_header.len) {
|
||||||
|
x8616_serialize_push(request.info_arena, msgs, x8616_serialize_output_full
|
||||||
|
, 0, 0, u4_(x8616_serialize_header.len), u4_(request.output.len));
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
Str8Gen gen = str8gen_make(request.output);
|
Str8Gen gen = str8gen_make(request.output);
|
||||||
if (x8616_serialize_header.len > gen.cap - gen.len) { result.status = x8616_serialize_output_full; goto exit; }
|
|
||||||
str8gen_append_str8(& gen, x8616_serialize_header);
|
str8gen_append_str8(& gen, x8616_serialize_header);
|
||||||
result.text.len = gen.len;
|
result.text.len = gen.len;
|
||||||
|
|
||||||
for (U4 id = 0; id < request.instruction_count; ++id) {
|
for (U4 id = 0; id < request.instruction_count; ++id)
|
||||||
X8616_SerializeStatus line_status = x8616_serialize_validate(& request.instructions[id]);
|
{
|
||||||
if (line_status != x8616_serialize_ok) { result.status = line_status; goto exit; }
|
X8616_DecodedInstruction_R inst = & request.instructions[id];
|
||||||
|
X8616_SerializeStatus line_status = x8616_serialize_validate(inst);
|
||||||
|
if (line_status != x8616_serialize_ok) {
|
||||||
|
x8616_serialize_push(request.info_arena, msgs, line_status
|
||||||
|
, id, inst->size, 0, u4_(inst->op));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Str8Gen line = str8gen_make(request.scratch);
|
Str8Gen line = str8gen_make(request.scratch);
|
||||||
line_status = x8616_serialize_instruction_line(& line, & request.instructions[id]);
|
line_status = x8616_serialize_instruction_line(& line, inst);
|
||||||
if (line_status != x8616_serialize_ok) { result.status = line_status; goto exit; }
|
if (line_status != x8616_serialize_ok) {
|
||||||
|
x8616_serialize_push(request.info_arena, msgs, line_status
|
||||||
|
, id, inst->size, u4_(request.scratch.len), u4_(line.len));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Str8 text = str8(line.ptr, line.len);
|
Str8 text = str8(line.ptr, line.len);
|
||||||
if (text.len > gen.cap - gen.len) { result.status = x8616_serialize_output_full; goto exit; }
|
if (text.len > gen.cap - gen.len) {
|
||||||
|
x8616_serialize_push(request.info_arena, msgs, x8616_serialize_output_full
|
||||||
|
, id, inst->size, u4_(request.output.len), u4_(gen.len));
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
str8gen_append_str8(& gen, text);
|
str8gen_append_str8(& gen, text);
|
||||||
result.text.len = gen.len;
|
result.text.len = gen.len;
|
||||||
result.instructions_written += 1;
|
result.instructions_written += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.status = x8616_serialize_ok;
|
|
||||||
exit:
|
exit:
|
||||||
|
result.msgs = *msgs;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,15 +12,18 @@ typedef Enum_(U1, X8616_SerializeStatus) {
|
|||||||
|
|
||||||
typedef Struct_(X8616_SerializeRequest) {
|
typedef Struct_(X8616_SerializeRequest) {
|
||||||
X8616_DecodedInstruction* instructions;
|
X8616_DecodedInstruction* instructions;
|
||||||
U4 instruction_count;
|
U4 instruction_count; byte_pad(4);
|
||||||
Slice output;
|
Slice output;
|
||||||
Slice scratch;
|
Slice scratch;
|
||||||
|
FArena* info_arena;
|
||||||
|
X8616_InfoList_R msgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Struct_(X8616_SerializeInfo) {
|
typedef Struct_(X8616_SerializeInfo) {
|
||||||
Str8 text;
|
X8616_InfoList msgs;
|
||||||
U4 instructions_written;
|
Str8 text;
|
||||||
X8616_SerializeStatus status;
|
U4 instructions_written;
|
||||||
|
byte_pad(4);
|
||||||
};
|
};
|
||||||
|
|
||||||
X8616_SerializeInfo x8616_serialize_instructions(X8616_SerializeRequest request);
|
X8616_SerializeInfo x8616_serialize_instructions(X8616_SerializeRequest request);
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
#ifdef INTELLISENSE_DIRECTIVES
|
||||||
|
# pragma once
|
||||||
|
# include "encoder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
RO_ global Str8 x8616_serialize_header = slit8("bits 16\n\n");
|
||||||
|
|
||||||
|
RO_ global Str8 x8616_serialize_mnemonic[] = {
|
||||||
|
[x8616_op_invalid] = slit8(""),
|
||||||
|
[x8616_op_nop] = slit8("nop"),
|
||||||
|
[x8616_op_mov] = slit8("mov"),
|
||||||
|
[x8616_op_add] = slit8("add"),
|
||||||
|
[x8616_op_or] = slit8("or"),
|
||||||
|
[x8616_op_adc] = slit8("adc"),
|
||||||
|
[x8616_op_sbb] = slit8("sbb"),
|
||||||
|
[x8616_op_and] = slit8("and"),
|
||||||
|
[x8616_op_sub] = slit8("sub"),
|
||||||
|
[x8616_op_xor] = slit8("xor"),
|
||||||
|
[x8616_op_cmp] = slit8("cmp"),
|
||||||
|
[x8616_op_push] = slit8("push"),
|
||||||
|
[x8616_op_pop] = slit8("pop"),
|
||||||
|
[x8616_op_xchg] = slit8("xchg"),
|
||||||
|
[x8616_op_in] = slit8("in"),
|
||||||
|
[x8616_op_out] = slit8("out"),
|
||||||
|
[x8616_op_xlat] = slit8("xlat"),
|
||||||
|
[x8616_op_lea] = slit8("lea"),
|
||||||
|
[x8616_op_lds] = slit8("lds"),
|
||||||
|
[x8616_op_les] = slit8("les"),
|
||||||
|
[x8616_op_lahf] = slit8("lahf"),
|
||||||
|
[x8616_op_sahf] = slit8("sahf"),
|
||||||
|
[x8616_op_pushf] = slit8("pushf"),
|
||||||
|
[x8616_op_popf] = slit8("popf"),
|
||||||
|
[x8616_op_inc] = slit8("inc"),
|
||||||
|
[x8616_op_aaa] = slit8("aaa"),
|
||||||
|
[x8616_op_daa] = slit8("daa"),
|
||||||
|
[x8616_op_dec] = slit8("dec"),
|
||||||
|
[x8616_op_neg] = slit8("neg"),
|
||||||
|
[x8616_op_aas] = slit8("aas"),
|
||||||
|
[x8616_op_das] = slit8("das"),
|
||||||
|
[x8616_op_mul] = slit8("mul"),
|
||||||
|
[x8616_op_imul] = slit8("imul"),
|
||||||
|
[x8616_op_aam] = slit8("aam"),
|
||||||
|
[x8616_op_div] = slit8("div"),
|
||||||
|
[x8616_op_idiv] = slit8("idiv"),
|
||||||
|
[x8616_op_aad] = slit8("aad"),
|
||||||
|
[x8616_op_cbw] = slit8("cbw"),
|
||||||
|
[x8616_op_cwd] = slit8("cwd"),
|
||||||
|
[x8616_op_not] = slit8("not"),
|
||||||
|
[x8616_op_shl] = slit8("shl"),
|
||||||
|
[x8616_op_shr] = slit8("shr"),
|
||||||
|
[x8616_op_sar] = slit8("sar"),
|
||||||
|
[x8616_op_rol] = slit8("rol"),
|
||||||
|
[x8616_op_ror] = slit8("ror"),
|
||||||
|
[x8616_op_rcl] = slit8("rcl"),
|
||||||
|
[x8616_op_rcr] = slit8("rcr"),
|
||||||
|
[x8616_op_test] = slit8("test"),
|
||||||
|
[x8616_op_rep] = slit8(""),
|
||||||
|
[x8616_op_movs] = slit8("movs"),
|
||||||
|
[x8616_op_cmps] = slit8("cmps"),
|
||||||
|
[x8616_op_scas] = slit8("scas"),
|
||||||
|
[x8616_op_lods] = slit8("lods"),
|
||||||
|
[x8616_op_stos] = slit8("stos"),
|
||||||
|
[x8616_op_call] = slit8("call"),
|
||||||
|
[x8616_op_jmp] = slit8("jmp"),
|
||||||
|
[x8616_op_ret] = slit8("ret"),
|
||||||
|
[x8616_op_retf] = slit8("retf"),
|
||||||
|
[x8616_op_je] = slit8("je"),
|
||||||
|
[x8616_op_jl] = slit8("jl"),
|
||||||
|
[x8616_op_jle] = slit8("jle"),
|
||||||
|
[x8616_op_jb] = slit8("jb"),
|
||||||
|
[x8616_op_jbe] = slit8("jbe"),
|
||||||
|
[x8616_op_jp] = slit8("jp"),
|
||||||
|
[x8616_op_jo] = slit8("jo"),
|
||||||
|
[x8616_op_js] = slit8("js"),
|
||||||
|
[x8616_op_jne] = slit8("jne"),
|
||||||
|
[x8616_op_jnl] = slit8("jnl"),
|
||||||
|
[x8616_op_jg] = slit8("jg"),
|
||||||
|
[x8616_op_jnb] = slit8("jnb"),
|
||||||
|
[x8616_op_ja] = slit8("ja"),
|
||||||
|
[x8616_op_jnp] = slit8("jnp"),
|
||||||
|
[x8616_op_jno] = slit8("jno"),
|
||||||
|
[x8616_op_jns] = slit8("jns"),
|
||||||
|
[x8616_op_loop] = slit8("loop"),
|
||||||
|
[x8616_op_loopz] = slit8("loopz"),
|
||||||
|
[x8616_op_loopnz] = slit8("loopnz"),
|
||||||
|
[x8616_op_jcxz] = slit8("jcxz"),
|
||||||
|
[x8616_op_int] = slit8("int"),
|
||||||
|
[x8616_op_int3] = slit8("int3"),
|
||||||
|
[x8616_op_into] = slit8("into"),
|
||||||
|
[x8616_op_iret] = slit8("iret"),
|
||||||
|
[x8616_op_clc] = slit8("clc"),
|
||||||
|
[x8616_op_cmc] = slit8("cmc"),
|
||||||
|
[x8616_op_stc] = slit8("stc"),
|
||||||
|
[x8616_op_cld] = slit8("cld"),
|
||||||
|
[x8616_op_std] = slit8("std"),
|
||||||
|
[x8616_op_cli] = slit8("cli"),
|
||||||
|
[x8616_op_sti] = slit8("sti"),
|
||||||
|
[x8616_op_hlt] = slit8("hlt"),
|
||||||
|
[x8616_op_wait] = slit8("wait"),
|
||||||
|
[x8616_op_lock] = slit8(""),
|
||||||
|
[x8616_op_segment] = slit8(""),
|
||||||
|
};
|
||||||
|
|
||||||
|
RO_ global Str8 x8616_serialize_reg8[] = {
|
||||||
|
[x8616_al] = slit8("al"),
|
||||||
|
[x8616_cl] = slit8("cl"),
|
||||||
|
[x8616_dl] = slit8("dl"),
|
||||||
|
[x8616_bl] = slit8("bl"),
|
||||||
|
[x8616_ah] = slit8("ah"),
|
||||||
|
[x8616_ch] = slit8("ch"),
|
||||||
|
[x8616_dh] = slit8("dh"),
|
||||||
|
[x8616_bh] = slit8("bh"),
|
||||||
|
};
|
||||||
|
|
||||||
|
RO_ global Str8 x8616_serialize_reg16[] = {
|
||||||
|
[x8616_ax] = slit8("ax"),
|
||||||
|
[x8616_cx] = slit8("cx"),
|
||||||
|
[x8616_dx] = slit8("dx"),
|
||||||
|
[x8616_bx] = slit8("bx"),
|
||||||
|
[x8616_sp] = slit8("sp"),
|
||||||
|
[x8616_bp] = slit8("bp"),
|
||||||
|
[x8616_si] = slit8("si"),
|
||||||
|
[x8616_di] = slit8("di"),
|
||||||
|
};
|
||||||
|
|
||||||
|
RO_ global Str8 x8616_serialize_seg[] = {
|
||||||
|
[x8616_es] = slit8("es"),
|
||||||
|
[x8616_cs] = slit8("cs"),
|
||||||
|
[x8616_ss] = slit8("ss"),
|
||||||
|
[x8616_ds] = slit8("ds"),
|
||||||
|
};
|
||||||
|
|
||||||
|
RO_ global Str8 x8616_serialize_ea[] = {
|
||||||
|
[x8616_ea_bx_si] = slit8("bx + si"),
|
||||||
|
[x8616_ea_bx_di] = slit8("bx + di"),
|
||||||
|
[x8616_ea_bp_si] = slit8("bp + si"),
|
||||||
|
[x8616_ea_bp_di] = slit8("bp + di"),
|
||||||
|
[x8616_ea_si] = slit8("si"),
|
||||||
|
[x8616_ea_di] = slit8("di"),
|
||||||
|
[x8616_ea_bp] = slit8("bp"),
|
||||||
|
[x8616_ea_bx] = slit8("bx"),
|
||||||
|
};
|
||||||
+4
-8
@@ -110,14 +110,10 @@ FI_ U4 find_aos_keys_mask_u8x4(U8_R p0, U8_R p1, U8_R p2, U8_R p3, U8 key) {
|
|||||||
U8x4 keys, splat, eq;
|
U8x4 keys, splat, eq;
|
||||||
U4 mask;
|
U4 mask;
|
||||||
asm volatile(
|
asm volatile(
|
||||||
x64_u8x2_load_u8 (lo, p0)
|
x64_u8x2_load_u8 (lo, p0) x64_u8x2_insert_u8(lo, p1, 1)
|
||||||
x64_u8x2_insert_u8(lo, p1, 1)
|
x64_u8x2_load_u8 (hi, p2) x64_u8x2_insert_u8(hi, p3, 1)
|
||||||
x64_u8x2_load_u8 (hi, p2)
|
x64_u8x4_insert_xmm(keys, lo, 0) x64_u8x4_insert_xmm(keys, hi, 1)
|
||||||
x64_u8x2_insert_u8(hi, p3, 1)
|
x64_u8x4_broadcast(splat, key) x64_u8x4_match(eq, keys, splat)
|
||||||
x64_u8x4_insert_xmm(keys, lo, 0)
|
|
||||||
x64_u8x4_insert_xmm(keys, hi, 1)
|
|
||||||
x64_u8x4_broadcast(splat, key)
|
|
||||||
x64_u8x4_match(eq, keys, splat)
|
|
||||||
x64_u4_from_qword_hits(mask, eq)
|
x64_u4_from_qword_hits(mask, eq)
|
||||||
asm_out : asm_out_x(lo), asm_out_x(hi), asm_out_x(keys), asm_out_x(splat), asm_out_x(eq), asm_out_r(mask)
|
asm_out : asm_out_x(lo), asm_out_x(hi), asm_out_x(keys), asm_out_x(splat), asm_out_x(eq), asm_out_r(mask)
|
||||||
asm_in : asm_in_r(p0), asm_in_r(p1), asm_in_r(p2), asm_in_r(p3), asm_in_r(key)
|
asm_in : asm_in_r(p0), asm_in_r(p1), asm_in_r(p2), asm_in_r(p3), asm_in_r(key)
|
||||||
|
|||||||
+4
-35
@@ -55,7 +55,6 @@ Standard: c23
|
|||||||
#define LP_ static // static data within procedure scope
|
#define LP_ static // static data within procedure scope
|
||||||
#define internal static // internal
|
#define internal static // internal
|
||||||
|
|
||||||
|
|
||||||
#define attribute(directive) __attribute__((directive))
|
#define attribute(directive) __attribute__((directive))
|
||||||
|
|
||||||
#define asm __asm__
|
#define asm __asm__
|
||||||
@@ -74,39 +73,6 @@ Standard: c23
|
|||||||
#define R_ restrict
|
#define R_ restrict
|
||||||
#define V_ volatile
|
#define V_ volatile
|
||||||
|
|
||||||
// R_ (restrict) establishes an "Eigen" or "Proprius" mapping.
|
|
||||||
// Unlike volatile (V_), which assumes the memory can be changed by anything,
|
|
||||||
// R_ tells the compiler that this pointer holds the *sole*, private (idios) ownership of the memory slice.
|
|
||||||
// Writes to this memory are exclusively bound to this single symbolic mapping for the duration of the scope, guaranteeing zero aliasing.
|
|
||||||
|
|
||||||
#pragma region Fictional //, used for intiution
|
|
||||||
|
|
||||||
#define EUB_ restrict // Execute Unit Bound: Data is siloed in the ALU Register File. The Load/Store Unit is bypassed. (Route to Execution Unit. Keep in registers)
|
|
||||||
#define ISO_ restrict // Isolated Provenance: Alternative to Exu_. Guarantees electrical memory isolation,
|
|
||||||
// unlocking the compiler’s ability to safely pack data across multiple parallel SIMD lanes (vectorization).
|
|
||||||
#define LSU_ volatile // Load/Store Unit Bound: The compiler is forbidden from caching in registers. Forces physical L1 Cache matrix sampling.
|
|
||||||
#define LIVE_ volatile // Live External Data: Alternative to Lsu_ emphasizing the memory is tapped by an external electrical actor.
|
|
||||||
|
|
||||||
#define latch_store /* ~: atomic_store*/ // Blasts voltages from the Store Buffer into the L1 SRAM, physically flipping the cross-coupled inverters to lock the state.
|
|
||||||
#define pulse_rfo /* ~: atomic_xchg*/ // Broadcasts an electrical RFO (Request For Ownership) pulse across the CPU mesh network to invalidate other L1 caches.
|
|
||||||
#define tact_acquire /* ~: memory_order_acquire*/ // Clamp. Sends a voltage signal to the instruction decoder to halt the Out-of-Order engine until the load resolves.
|
|
||||||
#define tact_release /* ~: memory_order_release*/ // Drain. Forces the Store Buffer flip-flops to completely empty into the L1 cache before proceeding.
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// Out-of-Order (OoO) Pipeline Modifiers
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
#define ooo_drift_ __ATOMIC_RELAXED // OoO engine allowed to drift
|
|
||||||
#define ooo_anchor_ __ATOMIC_ACQUIRE // Anchor the Load Queue (halt spec lookahead)
|
|
||||||
#define ooo_drain_ __ATOMIC_RELEASE // Drain the Store Buffer (force writeback)
|
|
||||||
#define ooo_weld_ __ATOMIC_SEQ_CST // Weld pipeline (total order bus lock)
|
|
||||||
|
|
||||||
// Latch operations with physical queue modifiers
|
|
||||||
#define latch_load_anchor(ptr) //__atomic_load_n(ptr, ooo_anchor_)
|
|
||||||
#define latch_store_drain(ptr, val) //__atomic_store_n(ptr, val, ooo_drain_)
|
|
||||||
#define pulse_xchg_weld(ptr, val) //__atomic_exchange_n(ptr, val, ooo_weld_)
|
|
||||||
|
|
||||||
#pragma endregion Fictional
|
|
||||||
|
|
||||||
#define r_(ptr) C_(T_(ptr[0])*R_, ptr) // Constrain pointer to restrict
|
#define r_(ptr) C_(T_(ptr[0])*R_, ptr) // Constrain pointer to restrict
|
||||||
#define v_(ptr) C_(T_(ptr[0])V_*, ptr) //
|
#define v_(ptr) C_(T_(ptr[0])V_*, ptr) //
|
||||||
#define tr_(type, ptr) C_(type *R_, ptr)
|
#define tr_(type, ptr) C_(type *R_, ptr)
|
||||||
@@ -168,8 +134,11 @@ typedef float F4_2 __attribute__((vector_size(16)));
|
|||||||
#define u8_v(value) C_(U8 V_*, value)
|
#define u8_v(value) C_(U8 V_*, value)
|
||||||
enum { false = 0, true = 1, true_overflow, };
|
enum { false = 0, true = 1, true_overflow, };
|
||||||
|
|
||||||
|
#define u2_lo(value) u1_(u2_(value))
|
||||||
|
#define u2_hi(value) u1_(u2_(value) >> 8)
|
||||||
|
|
||||||
#define u4_lo(value) ((value) & 0xFFFFU)
|
#define u4_lo(value) ((value) & 0xFFFFU)
|
||||||
#define u4_hi(value) ((value) >> 12)
|
#define u4_hi(value) ((value) >> 16)
|
||||||
|
|
||||||
typedef void Proc_(VoidFn) (void);
|
typedef void Proc_(VoidFn) (void);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ RO_ U8 integer_symbol_reverse[128] = {
|
|||||||
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FI_ B4 char_is_space(UTF8 c) { return(c == ' ' || c == '\n' || c == '\t' || c == '\r' || c == '\f' || c == '\v'); }
|
||||||
FI_ B4 char_is_upper(UTF8 c) { return('A' <= c && c <= 'Z'); }
|
FI_ B4 char_is_upper(UTF8 c) { return('A' <= c && c <= 'Z'); }
|
||||||
FI_ UTF8 char_to_lower(UTF8 c) { if (char_is_upper(c)) { c += ('a' - 'A'); } return(c); }
|
FI_ UTF8 char_to_lower(UTF8 c) { if (char_is_upper(c)) { c += ('a' - 'A'); } return(c); }
|
||||||
FI_ B4 char_is_digit(UTF8 c, U4 base) {
|
FI_ B4 char_is_digit(UTF8 c, U4 base) {
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
#include "8086/encoder.h"
|
#include "8086/encoder.h"
|
||||||
#include "8086/encoder_table.h"
|
#include "8086/encoder_table.h"
|
||||||
#include "8086/info.h"
|
#include "8086/info.h"
|
||||||
#include "8086/info_render.h"
|
|
||||||
#include "8086/decoder.h"
|
#include "8086/decoder.h"
|
||||||
#include "8086/serializer.h"
|
#include "8086/serializer.h"
|
||||||
|
#include "8086/serializer_tables.h"
|
||||||
#include "8086/gen/decoder_table.h"
|
#include "8086/gen/decoder_table.h"
|
||||||
|
|
||||||
#include "8086/decoder.c"
|
#include "8086/decoder.c"
|
||||||
@@ -99,11 +99,11 @@ int main()
|
|||||||
Slice_X8616_DecodedInstruction decoded = farena_push_array(& decode_arena, X8616_DecodedInstruction, data.len);
|
Slice_X8616_DecodedInstruction decoded = farena_push_array(& decode_arena, X8616_DecodedInstruction, data.len);
|
||||||
|
|
||||||
X8616_DecodeInfo info = x8616_decode_(
|
X8616_DecodeInfo info = x8616_decode_(
|
||||||
.source = data.ptr,
|
.source = data.ptr,
|
||||||
.source_size = data.len,
|
.source_len = data.len,
|
||||||
.instructions = decoded.ptr,
|
.out_instructions = decoded.ptr,
|
||||||
.instruction_capacity = decoded.len,
|
.instruction_cap = decoded.len,
|
||||||
.info_arena = & decode_arena,
|
.info_arena = & decode_arena,
|
||||||
);
|
);
|
||||||
if (info.source_consumed != data.len || info.instruction_count == 0 || info.msgs.error_count || info.msgs.dropped_count) {
|
if (info.source_consumed != data.len || info.instruction_count == 0 || info.msgs.error_count || info.msgs.dropped_count) {
|
||||||
ms_exit_process(10);
|
ms_exit_process(10);
|
||||||
@@ -114,13 +114,13 @@ int main()
|
|||||||
.instruction_count = info.instruction_count,
|
.instruction_count = info.instruction_count,
|
||||||
.output = slice_ut_arr(smem.text_mem),
|
.output = slice_ut_arr(smem.text_mem),
|
||||||
.scratch = slice_ut_arr(smem.Scratchpad),
|
.scratch = slice_ut_arr(smem.Scratchpad),
|
||||||
|
.info_arena = & decode_arena,
|
||||||
|
.msgs = & info.msgs,
|
||||||
});
|
});
|
||||||
if (text.status != x8616_serialize_ok || text.instructions_written != info.instruction_count) {
|
if (text.msgs.error_count || text.msgs.dropped_count || text.instructions_written != info.instruction_count) {
|
||||||
ms_exit_process(13);
|
ms_exit_process(13);
|
||||||
return 13;
|
return 13;
|
||||||
}
|
}
|
||||||
Str8 listing_text = text.text;
|
|
||||||
(void)listing_text;
|
|
||||||
|
|
||||||
ms_exit_process(0);
|
ms_exit_process(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user