Skip to content

Commit

Permalink
Make std/cld custom (FC/FD), remove unused unguarded_register and no_…
Browse files Browse the repository at this point in the history
…register properties from x86 table
  • Loading branch information
copy committed Jan 1, 2021
1 parent 732cc2e commit e99da40
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
3 changes: 1 addition & 2 deletions gen/generate_jit.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ function gen_instruction_body_after_fixed_g(encoding, size)

if(!encoding.prefix)
{
if(encoding.custom && !encoding.unguarded_register || encoding.no_register)
if(encoding.custom)
{
}
else
Expand All @@ -252,7 +252,6 @@ function gen_instruction_body_after_fixed_g(encoding, size)
instruction_postfix.push(
gen_call("::codegen::gen_move_registers_from_memory_to_locals", ["ctx"])
);

}
}

Expand Down
4 changes: 2 additions & 2 deletions gen/x86_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ const encodings = [
{ opcode: 0xFA, custom: 1, skip: 1 },
// sti: not a jump, but can cause a change in eip
{ opcode: 0xFB, block_boundary: 1, skip: 1, },
{ opcode: 0xFC, no_register: 1, },
{ opcode: 0xFD, no_register: 1, },
{ opcode: 0xFC, custom: 1, },
{ opcode: 0xFD, custom: 1, },

{ opcode: 0xFE, e: 1, fixed_g: 0, },
{ opcode: 0xFE, e: 1, fixed_g: 1, },
Expand Down
27 changes: 26 additions & 1 deletion src/rust/jit_instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
use codegen;
use cpu::BitSize;
use cpu2::cpu::{
FLAGS_ALL, FLAGS_DEFAULT, FLAGS_MASK, FLAG_ADJUST, FLAG_CARRY, FLAG_OVERFLOW, OPSIZE_32,
FLAGS_ALL, FLAGS_DEFAULT, FLAGS_MASK, FLAG_ADJUST, FLAG_CARRY, FLAG_DIRECTION, FLAG_OVERFLOW,
OPSIZE_32,
};
use global_pointers;
use jit::JitContext;
Expand Down Expand Up @@ -3497,6 +3498,30 @@ pub fn instr_FA_jit(ctx: &mut JitContext) {
ctx.builder.instruction_body.block_end();
}

pub fn instr_FC_jit(ctx: &mut JitContext) {
ctx.builder
.instruction_body
.const_i32(global_pointers::FLAGS as i32);
ctx.builder
.instruction_body
.load_aligned_i32(global_pointers::FLAGS);
ctx.builder.instruction_body.const_i32(!FLAG_DIRECTION);
ctx.builder.instruction_body.and_i32();
ctx.builder.instruction_body.store_aligned_i32(0);
}

pub fn instr_FD_jit(ctx: &mut JitContext) {
ctx.builder
.instruction_body
.const_i32(global_pointers::FLAGS as i32);
ctx.builder
.instruction_body
.load_aligned_i32(global_pointers::FLAGS);
ctx.builder.instruction_body.const_i32(FLAG_DIRECTION);
ctx.builder.instruction_body.or_i32();
ctx.builder.instruction_body.store_aligned_i32(0);
}

define_instruction_read_write_mem16!(
"inc16",
"instr16_FF_0_mem",
Expand Down

0 comments on commit e99da40

Please sign in to comment.