xref: /xv6-public/defs.h (revision c9fa90f7)
1 struct buf;
2 struct context;
3 struct file;
4 struct inode;
5 struct pipe;
6 struct proc;
7 struct rtcdate;
8 struct spinlock;
9 struct sleeplock;
10 struct stat;
11 struct superblock;
12 
13 // bio.c
14 void            binit(void);
15 struct buf*     bread(uint, uint);
16 void            brelse(struct buf*);
17 void            bwrite(struct buf*);
18 
19 // console.c
20 void            consoleinit(void);
21 void            cprintf(char*, ...);
22 void            consoleintr(int(*)(void));
23 void            panic(char*) __attribute__((noreturn));
24 
25 // exec.c
26 int             exec(char*, char**);
27 
28 // file.c
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*, char*, int n);
34 int             filestat(struct file*, struct stat*);
35 int             filewrite(struct file*, char*, int n);
36 
37 // fs.c
38 void            readsb(int dev, struct superblock *sb);
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(int dev);
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*, char*, uint, uint);
53 void            stati(struct inode*, struct stat*);
54 int             writei(struct inode*, char*, uint, uint);
55 
56 // ide.c
57 void            ideinit(void);
58 void            ideintr(void);
59 void            iderw(struct buf*);
60 
61 // ioapic.c
62 void            ioapicenable(int irq, int cpu);
63 extern uchar    ioapicid;
64 void            ioapicinit(void);
65 
66 // kalloc.c
67 char*           kalloc(void);
68 void            kfree(char*);
69 void            kinit1(void*, void*);
70 void            kinit2(void*, void*);
71 
72 // kbd.c
73 void            kbdintr(void);
74 
75 // lapic.c
76 void            cmostime(struct rtcdate *r);
77 int             lapicid(void);
78 extern volatile uint*    lapic;
79 void            lapiceoi(void);
80 void            lapicinit(void);
81 void            lapicstartap(uchar, uint);
82 void            microdelay(int);
83 
84 // log.c
85 void            initlog(int dev);
86 void            log_write(struct buf*);
87 void            begin_op();
88 void            end_op();
89 
90 // mp.c
91 extern int      ismp;
92 void            mpinit(void);
93 
94 // picirq.c
95 void            picenable(int);
96 void            picinit(void);
97 
98 // pipe.c
99 int             pipealloc(struct file**, struct file**);
100 void            pipeclose(struct pipe*, int);
101 int             piperead(struct pipe*, char*, int);
102 int             pipewrite(struct pipe*, char*, int);
103 
104 //PAGEBREAK: 16
105 // proc.c
106 int             cpuid(void);
107 void            exit(void);
108 int             fork(void);
109 int             growproc(int);
110 int             kill(int);
111 struct cpu*     mycpu(void);
112 struct proc*    myproc();
113 void            pinit(void);
114 void            procdump(void);
115 void            scheduler(void) __attribute__((noreturn));
116 void            sched(void);
117 void            setproc(struct proc*);
118 void            sleep(void*, struct spinlock*);
119 void            userinit(void);
120 int             wait(void);
121 void            wakeup(void*);
122 void            yield(void);
123 
124 // swtch.S
125 void            swtch(struct context**, struct context*);
126 
127 // spinlock.c
128 void            acquire(struct spinlock*);
129 void            getcallerpcs(void*, uint*);
130 int             holding(struct spinlock*);
131 void            initlock(struct spinlock*, char*);
132 void            release(struct spinlock*);
133 void            pushcli(void);
134 void            popcli(void);
135 
136 // sleeplock.c
137 void            acquiresleep(struct sleeplock*);
138 void            releasesleep(struct sleeplock*);
139 int             holdingsleep(struct sleeplock*);
140 void            initsleeplock(struct sleeplock*, char*);
141 
142 // string.c
143 int             memcmp(const void*, const void*, uint);
144 void*           memmove(void*, const void*, uint);
145 void*           memset(void*, int, uint);
146 char*           safestrcpy(char*, const char*, int);
147 int             strlen(const char*);
148 int             strncmp(const char*, const char*, uint);
149 char*           strncpy(char*, const char*, int);
150 
151 // syscall.c
152 int             argint(int, int*);
153 int             argptr(int, char**, int);
154 int             argstr(int, char**);
155 int             fetchint(uint, int*);
156 int             fetchstr(uint, char**);
157 void            syscall(void);
158 
159 // timer.c
160 void            timerinit(void);
161 
162 // trap.c
163 void            idtinit(void);
164 extern uint     ticks;
165 void            tvinit(void);
166 extern struct spinlock tickslock;
167 
168 // uart.c
169 void            uartinit(void);
170 void            uartintr(void);
171 void            uartputc(int);
172 
173 // vm.c
174 void            seginit(void);
175 void            kvmalloc(void);
176 pde_t*          setupkvm(void);
177 char*           uva2ka(pde_t*, char*);
178 int             allocuvm(pde_t*, uint, uint);
179 int             deallocuvm(pde_t*, uint, uint);
180 void            freevm(pde_t*);
181 void            inituvm(pde_t*, char*, uint);
182 int             loaduvm(pde_t*, char*, struct inode*, uint, uint);
183 pde_t*          copyuvm(pde_t*, uint);
184 void            switchuvm(struct proc*);
185 void            switchkvm(void);
186 int             copyout(pde_t*, uint, void*, uint);
187 void            clearpteu(pde_t *pgdir, char *uva);
188 
189 // number of elements in fixed-size array
190 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))
191