summaryrefslogtreecommitdiffstats
path: root/byterun/fix_code.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1997-04-28 15:51:29 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1997-04-28 15:51:29 +0000
commit2ef4e1c5bec0a5f19df87b754dfc10e1ca17c18e (patch)
tree9545f0eef3aaf19cd9885d6cff994b64ecb5aecb /byterun/fix_code.c
parenta2ea30248a84def7446816aecf47bd9a62968eae (diff)
Support pour le threaded code sur processeurs 64 bits lorsqu'on ne peut pas garantir que le code de l'interprete est dans les 4 premiers gigas
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1515 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/fix_code.c')
-rw-r--r--byterun/fix_code.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/byterun/fix_code.c b/byterun/fix_code.c
index 189b1b48c..37543ace7 100644
--- a/byterun/fix_code.c
+++ b/byterun/fix_code.c
@@ -79,6 +79,7 @@ void fixup_endianness(code, len)
#ifdef THREADED_CODE
void ** instr_table;
+void * instr_base;
void thread_code (code_t code, asize_t len)
{
@@ -109,9 +110,9 @@ void thread_code (code_t code, asize_t len)
opcode_t instr = *p;
if (instr < 0 || instr > STOP){
fatal_error_arg ("Fatal error in fix_code: bad opcode (%lx)\n",
- (void *) instr);
+ (char *)(long)instr);
}
- *p++ = (opcode_t)((unsigned long)(instr_table[instr]));
+ *p++ = (opcode_t)(instr_table[instr] - instr_base);
if (instr == SWITCH) {
uint32 sizes = *p++;
uint32 const_size = sizes & 0xFFFF;
@@ -131,7 +132,7 @@ void set_instruction(pos, instr)
opcode_t instr;
{
#ifdef THREADED_CODE
- *pos = (opcode_t)((unsigned long)(instr_table[instr]));
+ *pos = (opcode_t)(instr_table[instr] - instr_base);
#else
*pos = instr;
#endif