Merge Interpreteur serucise et non securise
This commit is contained in:
commit
3efa8d5ef2
1 changed files with 13 additions and 4 deletions
|
@ -6,6 +6,8 @@
|
||||||
#define TAILLE_MEMOIRE (64)
|
#define TAILLE_MEMOIRE (64)
|
||||||
#define TAILLE_PILE_APPELS (16)
|
#define TAILLE_PILE_APPELS (16)
|
||||||
|
|
||||||
|
#define SECURISED (1)
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
|
@ -199,10 +201,17 @@ void execute() {
|
||||||
eip = programme[eip].param1 - 1;
|
eip = programme[eip].param1 - 1;
|
||||||
|
|
||||||
} else if (programme[eip].instruction == RET) {
|
} else if (programme[eip].instruction == RET) {
|
||||||
|
if (SECURISED) {
|
||||||
esp--;
|
esp--;
|
||||||
eip = pile[check_adresse_pile(esp)] - 1;
|
eip = pile[check_adresse_pile(esp)] - 1;
|
||||||
esp--;
|
esp--;
|
||||||
ebp = pile[check_adresse_pile(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) {
|
} else if (programme[eip].instruction == STOP) {
|
||||||
if (programme[eip].param1 == 0) {
|
if (programme[eip].param1 == 0) {
|
||||||
|
|
Loading…
Reference in a new issue