File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 93
93
* Only enable assembly for GNU C compatible compilers,
94
94
* because other platforms may not support GAS assembly syntax.
95
95
*
96
- * Only enable assembly for Linux / MacOS, other platforms may
96
+ * Only enable assembly for Linux / MacOS / Win32 , other platforms may
97
97
* work, but they haven't been tested. This could likely be
98
98
* extended to BSD systems.
99
99
*
100
100
* Disable assembly when MSAN is enabled, because MSAN requires
101
101
* 100% of code to be instrumented to work.
102
102
*/
103
103
#if defined(__GNUC__ )
104
- # if defined(__linux__ ) || defined(__linux ) || defined(__APPLE__ )
104
+ # if defined(__linux__ ) || defined(__linux ) || defined(__APPLE__ ) || defined( _WIN32 )
105
105
# if ZSTD_MEMORY_SANITIZER
106
106
# define ZSTD_ASM_SUPPORTED 0
107
107
# elif ZSTD_DATAFLOW_SANITIZER
Original file line number Diff line number Diff line change 42
42
43
43
/* Calling convention:
44
44
*
45
- * %rdi contains the first argument: HUF_DecompressAsmArgs*.
45
+ * %rdi (or %rcx on Windows) contains the first argument: HUF_DecompressAsmArgs*.
46
46
* %rbp isn't maintained (no frame pointer).
47
47
* %rsp contains the stack pointer that grows down.
48
48
* No red-zone is assumed, only addresses >= %rsp are used.
49
49
* All register contents are preserved.
50
- *
51
- * TODO: Support Windows calling convention.
52
50
*/
53
51
54
52
ZSTD_HIDE_ASM_FUNCTION(HUF_decompress4X1_usingDTable_internal_fast_asm_loop)
@@ -137,7 +135,11 @@ HUF_decompress4X1_usingDTable_internal_fast_asm_loop:
137
135
push %r15
138
136
139
137
/* Read HUF_DecompressAsmArgs* args from %rax */
138
+ #if defined(_WIN32)
139
+ movq %rcx , %rax
140
+ #else
140
141
movq %rdi , %rax
142
+ #endif
141
143
movq 0 (%rax ), %ip0
142
144
movq 8 (%rax ), %ip1
143
145
movq 16 (%rax ), %ip2
@@ -391,7 +393,12 @@ HUF_decompress4X2_usingDTable_internal_fast_asm_loop:
391
393
push %r14
392
394
push %r15
393
395
396
+ /* Read HUF_DecompressAsmArgs* args from %rax */
397
+ #if defined(_WIN32)
398
+ movq %rcx , %rax
399
+ #else
394
400
movq %rdi , %rax
401
+ #endif
395
402
movq 0 (%rax ), %ip0
396
403
movq 8 (%rax ), %ip1
397
404
movq 16 (%rax ), %ip2
You can’t perform that action at this time.
0 commit comments