Include the ABI version in the file format, and refuse to execute

binary files with ABI mismatches
This commit is contained in:
2007-04-29 15:18:56 +00:00
parent 5fbc625840
commit ec2b71d545
4 changed files with 38 additions and 6 deletions

View File

@@ -2,6 +2,12 @@
typedef int (*vm_intfn)(void);
extern const long vm_abiversion1;
extern const long vm_abiversion2;
extern const long vm_abiversion3;
extern const long vm_abiversion4;
extern const long vm_abiversion5;
/*
* We must include here all prototypes for functions which can be
* included in the ABI function table

View File

@@ -609,6 +609,11 @@ void vm_init_functions(void)
assert(vm_codearea[2] == VERSION1);
assert(vm_codearea[3] == VERSION2);
assert(GETINT(vm_codearea, 8) == vm_abiversion1);
assert(GETINT(vm_codearea, 12) == vm_abiversion2);
assert(GETINT(vm_codearea, 16) == vm_abiversion3);
assert(GETINT(vm_codearea, 20) == vm_abiversion4);
assert(GETINT(vm_codearea, 24) == vm_abiversion5);
/* Now, get the function table pointer */
t = GETINT(vm_codearea, 4);