Assert certain functions not being called when in jit

This commit is contained in:
Fabian 2020-12-31 19:14:30 -06:00
parent f3c56e7684
commit 1b7435c05e
2 changed files with 13 additions and 0 deletions

View file

@ -254,6 +254,7 @@ pub static mut valid_tlb_entries: [i32; 10000] = [0; 10000];
pub static mut valid_tlb_entries_count: i32 = 0;
pub static mut apic_enabled: bool = false;
pub static mut in_jit: bool = false;
pub enum LastJump {
Interrupt {
@ -1506,10 +1507,12 @@ pub unsafe fn read_imm32s() -> OrPageFault<i32> {
}
pub unsafe fn is_osize_32() -> bool {
dbg_assert!(!in_jit);
return *is_32 != (*prefixes as i32 & PREFIX_MASK_OPSIZE == PREFIX_MASK_OPSIZE);
}
pub unsafe fn is_asize_32() -> bool {
dbg_assert!(!in_jit);
return *is_32 != (*prefixes as i32 & PREFIX_MASK_ADDRSIZE == PREFIX_MASK_ADDRSIZE);
}
@ -1781,6 +1784,7 @@ pub unsafe fn get_seg_cs() -> i32 { return *segment_offsets.offset(CS as isize);
pub unsafe fn get_seg_ss() -> i32 { return *segment_offsets.offset(SS as isize); }
pub unsafe fn get_seg_prefix(default_segment: i32) -> i32 {
dbg_assert!(!in_jit);
let prefix = *prefixes as i32 & PREFIX_MASK_SEGMENT;
if 0 != prefix {
if prefix == SEG_PREFIX_ZERO {
@ -1821,10 +1825,18 @@ pub unsafe fn cycle_internal() {
let initial_tsc = *timestamp_counter;
let wasm_table_index = (entry & 0xFFFF) as u16;
let initial_state = (entry >> 16) as u16;
#[cfg(debug_assertions)]
{
in_jit = true;
}
call_indirect1(
(wasm_table_index as u32).wrapping_add(WASM_TABLE_OFFSET as u32) as i32,
initial_state,
);
#[cfg(debug_assertions)]
{
in_jit = false;
}
profiler::stat_increment_by(
RUN_FROM_CACHE_STEPS,
(*timestamp_counter - initial_tsc) as u64,

View file

@ -2423,6 +2423,7 @@ pub unsafe fn instr_D6() {
#[no_mangle]
pub unsafe fn instr_D7() {
// xlat
dbg_assert!(!in_jit, "TODO");
if is_asize_32() {
*reg8.offset(AL as isize) = return_on_pagefault!(safe_read8(
get_seg_prefix(DS) + *reg32.offset(EBX as isize) + *reg8.offset(AL as isize) as i32,