Optimise clear_tlb
This commit is contained in:
parent
c46a6f310a
commit
593ce966d0
|
@ -95,6 +95,7 @@ function V86Starter(options)
|
|||
var emulator;
|
||||
var cpu;
|
||||
var mem;
|
||||
var mem8;
|
||||
var wasm_shared_funcs = {
|
||||
"_throw_cpu_exception": () => { throw MAGIC_CPU_EXCEPTION; },
|
||||
"_hlt_op": function() { return cpu.hlt_op(); },
|
||||
|
@ -108,6 +109,10 @@ function V86Starter(options)
|
|||
"_get_rand_int": function() { return v86util.get_rand_int(); },
|
||||
"_has_rand_int": function() { return v86util.has_rand_int(); },
|
||||
"_printf": function(offset) { dbg_log_wasm(mem, offset, [].slice.call(arguments, 1)); },
|
||||
"_memcpy_large": function(dest, source, length) {
|
||||
mem8.set(mem8.subarray(source, source + length), dest);
|
||||
return dest;
|
||||
},
|
||||
|
||||
"_call_interrupt_vector": function(interrupt_nr, is_software_int, has_error_code, error_code) {
|
||||
cpu.call_interrupt_vector(interrupt_nr, is_software_int, !!has_error_code, error_code);
|
||||
|
@ -274,6 +279,7 @@ function V86Starter(options)
|
|||
emulator = this.v86 = new v86(this.emulator_bus, wm);
|
||||
cpu = emulator.cpu;
|
||||
mem = wm.mem.buffer;
|
||||
mem8 = new Uint8Array(mem);
|
||||
|
||||
this.bus.register("emulator-stopped", function()
|
||||
{
|
||||
|
|
|
@ -11,6 +11,10 @@ int32_t read_e8_partial_branch() {
|
|||
return reg8[*modrm_byte << 2 & 0xC | *modrm_byte >> 2 & 1];
|
||||
}
|
||||
|
||||
// like memcpy, but only efficient for large (approximately 10k) sizes
|
||||
// See memcpy in https://github.com/kripken/emscripten/blob/master/src/library.js
|
||||
void* memcpy_large(void* dest, const void* src, size_t n);
|
||||
|
||||
void writable_or_pagefault(int32_t, int32_t);
|
||||
int32_t translate_address_read(int32_t);
|
||||
int32_t translate_address_write(int32_t);
|
||||
|
@ -687,10 +691,7 @@ void write_xmm128s(int32_t d0, int32_t d1, int32_t d2, int32_t d3)
|
|||
|
||||
void clear_tlb()
|
||||
{
|
||||
for(int32_t i = 0; i < 0x100000; i += 4)
|
||||
{
|
||||
*(int32_t*)(tlb_info + i) = *(int32_t*)(tlb_info_global + i);
|
||||
}
|
||||
memcpy_large(tlb_info, tlb_info_global, 0x100000);
|
||||
}
|
||||
|
||||
void task_switch_test_mmx()
|
||||
|
|
Loading…
Reference in a new issue