]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/5e/dat.h
5e: added note support
[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         STACKSIZE = 0x100000,
8         NAMEMAX = 27,
9         NNOTE = 5,
10         SEGNUM = 8,
11
12         flN = 1<<31,
13         flZ = 1<<30,
14         flC = 1<<29,
15         flV = 1<<28,
16         FLAGS = flN | flZ | flC | flV,
17 };
18
19 enum {
20         SEGTEXT,
21         SEGDATA,
22         SEGBSS,
23         SEGSTACK,
24 };
25
26 struct Process {
27         Process *prev, *next;   /* linked list (for fs) */
28         int pid;
29         char name[NAMEMAX+1];   /* name for status file */
30         Ref *path;              /* Ref + string data */
31
32         Segment *S[SEGNUM];     /* memory */
33         u32int R[16];           /* general purpose registers / PC (R15) */
34         u32int CPSR;            /* status register */
35
36         char errbuf[ERRMAX];
37         Fd *fd;                 /* bitmap of OCEXEC files */
38         
39         /* note handling */
40         u32int notehandler;
41         int innote;
42         jmp_buf notejmp;
43         char notes[ERRMAX][NNOTE];
44         long notein, noteout;
45 };
46
47 extern void **_privates;
48 extern int _nprivates;
49 #define P (*(Process**)_privates)
50 extern Ref nproc;
51 extern Process plist;
52 extern Lock plistlock;
53
54 enum {
55         SEGFLLOCK = 1,
56 };
57
58 struct Segment {
59         Ref;
60         int flags;
61         RWLock rw; /* lock for SEGFLLOCK segments */
62         Lock lock; /* atomic accesses */
63         u32int start, size;
64         void *data;
65         Ref *dref;
66 };
67
68 struct Fd {
69         RWLock;
70         Ref;
71         u8int *fds;
72         int nfds;
73 };
74
75 #define fulltrace 0
76 #define havesymbols 0
77 #define ultraverbose 0
78 #define systrace 0