fns.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include "../port/portfns.h"
  10. void intrac(Proc*);
  11. void acinit(void);
  12. int acpiinit(void);
  13. void actrapenable(int, char* (*)(Ureg*, void*), void*, char*);
  14. void apicipi(int);
  15. void apicpri(int);
  16. void acsysret(void);
  17. void actouser(void);
  18. void runacore(void);
  19. void aamloop(int);
  20. Dirtab* addarchfile(char*, int, long(*)(Chan*,void*,long,vlong), long(*)(Chan*,void*,long,vlong));
  21. void acmmuswitch(void);
  22. void acmodeset(int);
  23. void archfmtinstall(void);
  24. void archidle(void);
  25. int archmmu(void);
  26. int asmfree(uintmem, uintmem, int);
  27. uvlong asmalloc(uintmem, uintmem, int, int);
  28. void asminit(void);
  29. void asmmapinit(uintmem, uintmem, int);
  30. extern void asmmodinit(u32int, u32int, char*);
  31. void noerrorsleft(void);
  32. void archinit(void);
  33. void archreset(void);
  34. vlong archhz(void);
  35. void cgaconsputs(char*, int);
  36. void cgainit(void);
  37. void cgapost(int);
  38. void checkpa(char*, uintmem);
  39. #define clearmmucache() /* x86 doesn't have one */
  40. void (*coherence)(void);
  41. int corecolor(int);
  42. u32int cpuid(u32int, u32int, u32int[4]);
  43. int dbgprint(char*, ...);
  44. int decref(Ref*);
  45. void delay(int);
  46. void dumpmmu(Proc*);
  47. void dumpmmuwalk(u64int pa);
  48. void dumpptepg(int lvl,uintptr pa);
  49. #define evenaddr(x) /* x86 doesn't care */
  50. int fpudevprocio(Proc*, void*, long, uintptr, int);
  51. void fpuinit(void);
  52. void fpunoted(void);
  53. void fpunotify(Ureg*);
  54. void fpuprocrestore(Proc*);
  55. void fpuprocsave(Proc*);
  56. void fpusysprocsetup(Proc*);
  57. void fpusysrfork(Ureg*);
  58. void fpusysrforkchild(Proc*, Proc*);
  59. Mach* getac(Proc*, int);
  60. char* getconf(char*);
  61. void halt(void);
  62. void hardhalt(void);
  63. int i8042auxcmd(int);
  64. int i8042auxcmds(uchar*, int);
  65. void i8042auxenable(void (*)(int, int));
  66. void i8042reset(void);
  67. Uart* i8250console(char*);
  68. void* i8250alloc(int, int, int);
  69. vlong i8254hz(u32int[2][4]);
  70. void idlehands(void);
  71. void acidthandlers(void);
  72. void idthandlers(void);
  73. int inb(int);
  74. int incref(Ref*);
  75. void insb(int, void*, int);
  76. ushort ins(int);
  77. void inss(int, void*, int);
  78. uint32_t inl(int);
  79. void insl(int, void*, int);
  80. int intrdisable(void*);
  81. void* intrenable(int, void (*)(Ureg*, void*), void*, int, char*);
  82. void invlpg(uintptr);
  83. void iofree(int);
  84. void ioinit(void);
  85. int iounused(int, int);
  86. int ioalloc(int, int, int, char*);
  87. int ioreserve(int, int, int, char*);
  88. int iprint(char*, ...);
  89. int isaconfig(char*, int, ISAConf*);
  90. void kbdenable(void);
  91. void kbdinit(void);
  92. void kexit(Ureg*);
  93. #define kmapinval()
  94. void lfence(void);
  95. void links(void);
  96. void machinit(void);
  97. void mach0init(void);
  98. void mapraminit(uvlong, uvlong);
  99. void mapupainit(uvlong, uint32_t);
  100. void meminit(void);
  101. void mfence(void);
  102. void mmuflushtlb(u64int);
  103. void mmuinit(void);
  104. uintptr mmukmap(uintptr, uintptr, usize);
  105. int mmukmapsync(uvlong);
  106. uintmem mmuphysaddr(uintptr);
  107. int mmuwalk(PTE*, uintptr, int, PTE**, PTE (*)(usize));
  108. int multiboot(u32int, u32int, int);
  109. void ndnr(void);
  110. uchar nvramread(int);
  111. void nvramwrite(int, uchar);
  112. void optionsinit(char*);
  113. void outb(int, int);
  114. void outsb(int, void*, int);
  115. void outs(int, ushort);
  116. void outss(int, void*, int);
  117. void outl(int, uint32_t);
  118. void outsl(int, void*, int);
  119. int pcicap(Pcidev*, int);
  120. int pcicfgr8(Pcidev*, int);
  121. int pcicfgr16(Pcidev*, int);
  122. int pcicfgr32(Pcidev*, int);
  123. void pcicfgw8(Pcidev*, int, int);
  124. void pcicfgw16(Pcidev*, int, int);
  125. void pcicfgw32(Pcidev*, int, int);
  126. void pciclrbme(Pcidev*);
  127. void pciclrmwi(Pcidev*);
  128. int pcigetpms(Pcidev*);
  129. void pcihinv(Pcidev*);
  130. Pcidev* pcimatch(Pcidev*, int, int);
  131. Pcidev* pcimatchtbdf(int);
  132. void pcireset(void);
  133. void pcisetbme(Pcidev*);
  134. void pcisetmwi(Pcidev*);
  135. int pcisetpms(Pcidev*, int);
  136. int pickcore(int, int);
  137. void printcpufreq(void);
  138. void putac(Mach*);
  139. void runapcore(int);
  140. int screenprint(char*, ...); /* debugging */
  141. void sfence(void);
  142. void spldone(void);
  143. u64int splhi(void);
  144. u64int spllo(void);
  145. void splx(u64int);
  146. void splxpc(u64int);
  147. void stopac(void);
  148. void syncclock(void);
  149. void syscall(int scallnr, Ureg* ureg);
  150. void* sysexecregs(uintptr, uint32_t, uint32_t);
  151. uintptr sysexecstack(uintptr, int);
  152. void sysprocsetup(Proc*);
  153. void tssrsp0(u64int);
  154. void trapenable(int, void (*)(Ureg*, void*), void*, char*);
  155. void trapinit(void);
  156. void trap(Ureg*);
  157. void umeminit(void);
  158. void upafree(uintptr, usize);
  159. uintptr upamalloc(uintptr, usize, usize);
  160. void upareserve(uintptr, usize);
  161. int userureg(Ureg*);
  162. void* vmap(uintptr, usize);
  163. void vsvminit(int, int);
  164. void vunmap(void*, usize);
  165. extern u64int cr0get(void);
  166. extern void cr0put(u64int);
  167. extern u64int cr2get(void);
  168. extern u64int cr3get(void);
  169. extern void cr3put(u64int);
  170. extern u64int cr4get(void);
  171. extern void cr4put(u64int);
  172. extern void gdtget(void*);
  173. extern void gdtput(int, u64int, u16int);
  174. extern void idtput(int, u64int);
  175. extern u64int rdmsr(u32int);
  176. extern u64int rdtsc(void);
  177. extern void trput(u64int);
  178. extern void wrmsr(u32int, u64int);
  179. extern int islo(void);
  180. extern void spldone(void);
  181. extern Mpl splhi(void);
  182. extern Mpl spllo(void);
  183. extern void splx(Mpl);
  184. int cas32(void*, u32int, u32int);
  185. int cas64(void*, u64int, u64int);
  186. int tas32(void*);
  187. u64int fas64(u64int*, u64int);
  188. #define CASU(p, e, n) cas64((p), (u64int)(e), (u64int)(n))
  189. #define CASV(p, e, n) cas64((p), (u64int)(e), (u64int)(n))
  190. #define CASP(p, e, n) cas64((p), (u64int)(e), (u64int)(n))
  191. #define CASW(p, e, n) cas32((p), (e), (n))
  192. #define TAS(addr) tas32((addr))
  193. #define FASP(p, v) ((void*)fas64((u64int*)(p), (u64int)(v)))
  194. void touser(uintptr);
  195. void syscallentry(void);
  196. void acsyscallentry(void);
  197. void syscallreturn(void);
  198. void sysrforkret(void);
  199. #define waserror() (up->nerrlab++, setlabel(&up->errlab[up->nerrlab-1]))
  200. #define dcflush(a, b)
  201. #define PTR2UINT(p) ((uintptr)(p))
  202. #define UINT2PTR(i) ((void*)(i))
  203. void* KADDR(uintptr);
  204. uintmem PADDR(void*);
  205. #define BIOSSEG(a) KADDR(((uint)(a))<<4)
  206. /*
  207. * apic.c
  208. */
  209. extern int apiceoi(int);
  210. extern void apicipi(int);
  211. extern void apicinit(int, uintmem, int);
  212. extern int apicisr(int);
  213. extern int apiconline(void);
  214. extern void apicpri(int);
  215. extern void apicsipi(int, uintmem);
  216. extern void ioapicinit(int, uintmem);
  217. extern void ioapicintrinit(int, int, int, int, u32int);
  218. extern void ioapiconline(void);
  219. /*
  220. * archk10.c
  221. */
  222. extern void millidelay(int);
  223. extern void k10mwait(void*);
  224. /*
  225. * i8259.c
  226. */
  227. extern int i8259init(int);
  228. extern int i8259irqdisable(int);
  229. extern int i8259irqenable(int);
  230. extern int i8259isr(int);
  231. /*
  232. * mp.c
  233. */
  234. extern void mpsinit(int);
  235. /*
  236. * sipi.c
  237. */
  238. extern void sipi(void);
  239. /*
  240. * debug
  241. */
  242. void HERE(void);
  243. void DONE(void);