xref: /inferno-os/os/js/dat.h (revision 9dc22068e29604f4b484e746112a9a4efe6fd57f)
1 typedef struct Conf	Conf;
2 typedef struct FPenv	FPenv;
3 typedef struct FPU	FPU;
4 typedef struct Label	Label;
5 typedef struct Lock	Lock;
6 typedef struct Mach	Mach;
7 typedef struct Ureg	Ureg;
8 typedef struct Lance	Lance;
9 typedef struct Lancemem	Lancemem;
10 typedef struct Etherpkt	Etherpkt;
11 typedef struct Lancepkt	Lancepkt;
12 
13 typedef	ulong	Instr;
14 
15 struct Conf
16 {
17 	int	nmach;		/* processors */
18 	int	nproc;		/* processes */
19 	ulong	monitor;	/* graphics monitor id; 0 for none */
20 	char	ss2;		/* is a sparcstation 2 */
21 	char	ss2cachebug;	/* has sparcstation2 cache bug */
22 	int	ncontext;	/* in mmu */
23 	int	vacsize;	/* size of virtual address cache, in bytes */
24 	int	vaclinesize;	/* size of cache line */
25 	ulong	npage0;		/* total physical pages of memory, bank 0 */
26 	ulong	npage1;		/* total physical pages of memory, bank 1 */
27 	ulong	base0;		/* base of bank 0 */
28 	ulong	base1;		/* base of bank 1 */
29 	ulong	ialloc;		/* max interrupt time allocation in bytes */
30 	ulong	npage;		/* total physical pages of memory */
31 	int	copymode;	/* 0 is copy on write, 1 is copy on reference */
32 	ulong	ipif;		/* Ip protocol interfaces */
33 	ulong	ip;		/* Ip conversations per interface */
34 	ulong	arp;		/* Arp table size */
35 	ulong	frag;		/* Ip fragment assemble queue size */
36 };
37 
38 
39 /*
40  * FPenv.status
41  */
42 enum
43 {
44 	FPINIT,
45 	FPACTIVE,
46 	FPINACTIVE,
47 };
48 
49 struct	FPenv
50 {
51 	ulong	status;
52 	ulong	pad;
53 };
54 
55 /*
56  * This structure must agree with fpsave and fprestore asm routines
57  */
58 struct	FPU
59 {
60 
61 	double	regs[17];	/* floating point registers */
62 	FPenv	env;
63 };
64 
65 /*
66  *  machine dependent definitions used by ../port/dat.h
67  */
68 
69 struct Label
70 {
71 	ulong	sp;
72 	ulong	pc;
73 };
74 
75 struct Lock
76 {
77 	ulong	key;
78 	ulong	pc;
79 	ulong	sr;
80 	int	pri;
81 };
82 
83 #include "../port/portdat.h"
84 
85 /*
86  *  machine dependent definitions not used by ../port/dat.h
87  */
88 
89 struct Mach
90 {
91 	ulong	ticks;			/* of the clock since boot time */
92 	int		machno;			/* physical id of this processor */
93 	Proc	*proc;			/* current process on this processor */
94 	Label	sched;			/* scheduler wakeup */
95 	Lock	alarmlock;		/* access to alarm list */
96 	void	*alarm;			/* alarms bound to this clock */
97 	ulong	*contexts;		/* hardware context table */
98 	ulong	*ctx;			/* the context */
99 	int	fptrap;			/* FP trap occurred while unsave */
100 
101 	int	nrdy;
102 
103 	int	stack[1];
104 };
105 
106 /*
107  * XXX - Eric: It just works....
108  */
109 
110 /*
111  *  LANCE CSR3 (bus control bits)
112  */
113 #define BSWP	0x4
114 #define ACON	0x2
115 #define BCON	0x1
116 
117 struct Lancepkt
118 {
119 	uchar	d[6];
120 	uchar	s[6];
121 	uchar	type[2];
122 	uchar	data[1500];
123 	uchar	crc[4];
124 };
125 
126 /*
127  *  system dependent lance stuff
128  *  filled by lancesetup()
129  */
130 struct Lance
131 {
132 	ushort	lognrrb;	/* log2 number of receive ring buffers */
133 	ushort	logntrb;	/* log2 number of xmit ring buffers */
134 	ushort	nrrb;		/* number of receive ring buffers */
135 	ushort	ntrb;		/* number of xmit ring buffers */
136 	ushort	*rap;		/* lance address register */
137 	ushort	*rdp;		/* lance data register */
138 	ushort	busctl;		/* bus control bits */
139 	uchar	ea[6];		/* our ether addr */
140 	int	sep;		/* separation between shorts in lance ram
141 				    as seen by host */
142 	ushort	*lanceram;	/* start of lance ram as seen by host */
143 	Lancemem *lm;		/* start of lance ram as seen by lance */
144 	Lancepkt *rp;		/* receive buffers (host address) */
145 	Lancepkt *tp;		/* transmit buffers (host address) */
146 	Lancepkt *lrp;		/* receive buffers (lance address) */
147 	Lancepkt *ltp;		/* transmit buffers (lance address) */
148 };
149 
150 /*
151  * Fake kmap
152  */
153 typedef void		KMap;
154 #define	VA(k)		((ulong)(k))
155 #define	kmap(p)		(KMap*)((p)->pa|KZERO)
156 #define	kunmap(k)
157 #define	MACHP(n)	(n==0? &mach0 : *(Mach**)0)
158 
159 extern Mach *m;
160 extern Proc *up;
161 extern Mach mach0;
162 
163 #define	swcursor	1
164