* same with xv6
[mascara-docs.git] / i386 / MIT / src.xv6 / defs.h
blob7f1e88d34f5f3aacfb0e55cac8985fbb8beb00bb
1 struct buf;
2 struct context;
3 struct file;
4 struct inode;
5 struct pipe;
6 struct proc;
7 struct spinlock;
8 struct stat;
9 struct superblock;
11 // bio.c
12 void binit(void);
13 struct buf* bread(uint, uint);
14 void brelse(struct buf*);
15 void bwrite(struct buf*);
17 // console.c
18 void consoleinit(void);
19 void cprintf(char*, ...);
20 void consoleintr(int(*)(void));
21 void panic(char*) __attribute__((noreturn));
23 // exec.c
24 int exec(char*, char**);
26 // file.c
27 struct file* filealloc(void);
28 void fileclose(struct file*);
29 struct file* filedup(struct file*);
30 void fileinit(void);
31 int fileread(struct file*, char*, int n);
32 int filestat(struct file*, struct stat*);
33 int filewrite(struct file*, char*, int n);
35 // fs.c
36 void readsb(int dev, struct superblock *sb);
37 int dirlink(struct inode*, char*, uint);
38 struct inode* dirlookup(struct inode*, char*, uint*);
39 struct inode* ialloc(uint, short);
40 struct inode* idup(struct inode*);
41 void iinit(void);
42 void ilock(struct inode*);
43 void iput(struct inode*);
44 void iunlock(struct inode*);
45 void iunlockput(struct inode*);
46 void iupdate(struct inode*);
47 int namecmp(const char*, const char*);
48 struct inode* namei(char*);
49 struct inode* nameiparent(char*, char*);
50 int readi(struct inode*, char*, uint, uint);
51 void stati(struct inode*, struct stat*);
52 int writei(struct inode*, char*, uint, uint);
54 // ide.c
55 void ideinit(void);
56 void ideintr(void);
57 void iderw(struct buf*);
59 // ioapic.c
60 void ioapicenable(int irq, int cpu);
61 extern uchar ioapicid;
62 void ioapicinit(void);
64 // kalloc.c
65 char* kalloc(void);
66 void kfree(char*);
67 void kinit1(void*, void*);
68 void kinit2(void*, void*);
70 // kbd.c
71 void kbdintr(void);
73 // lapic.c
74 int cpunum(void);
75 extern volatile uint* lapic;
76 void lapiceoi(void);
77 void lapicinit(int);
78 void lapicstartap(uchar, uint);
79 void microdelay(int);
81 // log.c
82 void initlog(void);
83 void log_write(struct buf*);
84 void begin_trans();
85 void commit_trans();
87 // mp.c
88 extern int ismp;
89 int mpbcpu(void);
90 void mpinit(void);
91 void mpstartthem(void);
93 // picirq.c
94 void picenable(int);
95 void picinit(void);
97 // pipe.c
98 int pipealloc(struct file**, struct file**);
99 void pipeclose(struct pipe*, int);
100 int piperead(struct pipe*, char*, int);
101 int pipewrite(struct pipe*, char*, int);
103 //PAGEBREAK: 16
104 // proc.c
105 struct proc* copyproc(struct proc*);
106 void exit(void);
107 int fork(void);
108 int growproc(int);
109 int kill(int);
110 void pinit(void);
111 void procdump(void);
112 void scheduler(void) __attribute__((noreturn));
113 void sched(void);
114 void sleep(void*, struct spinlock*);
115 void userinit(void);
116 int wait(void);
117 void wakeup(void*);
118 void yield(void);
120 // swtch.S
121 void swtch(struct context**, struct context*);
123 // spinlock.c
124 void acquire(struct spinlock*);
125 void getcallerpcs(void*, uint*);
126 int holding(struct spinlock*);
127 void initlock(struct spinlock*, char*);
128 void release(struct spinlock*);
129 void pushcli(void);
130 void popcli(void);
132 // string.c
133 int memcmp(const void*, const void*, uint);
134 void* memmove(void*, const void*, uint);
135 void* memset(void*, int, uint);
136 char* safestrcpy(char*, const char*, int);
137 int strlen(const char*);
138 int strncmp(const char*, const char*, uint);
139 char* strncpy(char*, const char*, int);
141 // syscall.c
142 int argint(int, int*);
143 int argptr(int, char**, int);
144 int argstr(int, char**);
145 int fetchint(uint, int*);
146 int fetchstr(uint, char**);
147 void syscall(void);
149 // timer.c
150 void timerinit(void);
152 // trap.c
153 void idtinit(void);
154 extern uint ticks;
155 void tvinit(void);
156 extern struct spinlock tickslock;
158 // uart.c
159 void uartinit(void);
160 void uartintr(void);
161 void uartputc(int);
163 // vm.c
164 void seginit(void);
165 void kvmalloc(void);
166 void vmenable(void);
167 pde_t* setupkvm();
168 char* uva2ka(pde_t*, char*);
169 int allocuvm(pde_t*, uint, uint);
170 int deallocuvm(pde_t*, uint, uint);
171 void freevm(pde_t*);
172 void inituvm(pde_t*, char*, uint);
173 int loaduvm(pde_t*, char*, struct inode*, uint, uint);
174 pde_t* copyuvm(pde_t*, uint);
175 void switchuvm(struct proc*);
176 void switchkvm(void);
177 int copyout(pde_t*, uint, void*, uint);
178 void clearpteu(pde_t *pgdir, char *uva);
180 // number of elements in fixed-size array
181 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))