diff --git a/sys/boot/ficl/alpha/sysdep.c b/sys/boot/ficl/alpha/sysdep.c index 38223645c5ea..56194fd921fe 100644 --- a/sys/boot/ficl/alpha/sysdep.c +++ b/sys/boot/ficl/alpha/sysdep.c @@ -13,6 +13,9 @@ #else #include #endif +#ifdef __i386__ +#include +#endif #include "ficl.h" /* @@ -68,6 +71,38 @@ void ficlFree (void *p) free(p); } +#ifdef __i386__ +/* + * pc! ( port# c -- ) + * Store a byte to I/O port number port# + */ +void +pc_store(FICL_VM *pVM) +{ + u_char c; + u_int32_t port; + + port=stackPopUNS32(pVM->pStack); + c=(u_char)stackPopINT32(pVM->pStack); + outb(port,c); +} + +/* + * pc@ ( port# -- c ) + * Fetch a byte from I/O port number port# + */ +void +pc_fetch(FICL_VM *pVM) +{ + u_char c; + u_int32_t port; + + port=stackPopUNS32(pVM->pStack); + c=inb(port); + stackPushINT32(pVM->pStack,c); +} +#endif + /* ** Stub function for dictionary access control - does nothing ** by default, user can redefine to guarantee exclusive dict diff --git a/sys/boot/ficl/ficl.h b/sys/boot/ficl/ficl.h index 2836c9dee304..3eea20160187 100644 --- a/sys/boot/ficl/ficl.h +++ b/sys/boot/ficl/ficl.h @@ -761,6 +761,11 @@ void ficlCompileSoftCore(FICL_VM *pVM); void constantParen(FICL_VM *pVM); void twoConstParen(FICL_VM *pVM); +#ifdef __i386__ +extern void pc_fetch(FICL_VM *pVM); +extern void pc_store(FICL_VM *pVM); +#endif + #ifdef __cplusplus } #endif diff --git a/sys/boot/ficl/i386/sysdep.c b/sys/boot/ficl/i386/sysdep.c index 38223645c5ea..56194fd921fe 100644 --- a/sys/boot/ficl/i386/sysdep.c +++ b/sys/boot/ficl/i386/sysdep.c @@ -13,6 +13,9 @@ #else #include #endif +#ifdef __i386__ +#include +#endif #include "ficl.h" /* @@ -68,6 +71,38 @@ void ficlFree (void *p) free(p); } +#ifdef __i386__ +/* + * pc! ( port# c -- ) + * Store a byte to I/O port number port# + */ +void +pc_store(FICL_VM *pVM) +{ + u_char c; + u_int32_t port; + + port=stackPopUNS32(pVM->pStack); + c=(u_char)stackPopINT32(pVM->pStack); + outb(port,c); +} + +/* + * pc@ ( port# -- c ) + * Fetch a byte from I/O port number port# + */ +void +pc_fetch(FICL_VM *pVM) +{ + u_char c; + u_int32_t port; + + port=stackPopUNS32(pVM->pStack); + c=inb(port); + stackPushINT32(pVM->pStack,c); +} +#endif + /* ** Stub function for dictionary access control - does nothing ** by default, user can redefine to guarantee exclusive dict diff --git a/sys/boot/ficl/sysdep.c b/sys/boot/ficl/sysdep.c index 38223645c5ea..56194fd921fe 100644 --- a/sys/boot/ficl/sysdep.c +++ b/sys/boot/ficl/sysdep.c @@ -13,6 +13,9 @@ #else #include #endif +#ifdef __i386__ +#include +#endif #include "ficl.h" /* @@ -68,6 +71,38 @@ void ficlFree (void *p) free(p); } +#ifdef __i386__ +/* + * pc! ( port# c -- ) + * Store a byte to I/O port number port# + */ +void +pc_store(FICL_VM *pVM) +{ + u_char c; + u_int32_t port; + + port=stackPopUNS32(pVM->pStack); + c=(u_char)stackPopINT32(pVM->pStack); + outb(port,c); +} + +/* + * pc@ ( port# -- c ) + * Fetch a byte from I/O port number port# + */ +void +pc_fetch(FICL_VM *pVM) +{ + u_char c; + u_int32_t port; + + port=stackPopUNS32(pVM->pStack); + c=inb(port); + stackPushINT32(pVM->pStack,c); +} +#endif + /* ** Stub function for dictionary access control - does nothing ** by default, user can redefine to guarantee exclusive dict diff --git a/sys/boot/ficl/words.c b/sys/boot/ficl/words.c index d0f6ad6f28d2..3d71c3c529a1 100644 --- a/sys/boot/ficl/words.c +++ b/sys/boot/ficl/words.c @@ -2758,6 +2758,9 @@ static void type(FICL_VM *pVM) ** (oops), make sure the string is null terminated. If not, copy ** and terminate it. */ + /* XXX Uses free space on top of dictionary. Is it guaranteed + * XXX to always fit? (abial) + */ if (cp[count] != '\0') { char *pDest = (char *)ficlGetDict()->here; @@ -4382,6 +4385,13 @@ void ficlCompileCore(FICL_DICT *dp) dictAppendWord(dp, "key?", keyQuestion, FW_DEFAULT); dictAppendWord(dp, "ms", ms, FW_DEFAULT); dictAppendWord(dp, "seconds", pseconds, FW_DEFAULT); +#ifdef __i386__ + dictAppendWord(dp, "pc!", pc_store, FW_DEFAULT); + dictAppendWord(dp, "pc@", pc_fetch, FW_DEFAULT); + ficlSetEnv("arch-i386", FICL_TRUE); +#else + ficlSetEnv("arch-i386", FICL_FALSE); +#endif /* ** Set CORE environment query values