Add ficl words for isvirtualized and move ficl inb and outb words to ficl/x86/sysdep.c so can be shared by i386 and amd64 Reviewed by: imp bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22069
52 lines
871 B
C
52 lines
871 B
C
/* $FreeBSD$ */
|
|
|
|
#ifndef TESTMAIN
|
|
#include <machine/cpufunc.h>
|
|
|
|
/*
|
|
* outb ( port# c -- )
|
|
* Store a byte to I/O port number port#
|
|
*/
|
|
void
|
|
ficlOutb(FICL_VM *pVM)
|
|
{
|
|
u_char c;
|
|
uint32_t port;
|
|
|
|
port=stackPopUNS(pVM->pStack);
|
|
c=(u_char)stackPopINT(pVM->pStack);
|
|
outb(port,c);
|
|
}
|
|
|
|
/*
|
|
* inb ( port# -- c )
|
|
* Fetch a byte from I/O port number port#
|
|
*/
|
|
void
|
|
ficlInb(FICL_VM *pVM)
|
|
{
|
|
u_char c;
|
|
uint32_t port;
|
|
|
|
port=stackPopUNS(pVM->pStack);
|
|
c=inb(port);
|
|
stackPushINT(pVM->pStack,c);
|
|
}
|
|
|
|
/*
|
|
* Glue function to add the appropriate forth words to access x86 special cpu
|
|
* functionality.
|
|
*/
|
|
static void ficlCompileCpufunc(FICL_SYSTEM *pSys)
|
|
{
|
|
FICL_DICT *dp = pSys->dp;
|
|
assert (dp);
|
|
|
|
dictAppendWord(dp, "outb", ficlOutb, FW_DEFAULT);
|
|
dictAppendWord(dp, "inb", ficlInb, FW_DEFAULT);
|
|
}
|
|
|
|
FICL_COMPILE_SET(ficlCompileCpufunc);
|
|
|
|
#endif
|