xref: /xv6-public/defs.h (revision aae4e749)
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 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*           kalloc(void);
67 void            kfree(char*);
68 void            kinit1(void*, void*);
69 void            kinit2(void*, void*);
70 
71 // kbd.c
72 void            kbdintr(void);
73 
74 // lapic.c
75 void            cmostime(struct rtcdate *r);
76 int             cpunum(void);
77 extern volatile uint*    lapic;
78 void            lapiceoi(void);
79 void            lapicinit(void);
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_op();
87 void            end_op();
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 
134 // string.c
135 int             memcmp(const void*, const void*, uint);
136 void*           memmove(void*, const void*, uint);
137 void*           memset(void*, int, uint);
138 char*           safestrcpy(char*, const char*, int);
139 int             strlen(const char*);
140 int             strncmp(const char*, const char*, uint);
141 char*           strncpy(char*, const char*, int);
142 
143 // syscall.c
144 int             argint(int, int*);
145 int             argptr(int, char**, int);
146 int             argstr(int, char**);
147 int             fetchint(uint, int*);
148 int             fetchstr(uint, char**);
149 void            syscall(void);
150 
151 // timer.c
152 void            timerinit(void);
153 
154 // trap.c
155 void            idtinit(void);
156 extern uint     ticks;
157 void            tvinit(void);
158 extern struct spinlock tickslock;
159 
160 // uart.c
161 void            uartinit(void);
162 void            uartintr(void);
163 void            uartputc(int);
164 
165 // vm.c
166 void            seginit(void);
167 void            kvmalloc(void);
168 void            vmenable(void);
169 pde_t*          setupkvm(void);
170 char*           uva2ka(pde_t*, char*);
171 int             allocuvm(pde_t*, uint, uint);
172 int             deallocuvm(pde_t*, uint, uint);
173 void            freevm(pde_t*);
174 void            inituvm(pde_t*, char*, uint);
175 int             loaduvm(pde_t*, char*, struct inode*, uint, uint);
176 pde_t*          copyuvm(pde_t*, uint);
177 void            switchuvm(struct proc*);
178 void            switchkvm(void);
179 int             copyout(pde_t*, uint, void*, uint);
180 void            clearpteu(pde_t *pgdir, char *uva);
181 
182 // number of elements in fixed-size array
183 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))
184