From cb7b2d65938978e5d1b6dda435734bfb65f471f0 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sat, 9 Dec 2017 19:11:31 +0200 Subject: [PATCH] 8911 loader: move ficl outb and inb into libi386 --- usr/src/boot/sys/boot/i386/libi386/biospci.c | 44 ++++++++++++++++++++++++++++ usr/src/common/ficl/loader.c | 43 --------------------------- 2 files changed, 44 insertions(+), 43 deletions(-) diff --git a/usr/src/boot/sys/boot/i386/libi386/biospci.c b/usr/src/boot/sys/boot/i386/libi386/biospci.c index e143ba9746..1f9f86338f 100644 --- a/usr/src/boot/sys/boot/i386/libi386/biospci.c +++ b/usr/src/boot/sys/boot/i386/libi386/biospci.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -599,3 +600,46 @@ ficlCompilePciBios(ficlSystem *pSys) } FICL_COMPILE_SET(ficlCompilePciBios); + +/* + * outb ( port# c -- ) + * Store a byte to I/O port number port# + */ +static void +ficlOutb(ficlVm *pVM) +{ + uint8_t c; + uint32_t port; + + port = ficlStackPopUnsigned(ficlVmGetDataStack(pVM)); + c = ficlStackPopInteger(ficlVmGetDataStack(pVM)); + outb(port, c); +} + +/* + * inb ( port# -- c ) + * Fetch a byte from I/O port number port# + */ +static void +ficlInb(ficlVm *pVM) +{ + uint8_t c; + uint32_t port; + + port = ficlStackPopUnsigned(ficlVmGetDataStack(pVM)); + c = inb(port); + ficlStackPushInteger(ficlVmGetDataStack(pVM), c); +} + +static void +ficlCompileCpufunc(ficlSystem *pSys) +{ + ficlDictionary *dp = ficlSystemGetDictionary(pSys); + + FICL_SYSTEM_ASSERT(pSys, dp); + + ficlDictionarySetPrimitive(dp, "outb", ficlOutb, FICL_WORD_DEFAULT); + ficlDictionarySetPrimitive(dp, "inb", ficlInb, FICL_WORD_DEFAULT); +} + +FICL_COMPILE_SET(ficlCompileCpufunc); diff --git a/usr/src/common/ficl/loader.c b/usr/src/common/ficl/loader.c index 98eb2db19f..627dbb3dfc 100644 --- a/usr/src/common/ficl/loader.c +++ b/usr/src/common/ficl/loader.c @@ -43,9 +43,6 @@ #include #else #include -#ifdef __i386__ -#include -#endif #include "bootstrap.h" #endif #ifdef _STANDALONE @@ -852,42 +849,6 @@ fkey(ficlVm *pVM) ficlStackPushInteger(ficlVmGetDataStack(pVM), i > 0 ? ch : -1); } - -#ifdef _STANDALONE -#ifdef __i386__ - -/* - * outb ( port# c -- ) - * Store a byte to I/O port number port# - */ -void -ficlOutb(ficlVm *pVM) -{ - uint8_t c; - uint32_t port; - - port = ficlStackPopUnsigned(ficlVmGetDataStack(pVM)); - c = ficlStackPopInteger(ficlVmGetDataStack(pVM)); - outb(port, c); -} - -/* - * inb ( port# -- c ) - * Fetch a byte from I/O port number port# - */ -void -ficlInb(ficlVm *pVM) -{ - uint8_t c; - uint32_t port; - - port = ficlStackPopUnsigned(ficlVmGetDataStack(pVM)); - c = inb(port); - ficlStackPushInteger(ficlVmGetDataStack(pVM), c); -} -#endif -#endif - /* * Retrieves free space remaining on the dictionary */ @@ -954,10 +915,6 @@ ficlSystemCompilePlatform(ficlSystem *pSys) ficlDictionarySetPrimitive(dp, "uuid-to-string", ficlUuidToString, FICL_WORD_DEFAULT); #ifdef _STANDALONE -#ifdef __i386__ - ficlDictionarySetPrimitive(dp, "outb", ficlOutb, FICL_WORD_DEFAULT); - ficlDictionarySetPrimitive(dp, "inb", ficlInb, FICL_WORD_DEFAULT); -#endif /* Register words from linker set. */ SET_FOREACH(fnpp, Xficl_compile_set) (*fnpp)(pSys); -- 2.11.4.GIT