summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/realemu/fns.h
blob: 11b7e8cdb17a5365fbfe694c97c3f79cd70c5840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* arg */
Iarg *adup(Iarg *x);
Iarg *areg(Cpu *cpu, uchar len, uchar reg);
Iarg *amem(Cpu *cpu, uchar len, uchar sreg, ulong off);
Iarg *afar(Iarg *mem, uchar len, uchar alen);
Iarg *acon(Cpu *cpu, uchar len, ulong val);
ulong ar(Iarg *a);
long ars(Iarg *a);
void aw(Iarg *a, ulong w);

/* decode */
void decode(Iarg *ip, Inst *i);

/* xec */
void trap(Cpu *cpu, int e);
int intr(Cpu *cpu, int v);
int xec(Cpu *cpu, int n);

#pragma varargck type "I" Inst*
#pragma varargck type "J" ulong
#pragma varargck type "C" Cpu*

int instfmt(Fmt *fmt);
int flagfmt(Fmt *fmt);
int cpufmt(Fmt *fmt);

/* pit */
void clockpit(Pit *pit, vlong cycles);
void setgate(Pit *ch, uchar gate);
uchar rpit(Pit *pit, uchar addr);
void wpit(Pit *pit, uchar addr, uchar data);

/* pci */
Pcidev *pciopen(int bdf);
int pcicfgr(Pcidev *pci, void *data, int len, int addr);
int pcicfgw(Pcidev *pci, void *data, int len, int addr);

#define BDFBNO(bdf)	(((int)bdf >> 16) & 0xFF)
#define BDFDNO(bdf)	(((int)bdf >> 11) & 0x1F)
#define BDFFNO(bdf)	(((int)bdf >>  8) & 0x07)