Browse Source

generate slightly better code for ud2

Fabian 1 year ago
parent
commit
625fdcd4a2
3 changed files with 3 additions and 2 deletions
  1. 1 1
      gen/x86_table.js
  2. 0 1
      src/rust/cpu/instructions_0f.rs
  3. 2 0
      src/rust/jit_instructions.rs

+ 1 - 1
gen/x86_table.js

@@ -443,7 +443,7 @@ const encodings = [
     // Technically has a next instruction, but Linux uses this for assertions
     // and embeds the assertion message after this instruction, which is likely
     // the most common use case of ud2
-    { opcode: 0x0F0B, skip: 1, block_boundary: 1, no_next_instruction: 1, },
+    { opcode: 0x0F0B, skip: 1, block_boundary: 1, custom: 1, no_next_instruction: 1, },
     { opcode: 0x0F0C, skip: 1, block_boundary: 1, },
     { opcode: 0x0F0D, skip: 1, block_boundary: 1, },
     { opcode: 0x0F0E, skip: 1, block_boundary: 1, },

+ 0 - 1
src/rust/cpu/instructions_0f.rs

@@ -449,7 +449,6 @@ pub unsafe fn instr_0F09() {
 }
 #[no_mangle]
 pub unsafe fn instr_0F0A() { undefined_instruction(); }
-#[no_mangle]
 pub unsafe fn instr_0F0B() {
     // UD2
     trigger_ud();

+ 2 - 0
src/rust/jit_instructions.rs

@@ -5064,6 +5064,8 @@ pub fn instr_0F31_jit(ctx: &mut JitContext) {
     ctx.builder.block_end();
 }
 
+pub fn instr_0F0B_jit(ctx: &mut JitContext) { codegen::gen_trigger_ud(ctx) }
+
 pub fn instr_0F18_mem_jit(_ctx: &mut JitContext, _modrm_byte: ModrmByte, _reg: u32) {}
 pub fn instr_0F18_reg_jit(_ctx: &mut JitContext, _r1: u32, _r2: u32) {}