u.h 2.4 KB

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