mirror of
https://github.com/copy/v86.git
synced 2025-12-31 04:23:15 +00:00
Codegen more fpu instructions and run their tests (D9_6, DA_5)
This commit is contained in:
parent
fdd1dc377d
commit
815e5d338e
2 changed files with 39 additions and 9 deletions
|
|
@ -283,12 +283,12 @@ const encodings = [
|
|||
{ opcode: 0xD8, e: 1, fixed_g: 7, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 0, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 1, custom: 1, is_fpu: 1, task_switch_test: 1, only_reg: 1 }, // skipped: #ud not supported by nasmtests in compiled code
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 2, custom: 1, is_fpu: 1, task_switch_test: 1, only_mem: 1 }, // skipped: #ud not supported by nasmtests in compiled code
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 1, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 2, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 3, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 4, custom: 1, is_fpu: 1, task_switch_test: 1, only_reg: 1 }, // fldenv
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 5, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 6, custom: 0, is_fpu: 1, task_switch_test: 1, skip: 1, }, // fstenv (mem), fprem (reg)
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 6, custom: 1, is_fpu: 1, task_switch_test: 1, skip: 1, }, // fstenv (mem), fprem (reg)
|
||||
{ opcode: 0xD9, e: 1, fixed_g: 7, custom: 1, is_fpu: 1, task_switch_test: 1, only_mem: 1, }, // fprem
|
||||
|
||||
{ opcode: 0xDA, e: 1, fixed_g: 0, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
|
|
@ -296,7 +296,7 @@ const encodings = [
|
|||
{ opcode: 0xDA, e: 1, fixed_g: 2, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDA, e: 1, fixed_g: 3, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDA, e: 1, fixed_g: 4, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDA, e: 1, fixed_g: 5, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDA, e: 1, fixed_g: 5, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDA, e: 1, fixed_g: 6, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDA, e: 1, fixed_g: 7, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
|
||||
|
|
@ -305,7 +305,7 @@ const encodings = [
|
|||
{ opcode: 0xDB, e: 1, fixed_g: 2, custom: 2, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDB, e: 1, fixed_g: 3, custom: 2, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDB, e: 1, fixed_g: 4, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDB, e: 1, fixed_g: 5, custom: 1, is_fpu: 1, task_switch_test: 1, only_reg: 1 }, // skipped: #ud not supported by nasmtests in compiled code
|
||||
{ opcode: 0xDB, e: 1, fixed_g: 5, custom: 1, is_fpu: 1, task_switch_test: 1, only_reg: 1, }, // XXX: skipped: Seems to page fault or so
|
||||
{ opcode: 0xDB, e: 1, fixed_g: 6, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDB, e: 1, fixed_g: 7, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
|
||||
|
|
@ -323,14 +323,14 @@ const encodings = [
|
|||
{ opcode: 0xDD, e: 1, fixed_g: 2, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDD, e: 1, fixed_g: 3, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDD, e: 1, fixed_g: 4, custom: 0, is_fpu: 1, task_switch_test: 1, only_reg: 1, }, // frstor
|
||||
{ opcode: 0xDD, e: 1, fixed_g: 5, custom: 1, is_fpu: 1, task_switch_test: 1, only_reg: 1, }, // skipped: #ud not supported by nasmtests in compiled code
|
||||
{ opcode: 0xDD, e: 1, fixed_g: 5, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDD, e: 1, fixed_g: 6, custom: 0, is_fpu: 1, task_switch_test: 1, only_reg: 1, }, // fsave
|
||||
{ opcode: 0xDD, e: 1, fixed_g: 7, custom: 0, is_fpu: 1, task_switch_test: 1, },
|
||||
|
||||
{ opcode: 0xDE, e: 1, fixed_g: 0, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDE, e: 1, fixed_g: 1, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDE, e: 1, fixed_g: 2, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDE, e: 1, fixed_g: 3, custom: 1, is_fpu: 1, task_switch_test: 1, only_mem: 1, }, // skipped: #ud not supported by nasmtests in compiled code
|
||||
{ opcode: 0xDE, e: 1, fixed_g: 3, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDE, e: 1, fixed_g: 4, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDE, e: 1, fixed_g: 5, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDE, e: 1, fixed_g: 6, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
|
|
@ -341,10 +341,10 @@ const encodings = [
|
|||
{ opcode: 0xDF, e: 1, fixed_g: 2, custom: 1, is_fpu: 1, task_switch_test: 1 },
|
||||
{ opcode: 0xDF, e: 1, fixed_g: 3, custom: 1, is_fpu: 1, task_switch_test: 1 },
|
||||
{ opcode: 0xDF, e: 1, fixed_g: 4, custom: 1, is_fpu: 1, task_switch_test: 1, skip: 1 }, // unimplemented (mem): Binary Coded Decimals
|
||||
// skipped (reg): #ud not supported by nasmtests in compiled code
|
||||
// skipped (reg): fnstsw
|
||||
{ opcode: 0xDF, e: 1, fixed_g: 5, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
{ opcode: 0xDF, e: 1, fixed_g: 6, custom: 0, is_fpu: 1, task_switch_test: 1, only_reg: 1 }, // unimplemented: Binary Coded Decimals
|
||||
{ opcode: 0xDF, e: 1, fixed_g: 7, custom: 1, is_fpu: 1, task_switch_test: 1, only_mem: 1 }, // skipped: #ud not supported by nasmtests in compiled code
|
||||
{ opcode: 0xDF, e: 1, fixed_g: 7, custom: 1, is_fpu: 1, task_switch_test: 1, },
|
||||
|
||||
// loop, jcxz, etc.
|
||||
// Conditional jumps, but condition code not supported by code generator
|
||||
|
|
|
|||
|
|
@ -2423,6 +2423,20 @@ pub fn instr_D9_5_reg_jit(ctx: &mut JitContext, r: u32) {
|
|||
// XXX: May call trigger_ud
|
||||
codegen::gen_fn1_const(ctx.builder, "instr_D9_5_reg", r);
|
||||
}
|
||||
|
||||
pub fn instr_D9_6_mem_jit(ctx: &mut JitContext, modrm_byte: u8) {
|
||||
codegen::gen_modrm_resolve(ctx, modrm_byte);
|
||||
// XXX: generated because fpu_fstenv might page-fault, but doesn't generate a proper block boundary
|
||||
codegen::gen_move_registers_from_locals_to_memory(ctx);
|
||||
codegen::gen_call_fn1(ctx.builder, "fpu_fstenv");
|
||||
codegen::gen_debug_track_jit_exit(ctx.builder, ctx.start_of_current_instruction);
|
||||
codegen::gen_clear_prefixes(ctx);
|
||||
ctx.builder.instruction_body.return_();
|
||||
}
|
||||
pub fn instr_D9_6_reg_jit(ctx: &mut JitContext, r: u32) {
|
||||
codegen::gen_fn1_const(ctx.builder, "instr_D9_6_reg", r);
|
||||
}
|
||||
|
||||
pub fn instr_D9_7_mem_jit(ctx: &mut JitContext, modrm_byte: u8) {
|
||||
codegen::gen_modrm_resolve(ctx, modrm_byte);
|
||||
let address_local = ctx.builder.set_new_local();
|
||||
|
|
@ -2442,6 +2456,22 @@ pub fn instr_D9_7_reg_jit(ctx: &mut JitContext, r: u32) {
|
|||
codegen::gen_fn1_const(ctx.builder, "instr_D9_7_reg", r);
|
||||
}
|
||||
|
||||
pub fn instr_DA_5_mem_jit(ctx: &mut JitContext, modrm_byte: u8) {
|
||||
ctx.builder.instruction_body.const_i32(0);
|
||||
codegen::gen_modrm_resolve(ctx, modrm_byte);
|
||||
codegen::gen_safe_read32(ctx);
|
||||
ctx.builder.instruction_body.convert_i32_to_f64();
|
||||
codegen::gen_call_fn2_i32_f64(ctx.builder, "fpu_fsubr")
|
||||
}
|
||||
pub fn instr_DA_5_reg_jit(ctx: &mut JitContext, r: u32) {
|
||||
if r == 1 {
|
||||
codegen::gen_fn0_const(ctx.builder, "fpu_fucompp");
|
||||
}
|
||||
else {
|
||||
codegen::gen_trigger_ud(ctx);
|
||||
};
|
||||
}
|
||||
|
||||
pub fn instr_DB_0_mem_jit(ctx: &mut JitContext, modrm_byte: u8) {
|
||||
codegen::gen_modrm_resolve(ctx, modrm_byte);
|
||||
codegen::gen_safe_read32(ctx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue