Add sanity check

release
Slava Pestov 2007-10-22 03:49:19 -04:00
parent a271b84bba
commit 9d80b13932
2 changed files with 6 additions and 0 deletions

View File

@ -70,6 +70,11 @@ INLINE void reloc_set_2_2(CELL cell, CELL value)
/* Store a value into a bitfield of a PowerPC instruction */
INLINE void reloc_set_masked(CELL cell, F_FIXNUM value, CELL mask, F_FIXNUM shift)
{
/* This is unaccurate but good enough */
F_FIXNUM test = (F_FIXNUM)mask >> 1;
if(value <= -test || value >= test)
critical_error("Value does not fit inside relocation",0);
u32 original = *(u32*)cell;
original &= ~mask;
*(u32*)cell = (original | ((value >> shift) & mask));

View File

@ -111,6 +111,7 @@ void print_stack_frame(F_STACK_FRAME *frame)
printf("\n");
print_obj(frame_scan(frame));
printf("\n");
printf("%lx\n",(CELL)frame->xt);
}
void print_callstack(void)