xref: /xv6-public/defs.h (revision 13a96bae)
1 struct buf;
2 struct context;
3 struct file;
4 struct inode;
5 struct pipe;
6 struct proc;
7 struct spinlock;
8 struct stat;
9 struct superblock;
10 
11 // bio.c
12 void            binit(void);
13 struct buf*     bread(uint, uint);
14 void            brelse(struct buf*);
15 void            bwrite(struct buf*);
16 
17 // console.c
18 void            consoleinit(void);
19 void            cprintf(char*, ...);
20 void            consoleintr(int(*)(void));
21 void            panic(char*) __attribute__((noreturn));
22 
23 // exec.c
24 int             exec(char*, char**);
25 
26 // file.c
27 struct file*    filealloc(void);
28 void            fileclose(struct file*);
29 struct file*    filedup(struct file*);
30 void            fileinit(void);
31 int             fileread(struct file*, char*, int n);
32 int             filestat(struct file*, struct stat*);
33 int             filewrite(struct file*, char*, int n);
34 
35 // fs.c
36 void            readsb(int dev, struct superblock *sb);
37 int             dirlink(struct inode*, char*, uint);
38 struct inode*   dirlookup(struct inode*, char*, uint*);
39 struct inode*   ialloc(uint, short);
40 struct inode*   idup(struct inode*);
41 void            iinit(void);
42 void            ilock(struct inode*);
43 void            iput(struct inode*);
44 void            iunlock(struct inode*);
45 void            iunlockput(struct inode*);
46 void            iupdate(struct inode*);
47 int             namecmp(const char*, const char*);
48 struct inode*   namei(char*);
49 struct inode*   nameiparent(char*, char*);
50 int             readi(struct inode*, char*, uint, uint);
51 void            stati(struct inode*, struct stat*);
52 int             writei(struct inode*, char*, uint, uint);
53 
54 // ide.c
55 void            ideinit(void);
56 void            ideintr(void);
57 void            iderw(struct buf*);
58 
59 // ioapic.c
60 void            ioapicenable(int irq, int cpu);
61 extern uchar    ioapicid;
62 void            ioapicinit(void);
63 
64 // kalloc.c
65 char*           kalloc(void);
66 void            kfree(char*);
67 void            kinit(void);
68 
69 // kbd.c
70 void            kbdintr(void);
71 
72 // lapic.c
73 int             cpunum(void);
74 extern volatile uint*    lapic;
75 void            lapiceoi(void);
76 void            lapicinit(int);
77 void            lapicstartap(uchar, uint);
78 void            microdelay(int);
79 
80 // log.c
81 void            initlog(void);
82 void            log_write(struct buf*);
83 void            begin_trans();
84 void            commit_trans();
85 
86 // mp.c
87 extern int      ismp;
88 int             mpbcpu(void);
89 void            mpinit(void);
90 void            mpstartthem(void);
91 
92 // picirq.c
93 void            picenable(int);
94 void            picinit(void);
95 
96 // pipe.c
97 int             pipealloc(struct file**, struct file**);
98 void            pipeclose(struct pipe*, int);
99 int             piperead(struct pipe*, char*, int);
100 int             pipewrite(struct pipe*, char*, int);
101 
102 //PAGEBREAK: 16
103 // proc.c
104 struct proc*    copyproc(struct proc*);
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(struct proc*, uint, int*);
145 int             fetchstr(struct proc*, 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 void            vmenable(void);
166 pde_t*          setupkvm(void);
167 char*           uva2ka(pde_t*, char*);
168 int             allocuvm(pde_t*, uint, uint);
169 int             deallocuvm(pde_t*, uint, uint);
170 void            freevm(pde_t*);
171 void            inituvm(pde_t*, char*, uint);
172 int             loaduvm(pde_t*, char*, struct inode*, uint, uint);
173 pde_t*          copyuvm(pde_t*, uint);
174 void            switchuvm(struct proc*);
175 void            switchkvm(void);
176 int             copyout(pde_t*, uint, void*, uint);
177 
178 // number of elements in fixed-size array
179 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))
180