port pop16 and get_stack_reg
This commit is contained in:
parent
3a78beeb78
commit
725edc451f
|
@ -166,7 +166,6 @@ function V86Starter(options)
|
|||
"_arpl": function() { return cpu.arpl.apply(cpu, arguments); },
|
||||
"_trigger_ud": function() { return cpu.trigger_ud.apply(cpu, arguments); },
|
||||
"_trigger_nm": function() { return cpu.trigger_nm.apply(cpu, arguments); },
|
||||
"_pop16": function() { return cpu.pop16.apply(cpu, arguments); },
|
||||
"_virt_boundary_read16": function() { return cpu.virt_boundary_read16.apply(cpu, arguments); },
|
||||
"_virt_boundary_read32s": function() { return cpu.virt_boundary_read32s.apply(cpu, arguments); },
|
||||
"_virt_boundary_write16": function() { return cpu.virt_boundary_write16.apply(cpu, arguments); },
|
||||
|
|
|
@ -298,6 +298,8 @@ CPU.prototype.wasm_patch = function(wm)
|
|||
this.push32 = this.wm.funcs['_push32'];
|
||||
this.pusha16 = this.wm.funcs['_pusha16'];
|
||||
this.pusha32 = this.wm.funcs['_pusha32'];
|
||||
this.pop16 = this.wm.funcs['_pop16'];
|
||||
this.get_stack_reg = this.wm.funcs['_get_stack_reg'];
|
||||
};
|
||||
|
||||
CPU.prototype.get_state = function()
|
||||
|
|
|
@ -738,3 +738,16 @@ int32_t get_real_eip()
|
|||
{
|
||||
return *instruction_pointer - get_seg(CS);
|
||||
}
|
||||
|
||||
int32_t get_stack_reg()
|
||||
{
|
||||
if(*stack_size_32)
|
||||
{
|
||||
return reg32s[ESP];
|
||||
}
|
||||
else
|
||||
{
|
||||
return reg16[SP];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -224,6 +224,15 @@ void push32(int32_t imm32)
|
|||
}
|
||||
}
|
||||
|
||||
int32_t pop16()
|
||||
{
|
||||
int32_t sp = get_seg(SS) + get_stack_reg();
|
||||
int32_t result = safe_read16(sp);
|
||||
|
||||
adjust_stack_reg(2);
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t pop32s()
|
||||
{
|
||||
if(*stack_size_32)
|
||||
|
|
Loading…
Reference in a new issue