13 struct buf
* bread(uint
, uint
);
14 void brelse(struct buf
*);
15 void bwrite(struct buf
*);
18 void consoleinit(void);
19 void cprintf(char*, ...);
20 void consoleintr(int(*)(void));
21 void panic(char*) __attribute__((noreturn
));
24 int exec(char*, char**);
27 struct file
* filealloc(void);
28 void fileclose(struct file
*);
29 struct file
* filedup(struct file
*);
31 int fileread(struct file
*, char*, int n
);
32 int filestat(struct file
*, struct stat
*);
33 int filewrite(struct file
*, char*, int n
);
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
*);
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
);
57 void iderw(struct buf
*);
60 void ioapicenable(int irq
, int cpu
);
61 extern uchar ioapicid
;
62 void ioapicinit(void);
67 void kinit1(void*, void*);
68 void kinit2(void*, void*);
75 extern volatile uint
* lapic
;
78 void lapicstartap(uchar
, uint
);
83 void log_write(struct buf
*);
91 void mpstartthem(void);
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);
105 struct proc
* copyproc(struct proc
*);
112 void scheduler(void) __attribute__((noreturn
));
114 void sleep(void*, struct spinlock
*);
121 void swtch(struct context
**, struct context
*);
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
*);
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);
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**);
150 void timerinit(void);
156 extern struct spinlock tickslock
;
168 char* uva2ka(pde_t
*, char*);
169 int allocuvm(pde_t
*, uint
, uint
);
170 int deallocuvm(pde_t
*, uint
, uint
);
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]))