xref: /xv6-public/defs.h (revision 40889627)
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 
10 // bio.c
11 void            binit(void);
12 struct buf*     bread(uint, uint);
13 void            brelse(struct buf*);
14 void            bwrite(struct buf*);
15 
16 // console.c
17 void            consoleinit(void);
18 void            cprintf(char*, ...);
19 void            consoleintr(int(*)(void));
20 void            panic(char*) __attribute__((noreturn));
21 
22 // exec.c
23 int             exec(char*, char**);
24 
25 // file.c
26 struct file*    filealloc(void);
27 void            fileclose(struct file*);
28 struct file*    filedup(struct file*);
29 void            fileinit(void);
30 int             fileread(struct file*, char*, int n);
31 int             filestat(struct file*, struct stat*);
32 int             filewrite(struct file*, char*, int n);
33 
34 // fs.c
35 int             dirlink(struct inode*, char*, uint);
36 struct inode*   dirlookup(struct inode*, char*, uint*);
37 struct inode*   ialloc(uint, short);
38 struct inode*   idup(struct inode*);
39 void            iinit(void);
40 void            ilock(struct inode*);
41 void            iput(struct inode*);
42 void            iunlock(struct inode*);
43 void            iunlockput(struct inode*);
44 void            iupdate(struct inode*);
45 int             namecmp(const char*, const char*);
46 struct inode*   namei(char*);
47 struct inode*   nameiparent(char*, char*);
48 int             readi(struct inode*, char*, uint, uint);
49 void            stati(struct inode*, struct stat*);
50 int             writei(struct inode*, char*, uint, uint);
51 
52 // ide.c
53 void            ideinit(void);
54 void            ideintr(void);
55 void            iderw(struct buf*);
56 
57 // ioapic.c
58 void            ioapicenable(int irq, int cpu);
59 extern uchar    ioapicid;
60 void            ioapicinit(void);
61 
62 // kalloc.c
63 extern int      nfreemem;
64 char*           kalloc(int);
65 void            kfree(char*, int);
66 void            kinit(char*,uint);
67 
68 // kbd.c
69 void            kbdintr(void);
70 
71 // lapic.c
72 int             cpunum(void);
73 extern volatile uint*    lapic;
74 void            lapiceoi(void);
75 void            lapicinit(int);
76 void            lapicstartap(uchar, uint);
77 void            microdelay(int);
78 
79 // mp.c
80 extern int      ismp;
81 int             mpbcpu(void);
82 void            mpinit(void);
83 void            mpstartthem(void);
84 
85 // picirq.c
86 void            picenable(int);
87 void            picinit(void);
88 
89 // pipe.c
90 int             pipealloc(struct file**, struct file**);
91 void            pipeclose(struct pipe*, int);
92 int             piperead(struct pipe*, char*, int);
93 int             pipewrite(struct pipe*, char*, int);
94 
95 //PAGEBREAK: 16
96 // proc.c
97 struct proc*    copyproc(struct proc*);
98 void            exit(void);
99 int             fork(void);
100 int             growproc(int);
101 int             kill(int);
102 void            pinit(void);
103 void            procdump(void);
104 void            scheduler(void) __attribute__((noreturn));
105 void            sleep(void*, struct spinlock*);
106 void            userinit(void);
107 int             wait(void);
108 void            wakeup(void*);
109 void            yield(void);
110 
111 // swtch.S
112 void            swtch(struct context**, struct context*);
113 void            jstack(uint);
114 
115 // spinlock.c
116 void            acquire(struct spinlock*);
117 void            getcallerpcs(void*, uint*);
118 int             holding(struct spinlock*);
119 void            initlock(struct spinlock*, char*);
120 void            release(struct spinlock*);
121 void            pushcli();
122 void            popcli();
123 
124 // string.c
125 int             memcmp(const void*, const void*, uint);
126 void*           memmove(void*, const void*, uint);
127 void*           memset(void*, int, uint);
128 char*           safestrcpy(char*, const char*, int);
129 int             strlen(const char*);
130 int             strncmp(const char*, const char*, uint);
131 char*           strncpy(char*, const char*, int);
132 
133 // syscall.c
134 int             argint(int, int*);
135 int             argptr(int, char**, int);
136 int             argstr(int, char**);
137 int             fetchint(struct proc*, uint, int*);
138 int             fetchstr(struct proc*, uint, char**);
139 void            syscall(void);
140 
141 // timer.c
142 void            timerinit(void);
143 
144 // trap.c
145 void            idtinit(void);
146 extern int      ticks;
147 void            tvinit(void);
148 extern struct spinlock tickslock;
149 
150 // uart.c
151 void            uartinit(void);
152 void            uartintr(void);
153 void            uartputc(int);
154 
155 // vm.c
156 #define PGROUNDUP(sz)  ((sz+PGSIZE-1) & ~(PGSIZE-1))
157 void            pminit(void);
158 void            swkstack(void);
159 void            vminit(void);
160 void            printpgdir(uint*);
161 uint*           setupkvm(void);    // XXX need pde_t*
162 char*           uva2ka(uint*, char*);
163 int             allocuvm(uint*, char*, uint);  // XXX need pde_t*
164 void            freevm(uint*);
165 void            inituvm(uint*, char*, char*, uint);
166 int             loaduvm(uint*, char*, struct inode *ip, uint, uint);
167 uint*           copyuvm(uint*,uint);
168 void            ksegment(void);
169 void            loadvm(struct proc*);
170 
171 // number of elements in fixed-size array
172 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))
173 
174