Mise à jour du code à chaque itération
This commit is contained in:
parent
73df49a5ba
commit
d52a76a88e
32
ia86.cpp
32
ia86.cpp
|
@ -679,26 +679,27 @@ uint32_t VMEngine::getNextInstr()
|
||||||
std::vector<std::array<std::string, 5>> VMEngine::getInstr(int segment, int address,int size)
|
std::vector<std::array<std::string, 5>> VMEngine::getInstr(int segment, int address,int size)
|
||||||
{
|
{
|
||||||
uint32_t realaddress=segment*16+address;
|
uint32_t realaddress=segment*16+address;
|
||||||
bool changed=false;
|
|
||||||
if (realaddress<bufferaddress || realaddress+(size*7)>bufferaddress+500)
|
if (realaddress<bufferaddress || realaddress+(size*7)>bufferaddress+500)
|
||||||
{
|
{
|
||||||
changed=true;
|
log->append("read");
|
||||||
int begin=realaddress-30;
|
bufferaddress=realaddress-30;
|
||||||
if (begin<0) begin=0x00000000;
|
if (bufferaddress<0)
|
||||||
err = uc_mem_read(uc, begin, code, 500);
|
bufferaddress=0x00000000;
|
||||||
if (err)
|
address_old=address-30;
|
||||||
{
|
if (address_old<0)
|
||||||
throw Error("VM IA86 - cache instructions......................[ERREUR]");
|
address_old=0x00000000;
|
||||||
}
|
|
||||||
bufferaddress=begin;
|
|
||||||
}
|
}
|
||||||
|
err = uc_mem_read(uc, bufferaddress, code, 500);
|
||||||
|
if (err)
|
||||||
|
throw Error("VM IA86 - cache instructions......................[ERREUR]");
|
||||||
crc = crc32(0, code, 500);
|
crc = crc32(0, code, 500);
|
||||||
if (crc != crc_old || changed)
|
if (crc != crc_old)
|
||||||
{
|
{
|
||||||
unasmer.Desassemble(code, address, 500, &unasm);
|
log->append("unasm");
|
||||||
if (unasm.src.size()==0)
|
unasmer.Desassemble(code, address_old, 500, &unasm);
|
||||||
throw Error("VM IA86 - cache instructions......................[ERREUR]");
|
if (unasm.src.size()==0)
|
||||||
crc_old=crc;
|
throw Error("VM IA86 - cache instructions......................[ERREUR]");
|
||||||
|
crc_old=crc;
|
||||||
}
|
}
|
||||||
int line=0;
|
int line=0;
|
||||||
for(int pos: unasm.pos)
|
for(int pos: unasm.pos)
|
||||||
|
@ -739,6 +740,7 @@ void VMEngine::Configure(State *init, std::string code)
|
||||||
return;
|
return;
|
||||||
Close();
|
Close();
|
||||||
Init();
|
Init();
|
||||||
|
bufferaddress=-666;
|
||||||
this->initialized=false;
|
this->initialized=false;
|
||||||
this->executed=false;
|
this->executed=false;
|
||||||
//log->append("Mappage de la mémoire virtuelle");
|
//log->append("Mappage de la mémoire virtuelle");
|
||||||
|
|
2
ia86.h
2
ia86.h
|
@ -327,7 +327,7 @@ class VMEngine
|
||||||
bool initialized=false;
|
bool initialized=false;
|
||||||
uc_engine *uc;
|
uc_engine *uc;
|
||||||
uc_err err;
|
uc_err err;
|
||||||
int bufferaddress=-555;
|
int bufferaddress;
|
||||||
int address_old;
|
int address_old;
|
||||||
uint8_t *code;
|
uint8_t *code;
|
||||||
uLong crc,crc_old;
|
uLong crc,crc_old;
|
||||||
|
|
|
@ -8,8 +8,13 @@
|
||||||
"niveau_tutoriel" : "Ceci vous...",
|
"niveau_tutoriel" : "Ceci vous...",
|
||||||
"niveau_code" : "mov ax,0x545
|
"niveau_code" : "mov ax,0x545
|
||||||
inc dx
|
inc dx
|
||||||
mov esi,0x44441234
|
mov esi,0x44440234
|
||||||
hlt",
|
hlt
|
||||||
|
.org 0x8D
|
||||||
|
mov es,ax
|
||||||
|
.org 0x14D
|
||||||
|
mov es,ax
|
||||||
|
",
|
||||||
"niveau_droits" : 10,
|
"niveau_droits" : 10,
|
||||||
"niveau_initial" :
|
"niveau_initial" :
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue