12 struct buf
* bread(uint
, uint
);
13 void brelse(struct buf
*);
14 void bwrite(struct buf
*);
17 void consoleinit(void);
18 void cprintf(char*, ...);
19 void consoleintr(int(*)(void));
20 void panic(char*) __attribute__((noreturn
));
23 int exec(char*, char**);
26 struct file
* filealloc(void);
27 void fileclose(struct file
*);
28 struct file
* filedup(struct file
*);
30 int fileread(struct file
*, char*, int n
);
31 int filestat(struct file
*, struct stat
*);
32 int filewrite(struct file
*, char*, int n
);
35 int dirlink(struct inode
*, char*, uint
);
36 struct inode
* dirlookup(struct inode
*, char*, uint
*);
37 struct inode
* ialloc(uint
, short);
38 struct inode
* idup(struct inode
*);
40 void ilock(struct inode
*);
41 void iput(struct inode
*);
42 void iunlock(struct inode
*);
43 void iunlockput(struct inode
*);
44 void iupdate(struct inode
*);
45 int namecmp(const char*, const char*);
46 struct inode
* namei(char*);
47 struct inode
* nameiparent(char*, char*);
48 int readi(struct inode
*, char*, uint
, uint
);
49 void stati(struct inode
*, struct stat
*);
50 int writei(struct inode
*, char*, uint
, uint
);
55 void iderw(struct buf
*);
58 void ioapicenable(int irq
, int cpu
);
59 extern uchar ioapicid
;
60 void ioapicinit(void);
72 extern volatile uint
* lapic
;
75 void lapicstartap(uchar
, uint
);
82 void mpstartthem(void);
89 int pipealloc(struct file
**, struct file
**);
90 void pipeclose(struct pipe
*, int);
91 int piperead(struct pipe
*, char*, int);
92 int pipewrite(struct pipe
*, char*, int);
95 struct proc
* copyproc(struct proc
*);
102 void scheduler(void) __attribute__((noreturn
));
104 void sleep(void*, struct spinlock
*);
111 void swtch(struct context
**, struct context
*);
114 void acquire(struct spinlock
*);
115 void getcallerpcs(void*, uint
*);
116 int holding(struct spinlock
*);
117 void initlock(struct spinlock
*, char*);
118 void release(struct spinlock
*);
123 int memcmp(const void*, const void*, uint
);
124 void* memmove(void*, const void*, uint
);
125 void* memset(void*, int, uint
);
126 char* safestrcpy(char*, const char*, int);
127 int strlen(const char*);
128 int strncmp(const char*, const char*, uint
);
129 char* strncpy(char*, const char*, int);
132 int argint(int, int*);
133 int argptr(int, char**, int);
134 int argstr(int, char**);
135 int fetchint(struct proc
*, uint
, int*);
136 int fetchstr(struct proc
*, uint
, char**);
140 void timerinit(void);
146 extern struct spinlock tickslock
;
157 pde_t
* setupkvm(void);
158 char* uva2ka(pde_t
*, char*);
159 int allocuvm(pde_t
*, uint
, uint
);
160 int deallocuvm(pde_t
*, uint
, uint
);
162 void inituvm(pde_t
*, char*, uint
);
163 int loaduvm(pde_t
*, char*, struct inode
*, uint
, uint
);
164 pde_t
* copyuvm(pde_t
*, uint
);
165 void switchuvm(struct proc
*);
166 void switchkvm(void);
167 int copyout(pde_t
*, uint
, void*, uint
);
169 // number of elements in fixed-size array
170 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))