Merge Interpreteur serucise et non securise

This commit is contained in:
Paul Faure 2021-06-24 14:53:18 +02:00
commit 3efa8d5ef2

View file

@ -6,6 +6,8 @@
#define TAILLE_MEMOIRE (64)
#define TAILLE_PILE_APPELS (16)
#define SECURISED (1)
/**************************************************/
/**************************************************/
@ -199,10 +201,17 @@ void execute() {
eip = programme[eip].param1 - 1;
} else if (programme[eip].instruction == RET) {
esp--;
eip = pile[check_adresse_pile(esp)] - 1;
esp--;
ebp = pile[check_adresse_pile(esp)];
if (SECURISED) {
esp--;
eip = pile[check_adresse_pile(esp)] - 1;
esp--;
ebp = pile[check_adresse_pile(esp)];
} else {
int lastebp = ebp;
eip = mem[check_adresse(ebp - 1)] - 1;
ebp = mem[check_adresse(ebp - 2)];
mem[check_adresse(lastebp - 2)] = mem[check_adresse(lastebp)];
}
} else if (programme[eip].instruction == STOP) {
if (programme[eip].param1 == 0) {