Clean up
This commit is contained in:
parent
b5f3409c56
commit
3e80be32a9
23
src/cpu.js
23
src/cpu.js
|
@ -459,8 +459,6 @@ CPU.prototype.exception_cleanup = function(e)
|
|||
|
||||
// restore state from prefixes
|
||||
this.clear_prefixes();
|
||||
|
||||
//this.main_run();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -805,8 +803,6 @@ if(typeof window !== "undefined")
|
|||
window.__no_inline3 = CPU.prototype.hlt_loop;
|
||||
};
|
||||
|
||||
var prefixes = {};
|
||||
|
||||
/**
|
||||
* execute a single instruction cycle on the cpu
|
||||
* this includes reading all prefixes and the whole instruction
|
||||
|
@ -815,12 +811,6 @@ CPU.prototype.cycle = function()
|
|||
{
|
||||
this.previous_ip = this.instruction_pointer;
|
||||
|
||||
//var op = this.safe_read32s(this.instruction_pointer);
|
||||
//var op = this.safe_read16(this.instruction_pointer);
|
||||
//var op2 = this.safe_read16(this.instruction_pointer + 4);
|
||||
//prefixes[op + op2 * 0x100000000] = true;
|
||||
//prefixes[op] = ~~prefixes[op] + 1 | 0;
|
||||
|
||||
this.timestamp_counter++;
|
||||
|
||||
var opcode = this.read_imm8();
|
||||
|
@ -872,14 +862,6 @@ CPU.prototype.hlt_loop = function()
|
|||
}
|
||||
|
||||
return 0;
|
||||
//if(!this.in_hlt)
|
||||
//{
|
||||
// return 0;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// return Math.ceil(Math.min(100, pit_time, rtc_time));
|
||||
//}
|
||||
};
|
||||
|
||||
CPU.prototype.clear_prefixes = function()
|
||||
|
@ -951,7 +933,6 @@ CPU.prototype.get_phys_eip = function()
|
|||
|
||||
CPU.prototype.read_imm8 = function()
|
||||
{
|
||||
//return this.safe_read8(this.instruction_pointer++);
|
||||
if((this.instruction_pointer & ~0xFFF) ^ this.last_virt_eip)
|
||||
{
|
||||
this.eip_phys = this.translate_address_read(this.instruction_pointer) ^ this.instruction_pointer;
|
||||
|
@ -974,8 +955,6 @@ CPU.prototype.read_imm8s = function()
|
|||
|
||||
CPU.prototype.read_imm16 = function()
|
||||
{
|
||||
//this.instruction_pointer += 2;
|
||||
//return this.safe_read16(this.instruction_pointer - 2);
|
||||
// Two checks in one comparison:
|
||||
// 1. Did the high 20 bits of eip change
|
||||
// or 2. Are the low 12 bits of eip 0xFFF (and this read crosses a page boundary)
|
||||
|
@ -997,8 +976,6 @@ CPU.prototype.read_imm16s = function()
|
|||
|
||||
CPU.prototype.read_imm32s = function()
|
||||
{
|
||||
//this.instruction_pointer += 4;
|
||||
//return this.safe_read32s(this.instruction_pointer - 4);
|
||||
// Analogue to the above comment
|
||||
if(((this.instruction_pointer ^ this.last_virt_eip) >>> 0) > 0xFFC)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,7 @@ function Memory(memory_size)
|
|||
/** @const */ this.memory_map_write32 = [];
|
||||
|
||||
// use by dynamic translator
|
||||
if(OP_TRANSLATION) this.mem_page_infos = new Uint8Array(1 << 20);
|
||||
//if(OP_TRANSLATION) this.mem_page_infos = new Uint8Array(1 << 20);
|
||||
|
||||
dbg_assert((memory_size & MMAP_BLOCK_SIZE - 1) === 0);
|
||||
|
||||
|
@ -57,7 +57,9 @@ Memory.prototype.debug_write = function(addr, size, value)
|
|||
return;
|
||||
}
|
||||
|
||||
//dbg_assert(typeof value === "number" && !isNaN(value));
|
||||
dbg_assert(typeof value === "number" && !isNaN(value));
|
||||
dbg_assert(value >= -0x80000000 && addr < 0x80000000);
|
||||
|
||||
this.debug_read(addr, size, true);
|
||||
}
|
||||
|
||||
|
@ -213,7 +215,7 @@ Memory.prototype.write8 = function(addr, value)
|
|||
|
||||
var page = addr >>> MMAP_BLOCK_BITS;
|
||||
|
||||
if(OP_TRANSLATION) this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
//if(OP_TRANSLATION) this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -235,11 +237,11 @@ Memory.prototype.write16 = function(addr, value)
|
|||
|
||||
var page = addr >>> MMAP_BLOCK_BITS;
|
||||
|
||||
if(OP_TRANSLATION)
|
||||
{
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
this.mem_page_infos[addr + 1 >>> MMAP_BLOCK_BITS] |= MEM_PAGE_WRITTEN;
|
||||
}
|
||||
//if(OP_TRANSLATION)
|
||||
//{
|
||||
// this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
// this.mem_page_infos[addr + 1 >>> MMAP_BLOCK_BITS] |= MEM_PAGE_WRITTEN;
|
||||
//}
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -263,7 +265,7 @@ Memory.prototype.write_aligned16 = function(addr, value)
|
|||
|
||||
var page = addr >>> MMAP_BLOCK_BITS - 1;
|
||||
|
||||
if(OP_TRANSLATION) this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
//if(OP_TRANSLATION) this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -285,11 +287,11 @@ Memory.prototype.write32 = function(addr, value)
|
|||
|
||||
var page = addr >>> MMAP_BLOCK_BITS;
|
||||
|
||||
if(OP_TRANSLATION)
|
||||
{
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
this.mem_page_infos[addr + 3 >>> MMAP_BLOCK_BITS] |= MEM_PAGE_WRITTEN;
|
||||
}
|
||||
//if(OP_TRANSLATION)
|
||||
//{
|
||||
// this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
// this.mem_page_infos[addr + 3 >>> MMAP_BLOCK_BITS] |= MEM_PAGE_WRITTEN;
|
||||
//}
|
||||
|
||||
if(this.memory_map_registered[page])
|
||||
{
|
||||
|
@ -333,16 +335,16 @@ Memory.prototype.write_blob = function(blob, offset)
|
|||
|
||||
this.mem8.set(blob, offset);
|
||||
|
||||
var page = offset >>> 12,
|
||||
end = (offset + blob) >>> 12;
|
||||
//var page = offset >>> 12;
|
||||
//var end = (offset + blob) >>> 12;
|
||||
|
||||
if(OP_TRANSLATION)
|
||||
{
|
||||
for(; page <= end; page++)
|
||||
{
|
||||
this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
}
|
||||
}
|
||||
//if(OP_TRANSLATION)
|
||||
//{
|
||||
// for(; page <= end; page++)
|
||||
// {
|
||||
// this.mem_page_infos[page] |= MEM_PAGE_WRITTEN;
|
||||
// }
|
||||
//}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue