added base src
[xv6-db.git] / defs.h
blobd0e3ad6ad677bc767496c55616778a0d44cb23f5
1 struct buf;
2 struct context;
3 struct file;
4 struct inode;
5 struct pipe;
6 struct proc;
7 struct spinlock;
8 struct stat;
10 // bio.c
11 void binit(void);
12 struct buf* bread(uint, uint);
13 void brelse(struct buf*);
14 void bwrite(struct buf*);
16 // console.c
17 void consoleinit(void);
18 void cprintf(char*, ...);
19 void consoleintr(int(*)(void));
20 void panic(char*) __attribute__((noreturn));
22 // exec.c
23 int exec(char*, char**);
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);
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);
52 // ide.c
53 void ideinit(void);
54 void ideintr(void);
55 void iderw(struct buf*);
57 // ioapic.c
58 void ioapicenable(int irq, int cpu);
59 extern uchar ioapicid;
60 void ioapicinit(void);
62 // kalloc.c
63 char* kalloc(void);
64 void kfree(char*);
65 void kinit(void);
67 // kbd.c
68 void kbdintr(void);
70 // lapic.c
71 int cpunum(void);
72 extern volatile uint* lapic;
73 void lapiceoi(void);
74 void lapicinit(int);
75 void lapicstartap(uchar, uint);
76 void microdelay(int);
78 // mp.c
79 extern int ismp;
80 int mpbcpu(void);
81 void mpinit(void);
82 void mpstartthem(void);
84 // picirq.c
85 void picenable(int);
86 void picinit(void);
88 // pipe.c
89 int pipealloc(struct file**, struct file**);
90 void pipeclose(struct pipe*, int);
91 int piperead(struct pipe*, char*, int);
92 int pipewrite(struct pipe*, char*, int);
94 // proc.c
95 struct proc* copyproc(struct proc*);
96 void exit(void);
97 int fork(void);
98 int growproc(int);
99 int kill(int);
100 void pinit(void);
101 void procdump(void);
102 void scheduler(void) __attribute__((noreturn));
103 void sched(void);
104 void sleep(void*, struct spinlock*);
105 void userinit(void);
106 int wait(void);
107 void wakeup(void*);
108 void yield(void);
110 // swtch.S
111 void swtch(struct context**, struct context*);
113 // spinlock.c
114 void acquire(struct spinlock*);
115 void getcallerpcs(void*, uint*);
116 int holding(struct spinlock*);
117 void initlock(struct spinlock*, char*);
118 void release(struct spinlock*);
119 void pushcli(void);
120 void popcli(void);
122 // string.c
123 int memcmp(const void*, const void*, uint);
124 void* memmove(void*, const void*, uint);
125 void* memset(void*, int, uint);
126 char* safestrcpy(char*, const char*, int);
127 int strlen(const char*);
128 int strncmp(const char*, const char*, uint);
129 char* strncpy(char*, const char*, int);
131 // syscall.c
132 int argint(int, int*);
133 int argptr(int, char**, int);
134 int argstr(int, char**);
135 int fetchint(struct proc*, uint, int*);
136 int fetchstr(struct proc*, uint, char**);
137 void syscall(void);
139 // timer.c
140 void timerinit(void);
142 // trap.c
143 void idtinit(void);
144 extern uint ticks;
145 void tvinit(void);
146 extern struct spinlock tickslock;
148 // uart.c
149 void uartinit(void);
150 void uartintr(void);
151 void uartputc(int);
153 // vm.c
154 void seginit(void);
155 void kvmalloc(void);
156 void vmenable(void);
157 pde_t* setupkvm(void);
158 char* uva2ka(pde_t*, char*);
159 int allocuvm(pde_t*, uint, uint);
160 int deallocuvm(pde_t*, uint, uint);
161 void freevm(pde_t*);
162 void inituvm(pde_t*, char*, uint);
163 int loaduvm(pde_t*, char*, struct inode*, uint, uint);
164 pde_t* copyuvm(pde_t*, uint);
165 void switchuvm(struct proc*);
166 void switchkvm(void);
167 int copyout(pde_t*, uint, void*, uint);
169 // number of elements in fixed-size array
170 #define NELEM(x) (sizeof(x)/sizeof((x)[0]))