This commit is contained in:
Fabian 2020-12-31 19:14:31 -06:00
parent 42ecf896bb
commit 1c78a09c93
3 changed files with 15 additions and 15 deletions

View file

@ -310,8 +310,6 @@ CPU.prototype.wasm_patch = function(wm)
this.set_tsc = get_import("set_tsc");
this.store_current_tsc = get_import("store_current_tsc");
this.pack_current_state_flags = get_import("pack_current_state_flags");
if(DEBUG)
{
this.jit_force_generate_unsafe = get_optional_import("jit_force_generate_unsafe");
@ -335,9 +333,7 @@ CPU.prototype.jit_force_generate = function(addr)
return;
}
const cs_offset = this.get_seg_cs();
const state_flags = this.pack_current_state_flags();
this.jit_force_generate_unsafe(addr, cs_offset, state_flags);
this.jit_force_generate_unsafe(addr);
};
CPU.prototype.jit_clear_func = function(index)

View file

@ -2297,7 +2297,7 @@ pub unsafe fn popa32() {
}
#[no_mangle]
pub unsafe fn get_seg_cs() -> i32 { return *segment_offsets.offset(CS as isize); }
pub fn get_seg_cs() -> i32 { unsafe { *segment_offsets.offset(CS as isize) } }
#[no_mangle]
pub unsafe fn get_seg_ss() -> i32 { return *segment_offsets.offset(SS as isize); }
@ -2512,14 +2512,15 @@ unsafe fn jit_run_interpreted(phys_addr: i32) {
}
}
#[no_mangle]
pub unsafe fn pack_current_state_flags() -> CachedStateFlags {
return CachedStateFlags::of_u32(
(*is_32 as u32) << 0
| (*stack_size_32 as u32) << 1
| ((*cpl == 3) as u32) << 2
| (has_flat_segmentation() as u32) << 3,
);
pub fn pack_current_state_flags() -> CachedStateFlags {
unsafe {
CachedStateFlags::of_u32(
(*is_32 as u32) << 0
| (*stack_size_32 as u32) << 1
| ((*cpl == 3) as u32) << 2
| (has_flat_segmentation() as u32) << 3,
)
}
}
#[no_mangle]

View file

@ -6,6 +6,7 @@ use std::ptr::NonNull;
use analysis::AnalysisType;
use codegen;
use cpu2;
use cpu2::cpu;
use cpu2::memory;
use cpu_context::CpuContext;
use global_pointers;
@ -898,9 +899,11 @@ fn create_cache_entry(ctx: &mut JitState, entry: jit_cache_array::Entry) {
#[no_mangle]
#[cfg(debug_assertions)]
pub fn jit_force_generate_unsafe(phys_addr: u32, cs_offset: u32, state_flags: CachedStateFlags) {
pub fn jit_force_generate_unsafe(phys_addr: u32) {
let ctx = get_jit_state();
record_entry_point(phys_addr);
let cs_offset = cpu::get_seg_cs() as u32;
let state_flags = cpu::pack_current_state_flags();
jit_analyze_and_generate(ctx, Page::page_of(phys_addr), cs_offset, state_flags);
}