#include "fixnum.h"
#include "svm1-defns.h"
#include "cmpintmd/svm1.h"
-
-#define SVM1_REG_SP 0
\f
typedef SCHEME_OBJECT word_t; /* convenience abbreviation */
#define DECODE_TRAP_2(name) byte_t name = NEXT_BYTE
#define DECODE_TRAP_3(name) byte_t name = NEXT_BYTE
-static void signal_illegal_instruction (void);
static void initialize_decoder_tables (void);
\f
static int initialized_p = 0;
static int little_endian_p;
-static bool execute_instruction (void);
-
static void
compute_little_endian_p (void)
{
{
IMPORT_REGS ();
PC = address;
- while (execute_instruction ());
+ while ((* (inst_defns[NEXT_BYTE])) ());
EXPORT_REGS ();
return (svm1_result);
}
-static jmp_buf k_execute_instruction;
-
-static bool
-execute_instruction (void)
-{
- if ((setjmp (k_execute_instruction)) != 0)
- return (0);
- return ((* (inst_defns[NEXT_BYTE])) ());
-}
-
static bool
illegal_instruction (void)
-{
- signal_illegal_instruction ();
- return (0);
-}
-
-static void
-signal_illegal_instruction (void)
{
svm1_result = ERR_COMPILED_CODE_ERROR;
- longjmp (k_execute_instruction, 1);
+ return (0);
}
#define TO_SIGNED(n) ((long) (n))
decode_wreg (void)
{
byte_t b = NEXT_BYTE;
- if (!WORD_REGISTER_P (b))
- signal_illegal_instruction ();
+ assert (WORD_REGISTER_P (b));
return (b);
}
decode_freg (void)
{
byte_t b = NEXT_BYTE;
- if (!FLOAT_REGISTER_P (b))
- signal_illegal_instruction ();
+ assert (FLOAT_REGISTER_P (b));
return (b);
}
decode_type_word (void)
{
byte_t b = NEXT_BYTE;
- if (b >= N_TYPE_CODES)
- signal_illegal_instruction ();
+ assert (b < N_TYPE_CODES);
return (b);
}
static bool
illegal_trap_0 (void)
{
- signal_illegal_instruction ();
+ svm1_result = ERR_COMPILED_CODE_ERROR;
return (0);
}
static bool
illegal_trap_1 (wreg_t r1)
{
- signal_illegal_instruction ();
+ svm1_result = ERR_COMPILED_CODE_ERROR;
return (0);
}
static bool
illegal_trap_2 (wreg_t r1, wreg_t r2)
{
- signal_illegal_instruction ();
+ svm1_result = ERR_COMPILED_CODE_ERROR;
return (0);
}
static bool
illegal_trap_3 (wreg_t r1, wreg_t r2, wreg_t r3)
{
- signal_illegal_instruction ();
+ svm1_result = ERR_COMPILED_CODE_ERROR;
return (0);
}
(* (address_decoders[NEXT_BYTE])) (address);
}
+static word_t
+illegal_address_value (address_t * address)
+{
+ return (0);
+}
+
static void
illegal_address (address_t * address)
{
- signal_illegal_instruction ();
+ address->value = illegal_address_value;
}
static word_t