xref: /xv6-public/defs.h (revision 211ff0c6)
1 // kalloc.c
2 char *kalloc(int n);
3 void kfree(char *cp, int len);
4 void kinit(void);
5 
6 // console.c
7 void console_init(void);
8 void cprintf(char *fmt, ...);
9 void panic(char *s);
10 void kbd_intr(void);
11 
12 // proc.c
13 void pinit(void);
14 struct proc;
15 struct jmpbuf;
16 void setupsegs(struct proc *);
17 struct proc * copyproc(struct proc*);
18 struct spinlock;
19 void sleep(void *, struct spinlock *);
20 void wakeup(void *);
21 void scheduler(void);
22 void proc_exit(void);
23 int proc_kill(int);
24 int proc_wait(void);
25 void yield(void);
26 
27 // swtch.S
28 struct jmpbuf;
29 int setjmp(struct jmpbuf*);
30 void longjmp(struct jmpbuf*);
31 
32 // trap.c
33 void tvinit(void);
34 void idtinit(void);
35 
36 // string.c
37 void * memset(void *dst, int c, uint n);
38 int memcmp(const void *v1, const void *v2, uint n);
39 void *memmove(void *dst, const void *src, uint n);
40 int strncmp(const char *p, const char *q, uint n);
41 
42 // syscall.c
43 void syscall(void);
44 
45 // picirq.c
46 void pic_init(void);
47 
48 // mp.c
49 void mp_init(void);
50 void mp_startthem(void);
51 int mp_bcpu(void);
52 
53 // lapic
54 extern uint *lapicaddr;
55 void lapic_init(int);
56 void lapic_startap(uchar, int);
57 void lapic_timerinit(void);
58 void lapic_timerintr(void);
59 void lapic_enableintr(void);
60 void lapic_disableintr(void);
61 void lapic_eoi(void);
62 int cpu(void);
63 
64 // ioapic
65 extern uchar ioapic_id;
66 void ioapic_init(void);
67 void ioapic_enable (int irq, int cpu);
68 
69 // spinlock.c
70 struct spinlock;
71 void initlock(struct spinlock *, char *);
72 void acquire(struct spinlock*);
73 void release(struct spinlock*);
74 int holding(struct spinlock*);
75 
76 // main.c
77 void load_icode(struct proc *p, uchar *binary, uint size);
78 
79 // pipe.c
80 struct pipe;
81 struct fd;
82 int pipe_alloc(struct fd **fd1, struct fd **fd2);
83 void pipe_close(struct pipe *p, int writeable);
84 int pipe_write(struct pipe *p, char *addr, int n);
85 int pipe_read(struct pipe *p, char *addr, int n);
86 
87 // fd.c
88 struct stat;
89 void fd_init(void);
90 int fd_ualloc(void);
91 struct fd * fd_alloc(void);
92 void fd_close(struct fd *);
93 int fd_read(struct fd *fd, char *addr, int n);
94 int fd_write(struct fd *fd, char *addr, int n);
95 int fd_stat(struct fd *fd, struct stat *);
96 void fd_incref(struct fd *fd);
97 
98 // ide.c
99 void ide_init(void);
100 void ide_intr(void);
101 void* ide_start_rw(int diskno, uint secno, void *dst, uint nsecs, int read);
102 int ide_finish(void *);
103 
104 // bio.c
105 void binit(void);
106 struct buf;
107 struct buf * getblk(uint dev, uint sector);
108 struct buf *bread(uint, uint);
109 void bwrite(struct buf *, uint);
110 void brelse(struct buf *);
111 
112 // fs.c
113 void iinit(void);
114 struct inode * iget(uint dev, uint inum);
115 void ilock(struct inode *ip);
116 void iunlock(struct inode *ip);
117 void idecref(struct inode *ip);
118 void iput(struct inode *ip);
119 struct inode * namei(char *path, int, uint *);
120 void stati(struct inode *ip, struct stat *st);
121 int readi(struct inode *ip, char *xdst, uint off, uint n);
122 int writei(struct inode *ip, char *addr, uint off, uint n);
123 struct inode *mknod(char *, short, short, short);
124 int unlink(char *cp);
125 void iupdate (struct inode *ip);
126 int link(char *file1, char *file2);
127