summaryrefslogtreecommitdiffstats
path: root/sys/boot/ficl/ficl.c
diff options
context:
space:
mode:
authordcs <dcs@FreeBSD.org>1999-02-04 16:53:47 +0000
committerdcs <dcs@FreeBSD.org>1999-02-04 16:53:47 +0000
commit60ace12c39d160ce8ffa553ba201f1f6ea1edc97 (patch)
treeafc135b4ad45aec9fa6c302e610e42d64a596994 /sys/boot/ficl/ficl.c
parentbd9aa5413c70bb486ca9d5acdb8099108f152e5d (diff)
downloadFreeBSD-src-60ace12c39d160ce8ffa553ba201f1f6ea1edc97.zip
FreeBSD-src-60ace12c39d160ce8ffa553ba201f1f6ea1edc97.tar.gz
Make ficlExec recursive. This removes vmReset and vmQuit from the
error cases, but the replacement should be doing everything they did, except what did shouldn't be doing, and might do a little more they ought to be doing.
Diffstat (limited to 'sys/boot/ficl/ficl.c')
-rw-r--r--sys/boot/ficl/ficl.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/boot/ficl/ficl.c b/sys/boot/ficl/ficl.c
index fab56f6..2dada3d 100644
--- a/sys/boot/ficl/ficl.c
+++ b/sys/boot/ficl/ficl.c
@@ -179,17 +179,20 @@ int ficlExec(FICL_VM *pVM, char *pText, INT32 size)
int except;
FICL_WORD *tempFW;
jmp_buf vmState;
- jmp_buf *oldState;
TIB saveTib;
+ FICL_VM VM;
+ FICL_STACK rStack;
assert(pVM);
vmPushTib(pVM, pText, size, &saveTib);
/*
- ** Save and restore VM's jmp_buf to enable nested calls to ficlExec
+ ** Save and restore pVM and pVM->rStack to enable nested calls to ficlExec
*/
- oldState = pVM->pState;
+ memcpy((void*)&VM, (void*)pVM, sizeof(FICL_VM));
+ memcpy((void*)&rStack, (void*)pVM->rStack, sizeof(FICL_STACK));
+
pVM->pState = &vmState; /* This has to come before the setjmp! */
except = setjmp(vmState);
@@ -285,7 +288,9 @@ int ficlExec(FICL_VM *pVM, char *pText, INT32 size)
vmTextOut(pVM, buffer, 1);
}
- else if (ficl_trace) /* probably not a word - punt and print value */
+ else if (ficl_trace) /* probably not a word
+ * - punt and print value
+ */
{
sprintf(buffer, " %ld (%#lx)", ((CELL*)pVM->ip)->i, ((CELL*)pVM->ip)->u);
vmTextOut(pVM, buffer, 1);
@@ -319,7 +324,9 @@ int ficlExec(FICL_VM *pVM, char *pText, INT32 size)
case VM_QUIT:
if (pVM->state == COMPILE)
dictAbortDefinition(dp);
- vmQuit(pVM);
+
+ memcpy((void*)pVM, (void*)&VM, sizeof(FICL_VM));
+ memcpy((void*)pVM->rStack, (void*)&rStack, sizeof(FICL_STACK));
break;
case VM_ERREXIT:
@@ -334,11 +341,14 @@ int ficlExec(FICL_VM *pVM, char *pText, INT32 size)
#endif
}
dictResetSearchOrder(dp);
- vmReset(pVM);
+ memcpy((void*)pVM, (void*)&VM, sizeof(FICL_VM));
+ memcpy((void*)pVM->rStack, (void*)&rStack, sizeof(FICL_STACK));
+ stackReset(pVM->pStack);
+ pVM->base = 10;
break;
}
- pVM->pState = oldState;
+ pVM->pState = VM.pState;
vmPopTib(pVM, &saveTib);
return (except);
}
OpenPOWER on IntegriCloud