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
13 void binit(void);
14 struct buf* bread(uint, uint);
15 void brelse(struct buf*);
16 void bwrite(struct buf*);
17 void bpin(struct buf*);
18 void bunpin(struct buf*);
19
20
21 void consoleinit(void);
22 void consoleintr(int);
23 void consputc(int);
24
25
26 int exec(char*, char**);
27
28
29 struct file* filealloc(void);
30 void fileclose(struct file*);
31 struct file* filedup(struct file*);
32 void fileinit(void);
33 int fileread(struct file*, uint64, int n);
34 int filestat(struct file*, uint64 addr);
35 int filewrite(struct file*, uint64, int n);
36
37
38 void fsinit(int);
39 int dirlink(struct inode*, char*, uint);
40 struct inode* dirlookup(struct inode*, char*, uint*);
41 struct inode* ialloc(uint, short);
42 struct inode* idup(struct inode*);
43 void iinit();
44 void ilock(struct inode*);
45 void iput(struct inode*);
46 void iunlock(struct inode*);
47 void iunlockput(struct inode*);
48 void iupdate(struct inode*);
49 int namecmp(const char*, const char*);
50 struct inode* namei(char*);
51 struct inode* nameiparent(char*, char*);
52 int readi(struct inode*, int, uint64, uint, uint);
53 void stati(struct inode*, struct stat*);
54 int writei(struct inode*, int, uint64, uint, uint);
55 void itrunc(struct inode*);
56
57
58 void ramdiskinit(void);
59 void ramdiskintr(void);
60 void ramdiskrw(struct buf*);
61
62
63 void* kalloc(void);
64 void kfree(void *);
65 void kinit(void);
66
67
68 void initlog(int, struct superblock*);
69 void log_write(struct buf*);
70 void begin_op(void);
71 void end_op(void);
72
73
74 int pipealloc(struct file**, struct file**);
75 void pipeclose(struct pipe*, int);
76 int piperead(struct pipe*, uint64, int);
77 int pipewrite(struct pipe*, uint64, int);
78
79
80 int printf(char*, ...) __attribute__ ((format (printf, 1, 2)));
81 void panic(char*) __attribute__((noreturn));
82 void printfinit(void);
83
84
85 int cpuid(void);
86 void exit(int);
87 int fork(void);
88 int growproc(int);
89 void proc_mapstacks(pagetable_t);
90 pagetable_t proc_pagetable(struct proc *);
91 void proc_freepagetable(pagetable_t, uint64);
92 int kill(int);
93 int killed(struct proc*);
94 void setkilled(struct proc*);
95 struct cpu* mycpu(void);
96 struct cpu* getmycpu(void);
97 struct proc* myproc();
98 void procinit(void);
99 void scheduler(void) __attribute__((noreturn));
100 void sched(void);
101 void sleep(void*, struct spinlock*);
102 void userinit(void);
103 int wait(uint64);
104 void wakeup(void*);
105 void yield(void);
106 int either_copyout(int user_dst, uint64 dst, void *src, uint64 len);
107 int either_copyin(void *dst, int user_src, uint64 src, uint64 len);
108 void procdump(void);
109
110
111 void swtch(struct context*, struct context*);
112
113
114 void acquire(struct spinlock*);
115 int holding(struct spinlock*);
116 void initlock(struct spinlock*, char*);
117 void release(struct spinlock*);
118 void push_off(void);
119 void pop_off(void);
120
121
122 void acquiresleep(struct sleeplock*);
123 void releasesleep(struct sleeplock*);
124 int holdingsleep(struct sleeplock*);
125 void initsleeplock(struct sleeplock*, char*);
126
127
128 int memcmp(const void*, const void*, uint);
129 void* memmove(void*, const void*, uint);
130 void* memset(void*, int, uint);
131 char* safestrcpy(char*, const char*, int);
132 int strlen(const char*);
133 int strncmp(const char*, const char*, uint);
134 char* strncpy(char*, const char*, int);
135
136
137 void argint(int, int*);
138 int argstr(int, char*, int);
139 void argaddr(int, uint64 *);
140 int fetchstr(uint64, char*, int);
141 int fetchaddr(uint64, uint64*);
142 void syscall();
143
144
145 extern uint ticks;
146 void trapinit(void);
147 void trapinithart(void);
148 extern struct spinlock tickslock;
149 void usertrapret(void);
150
151
152 void uartinit(void);
153 void uartintr(void);
154 void uartputc(int);
155 void uartputc_sync(int);
156 int uartgetc(void);
157
158
159 void kvminit(void);
160 void kvminithart(void);
161 void kvmmap(pagetable_t, uint64, uint64, uint64, int);
162 int mappages(pagetable_t, uint64, uint64, uint64, int);
163 pagetable_t uvmcreate(void);
164 void uvmfirst(pagetable_t, uchar *, uint);
165 uint64 uvmalloc(pagetable_t, uint64, uint64, int);
166 uint64 uvmdealloc(pagetable_t, uint64, uint64);
167 int uvmcopy(pagetable_t, pagetable_t, uint64);
168 void uvmfree(pagetable_t, uint64);
169 void uvmunmap(pagetable_t, uint64, uint64, int);
170 void uvmclear(pagetable_t, uint64);
171 pte_t * walk(pagetable_t, uint64, int);
172 uint64 walkaddr(pagetable_t, uint64);
173 int copyout(pagetable_t, uint64, char *, uint64);
174 int copyin(pagetable_t, char *, uint64, uint64);
175 int copyinstr(pagetable_t, char *, uint64, uint64);
176
177
178 void plicinit(void);
179 void plicinithart(void);
180 int plic_claim(void);
181 void plic_complete(int);
182
183
184 void virtio_disk_init(void);
185 void virtio_disk_rw(struct buf *, int);
186 void virtio_disk_intr(void);
187
188
189 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))