shithub: riscv

ref: c1d40df49550393f3afe53fb6e6d500dfa8eb7a8
dir: /sys/src/cmd/aux/realemu/fns.h/

View raw version
/* 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)