4 #include "/mips/include/ureg.h"
5 #define USERADDR 0xC0000000
6 #define UREGADDR (USERADDR+BY2PG-4-0xA0)
7 #define USER_REG(x) (UREGADDR+(ulong)(x))
8 #define REGOFF(x) (USER_REG(&((struct Ureg *) 0)->x))
10 typedef struct Registers Registers;
11 typedef struct Segment Segment;
12 typedef struct Memory Memory;
13 typedef struct Mul Mul;
14 typedef struct Mulu Mulu;
15 typedef struct Inst Inst;
16 typedef struct Icache Icache;
17 typedef struct Tlb Tlb;
18 typedef struct Breakpoint Breakpoint;
31 int type; /* Instruction/Read/Access/Write/Equal */
32 ulong addr; /* Place at address */
33 int count; /* To execute count times or value */
34 int done; /* How many times passed through */
35 Breakpoint *next; /* Link to next one */
56 int on; /* Being updated */
57 int tlbsize; /* Number of entries */
58 ulong tlbent[Nmaxtlb]; /* Virtual address tags */
59 int hit; /* Number of successful tag matches */
60 int miss; /* Number of failed tag matches */
65 int on; /* Turned on */
66 int linesize; /* Line size in bytes */
67 int stall; /* Cache stalls */
68 int *lines; /* Tag array */
69 int* (*hash)(ulong); /* Hash function */
70 char *hashtext; /* What the function looks like */
107 #define dreg(r) ((r)>>1)
154 void fatal(int, char*, ...);
160 void* emalloc(ulong);
161 void* erealloc(void*, ulong, ulong);
163 int badvaddr(ulong, int);
164 void itrace(char *, ...);
166 void Ssyscall(ulong);
167 char* memio(char*, ulong, int, int);
169 ulong getmem_w(ulong);
170 ushort getmem_h(ulong);
171 void putmem_w(ulong, ulong);
172 uchar getmem_b(ulong);
173 void putmem_b(ulong, uchar);
174 ulong getmem_4(ulong);
175 ulong getmem_2(ulong);
176 void putmem_h(ulong, short);
178 Mulu mulu(ulong, ulong);
180 void initicache(void);
181 void updateicache(ulong addr);
184 void randseed(long, long);
186 void brkchk(ulong, int);
188 void breakpoint(char*, char*);
193 void initstk(int, char**);
196 int _mipscoinst(Map*, uvlong, char*, int);
198 void printsource(long);
199 void printparams(Symbol *, ulong);
200 void printlocals(Symbol *, ulong);
205 Extern Registers reg;
206 Extern Memory memory;
213 Extern Icache icache;
216 Extern jmp_buf errjmp;
217 Extern Breakpoint *bplist;
224 Extern Biobuf *bioout;
231 /* Plan9 Kernel constants */
234 #define UTZERO 0x1000
235 #define STACKTOP 0x80000000
236 #define STACKSIZE 0x10000
239 /* Opcode decoders */
240 #define Getrsrt(s,t,i) s = (i>>21)&0x1f; t = (i>>16)&0x1f;
241 #define Getrbrt(b,t,i) b = (i>>21)&0x1f; t = (i>>16)&0x1f;
242 #define Get3(s, t, d, i) s = (i>>21)&0x1f; t = (i>>16)&0x1f; d = (i>>11)&0x1f;
243 #define Getf3(s, t, d, i) s = (i>>11)&0x1f; t = (i>>16)&0x1f; d = (i>>6)&0x1f;
244 #define Getf2(s, d, i) s = (i>>11)&0x1f; d = (i>>6)&0x1f;
245 #define SpecialGetrtrd(t, d, i) t = (i>>16)&0x1f; d = (i>>11)&0x1f;
247 #define INOPINST "nor"
248 #define INOP 0x00000027 /* Instruction used as nop */
249 #define SIGNBIT 0x80000000
250 #define Iexec(ir) {Inst *i; i = &itab[(ir)>>26]; reg.ip = i; i->count++; (*i->func)(ir); }
251 #define Statbra() reg.ip->taken++; if(reg.ir != INOP) reg.ip->useddelay++;
257 #define FP_CBIT (1<<23)