]> git.lizzy.rs Git - plan9front.git/blob - sys/include/aml.h
brk(2): sbrk(0) returns end address, not the base
[plan9front.git] / sys / include / aml.h
1 #pragma lib     "libaml.a"
2 #pragma src     "/sys/src/libaml"
3
4 /*
5  *      b       uchar*  buffer          amllen() returns number of bytes
6  *      s       char*   string          amllen() is strlen()
7  *      n       char*   undefined name  amllen() is strlen()
8  *      i       uvlong* integer
9  *      p       void**  package         amllen() is # of elements
10  *      r       void*   region
11  *      f       void*   field
12  *      u       void*   bufferfield
13  *      N       void*   name
14  *      R       void*   reference
15  */
16 int             amltag(void *);
17 void*           amlval(void *);
18 uvlong          amlint(void *);
19 int             amllen(void *);
20
21 void*           amlnew(char tag, int len);
22
23 void            amlinit(void);
24 void            amlexit(void);
25
26 int             amlload(uchar *data, int len);
27 void*           amlwalk(void *dot, char *name);
28 int             amleval(void *dot, char *fmt, ...);
29 void            amlenum(void *dot, char *seg, int (*proc)(void *, void *), void *arg);
30
31 /*
32  * exclude from garbage collection
33  */
34 void            amltake(void *);
35 void            amldrop(void *);
36
37 void*           amlroot;
38 int             amldebug;
39 uvlong          amlintmask;
40
41 #pragma varargck        type    "V"     void*
42 #pragma varargck        type    "N"     void*
43
44 /* to be provided by operating system */
45 extern void*    amlalloc(int);
46 extern void     amlfree(void*);
47
48 extern void     amldelay(int);  /* microseconds */
49
50 enum {
51         MemSpace        = 0x00,
52         IoSpace         = 0x01,
53         PcicfgSpace     = 0x02,
54         EbctlSpace      = 0x03,
55         SmbusSpace      = 0x04,
56         CmosSpace       = 0x05,
57         PcibarSpace     = 0x06,
58         IpmiSpace       = 0x07,
59 };
60
61 typedef struct Amlio Amlio;
62 struct Amlio
63 {
64         int     space;
65         uvlong  off;
66         uvlong  len;
67         void    *name;
68         uchar   *va;
69
70         void    *aux;
71         int     (*read)(Amlio *io, void *data, int len, int off);
72         int     (*write)(Amlio *io, void *data, int len, int off);
73 };
74
75 extern int      amlmapio(Amlio *io);
76 extern void     amlunmapio(Amlio *io);