diff --git a/inc/return.h b/inc/return.h index 90749fb..e493032 100644 --- a/inc/return.h +++ b/inc/return.h @@ -37,7 +37,7 @@ #define FastRetCALL \ do { \ /* Get IVar from Returnee's IVAR offset slot(BF) */ \ - IVar = NativeAligned2FromLAddr(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \ + IVar = NativeAligned2FromStackOffset(GETWORD((DLword *)CURRENTFX - 1)); \ /* Get FuncObj from Returnee's FNHEAD slot in FX */ \ FuncObj = (struct fnhead *)NativeAligned4FromLAddr(FX_FNHEADER); \ /* Get PC from Returnee's pc slot in FX */ \ @@ -47,7 +47,7 @@ #define FastRetCALL \ do { \ /* Get IVar from Returnee's IVAR offset slot(BF) */ \ - IVar = NativeAligned2FromLAddr(STK_OFFSET | GETWORD((DLword *)CURRENTFX -1)); \ + IVar = NativeAligned2FromStackOffset(GETWORD((DLword *)CURRENTFX - 1)); \ /* Get FuncObj from Returnee's FNHEAD slot in FX */ \ FuncObj = (struct fnhead *)NativeAligned4FromLAddr(FX_FNHEADER); \ /* Get PC from Returnee's pc slot in FX */ \ diff --git a/src/bbtsub.c b/src/bbtsub.c index af07f14..e824b09 100644 --- a/src/bbtsub.c +++ b/src/bbtsub.c @@ -1664,7 +1664,7 @@ void ccfuncall(unsigned int atom_index, int argnum, int bytenum) CURRENTFX->nextblock = (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (argnum << 1) + 4 /* +3 */; /* Setup IVar */ /* XXX: is it really only 2-byte aligned? */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); /* Set PC to the Next Instruction and save into FX */ CURRENTFX->pc = ((UNSIGNED)PC - (UNSIGNED)FuncObj) + bytenum; diff --git a/src/dbgtool.c b/src/dbgtool.c index 70ee8f4..3f0dad7 100644 --- a/src/dbgtool.c +++ b/src/dbgtool.c @@ -303,14 +303,14 @@ int sf(struct frameex1 *fx_addr68k) { if (((fx_addr68k)->alink & 1) == 0) { /* FAST */ bf = (Bframe *)(((DLword *)fx_addr68k) - 2); } else { /* SLOW */ - bf = (Bframe *)NativeAligned4FromLAddr(((fx_addr68k)->blink + STK_OFFSET)); + bf = (Bframe *)NativeAligned4FromStackOffset((fx_addr68k)->blink); } /* Print IVARs */ printf("IVAR -------\n"); BT_morep; - ptr = NativeAligned2FromLAddr(STK_OFFSET + bf->ivar); + ptr = NativeAligned2FromStackOffset(bf->ivar); i = 0; while (ptr != (DLword *)bf) { ptrlo = ptr + 1; @@ -475,7 +475,7 @@ int sf(struct frameex1 *fx_addr68k) { i++; } if (fx_addr68k->alink == 11) /* for contextsw */ - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); else next68k = CurrentStackPTR; @@ -493,7 +493,7 @@ int sf(struct frameex1 *fx_addr68k) { return (-1); } - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); ptr = (DLword *)(fx_addr68k + 1); i = 0; diff --git a/src/findkey.c b/src/findkey.c index 88d250a..f456f36 100644 --- a/src/findkey.c +++ b/src/findkey.c @@ -45,7 +45,7 @@ LispPTR N_OP_findkey(LispPTR tos, int byte) { #endif if (CURRENTFX->alink & 1) { /* slow case */ - find_end = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | (CURRENTFX->blink - 4)); + find_end = NativeAligned2FromStackOffset(CURRENTFX->blink - 4); } else { /* Fast cae */ find_end = ((DLword *)CURRENTFX) - 2 - 4; } diff --git a/src/loopsops.c b/src/loopsops.c index 3544905..90e2c1e 100644 --- a/src/loopsops.c +++ b/src/loopsops.c @@ -26,7 +26,7 @@ #include "gcarraydefs.h" // for get_package_atom #include "gcdata.h" // for FRPLPTR #include "lispemul.h" // for LispPTR, state, CurrentStackPTR, NIL_PTR, NIL -#include "lispmap.h" // for S_POSITIVE, STK_OFFSET +#include "lispmap.h" // for S_POSITIVE #include "loopsopsdefs.h" // for lcfuncall, LCFetchMethod, LCFetchMethodOrHelp #include "lspglob.h" #include "lsptypes.h" // for GetDTD, GetTypeNumber, dtd, Listp, GETWORD @@ -358,7 +358,7 @@ LispPTR lcfuncall(unsigned int atom_index, int argnum, int bytenum) CURRENTFX->nextblock = (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (argnum << 1) + 4 /* +3 */; /* Setup IVar */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); /* Set PC to the Next Instruction and save into FX */ CURRENTFX->pc = ((UNSIGNED)PC - (UNSIGNED)FuncObj) + bytenum; diff --git a/src/main.c b/src/main.c index 4d23107..b6e05a8 100644 --- a/src/main.c +++ b/src/main.c @@ -727,9 +727,9 @@ void start_lisp(void) { TopOfStack = 0; Error_Exit = 0; - PVar = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | InterfacePage->currentfxp) + FRAMESIZE; + PVar = NativeAligned2FromStackOffset(InterfacePage->currentfxp) + FRAMESIZE; - freeptr = next68k = NativeAligned2FromLAddr(STK_OFFSET | CURRENTFX->nextblock); + freeptr = next68k = NativeAligned2FromStackOffset(CURRENTFX->nextblock); if (GETWORD(next68k) != STK_FSB_WORD) error("Starting Lisp: Next stack block isn't free!"); diff --git a/src/return.c b/src/return.c index 0b8a23b..fe87cf6 100644 --- a/src/return.c +++ b/src/return.c @@ -129,7 +129,7 @@ void contextsw(DLword fxnum, DLword bytenum, DLword flags) Midpunt(fxnum); /* exchanging FX */ - next68k = (DLword *)NativeAligned2FromLAddr(STK_OFFSET | CURRENTFX->nextblock); + next68k = NativeAligned2FromStackOffset(CURRENTFX->nextblock); if (GETWORD(next68k) != STK_FSB_WORD) error("contextsw(): MP9316"); freeptr = next68k; diff --git a/src/testtool.c b/src/testtool.c index 1f49fd0..bf6b8a7 100644 --- a/src/testtool.c +++ b/src/testtool.c @@ -57,7 +57,7 @@ #include "gcarraydefs.h" // for aref1 #include "kprintdefs.h" // for print, prindatum #include "lispemul.h" // for DLword, LispPTR, DLbyte, state, T, ConsCell -#include "lispmap.h" // for STK_OFFSET, ATOMS_HI +#include "lispmap.h" // for ATOMS_HI #include "lspglob.h" // for Package_from_Index_word, Stackspace #include "lsptypes.h" // for GETWORD, dtd, GETBYTE, NEWSTRINGP, GetType... #include "mkatomdefs.h" // for compare_chars, make_atom @@ -852,7 +852,7 @@ void dump_bf(Bframe *bf) { if (BFRAMEPTR(bf)->residual) { goto printflags; } - ptr = NativeAligned2FromLAddr(STK_OFFSET + bf->ivar); + ptr = NativeAligned2FromStackOffset(bf->ivar); if ((((DLword *)bf - ptr) > 512) || (((UNSIGNED)ptr & 1) != 0)) { printf("\nInvalid basic frame"); return; @@ -910,7 +910,7 @@ void dump_fx(struct frameex1 *fx_addr68k) { /* should pay attention to the name table like RAID does */ - next68k = (DLword *)NativeAligned2FromLAddr((fx_addr68k->nextblock + STK_OFFSET)); + next68k = NativeAligned2FromStackOffset(fx_addr68k->nextblock); if (fx_addr68k == CURRENTFX) { next68k = CurrentStackPTR + 2; } if ((next68k < ptr) || (((UNSIGNED)next68k & 1) != 0)) { @@ -937,7 +937,7 @@ void dump_stackframe(struct frameex1 *fx_addr68k) { if ((fx_addr68k->alink & 1) == 0) { /* FAST */ bf = (Bframe *)(((DLword *)fx_addr68k) - 2); } else { /* SLOW */ - bf = (Bframe *)NativeAligned4FromLAddr((fx_addr68k->blink + STK_OFFSET)); + bf = (Bframe *)NativeAligned4FromStackOffset(fx_addr68k->blink); } dump_bf(bf); dump_fx((struct frameex1 *)fx_addr68k); @@ -1104,12 +1104,12 @@ void all_stack_dump(DLword start, DLword end, DLword silent) if (start == 0) start68k = Stackspace + InterfacePage->stackbase; else - start68k = NativeAligned2FromLAddr(STK_OFFSET | start); + start68k = NativeAligned2FromStackOffset(start); if (end == 0) end68k = Stackspace + InterfacePage->endofstack; else - end68k = NativeAligned2FromLAddr(STK_OFFSET | end); + end68k = NativeAligned2FromStackOffset(end); stkptr = (STKH *)start68k; @@ -1156,7 +1156,7 @@ void all_stack_dump(DLword start, DLword end, DLword silent) printf(" <-***current***"); size = EndSTKP - (DLword *)stkptr; } else { - size = NativeAligned2FromLAddr(STK_OFFSET | ((FX *)stkptr)->nextblock) - (DLword *)stkptr; + size = NativeAligned2FromStackOffset(((FX *)stkptr)->nextblock) - (DLword *)stkptr; } goto checksize; default: diff --git a/src/ufn.c b/src/ufn.c index 3f64be2..93eeff7 100644 --- a/src/ufn.c +++ b/src/ufn.c @@ -107,7 +107,7 @@ void ufn(DLword bytecode) (LAddrFromNative(CurrentStackPTR) & 0x0ffff) - (entry68k->arg_num << 1) + 2 /** +1 **/; /* Setup IVar */ - IVar = NativeAligned2FromLAddr((((LispPTR)(CURRENTFX->nextblock)) | STK_OFFSET)); + IVar = NativeAligned2FromStackOffset(CURRENTFX->nextblock); #ifdef LISPTRACE print(entry68k->atom_name);