1 /*******************************************************************
3 ** Forth Inspired Command Language
4 ** Author: John Sadler (john_sadler@alum.mit.edu)
5 ** Created: 16 Oct 1997
6 ** Implementations of FICL external interface functions...
8 *******************************************************************/
11 * $FreeBSD: src/sys/boot/ficl/i386/sysdep.c,v 1.7 1999/09/29 04:43:07 dcs Exp $
12 * $DragonFly: src/sys/boot/ficl/i386/sysdep.c,v 1.3 2003/11/10 06:08:33 dillon Exp $
21 #include <machine/cpufunc.h>
27 ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith
30 #if PORTABLE_LONGMULDIV == 0
31 DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
36 qx = (u_int64_t)x * (u_int64_t) y;
38 q.hi = (u_int32_t)( qx >> 32 );
39 q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
44 UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
50 qx = (qh << 32) | q.lo;
59 void ficlTextOut(FICL_VM *pVM, char *msg, int fNewline)
71 void *ficlMalloc (size_t size)
76 void *ficlRealloc (void *p, size_t size)
78 return realloc(p, size);
81 void ficlFree (void *p)
90 * Store a byte to I/O port number port#
93 ficlOutb(FICL_VM *pVM)
98 port=stackPopUNS(pVM->pStack);
99 c=(u_char)stackPopINT(pVM->pStack);
105 * Fetch a byte from I/O port number port#
108 ficlInb(FICL_VM *pVM)
113 port=stackPopUNS(pVM->pStack);
115 stackPushINT(pVM->pStack,c);
121 ** Stub function for dictionary access control - does nothing
122 ** by default, user can redefine to guarantee exclusive dict
123 ** access to a single thread for updates. All dict update code
124 ** is guaranteed to be bracketed as follows:
125 ** ficlLockDictionary(TRUE);
126 ** <code that updates dictionary>
127 ** ficlLockDictionary(FALSE);
129 ** Returns zero if successful, nonzero if unable to acquire lock
130 ** befor timeout (optional - could also block forever)
133 int ficlLockDictionary(short fLock)
138 #endif /* FICL_MULTITHREAD */