u.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. #define nil ((void*)0)
  10. typedef unsigned char uint8_t;
  11. typedef signed char int8_t;
  12. typedef unsigned short uint16_t;
  13. typedef signed short int16_t;
  14. typedef unsigned int uint32_t;
  15. typedef unsigned int uint;
  16. typedef signed int int32_t;
  17. typedef unsigned long long uint64_t;
  18. typedef long long int64_t;
  19. typedef uint64_t uintptr;
  20. typedef uint64_t uintptr_t;
  21. typedef uint32_t usize;
  22. typedef int64_t size_t;
  23. typedef uint32_t Rune;
  24. typedef union FPdbleword FPdbleword;
  25. typedef uintptr jmp_buf[10]; // for registers.
  26. #define JMPBUFSP 6
  27. #define JMPBUFPC 7
  28. #define JMPBUFARG1 8
  29. #define JMPBUFARG2 9
  30. #define JMPBUFDPC 0
  31. typedef unsigned int mpdigit; /* for /sys/include/mp.h */
  32. /* MXCSR */
  33. /* fcr */
  34. #define FPFTZ (1<<15) /* amd64 */
  35. #define FPINEX (1<<12)
  36. #define FPUNFL (1<<11)
  37. #define FPOVFL (1<<10)
  38. #define FPZDIV (1<<9)
  39. #define FPDNRM (1<<8) /* amd64 */
  40. #define FPINVAL (1<<7)
  41. #define FPDAZ (1<<6) /* amd64 */
  42. #define FPRNR (0<<13)
  43. #define FPRZ (3<<13)
  44. #define FPRPINF (2<<13)
  45. #define FPRNINF (1<<13)
  46. #define FPRMASK (3<<13)
  47. #define FPPEXT 0
  48. #define FPPSGL 0
  49. #define FPPDBL 0
  50. #define FPPMASK 0
  51. /* fsr */
  52. #define FPAINEX (1<<5)
  53. #define FPAUNFL (1<<4)
  54. #define FPAOVFL (1<<3)
  55. #define FPAZDIV (1<<2)
  56. #define FPADNRM (1<<1) /* not in plan 9 */
  57. #define FPAINVAL (1<<0)
  58. union FPdbleword
  59. {
  60. double x;
  61. struct { /* little endian */
  62. uint lo;
  63. uint hi;
  64. };
  65. };
  66. /*
  67. #if 0
  68. typedef char* va_list;
  69. #define va_start(list, start) list =\
  70. (sizeof(start) < 8?\
  71. (char*)((int64_t*)&(start)+1):\
  72. (char*)(&(start)+1))
  73. #define va_end(list)\
  74. USED(list)
  75. #define va_arg(list, mode)\
  76. ((sizeof(mode) == 1)?\
  77. ((list += 8), (mode*)list)[-8]:\
  78. (sizeof(mode) == 2)?\
  79. ((list += 8), (mode*)list)[-4]:\
  80. (sizeof(mode) == 4)?\
  81. ((list += 8), (mode*)list)[-2]:\
  82. ((list += sizeof(mode)), (mode*)list)[-1])
  83. #endif
  84. */
  85. typedef __builtin_va_list va_list;
  86. #define va_start(v,l) __builtin_va_start(v,l)
  87. #define va_end(v) __builtin_va_end(v)
  88. #define va_arg(v,l) __builtin_va_arg(v,l)
  89. #define va_copy(v,l) __builtin_va_copy(v,l)