port set_stack_reg

This commit is contained in:
Awal Garg 2017-07-27 16:46:24 +05:30 committed by Fabian
parent cd4d449159
commit c866462bd6
4 changed files with 14 additions and 2 deletions

View file

@ -170,7 +170,6 @@ function V86Starter(options)
"_virt_boundary_read32s": function() { return cpu.virt_boundary_read32s.apply(cpu, arguments); },
"_virt_boundary_write16": function() { return cpu.virt_boundary_write16.apply(cpu, arguments); },
"_virt_boundary_write32": function() { return cpu.virt_boundary_write32.apply(cpu, arguments); },
"_set_stack_reg": function() { return cpu.set_stack_reg.apply(cpu, arguments); },
"_getiopl": function() { return cpu.getiopl.apply(cpu, arguments); },
"_vm86_mode": function() { return cpu.vm86_mode.apply(cpu, arguments); },
"_shl8": function() { return cpu.shl8.apply(cpu, arguments); },

View file

@ -301,6 +301,7 @@ CPU.prototype.wasm_patch = function(wm)
this.pop16 = this.wm.funcs['_pop16'];
this.get_stack_reg = this.wm.funcs['_get_stack_reg'];
this.setcc = this.wm.funcs['_setcc'];
this.set_stack_reg = this.wm.funcs['_set_stack_reg'];
};
CPU.prototype.get_state = function()

View file

@ -751,3 +751,15 @@ int32_t get_stack_reg()
}
}
void set_stack_reg(int32_t value)
{
if(*stack_size_32)
{
reg32s[ESP] = value;
}
else
{
reg16[SP] = value;
}
}

View file

@ -286,5 +286,5 @@ void pusha32()
}
void setcc(bool condition) {
set_e8(condition);
set_e8(condition);
}