1
0

u.h 2.5 KB

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