Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/stand/ficl/x86/sysdep.c
34859 views
1
2
#ifndef TESTMAIN
3
#include <machine/cpufunc.h>
4
5
/*
6
* outb ( port# c -- )
7
* Store a byte to I/O port number port#
8
*/
9
void
10
ficlOutb(FICL_VM *pVM)
11
{
12
u_char c;
13
uint32_t port;
14
15
port=stackPopUNS(pVM->pStack);
16
c=(u_char)stackPopINT(pVM->pStack);
17
outb(port,c);
18
}
19
20
/*
21
* inb ( port# -- c )
22
* Fetch a byte from I/O port number port#
23
*/
24
void
25
ficlInb(FICL_VM *pVM)
26
{
27
u_char c;
28
uint32_t port;
29
30
port=stackPopUNS(pVM->pStack);
31
c=inb(port);
32
stackPushINT(pVM->pStack,c);
33
}
34
35
/*
36
* Glue function to add the appropriate forth words to access x86 special cpu
37
* functionality.
38
*/
39
static void ficlCompileCpufunc(FICL_SYSTEM *pSys)
40
{
41
FICL_DICT *dp = pSys->dp;
42
assert (dp);
43
44
dictAppendWord(dp, "outb", ficlOutb, FW_DEFAULT);
45
dictAppendWord(dp, "inb", ficlInb, FW_DEFAULT);
46
}
47
48
FICL_COMPILE_SET(ficlCompileCpufunc);
49
50
#endif
51
52