defs.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. void uart_putc(u32);
  13. void cprintf(char*, ...);
  14. void SetGpio(u32, u32);
  15. void SetGpioFunction(u32, u32);
  16. void Wait(u32);
  17. void consoleinit(void);
  18. void uart_init(void);
  19. void mmuinit1(void);
  20. void barriers(void);
  21. void dsb_barrier(void);
  22. void flush_tlb(void);
  23. void flush_dcache(u32 va1, u32 va2);
  24. void flush_idcache(void);
  25. void set_pgtbase(u32 base);
  26. // bio.c
  27. void binit(void);
  28. struct buf* bread(uint, uint);
  29. void brelse(struct buf*);
  30. void bwrite(struct buf*);
  31. // fs.c
  32. void readsb(int dev, struct superblock *sb);
  33. int dirlink(struct inode*, char*, uint);
  34. struct inode* dirlookup(struct inode*, char*, uint*);
  35. struct inode* ialloc(uint, short);
  36. struct inode* idup(struct inode*);
  37. void iinit(void);
  38. void ilock(struct inode*);
  39. void iput(struct inode*);
  40. void iunlock(struct inode*);
  41. void iunlockput(struct inode*);
  42. void iupdate(struct inode*);
  43. int namecmp(const char*, const char*);
  44. struct inode* namei(char*);
  45. struct inode* nameiparent(char*, char*);
  46. int readi(struct inode*, char*, uint, uint);
  47. void stati(struct inode*, struct stat*);
  48. int writei(struct inode*, char*, uint, uint);
  49. // ide.c
  50. void ideinit(void);
  51. void ideintr(void);
  52. void iderw(struct buf*);
  53. // exec.c
  54. int exec(char*, char**);
  55. // file.c
  56. struct file* filealloc(void);
  57. void fileclose(struct file*);
  58. struct file* filedup(struct file*);
  59. void fileinit(void);
  60. int fileread(struct file*, char*, int n);
  61. int filestat(struct file*, struct stat*);
  62. int filewrite(struct file*, char*, int n);
  63. // fs.c
  64. void readsb(int dev, struct superblock *sb);
  65. int dirlink(struct inode*, char*, uint);
  66. struct inode* dirlookup(struct inode*, char*, uint*);
  67. struct inode* ialloc(uint, short);
  68. struct inode* idup(struct inode*);
  69. void iinit(void);
  70. void ilock(struct inode*);
  71. void iput(struct inode*);
  72. void iunlock(struct inode*);
  73. void iunlockput(struct inode*);
  74. void iupdate(struct inode*);
  75. int namecmp(const char*, const char*);
  76. struct inode* namei(char*);
  77. struct inode* nameiparent(char*, char*);
  78. int readi(struct inode*, char*, uint, uint);
  79. void stati(struct inode*, struct stat*);
  80. int writei(struct inode*, char*, uint, uint);
  81. // kalloc.c
  82. char* kalloc(void);
  83. void kfree(char*);
  84. void kinit1(void*, void*);
  85. void kinit2(void*, void*);
  86. // log.c
  87. void initlog(void);
  88. void log_write(struct buf*);
  89. void begin_trans();
  90. void commit_trans();
  91. // pipe.c
  92. int pipealloc(struct file**, struct file**);
  93. void pipeclose(struct pipe*, int);
  94. int piperead(struct pipe*, char*, int);
  95. int pipewrite(struct pipe*, char*, int);
  96. //PAGEBREAK: 16
  97. // proc.c
  98. struct proc* copyproc(struct proc*);
  99. void exit(void);
  100. int fork(void);
  101. int growproc(int);
  102. int kill(int);
  103. void pinit(void);
  104. void procdump(void);
  105. void scheduler(void) __attribute__((noreturn));
  106. void sched(void);
  107. void sleep(void*, struct spinlock*);
  108. void userinit(void);
  109. int wait(void);
  110. void wakeup(void*);
  111. void yield(void);
  112. // swtch.S
  113. void swtch(struct context**, struct context*);
  114. // syscall.c
  115. int argint(int, int*);
  116. int argptr(int, char**, int);
  117. int argstr(int, char**);
  118. int fetchint(uint, int*);
  119. int fetchstr(uint, char**);
  120. void syscall(void);
  121. void kvmalloc(void);
  122. void drawCharacter(u8, u32, u32);
  123. int UsbInitialise(void);
  124. void KeyboardUpdate(void);
  125. char KeyboardGetChar(void);
  126. void gpuputc(u32);
  127. u32 KeyboardCount(void);
  128. u32 KeyboardGetAddress(u32);
  129. struct KeyboardLeds KeyboardGetLedSupport(u32);
  130. void panic(char *s);
  131. // spinlock.c
  132. void acquire(struct spinlock*);
  133. void getcallerpcs(void*, uint*);
  134. int holding(struct spinlock*);
  135. void initlock(struct spinlock*, char*);
  136. void release(struct spinlock*);
  137. void pushcli(void);
  138. void popcli(void);
  139. // string.c
  140. int memcmp(const void*, const void*, uint);
  141. void* memmove(void*, const void*, uint);
  142. void* memset(void*, int, uint);
  143. char* safestrcpy(char*, const char*, int);
  144. int strlen(const char*);
  145. int strncmp(const char*, const char*, uint);
  146. char* strncpy(char*, const char*, int);
  147. u32 div(u32 n, u32 d);
  148. // syscall.c
  149. int argint(int, int*);
  150. int argptr(int, char**, int);
  151. int argstr(int, char**);
  152. int fetchint(uint, int*);
  153. int fetchstr(uint, char**);
  154. void syscall(void);
  155. // trap.c
  156. void trap_init(void);
  157. extern uint ticks;
  158. extern struct spinlock tickslock;
  159. // vm.c
  160. void seginit(void);
  161. void kvmalloc(void);
  162. void vmenable(void);
  163. pde_t* setupkvm(void);
  164. char* uva2ka(pde_t*, char*);
  165. int allocuvm(pde_t*, uint, uint);
  166. int deallocuvm(pde_t*, uint, uint);
  167. void freevm(pde_t*);
  168. void inituvm(pde_t*, char*, uint);
  169. int loaduvm(pde_t*, char*, struct inode*, uint, uint);
  170. pde_t* copyuvm(pde_t*, uint);
  171. void switchuvm(struct proc*);
  172. void switchkvm(void);
  173. int copyout(pde_t*, uint, void*, uint);
  174. void clearpteu(pde_t *pgdir, char *uva);
  175. // number of elements in fixed-size array
  176. #define NELEM(x) (sizeof(x)/sizeof((x)[0]))