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