]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/5e/dat.h
merge
[plan9front.git] / sys / src / cmd / 5e / dat.h
1 typedef struct Process Process;
2 typedef struct Segment Segment;
3 typedef struct Fdtable Fdtable;
4 typedef struct Fd Fd;
5
6 enum {
7         STACKTOP = 0x80000000UL,
8         STACKSIZE = 0x10000,
9         
10         FDBLOCK = 16,
11         SEGNUM = 8,
12
13         flN = 1<<31,
14         flZ = 1<<30,
15         flC = 1<<29,
16         flV = 1<<28,
17         FLAGS = flN | flZ | flC | flV,
18 };
19
20 enum {
21         SEGTEXT,
22         SEGDATA,
23         SEGBSS,
24         SEGSTACK,
25 };
26
27 struct Process {
28         Segment* S[SEGNUM];
29         u32int R[16];           /* general purpose registers / PC (R15) */
30         u32int CPSR;            /* status register */
31         char errbuf[ERRMAX];
32         Fd *fd;
33         int pid;
34 };
35
36 extern void **_privates;
37 extern int _nprivates;
38 #define P (*(Process**)_privates)
39
40 enum {
41         SEGFLLOCK = 1,
42 };
43
44 struct Segment {
45         Ref;
46         int flags;
47         RWLock rw; /* lock for SEGLOCK segments */
48         Lock lock; /* atomic accesses */
49         u32int start, size;
50         void *data;
51         Ref *ref;
52 };
53
54 struct Fd {
55         RWLock;
56         Ref ref;
57         u8int *fds;
58         int nfds;
59 };
60
61 #define fulltrace 0
62 #define havesymbols 0
63 #define ultraverbose 0
64 #define systrace 0
65