defs.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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. void OkLoop(void);
  11. void NotOkLoop(void);
  12. // mmu.c
  13. void mmuinit1(void);
  14. void barriers(void);
  15. void dsb_barrier(void);
  16. void flush_tlb(void);
  17. void flush_dcache_all(void);
  18. void flush_dcache(uint va1, uint va2);
  19. void flush_idcache(void);
  20. void set_pgtbase(uint base);
  21. // bio.c
  22. void binit(void);
  23. struct buf* bread(uint, uint);
  24. void brelse(struct buf*);
  25. void bwrite(struct buf*);
  26. // console.c
  27. void consoleinit(void);
  28. void cprintf(char*, ...);
  29. void consoleintr(int(*)(void));
  30. void panic(char*) __attribute__((noreturn));
  31. void drawcharacter(u8, uint, uint);
  32. void gpuputc(uint);
  33. // fs.c
  34. void readsb(int dev, struct superblock *sb);
  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. // ide.c
  52. void ideinit(void);
  53. void ideintr(void);
  54. void iderw(struct buf*);
  55. // exec.c
  56. int exec(char*, char**);
  57. // file.c
  58. struct file* filealloc(void);
  59. void fileclose(struct file*);
  60. struct file* filedup(struct file*);
  61. void fileinit(void);
  62. int fileread(struct file*, char*, int n);
  63. int filestat(struct file*, struct stat*);
  64. int filewrite(struct file*, char*, int n);
  65. // fs.c
  66. void readsb(int dev, struct superblock *sb);
  67. int dirlink(struct inode*, char*, uint);
  68. struct inode* dirlookup(struct inode*, char*, uint*);
  69. struct inode* ialloc(uint, short);
  70. struct inode* idup(struct inode*);
  71. void iinit(void);
  72. void ilock(struct inode*);
  73. void iput(struct inode*);
  74. void iunlock(struct inode*);
  75. void iunlockput(struct inode*);
  76. void iupdate(struct inode*);
  77. int namecmp(const char*, const char*);
  78. struct inode* namei(char*);
  79. struct inode* nameiparent(char*, char*);
  80. int readi(struct inode*, char*, uint, uint);
  81. void stati(struct inode*, struct stat*);
  82. int writei(struct inode*, char*, uint, uint);
  83. // kalloc.c
  84. char* kalloc(void);
  85. void kfree(char*);
  86. void kinit1(void*, void*);
  87. void kinit2(void*, void*);
  88. // log.c
  89. void initlog(void);
  90. void log_write(struct buf*);
  91. void begin_trans();
  92. void commit_trans();
  93. // pipe.c
  94. int pipealloc(struct file**, struct file**);
  95. void pipeclose(struct pipe*, int);
  96. int piperead(struct pipe*, char*, int);
  97. int pipewrite(struct pipe*, char*, int);
  98. //PAGEBREAK: 16
  99. // proc.c
  100. struct proc* copyproc(struct proc*);
  101. void exit(void);
  102. int fork(void);
  103. int growproc(int);
  104. int kill(int);
  105. void pinit(void);
  106. void procdump(void);
  107. void scheduler(void) __attribute__((noreturn));
  108. void sched(void);
  109. void sleep(void*, struct spinlock*);
  110. void userinit(void);
  111. int wait(void);
  112. void wakeup(void*);
  113. void yield(void);
  114. // swtch.S
  115. void swtch(struct context**, struct context*);
  116. // syscall.c
  117. int argint(int, int*);
  118. int argptr(int, char**, int);
  119. int argstr(int, char**);
  120. int fetchint(uint, int*);
  121. int fetchstr(uint, char**);
  122. void syscall(void);
  123. void kvmalloc(void);
  124. int UsbInitialise(void);
  125. void KeyboardUpdate(void);
  126. char KeyboardGetChar(void);
  127. uint KeyboardCount(void);
  128. uint KeyboardGetAddress(uint);
  129. struct KeyboardLeds KeyboardGetLedSupport(uint);
  130. // spinlock.c
  131. void acquire(struct spinlock*);
  132. void getcallerpcs(void*, uint*);
  133. int holding(struct spinlock*);
  134. void initlock(struct spinlock*, char*);
  135. void release(struct spinlock*);
  136. void pushcli(void);
  137. void popcli(void);
  138. // string.c
  139. int memcmp(const void*, const void*, uint);
  140. void* memmove(void*, const void*, uint);
  141. void* memset(void*, int, uint);
  142. char* safestrcpy(char*, const char*, int);
  143. int strlen(const char*);
  144. int strncmp(const char*, const char*, uint);
  145. char* strncpy(char*, const char*, int);
  146. uint div(uint n, uint d);
  147. // syscall.c
  148. int argint(int, int*);
  149. int argptr(int, char**, int);
  150. int argstr(int, char**);
  151. int fetchint(uint, int*);
  152. int fetchstr(uint, char**);
  153. void syscall(void);
  154. // timer.c
  155. void timer3init(void);
  156. void timer3intr(void);
  157. unsigned long long getsystemtime(void);
  158. void delay(uint);
  159. // trap.c
  160. void tvinit(void);
  161. void sti(void);
  162. void cli(void);
  163. void disable_intrs(void);
  164. void enable_intrs(void);
  165. extern uint ticks;
  166. extern struct spinlock tickslock;
  167. uint readcpsr(void);
  168. // uart.c
  169. void uartinit(void);
  170. void miniuartintr(void);
  171. void uartputc(uint);
  172. void setgpiofunc(uint, uint);
  173. void setgpioval(uint, uint);
  174. // vm.c
  175. void seginit(void);
  176. void kvmalloc(void);
  177. void vmenable(void);
  178. pde_t* setupkvm(void);
  179. char* uva2ka(pde_t*, char*);
  180. int allocuvm(pde_t*, uint, uint);
  181. int deallocuvm(pde_t*, uint, uint);
  182. void freevm(pde_t*);
  183. void inituvm(pde_t*, char*, uint);
  184. int loaduvm(pde_t*, char*, struct inode*, uint, uint);
  185. pde_t* copyuvm(pde_t*, uint);
  186. void switchuvm(struct proc*);
  187. void switchkvm(void);
  188. int copyout(pde_t*, uint, void*, uint);
  189. void clearpteu(pde_t *pgdir, char *uva);
  190. // mailbox.c
  191. uint readmailbox(u8);
  192. void writemailbox(uint *, u8);
  193. void create_request(volatile uint *mbuf, uint tag, uint buflen, uint len, uint *data);
  194. void mailboxinit(void);
  195. // number of elements in fixed-size array
  196. #define NELEM(x) (sizeof(x)/sizeof((x)[0]))