xref: /xv6-public/defs.h (revision 2c60b7f3)
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(int dev);
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(int dev);
85 void            log_write(struct buf*);
86 void            begin_op();
87 void            end_op();
88 
89 // mp.c
90 extern int      ismp;
91 void            mpinit(void);
92 
93 // picirq.c
94 void            picenable(int);
95 void            picinit(void);
96 
97 // pipe.c
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);
102 
103 //PAGEBREAK: 16
104 // proc.c
105 void            exit(void);
106 int             fork(void);
107 int             growproc(int);
108 int             kill(int);
109 void            pinit(void);
110 void            procdump(void);
111 void            scheduler(void) __attribute__((noreturn));
112 void            sched(void);
113 void            sleep(void*, struct spinlock*);
114 void            userinit(void);
115 int             wait(void);
116 void            wakeup(void*);
117 void            yield(void);
118 
119 // swtch.S
120 void            swtch(struct context**, struct context*);
121 
122 // spinlock.c
123 void            acquire(struct spinlock*);
124 void            getcallerpcs(void*, uint*);
125 int             holding(struct spinlock*);
126 void            initlock(struct spinlock*, char*);
127 void            release(struct spinlock*);
128 void            pushcli(void);
129 void            popcli(void);
130 
131 // string.c
132 int             memcmp(const void*, const void*, uint);
133 void*           memmove(void*, const void*, uint);
134 void*           memset(void*, int, uint);
135 char*           safestrcpy(char*, const char*, int);
136 int             strlen(const char*);
137 int             strncmp(const char*, const char*, uint);
138 char*           strncpy(char*, const char*, int);
139 
140 // syscall.c
141 int             argint(int, int*);
142 int             argptr(int, char**, int);
143 int             argstr(int, char**);
144 int             fetchint(uint, int*);
145 int             fetchstr(uint, char**);
146 void            syscall(void);
147 
148 // timer.c
149 void            timerinit(void);
150 
151 // trap.c
152 void            idtinit(void);
153 extern uint     ticks;
154 void            tvinit(void);
155 extern struct spinlock tickslock;
156 
157 // uart.c
158 void            uartinit(void);
159 void            uartintr(void);
160 void            uartputc(int);
161 
162 // vm.c
163 void            seginit(void);
164 void            kvmalloc(void);
165 pde_t*          setupkvm(void);
166 char*           uva2ka(pde_t*, char*);
167 int             allocuvm(pde_t*, uint, uint);
168 int             deallocuvm(pde_t*, uint, uint);
169 void            freevm(pde_t*);
170 void            inituvm(pde_t*, char*, uint);
171 int             loaduvm(pde_t*, char*, struct inode*, uint, uint);
172 pde_t*          copyuvm(pde_t*, uint);
173 void            switchuvm(struct proc*);
174 void            switchkvm(void);
175 int             copyout(pde_t*, uint, void*, uint);
176 void            clearpteu(pde_t *pgdir, char *uva);
177 
178 // number of elements in fixed-size array
179 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))
180