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 *******************************************************************/
10 /* $FreeBSD: src/sys/boot/ficl/i386/sysdep.c,v 1.7 1999/09/29 04:43:07 dcs Exp $ */
11 /* $DragonFly: src/sys/boot/ficl/i386/sysdep.c,v 1.2 2003/06/17 04:28:18 dillon Exp $ */
19 #include <machine/cpufunc.h>
25 ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith
28 #if PORTABLE_LONGMULDIV == 0
29 DPUNS ficlLongMul(FICL_UNS x, FICL_UNS y)
34 qx = (u_int64_t)x * (u_int64_t) y;
36 q.hi = (u_int32_t)( qx >> 32 );
37 q.lo = (u_int32_t)( qx & 0xFFFFFFFFL);
42 UNSQR ficlLongDiv(DPUNS q, FICL_UNS y)
48 qx = (qh << 32) | q.lo;
57 void ficlTextOut(FICL_VM *pVM, char *msg, int fNewline)
69 void *ficlMalloc (size_t size)
74 void *ficlRealloc (void *p, size_t size)
76 return realloc(p, size);
79 void ficlFree (void *p)
88 * Store a byte to I/O port number port#
91 ficlOutb(FICL_VM *pVM)
96 port=stackPopUNS(pVM->pStack);
97 c=(u_char)stackPopINT(pVM->pStack);
103 * Fetch a byte from I/O port number port#
106 ficlInb(FICL_VM *pVM)
111 port=stackPopUNS(pVM->pStack);
113 stackPushINT(pVM->pStack,c);
119 ** Stub function for dictionary access control - does nothing
120 ** by default, user can redefine to guarantee exclusive dict
121 ** access to a single thread for updates. All dict update code
122 ** is guaranteed to be bracketed as follows:
123 ** ficlLockDictionary(TRUE);
124 ** <code that updates dictionary>
125 ** ficlLockDictionary(FALSE);
127 ** Returns zero if successful, nonzero if unable to acquire lock
128 ** befor timeout (optional - could also block forever)
131 int ficlLockDictionary(short fLock)
136 #endif /* FICL_MULTITHREAD */