Fork of Keith's WSL Patch Queue for my Win64 work
Revision | 33d4cee08b472a080785c78fb5b7a3ca36216d8c (tree) |
---|---|
Time | 2019-04-21 21:44:26 |
Author | Cesar Strauss <cestrauss@gmai...> |
Commiter | Cesar Strauss |
Reworked "cpu features" patch to fully build on 64 bits.
@@ -1,5 +1,6 @@ | ||
1 | 1 | # HG changeset patch |
2 | 2 | # Parent 66b461070c4b063621a1af46c9fbf17323ce536a |
3 | +# Parent d1de6110347aee4b3c939b68fcc9de1087c5e9c3 | |
3 | 4 | Make CPU features initialization code x86-64 compliant. |
4 | 5 | |
5 | 6 | * cpu_features.sx (CPUID_FLAG) [__x86_64__]: Omit check. |
@@ -16,9 +17,7 @@ | ||
16 | 17 | diff --git a/mingwrt/cpu_features.sx b/mingwrt/cpu_features.sx |
17 | 18 | --- a/mingwrt/cpu_features.sx |
18 | 19 | +++ b/mingwrt/cpu_features.sx |
19 | -@@ -40,12 +40,37 @@ | |
20 | - #define RH_FLAG(BITNUM) (1 << ((BITNUM) - 8)) | |
21 | - | |
20 | +@@ -42,8 +42,33 @@ | |
22 | 21 | #define CPUID_FLAG RX_FLAG(21) /* EFLAGS bit 21 */ |
23 | 22 | |
24 | 23 | #define FXSAVE_BUFSIZ 512 |
@@ -53,11 +52,7 @@ | ||
53 | 52 | |
54 | 53 | /* FIXME: is this optimization really worthwhile here? It breaks, |
55 | 54 | * with older GAS versions, (such as that commonly deployed in the |
56 | - * GCC-3.4.5 era, and earlier)! | |
57 | - * | |
58 | -@@ -70,11 +95,15 @@ | |
59 | - .def ___cpu_features_init; .scl 2; .type 32; .endef | |
60 | - | |
55 | +@@ -72,7 +97,11 @@ | |
61 | 56 | ___cpu_features_init: |
62 | 57 | |
63 | 58 | .cfi_startproc |
@@ -70,11 +65,7 @@ | ||
70 | 65 | * supported by the host CPU, we try to toggle the CPUID flag bit within the |
71 | 66 | * EFLAGS register, (ultimately leaving it unchanged). |
72 | 67 | */ |
73 | - pushf /* save original flags state */ | |
74 | - pushf /* duplicate them in both... */ | |
75 | -@@ -95,18 +124,20 @@ | |
76 | - */ | |
77 | - xor eax, edx /* isolate CPUID_FLAG state */ | |
68 | +@@ -97,14 +126,16 @@ | |
78 | 69 | test eax, CPUID_FLAG /* did it change? */ |
79 | 70 | je 90f /* no: quit immediately */ |
80 | 71 |
@@ -90,15 +81,11 @@ | ||
90 | 81 | -.cfi_def_cfa_offset 8 |
91 | 82 | -.cfi_offset ebx, -8 |
92 | 83 | +.cfi_def_cfa_offset CFI_OFFSET_BASE(2) |
93 | -+.cfi_offset ebx, -CFI_OFFSET_BASE(2) | |
84 | ++.cfi_offset rbx, -CFI_OFFSET_BASE(2) | |
94 | 85 | |
95 | 86 | /* First, we must perform a level zero CPUID enquiry, to determine the |
96 | 87 | * maximum level of interrogation which is supported. |
97 | - */ | |
98 | - xor eax, eax /* zero request level code */ | |
99 | -@@ -168,48 +199,48 @@ 15: | |
100 | - /* We must create a local stack frame, with the stack pointer aligned to a | |
101 | - * sixteen byte boundary, in which to allocate an FXSAVE buffer; (failure to | |
88 | +@@ -170,44 +201,44 @@ | |
102 | 89 | * align this correctly will raise an unhandled exception, and GCC cannot be |
103 | 90 | * trusted to get this right in C language code). |
104 | 91 | */ |
@@ -160,11 +147,7 @@ | ||
160 | 147 | |
161 | 148 | cmp ebx, FXTEST_BITS /* SSE flags were changed? */ |
162 | 149 | jne 20f /* no: skip SSE detection */ |
163 | - | |
164 | - /* If we're still here, then the operating system should support SSE; | |
165 | -@@ -268,14 +299,14 @@ 30: chk CPUID_CAP(3DNOWP) | |
166 | - */ | |
167 | - or DWORD PTR ___cpu_features, eax | |
150 | +@@ -270,10 +301,10 @@ | |
168 | 151 | |
169 | 152 | /* ...we restore the preserved state of the EBX register... |
170 | 153 | */ |
@@ -178,5 +161,3 @@ | ||
178 | 161 | |
179 | 162 | /* ...and return to the C runtime initialization procedure. |
180 | 163 | */ |
181 | - 90: ret | |
182 | - |
@@ -1,6 +1,6 @@ | ||
1 | 1 | win64-context.patch #+win64 |
2 | +cpu-features-x86-64.patch #+win64 | |
2 | 3 | win64-time-typedef.patch #+win64 |
3 | -cpu-features-x86-64.patch #+win64 | |
4 | 4 | alloca-testing.patch #+void #-void |
5 | 5 | winerror-winsock2-update.patch #+void #-void |
6 | 6 | winnls-self-contained.patch #+self-contained |