Changeset View
Changeset View
Standalone View
Standalone View
head/stand/ficl/loader.c
Show First 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | |||||
#else | #else | ||||
fp = NULL; | fp = NULL; | ||||
#endif | #endif | ||||
stackPushPtr(pVM->pStack, fp); | stackPushPtr(pVM->pStack, fp); | ||||
return; | return; | ||||
} | } | ||||
#ifndef TESTMAIN | |||||
/* isvirtualized? - Return whether the loader runs under a | |||||
* hypervisor. | |||||
* | |||||
* isvirtualized? ( -- flag ) | |||||
*/ | |||||
static void | |||||
ficlIsvirtualizedQ(FICL_VM *pVM) | |||||
{ | |||||
FICL_INT flag; | |||||
const char *hv; | |||||
#if FICL_ROBUST > 1 | |||||
vmCheckStack(pVM, 0, 1); | |||||
#endif | |||||
hv = (archsw.arch_hypervisor != NULL) | |||||
? (*archsw.arch_hypervisor)() | |||||
: NULL; | |||||
flag = (hv != NULL) ? FICL_TRUE : FICL_FALSE; | |||||
stackPushINT(pVM->pStack, flag); | |||||
} | |||||
#endif /* ndef TESTMAIN */ | |||||
void | void | ||||
ficlCcall(FICL_VM *pVM) | ficlCcall(FICL_VM *pVM) | ||||
{ | { | ||||
int (*func)(int, ...); | int (*func)(int, ...); | ||||
int result, p[10]; | int result, p[10]; | ||||
int nparam, i; | int nparam, i; | ||||
#if FICL_ROBUST > 1 | #if FICL_ROBUST > 1 | ||||
▲ Show 20 Lines • Show All 537 Lines • ▼ Show 20 Lines | void ficlCompilePlatform(FICL_SYSTEM *pSys) | ||||
dictAppendWord(dp, "getenv", ficlGetenv, FW_DEFAULT); | dictAppendWord(dp, "getenv", ficlGetenv, FW_DEFAULT); | ||||
dictAppendWord(dp, "unsetenv", ficlUnsetenv, FW_DEFAULT); | dictAppendWord(dp, "unsetenv", ficlUnsetenv, FW_DEFAULT); | ||||
dictAppendWord(dp, "copyin", ficlCopyin, FW_DEFAULT); | dictAppendWord(dp, "copyin", ficlCopyin, FW_DEFAULT); | ||||
dictAppendWord(dp, "copyout", ficlCopyout, FW_DEFAULT); | dictAppendWord(dp, "copyout", ficlCopyout, FW_DEFAULT); | ||||
dictAppendWord(dp, "findfile", ficlFindfile, FW_DEFAULT); | dictAppendWord(dp, "findfile", ficlFindfile, FW_DEFAULT); | ||||
dictAppendWord(dp, "ccall", ficlCcall, FW_DEFAULT); | dictAppendWord(dp, "ccall", ficlCcall, FW_DEFAULT); | ||||
dictAppendWord(dp, "uuid-from-string", ficlUuidFromString, FW_DEFAULT); | dictAppendWord(dp, "uuid-from-string", ficlUuidFromString, FW_DEFAULT); | ||||
dictAppendWord(dp, "uuid-to-string", ficlUuidToString, FW_DEFAULT); | dictAppendWord(dp, "uuid-to-string", ficlUuidToString, FW_DEFAULT); | ||||
#ifndef TESTMAIN | |||||
dictAppendWord(dp, "isvirtualized?",ficlIsvirtualizedQ, FW_DEFAULT); | |||||
#endif | |||||
SET_FOREACH(fnpp, Xficl_compile_set) | SET_FOREACH(fnpp, Xficl_compile_set) | ||||
(*fnpp)(pSys); | (*fnpp)(pSys); | ||||
#if defined(__i386__) | #if defined(__i386__) | ||||
ficlSetEnv(pSys, "arch-i386", FICL_TRUE); | ficlSetEnv(pSys, "arch-i386", FICL_TRUE); | ||||
ficlSetEnv(pSys, "arch-powerpc", FICL_FALSE); | ficlSetEnv(pSys, "arch-powerpc", FICL_FALSE); | ||||
#elif defined(__powerpc__) | #elif defined(__powerpc__) | ||||
ficlSetEnv(pSys, "arch-i386", FICL_FALSE); | ficlSetEnv(pSys, "arch-i386", FICL_FALSE); | ||||
ficlSetEnv(pSys, "arch-powerpc", FICL_TRUE); | ficlSetEnv(pSys, "arch-powerpc", FICL_TRUE); | ||||
#endif | #endif | ||||
return; | return; | ||||
} | } |