triton-windows 3.5.1.post21__cp313-cp313-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. triton/_C/libtriton.pyd +0 -0
  2. triton/__init__.py +82 -0
  3. triton/_filecheck.py +97 -0
  4. triton/_internal_testing.py +255 -0
  5. triton/_utils.py +126 -0
  6. triton/backends/__init__.py +47 -0
  7. triton/backends/amd/__init__.py +0 -0
  8. triton/backends/amd/compiler.py +461 -0
  9. triton/backends/amd/driver.c +283 -0
  10. triton/backends/amd/driver.py +724 -0
  11. triton/backends/amd/lib/asanrtl.bc +0 -0
  12. triton/backends/amd/lib/ockl.bc +0 -0
  13. triton/backends/amd/lib/ocml.bc +0 -0
  14. triton/backends/compiler.py +90 -0
  15. triton/backends/driver.py +66 -0
  16. triton/backends/nvidia/__init__.py +0 -0
  17. triton/backends/nvidia/bin/ptxas.exe +0 -0
  18. triton/backends/nvidia/compiler.py +533 -0
  19. triton/backends/nvidia/driver.c +517 -0
  20. triton/backends/nvidia/driver.py +799 -0
  21. triton/backends/nvidia/include/cuda.h +26280 -0
  22. triton/backends/nvidia/lib/libdevice.10.bc +0 -0
  23. triton/backends/nvidia/lib/x64/cuda.lib +0 -0
  24. triton/compiler/__init__.py +7 -0
  25. triton/compiler/code_generator.py +1614 -0
  26. triton/compiler/compiler.py +509 -0
  27. triton/compiler/errors.py +51 -0
  28. triton/compiler/make_launcher.py +0 -0
  29. triton/errors.py +5 -0
  30. triton/experimental/__init__.py +0 -0
  31. triton/experimental/gluon/__init__.py +5 -0
  32. triton/experimental/gluon/_compiler.py +0 -0
  33. triton/experimental/gluon/_runtime.py +102 -0
  34. triton/experimental/gluon/language/__init__.py +119 -0
  35. triton/experimental/gluon/language/_core.py +490 -0
  36. triton/experimental/gluon/language/_layouts.py +583 -0
  37. triton/experimental/gluon/language/_math.py +20 -0
  38. triton/experimental/gluon/language/_semantic.py +380 -0
  39. triton/experimental/gluon/language/_standard.py +80 -0
  40. triton/experimental/gluon/language/amd/__init__.py +4 -0
  41. triton/experimental/gluon/language/amd/_layouts.py +96 -0
  42. triton/experimental/gluon/language/amd/cdna3/__init__.py +100 -0
  43. triton/experimental/gluon/language/amd/cdna4/__init__.py +48 -0
  44. triton/experimental/gluon/language/amd/cdna4/async_copy.py +151 -0
  45. triton/experimental/gluon/language/extra/__init__.py +3 -0
  46. triton/experimental/gluon/language/nvidia/__init__.py +4 -0
  47. triton/experimental/gluon/language/nvidia/ampere/__init__.py +3 -0
  48. triton/experimental/gluon/language/nvidia/ampere/async_copy.py +74 -0
  49. triton/experimental/gluon/language/nvidia/ampere/mbarrier.py +80 -0
  50. triton/experimental/gluon/language/nvidia/blackwell/__init__.py +387 -0
  51. triton/experimental/gluon/language/nvidia/blackwell/tma.py +52 -0
  52. triton/experimental/gluon/language/nvidia/hopper/__init__.py +132 -0
  53. triton/experimental/gluon/language/nvidia/hopper/mbarrier.py +34 -0
  54. triton/experimental/gluon/language/nvidia/hopper/tma.py +97 -0
  55. triton/experimental/gluon/nvidia/__init__.py +4 -0
  56. triton/experimental/gluon/nvidia/blackwell.py +3 -0
  57. triton/experimental/gluon/nvidia/hopper.py +45 -0
  58. triton/knobs.py +546 -0
  59. triton/language/__init__.py +342 -0
  60. triton/language/core.py +3405 -0
  61. triton/language/extra/__init__.py +26 -0
  62. triton/language/extra/cuda/__init__.py +16 -0
  63. triton/language/extra/cuda/gdc.py +42 -0
  64. triton/language/extra/cuda/libdevice.py +1629 -0
  65. triton/language/extra/cuda/utils.py +109 -0
  66. triton/language/extra/hip/__init__.py +5 -0
  67. triton/language/extra/hip/libdevice.py +491 -0
  68. triton/language/extra/hip/utils.py +35 -0
  69. triton/language/extra/libdevice.py +790 -0
  70. triton/language/math.py +249 -0
  71. triton/language/random.py +218 -0
  72. triton/language/semantic.py +1939 -0
  73. triton/language/standard.py +534 -0
  74. triton/language/target_info.py +54 -0
  75. triton/runtime/__init__.py +23 -0
  76. triton/runtime/_allocation.py +44 -0
  77. triton/runtime/_async_compile.py +55 -0
  78. triton/runtime/autotuner.py +476 -0
  79. triton/runtime/build.py +168 -0
  80. triton/runtime/cache.py +317 -0
  81. triton/runtime/driver.py +38 -0
  82. triton/runtime/errors.py +36 -0
  83. triton/runtime/interpreter.py +1414 -0
  84. triton/runtime/jit.py +1107 -0
  85. triton/runtime/tcc/include/_mingw.h +168 -0
  86. triton/runtime/tcc/include/assert.h +62 -0
  87. triton/runtime/tcc/include/conio.h +409 -0
  88. triton/runtime/tcc/include/ctype.h +281 -0
  89. triton/runtime/tcc/include/dir.h +31 -0
  90. triton/runtime/tcc/include/direct.h +68 -0
  91. triton/runtime/tcc/include/dirent.h +135 -0
  92. triton/runtime/tcc/include/dos.h +55 -0
  93. triton/runtime/tcc/include/errno.h +75 -0
  94. triton/runtime/tcc/include/excpt.h +123 -0
  95. triton/runtime/tcc/include/fcntl.h +52 -0
  96. triton/runtime/tcc/include/fenv.h +108 -0
  97. triton/runtime/tcc/include/float.h +75 -0
  98. triton/runtime/tcc/include/inttypes.h +297 -0
  99. triton/runtime/tcc/include/io.h +418 -0
  100. triton/runtime/tcc/include/iso646.h +36 -0
  101. triton/runtime/tcc/include/limits.h +116 -0
  102. triton/runtime/tcc/include/locale.h +91 -0
  103. triton/runtime/tcc/include/malloc.h +181 -0
  104. triton/runtime/tcc/include/math.h +497 -0
  105. triton/runtime/tcc/include/mem.h +13 -0
  106. triton/runtime/tcc/include/memory.h +40 -0
  107. triton/runtime/tcc/include/process.h +176 -0
  108. triton/runtime/tcc/include/sec_api/conio_s.h +42 -0
  109. triton/runtime/tcc/include/sec_api/crtdbg_s.h +19 -0
  110. triton/runtime/tcc/include/sec_api/io_s.h +33 -0
  111. triton/runtime/tcc/include/sec_api/mbstring_s.h +52 -0
  112. triton/runtime/tcc/include/sec_api/search_s.h +25 -0
  113. triton/runtime/tcc/include/sec_api/stdio_s.h +145 -0
  114. triton/runtime/tcc/include/sec_api/stdlib_s.h +67 -0
  115. triton/runtime/tcc/include/sec_api/stralign_s.h +30 -0
  116. triton/runtime/tcc/include/sec_api/string_s.h +41 -0
  117. triton/runtime/tcc/include/sec_api/sys/timeb_s.h +34 -0
  118. triton/runtime/tcc/include/sec_api/tchar_s.h +266 -0
  119. triton/runtime/tcc/include/sec_api/time_s.h +61 -0
  120. triton/runtime/tcc/include/sec_api/wchar_s.h +128 -0
  121. triton/runtime/tcc/include/setjmp.h +160 -0
  122. triton/runtime/tcc/include/share.h +28 -0
  123. triton/runtime/tcc/include/signal.h +63 -0
  124. triton/runtime/tcc/include/stdalign.h +16 -0
  125. triton/runtime/tcc/include/stdarg.h +14 -0
  126. triton/runtime/tcc/include/stdatomic.h +171 -0
  127. triton/runtime/tcc/include/stdbool.h +11 -0
  128. triton/runtime/tcc/include/stddef.h +42 -0
  129. triton/runtime/tcc/include/stdint.h +212 -0
  130. triton/runtime/tcc/include/stdio.h +429 -0
  131. triton/runtime/tcc/include/stdlib.h +591 -0
  132. triton/runtime/tcc/include/stdnoreturn.h +7 -0
  133. triton/runtime/tcc/include/string.h +164 -0
  134. triton/runtime/tcc/include/sys/fcntl.h +13 -0
  135. triton/runtime/tcc/include/sys/file.h +14 -0
  136. triton/runtime/tcc/include/sys/locking.h +30 -0
  137. triton/runtime/tcc/include/sys/stat.h +290 -0
  138. triton/runtime/tcc/include/sys/time.h +69 -0
  139. triton/runtime/tcc/include/sys/timeb.h +133 -0
  140. triton/runtime/tcc/include/sys/types.h +123 -0
  141. triton/runtime/tcc/include/sys/unistd.h +14 -0
  142. triton/runtime/tcc/include/sys/utime.h +146 -0
  143. triton/runtime/tcc/include/tcc/tcc_libm.h +618 -0
  144. triton/runtime/tcc/include/tccdefs.h +342 -0
  145. triton/runtime/tcc/include/tcclib.h +80 -0
  146. triton/runtime/tcc/include/tchar.h +1102 -0
  147. triton/runtime/tcc/include/tgmath.h +89 -0
  148. triton/runtime/tcc/include/time.h +287 -0
  149. triton/runtime/tcc/include/uchar.h +33 -0
  150. triton/runtime/tcc/include/unistd.h +1 -0
  151. triton/runtime/tcc/include/vadefs.h +11 -0
  152. triton/runtime/tcc/include/values.h +4 -0
  153. triton/runtime/tcc/include/varargs.h +12 -0
  154. triton/runtime/tcc/include/wchar.h +873 -0
  155. triton/runtime/tcc/include/wctype.h +172 -0
  156. triton/runtime/tcc/include/winapi/basetsd.h +149 -0
  157. triton/runtime/tcc/include/winapi/basetyps.h +85 -0
  158. triton/runtime/tcc/include/winapi/guiddef.h +156 -0
  159. triton/runtime/tcc/include/winapi/poppack.h +8 -0
  160. triton/runtime/tcc/include/winapi/pshpack1.h +8 -0
  161. triton/runtime/tcc/include/winapi/pshpack2.h +8 -0
  162. triton/runtime/tcc/include/winapi/pshpack4.h +8 -0
  163. triton/runtime/tcc/include/winapi/pshpack8.h +8 -0
  164. triton/runtime/tcc/include/winapi/qos.h +72 -0
  165. triton/runtime/tcc/include/winapi/shellapi.h +59 -0
  166. triton/runtime/tcc/include/winapi/winbase.h +2958 -0
  167. triton/runtime/tcc/include/winapi/wincon.h +309 -0
  168. triton/runtime/tcc/include/winapi/windef.h +293 -0
  169. triton/runtime/tcc/include/winapi/windows.h +127 -0
  170. triton/runtime/tcc/include/winapi/winerror.h +3166 -0
  171. triton/runtime/tcc/include/winapi/wingdi.h +4080 -0
  172. triton/runtime/tcc/include/winapi/winnls.h +778 -0
  173. triton/runtime/tcc/include/winapi/winnt.h +5837 -0
  174. triton/runtime/tcc/include/winapi/winreg.h +272 -0
  175. triton/runtime/tcc/include/winapi/winsock2.h +1474 -0
  176. triton/runtime/tcc/include/winapi/winuser.h +5651 -0
  177. triton/runtime/tcc/include/winapi/winver.h +160 -0
  178. triton/runtime/tcc/include/winapi/ws2ipdef.h +21 -0
  179. triton/runtime/tcc/include/winapi/ws2tcpip.h +391 -0
  180. triton/runtime/tcc/lib/cuda.def +697 -0
  181. triton/runtime/tcc/lib/gdi32.def +337 -0
  182. triton/runtime/tcc/lib/kernel32.def +770 -0
  183. triton/runtime/tcc/lib/libtcc1.a +0 -0
  184. triton/runtime/tcc/lib/msvcrt.def +1399 -0
  185. triton/runtime/tcc/lib/python3.def +810 -0
  186. triton/runtime/tcc/lib/python310.def +1610 -0
  187. triton/runtime/tcc/lib/python311.def +1633 -0
  188. triton/runtime/tcc/lib/python312.def +1703 -0
  189. triton/runtime/tcc/lib/python313.def +1651 -0
  190. triton/runtime/tcc/lib/python313t.def +1656 -0
  191. triton/runtime/tcc/lib/python314.def +1800 -0
  192. triton/runtime/tcc/lib/python314t.def +1809 -0
  193. triton/runtime/tcc/lib/python39.def +1644 -0
  194. triton/runtime/tcc/lib/python3t.def +905 -0
  195. triton/runtime/tcc/lib/user32.def +658 -0
  196. triton/runtime/tcc/libtcc.dll +0 -0
  197. triton/runtime/tcc/tcc.exe +0 -0
  198. triton/testing.py +543 -0
  199. triton/tools/__init__.py +0 -0
  200. triton/tools/build_extern.py +365 -0
  201. triton/tools/compile.py +210 -0
  202. triton/tools/disasm.py +143 -0
  203. triton/tools/extra/cuda/compile.c +70 -0
  204. triton/tools/extra/cuda/compile.h +14 -0
  205. triton/tools/extra/hip/compile.cpp +66 -0
  206. triton/tools/extra/hip/compile.h +13 -0
  207. triton/tools/link.py +322 -0
  208. triton/tools/mxfp.py +301 -0
  209. triton/tools/ragged_tma.py +92 -0
  210. triton/tools/tensor_descriptor.py +34 -0
  211. triton/windows_utils.py +405 -0
  212. triton_windows-3.5.1.post21.dist-info/METADATA +46 -0
  213. triton_windows-3.5.1.post21.dist-info/RECORD +217 -0
  214. triton_windows-3.5.1.post21.dist-info/WHEEL +5 -0
  215. triton_windows-3.5.1.post21.dist-info/entry_points.txt +3 -0
  216. triton_windows-3.5.1.post21.dist-info/licenses/LICENSE +23 -0
  217. triton_windows-3.5.1.post21.dist-info/top_level.txt +1 -0
@@ -0,0 +1,168 @@
1
+ /*
2
+ * _mingw.h
3
+ *
4
+ * This file is for TinyCC and not part of the Mingw32 package.
5
+ *
6
+ * THIS SOFTWARE IS NOT COPYRIGHTED
7
+ *
8
+ * This source code is offered for use in the public domain. You may
9
+ * use, modify or distribute it freely.
10
+ *
11
+ * This code is distributed in the hope that it will be useful but
12
+ * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
13
+ * DISCLAIMED. This includes but is not limited to warranties of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
+ *
16
+ */
17
+
18
+ #ifndef __MINGW_H
19
+ #define __MINGW_H
20
+
21
+ /* some winapi files define these before including _mingw.h --> */
22
+ #undef __cdecl
23
+ #undef _X86_
24
+ #undef WIN32
25
+ /* <-- */
26
+
27
+ #include <stddef.h>
28
+ #include <stdarg.h>
29
+
30
+ #define __int8 char
31
+ #define __int16 short
32
+ #define __int32 int
33
+ #define __int64 long long
34
+ #define _HAVE_INT64
35
+
36
+ #define __cdecl
37
+ #define __declspec(x) __attribute__((x))
38
+ #define __unaligned __attribute__((packed))
39
+ #define __fastcall __attribute__((fastcall))
40
+
41
+ #define __MSVCRT__ 1
42
+ #undef _MSVCRT_
43
+ #define __MINGW_IMPORT extern __declspec(dllimport)
44
+ #define __MINGW_ATTRIB_NORETURN __declspec(noreturn)
45
+ #define __MINGW_ATTRIB_CONST
46
+ #define __MINGW_ATTRIB_DEPRECATED
47
+ #define __MINGW_ATTRIB_MALLOC
48
+ #define __MINGW_ATTRIB_PURE
49
+ #define __MINGW_ATTRIB_NONNULL(arg)
50
+ #define __MINGW_NOTHROW
51
+ #define __GNUC_VA_LIST
52
+
53
+ #define _CRTIMP extern
54
+ #define __CRT_INLINE static __inline__
55
+
56
+ #define _CRT_ALIGN(x) __attribute__((aligned(x)))
57
+ #define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
58
+ #define _CRT_PACKING 8
59
+ #define __CRT_UNALIGNED
60
+ #define _CONST_RETURN
61
+
62
+ #ifndef _TRUNCATE
63
+ #define _TRUNCATE ((size_t)-1)
64
+ #endif
65
+
66
+ #define __CRT_STRINGIZE(_Value) #_Value
67
+ #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
68
+ #define __CRT_WIDE(_String) L ## _String
69
+ #define _CRT_WIDE(_String) __CRT_WIDE(_String)
70
+
71
+ #ifdef _WIN64
72
+ #define __stdcall
73
+ #define _AMD64_ 1
74
+ #define __x86_64 1
75
+ #define _M_X64 100 /* Visual Studio */
76
+ #define _M_AMD64 100 /* Visual Studio */
77
+ #define USE_MINGW_SETJMP_TWO_ARGS
78
+ #define mingw_getsp tinyc_getbp
79
+ #else
80
+ #define __stdcall __attribute__((__stdcall__))
81
+ #define _X86_ 1
82
+ #define _M_IX86 300 /* Visual Studio */
83
+ #ifndef __MINGW_USE_VC2005_COMPAT /* time became 64, but not timeval.tv_sec */
84
+ # ifndef _USE_32BIT_TIME_T
85
+ # define _USE_32BIT_TIME_T
86
+ # endif
87
+ #endif
88
+ #endif
89
+
90
+ /* in stddef.h */
91
+ #define _SIZE_T_DEFINED
92
+ #define _SSIZE_T_DEFINED
93
+ #define _PTRDIFF_T_DEFINED
94
+ #define _WCHAR_T_DEFINED
95
+ #define _UINTPTR_T_DEFINED
96
+ #define _INTPTR_T_DEFINED
97
+ #define _INTEGRAL_MAX_BITS 64
98
+
99
+ #ifndef _TIME32_T_DEFINED
100
+ #define _TIME32_T_DEFINED
101
+ typedef long __time32_t;
102
+ #endif
103
+
104
+ #ifndef _TIME64_T_DEFINED
105
+ #define _TIME64_T_DEFINED
106
+ typedef long long __time64_t;
107
+ #endif
108
+
109
+ #ifndef _TIME_T_DEFINED
110
+ #define _TIME_T_DEFINED
111
+ #ifdef _USE_32BIT_TIME_T
112
+ typedef __time32_t time_t;
113
+ #else
114
+ typedef __time64_t time_t;
115
+ #endif
116
+ #endif
117
+
118
+ #ifndef _WCTYPE_T_DEFINED
119
+ #define _WCTYPE_T_DEFINED
120
+ typedef wchar_t wctype_t;
121
+ #endif
122
+
123
+ #ifndef _WINT_T
124
+ #define _WINT_T
125
+ typedef __WINT_TYPE__ wint_t;
126
+ #endif
127
+
128
+ typedef int errno_t;
129
+ #define _ERRCODE_DEFINED
130
+
131
+ typedef struct threadlocaleinfostruct *pthreadlocinfo;
132
+ typedef struct threadmbcinfostruct *pthreadmbcinfo;
133
+ typedef struct localeinfo_struct _locale_tstruct,*_locale_t;
134
+
135
+ /* for winapi */
136
+ #define _ANONYMOUS_UNION
137
+ #define _ANONYMOUS_STRUCT
138
+ #define DECLSPEC_NORETURN __declspec(noreturn)
139
+ #define DECLARE_STDCALL_P(type) __stdcall type
140
+ #define NOSERVICE 1
141
+ #define NOMCX 1
142
+ #define NOIME 1
143
+ #define __INTRIN_H_
144
+ #ifndef DUMMYUNIONNAME
145
+ # define DUMMYUNIONNAME
146
+ # define DUMMYUNIONNAME1
147
+ # define DUMMYUNIONNAME2
148
+ # define DUMMYUNIONNAME3
149
+ # define DUMMYUNIONNAME4
150
+ # define DUMMYUNIONNAME5
151
+ #endif
152
+ #ifndef DUMMYSTRUCTNAME
153
+ # define DUMMYSTRUCTNAME
154
+ #endif
155
+ #ifndef WINVER
156
+ # define WINVER 0x0502
157
+ #endif
158
+ #ifndef _WIN32_WINNT
159
+ # define _WIN32_WINNT 0x502
160
+ #endif
161
+
162
+ #define __C89_NAMELESS
163
+ #define __MINGW_EXTENSION
164
+ #define WINAPI_FAMILY_PARTITION(X) 1
165
+ #define MINGW_HAS_SECURE_API
166
+ #define WIN32 1
167
+
168
+ #endif /* __MINGW_H */
@@ -0,0 +1,62 @@
1
+ /**
2
+ * This file has no copyright assigned and is placed in the Public Domain.
3
+ * This file is part of the w64 mingw-runtime package.
4
+ * No warranty is given; refer to the file DISCLAIMER within this package.
5
+ */
6
+ #ifndef __ASSERT_H_
7
+ #define __ASSERT_H_
8
+
9
+ #include <_mingw.h>
10
+ #ifdef __cplusplus
11
+ #include <stdlib.h>
12
+ #endif
13
+
14
+ #ifdef NDEBUG
15
+ #ifndef assert
16
+ #define assert(_Expression) ((void)0)
17
+ #endif
18
+ #else
19
+
20
+ #ifndef _CRT_TERMINATE_DEFINED
21
+ #define _CRT_TERMINATE_DEFINED
22
+ void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN;
23
+ _CRTIMP void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN;
24
+ #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
25
+ /* C99 function name */
26
+ void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN;
27
+ __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status)
28
+ { _exit(status); }
29
+ #endif
30
+
31
+ #pragma push_macro("abort")
32
+ #undef abort
33
+ void __cdecl __declspec(noreturn) abort(void);
34
+ #pragma pop_macro("abort")
35
+
36
+ #endif
37
+
38
+ #ifdef __cplusplus
39
+ extern "C" {
40
+ #endif
41
+
42
+
43
+ extern void __cdecl _wassert(const wchar_t *_Message,const wchar_t *_File,unsigned _Line);
44
+ extern void __cdecl _assert(const char *, const char *, unsigned);
45
+
46
+ #ifdef __cplusplus
47
+ }
48
+ #endif
49
+
50
+ #ifndef assert
51
+ //#define assert(_Expression) (void)((!!(_Expression)) || (_wassert(_CRT_WIDE(#_Expression),_CRT_WIDE(__FILE__),__LINE__),0))
52
+ #define assert(e) ((e) ? (void)0 : _assert(#e, __FILE__, __LINE__))
53
+ #endif
54
+
55
+ #endif
56
+
57
+ #if (__STDC_VERSION__ >= 201112L) && !defined(static_assert)
58
+ /* C11, section 7.2: The macro static_assert expands to _Static_assert. */
59
+ #define static_assert(exp, str) _Static_assert(exp, str)
60
+ #endif
61
+
62
+ #endif
@@ -0,0 +1,409 @@
1
+ /**
2
+ * This file has no copyright assigned and is placed in the Public Domain.
3
+ * This file is part of the w64 mingw-runtime package.
4
+ * No warranty is given; refer to the file DISCLAIMER within this package.
5
+ */
6
+ #ifndef _INC_CONIO
7
+ #define _INC_CONIO
8
+
9
+ #include <_mingw.h>
10
+
11
+ #ifdef __cplusplus
12
+ extern "C" {
13
+ #endif
14
+
15
+ _CRTIMP char *_cgets(char *_Buffer);
16
+ _CRTIMP int __cdecl _cprintf(const char *_Format,...);
17
+ _CRTIMP int __cdecl _cputs(const char *_Str);
18
+ _CRTIMP int __cdecl _cscanf(const char *_Format,...);
19
+ _CRTIMP int __cdecl _cscanf_l(const char *_Format,_locale_t _Locale,...);
20
+ _CRTIMP int __cdecl _getch(void);
21
+ _CRTIMP int __cdecl _getche(void);
22
+ _CRTIMP int __cdecl _vcprintf(const char *_Format,va_list _ArgList);
23
+ _CRTIMP int __cdecl _cprintf_p(const char *_Format,...);
24
+ _CRTIMP int __cdecl _vcprintf_p(const char *_Format,va_list _ArgList);
25
+ _CRTIMP int __cdecl _cprintf_l(const char *_Format,_locale_t _Locale,...);
26
+ _CRTIMP int __cdecl _vcprintf_l(const char *_Format,_locale_t _Locale,va_list _ArgList);
27
+ _CRTIMP int __cdecl _cprintf_p_l(const char *_Format,_locale_t _Locale,...);
28
+ _CRTIMP int __cdecl _vcprintf_p_l(const char *_Format,_locale_t _Locale,va_list _ArgList);
29
+ _CRTIMP int __cdecl _kbhit(void);
30
+
31
+ #if defined(_X86_) && !defined(__x86_64)
32
+ int __cdecl _inp(unsigned short);
33
+ unsigned short __cdecl _inpw(unsigned short);
34
+ unsigned long __cdecl _inpd(unsigned short);
35
+ int __cdecl _outp(unsigned short,int);
36
+ unsigned short __cdecl _outpw(unsigned short,unsigned short);
37
+ unsigned long __cdecl _outpd(unsigned short,unsigned long);
38
+ #endif
39
+
40
+ _CRTIMP int __cdecl _putch(int _Ch);
41
+ _CRTIMP int __cdecl _ungetch(int _Ch);
42
+ _CRTIMP int __cdecl _getch_nolock(void);
43
+ _CRTIMP int __cdecl _getche_nolock(void);
44
+ _CRTIMP int __cdecl _putch_nolock(int _Ch);
45
+ _CRTIMP int __cdecl _ungetch_nolock(int _Ch);
46
+
47
+ #ifndef _WCONIO_DEFINED
48
+ #define _WCONIO_DEFINED
49
+
50
+ #ifndef WEOF
51
+ #define WEOF (wint_t)(0xFFFF)
52
+ #endif
53
+
54
+ _CRTIMP wchar_t *_cgetws(wchar_t *_Buffer);
55
+ _CRTIMP wint_t __cdecl _getwch(void);
56
+ _CRTIMP wint_t __cdecl _getwche(void);
57
+ _CRTIMP wint_t __cdecl _putwch(wchar_t _WCh);
58
+ _CRTIMP wint_t __cdecl _ungetwch(wint_t _WCh);
59
+ _CRTIMP int __cdecl _cputws(const wchar_t *_String);
60
+ _CRTIMP int __cdecl _cwprintf(const wchar_t *_Format,...);
61
+ _CRTIMP int __cdecl _cwscanf(const wchar_t *_Format,...);
62
+ _CRTIMP int __cdecl _cwscanf_l(const wchar_t *_Format,_locale_t _Locale,...);
63
+ _CRTIMP int __cdecl _vcwprintf(const wchar_t *_Format,va_list _ArgList);
64
+ _CRTIMP int __cdecl _cwprintf_p(const wchar_t *_Format,...);
65
+ _CRTIMP int __cdecl _vcwprintf_p(const wchar_t *_Format,va_list _ArgList);
66
+ _CRTIMP int __cdecl _cwprintf_l(const wchar_t *_Format,_locale_t _Locale,...);
67
+ _CRTIMP int __cdecl _vcwprintf_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList);
68
+ _CRTIMP int __cdecl _cwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,...);
69
+ _CRTIMP int __cdecl _vcwprintf_p_l(const wchar_t *_Format,_locale_t _Locale,va_list _ArgList);
70
+ _CRTIMP wint_t __cdecl _putwch_nolock(wchar_t _WCh);
71
+ _CRTIMP wint_t __cdecl _getwch_nolock(void);
72
+ _CRTIMP wint_t __cdecl _getwche_nolock(void);
73
+ _CRTIMP wint_t __cdecl _ungetwch_nolock(wint_t _WCh);
74
+ #endif
75
+
76
+ #ifndef NO_OLDNAMES
77
+ char *__cdecl cgets(char *_Buffer);
78
+ int __cdecl cprintf(const char *_Format,...);
79
+ int __cdecl cputs(const char *_Str);
80
+ int __cdecl cscanf(const char *_Format,...);
81
+ int __cdecl getch(void);
82
+ int __cdecl getche(void);
83
+ int __cdecl kbhit(void);
84
+ int __cdecl putch(int _Ch);
85
+ int __cdecl ungetch(int _Ch);
86
+
87
+ #if (defined(_X86_) && !defined(__x86_64))
88
+ int __cdecl inp(unsigned short);
89
+ unsigned short __cdecl inpw(unsigned short);
90
+ int __cdecl outp(unsigned short,int);
91
+ unsigned short __cdecl outpw(unsigned short,unsigned short);
92
+ #endif
93
+
94
+ /* I/O intrin functions. */
95
+ __CRT_INLINE unsigned char __inbyte(unsigned short Port)
96
+ {
97
+ unsigned char value;
98
+ __asm__ __volatile__ ("inb %w1,%b0"
99
+ : "=a" (value)
100
+ : "Nd" (Port));
101
+ return value;
102
+ }
103
+ __CRT_INLINE unsigned short __inword(unsigned short Port)
104
+ {
105
+ unsigned short value;
106
+ __asm__ __volatile__ ("inw %w1,%w0"
107
+ : "=a" (value)
108
+ : "Nd" (Port));
109
+ return value;
110
+ }
111
+ __CRT_INLINE unsigned long __indword(unsigned short Port)
112
+ {
113
+ unsigned long value;
114
+ __asm__ __volatile__ ("inl %w1,%0"
115
+ : "=a" (value)
116
+ : "Nd" (Port));
117
+ return value;
118
+ }
119
+ __CRT_INLINE void __outbyte(unsigned short Port,unsigned char Data)
120
+ {
121
+ __asm__ __volatile__ ("outb %b0,%w1"
122
+ :
123
+ : "a" (Data), "Nd" (Port));
124
+ }
125
+ __CRT_INLINE void __outword(unsigned short Port,unsigned short Data)
126
+ {
127
+ __asm__ __volatile__ ("outw %w0,%w1"
128
+ :
129
+ : "a" (Data), "Nd" (Port));
130
+ }
131
+ __CRT_INLINE void __outdword(unsigned short Port,unsigned long Data)
132
+ {
133
+ __asm__ __volatile__ ("outl %0,%w1"
134
+ :
135
+ : "a" (Data), "Nd" (Port));
136
+ }
137
+ __CRT_INLINE void __inbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count)
138
+ {
139
+ __asm__ __volatile__ (
140
+ "cld ; rep ; insb "
141
+ : "=D" (Buffer), "=c" (Count)
142
+ : "d"(Port), "0"(Buffer), "1" (Count)
143
+ );
144
+ }
145
+ __CRT_INLINE void __inwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count)
146
+ {
147
+ __asm__ __volatile__ (
148
+ "cld ; rep ; insw "
149
+ : "=D" (Buffer), "=c" (Count)
150
+ : "d"(Port), "0"(Buffer), "1" (Count)
151
+ );
152
+ }
153
+ __CRT_INLINE void __indwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count)
154
+ {
155
+ __asm__ __volatile__ (
156
+ "cld ; rep ; insl "
157
+ : "=D" (Buffer), "=c" (Count)
158
+ : "d"(Port), "0"(Buffer), "1" (Count)
159
+ );
160
+ }
161
+
162
+ __CRT_INLINE void __outbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count)
163
+ {
164
+ __asm__ __volatile__ (
165
+ "cld ; rep ; outsb "
166
+ : "=S" (Buffer), "=c" (Count)
167
+ : "d"(Port), "0"(Buffer), "1" (Count)
168
+ );
169
+ }
170
+ __CRT_INLINE void __outwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count)
171
+ {
172
+ __asm__ __volatile__ (
173
+ "cld ; rep ; outsw "
174
+ : "=S" (Buffer), "=c" (Count)
175
+ : "d"(Port), "0"(Buffer), "1" (Count)
176
+ );
177
+ }
178
+ __CRT_INLINE void __outdwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count)
179
+ {
180
+ __asm__ __volatile__ (
181
+ "cld ; rep ; outsl "
182
+ : "=S" (Buffer), "=c" (Count)
183
+ : "d"(Port), "0"(Buffer), "1" (Count)
184
+ );
185
+ }
186
+
187
+ __CRT_INLINE unsigned __int64 __readcr0(void)
188
+ {
189
+ unsigned __int64 value;
190
+ __asm__ __volatile__ (
191
+ "mov %%cr0, %[value]"
192
+ : [value] "=q" (value));
193
+ return value;
194
+ }
195
+
196
+ /* Register sizes are different between 32/64 bit mode. So we have to do this for _WIN64 and _WIN32
197
+ separately. */
198
+
199
+ #ifdef _WIN64
200
+ __CRT_INLINE void __writecr0(unsigned __int64 Data)
201
+ {
202
+ __asm__ __volatile__ (
203
+ "mov %[Data], %%cr0"
204
+ :
205
+ : [Data] "q" (Data)
206
+ : "memory");
207
+ }
208
+
209
+ __CRT_INLINE unsigned __int64 __readcr2(void)
210
+ {
211
+ unsigned __int64 value;
212
+ __asm__ __volatile__ (
213
+ "mov %%cr2, %[value]"
214
+ : [value] "=q" (value));
215
+ return value;
216
+ }
217
+
218
+ __CRT_INLINE void __writecr2(unsigned __int64 Data)
219
+ {
220
+ __asm__ __volatile__ (
221
+ "mov %[Data], %%cr2"
222
+ :
223
+ : [Data] "q" (Data)
224
+ : "memory");
225
+ }
226
+
227
+ __CRT_INLINE unsigned __int64 __readcr3(void)
228
+ {
229
+ unsigned __int64 value;
230
+ __asm__ __volatile__ (
231
+ "mov %%cr3, %[value]"
232
+ : [value] "=q" (value));
233
+ return value;
234
+ }
235
+
236
+ __CRT_INLINE void __writecr3(unsigned __int64 Data)
237
+ {
238
+ __asm__ __volatile__ (
239
+ "mov %[Data], %%cr3"
240
+ :
241
+ : [Data] "q" (Data)
242
+ : "memory");
243
+ }
244
+
245
+ __CRT_INLINE unsigned __int64 __readcr4(void)
246
+ {
247
+ unsigned __int64 value;
248
+ __asm__ __volatile__ (
249
+ "mov %%cr4, %[value]"
250
+ : [value] "=q" (value));
251
+ return value;
252
+ }
253
+
254
+ __CRT_INLINE void __writecr4(unsigned __int64 Data)
255
+ {
256
+ __asm__ __volatile__ (
257
+ "mov %[Data], %%cr4"
258
+ :
259
+ : [Data] "q" (Data)
260
+ : "memory");
261
+ }
262
+
263
+ __CRT_INLINE unsigned __int64 __readcr8(void)
264
+ {
265
+ unsigned __int64 value;
266
+ __asm__ __volatile__ (
267
+ "mov %%cr8, %[value]"
268
+ : [value] "=q" (value));
269
+ return value;
270
+ }
271
+
272
+ __CRT_INLINE void __writecr8(unsigned __int64 Data)
273
+ {
274
+ __asm__ __volatile__ (
275
+ "mov %[Data], %%cr8"
276
+ :
277
+ : [Data] "q" (Data)
278
+ : "memory");
279
+ }
280
+
281
+ #elif defined(_WIN32)
282
+
283
+ __CRT_INLINE void __writecr0(unsigned Data)
284
+ {
285
+ __asm__ __volatile__ (
286
+ "mov %[Data], %%cr0"
287
+ :
288
+ : [Data] "q" (Data)
289
+ : "memory");
290
+ }
291
+
292
+ __CRT_INLINE unsigned long __readcr2(void)
293
+ {
294
+ unsigned long value;
295
+ __asm__ __volatile__ (
296
+ "mov %%cr2, %[value]"
297
+ : [value] "=q" (value));
298
+ return value;
299
+ }
300
+
301
+ __CRT_INLINE void __writecr2(unsigned Data)
302
+ {
303
+ __asm__ __volatile__ (
304
+ "mov %[Data], %%cr2"
305
+ :
306
+ : [Data] "q" (Data)
307
+ : "memory");
308
+ }
309
+
310
+ __CRT_INLINE unsigned long __readcr3(void)
311
+ {
312
+ unsigned long value;
313
+ __asm__ __volatile__ (
314
+ "mov %%cr3, %[value]"
315
+ : [value] "=q" (value));
316
+ return value;
317
+ }
318
+
319
+ __CRT_INLINE void __writecr3(unsigned Data)
320
+ {
321
+ __asm__ __volatile__ (
322
+ "mov %[Data], %%cr3"
323
+ :
324
+ : [Data] "q" (Data)
325
+ : "memory");
326
+ }
327
+
328
+ __CRT_INLINE unsigned long __readcr4(void)
329
+ {
330
+ unsigned long value;
331
+ __asm__ __volatile__ (
332
+ "mov %%cr4, %[value]"
333
+ : [value] "=q" (value));
334
+ return value;
335
+ }
336
+
337
+ __CRT_INLINE void __writecr4(unsigned Data)
338
+ {
339
+ __asm__ __volatile__ (
340
+ "mov %[Data], %%cr4"
341
+ :
342
+ : [Data] "q" (Data)
343
+ : "memory");
344
+ }
345
+
346
+ __CRT_INLINE unsigned long __readcr8(void)
347
+ {
348
+ unsigned long value; __asm__ __volatile__ (
349
+ "mov %%cr8, %[value]"
350
+ : [value] "=q" (value));
351
+ return value;
352
+ }
353
+
354
+ __CRT_INLINE void __writecr8(unsigned Data)
355
+ {
356
+ __asm__ __volatile__ (
357
+ "mov %[Data], %%cr8"
358
+ :
359
+ : [Data] "q" (Data)
360
+ : "memory");
361
+ }
362
+
363
+ #endif
364
+
365
+ __CRT_INLINE unsigned __int64 __readmsr(unsigned long msr)
366
+ {
367
+ unsigned __int64 val1, val2;
368
+ __asm__ __volatile__(
369
+ "rdmsr"
370
+ : "=a" (val1), "=d" (val2)
371
+ : "c" (msr));
372
+ return val1 | (val2 << 32);
373
+ }
374
+
375
+ __CRT_INLINE void __writemsr (unsigned long msr, unsigned __int64 Value)
376
+ {
377
+ unsigned long val1 = Value, val2 = Value >> 32;
378
+ __asm__ __volatile__ (
379
+ "wrmsr"
380
+ :
381
+ : "c" (msr), "a" (val1), "d" (val2));
382
+ }
383
+
384
+ __CRT_INLINE unsigned __int64 __rdtsc(void)
385
+ {
386
+ unsigned __int64 val1, val2;
387
+ __asm__ __volatile__ (
388
+ "rdtsc"
389
+ : "=a" (val1), "=d" (val2));
390
+ return val1 | (val2 << 32);
391
+ }
392
+
393
+ __CRT_INLINE void __cpuid(int CPUInfo[4], int InfoType)
394
+ {
395
+ __asm__ __volatile__ (
396
+ "cpuid"
397
+ : "=a" (CPUInfo [0]), "=b" (CPUInfo [1]), "=c" (CPUInfo [2]), "=d" (CPUInfo [3])
398
+ : "a" (InfoType));
399
+ }
400
+
401
+ #endif
402
+
403
+ #ifdef __cplusplus
404
+ }
405
+ #endif
406
+
407
+ #include <sec_api/conio_s.h>
408
+
409
+ #endif