提交 4bb90087 编写于 作者: A Andy Polyakov

x86[_64]cpuid.pl: harmonize usage of reserved bits #20 and #30.

上级 67150340
...@@ -159,8 +159,8 @@ $code.=<<___; ...@@ -159,8 +159,8 @@ $code.=<<___;
movl ($dat,$XX[0],4),$TX[0]#d movl ($dat,$XX[0],4),$TX[0]#d
test \$-16,$len test \$-16,$len
jz .Lloop1 jz .Lloop1
bt \$30,%r8d # Intel CPU Family 6 bt \$30,%r8d # Intel CPU?
jc .L16x jc .Lintel
and \$7,$TX[1] and \$7,$TX[1]
lea 1($XX[0]),$XX[1] lea 1($XX[0]),$XX[1]
jz .Loop8 jz .Loop8
...@@ -217,7 +217,7 @@ $code.=<<___; ...@@ -217,7 +217,7 @@ $code.=<<___;
jmp .Lexit jmp .Lexit
.align 16 .align 16
.L16x: .Lintel:
test \$-32,$len test \$-32,$len
jz .Lloop1 jz .Lloop1
and \$15,$TX[1] and \$15,$TX[1]
...@@ -438,10 +438,8 @@ RC4_set_key: ...@@ -438,10 +438,8 @@ RC4_set_key:
xor %r11,%r11 xor %r11,%r11
mov OPENSSL_ia32cap_P(%rip),$idx#d mov OPENSSL_ia32cap_P(%rip),$idx#d
bt \$20,$idx#d # Intel CPU bt \$20,$idx#d # RC4_CHAR?
jnc .Lw1stloop jc .Lc1stloop
bt \$30,$idx#d # Intel CPU Family 6
jnc .Lc1stloop
jmp .Lw1stloop jmp .Lw1stloop
.align 16 .align 16
......
...@@ -124,13 +124,14 @@ OPENSSL_ia32_cpuid: ...@@ -124,13 +124,14 @@ OPENSSL_ia32_cpuid:
.Lnocacheinfo: .Lnocacheinfo:
mov \$1,%eax mov \$1,%eax
cpuid cpuid
and \$0xbfefffff,%edx # force reserved bits to 0
cmp \$0,%r9d cmp \$0,%r9d
jne .Lnotintel jne .Lnotintel
or \$0x00100000,%edx # use reserved 20th bit to engage RC4_CHAR or \$0x40000000,%edx # set reserved bit#30 on Intel CPUs
and \$15,%ah and \$15,%ah
cmp \$15,%ah # examine Family ID cmp \$15,%ah # examine Family ID
je .Lnotintel jne .Lnotintel
or \$0x40000000,%edx # use reserved bit to skip unrolled loop or \$0x00100000,%edx # set reserved bit#20 to engage RC4_CHAR
.Lnotintel: .Lnotintel:
bt \$28,%edx # test hyper-threading bit bt \$28,%edx # test hyper-threading bit
jnc .Lgeneric jnc .Lgeneric
......
...@@ -92,13 +92,15 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); } ...@@ -92,13 +92,15 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
&set_label("nocacheinfo"); &set_label("nocacheinfo");
&mov ("eax",1); &mov ("eax",1);
&cpuid (); &cpuid ();
&and ("edx",~(1<<20|1<<30)); # force reserved bits to 0
&cmp ("ebp",0); &cmp ("ebp",0);
&jne (&label("notP4")); &jne (&label("notintel"));
&or ("edx",1<<30); # set reserved bit#30 on Intel CPUs
&and (&HB("eax"),15); # familiy ID &and (&HB("eax"),15); # familiy ID
&cmp (&HB("eax"),15); # P4? &cmp (&HB("eax"),15); # P4?
&jne (&label("notP4")); &jne (&label("notintel"));
&or ("edx",1<<20); # use reserved bit to engage RC4_CHAR &or ("edx",1<<20); # set reserved bit#20 to engage RC4_CHAR
&set_label("notP4"); &set_label("notintel");
&bt ("edx",28); # test hyper-threading bit &bt ("edx",28); # test hyper-threading bit
&jnc (&label("generic")); &jnc (&label("generic"));
&and ("edx",0xefffffff); &and ("edx",0xefffffff);
......
...@@ -37,14 +37,13 @@ moment of this writing following bits are significant: ...@@ -37,14 +37,13 @@ moment of this writing following bits are significant:
=item bit #28 denoting Hyperthreading, which is used to distiguish =item bit #28 denoting Hyperthreading, which is used to distiguish
cores with shared cache; cores with shared cache;
=item bit #30, reserved by Intel, is used to choose among RC4 code =item bit #30, reserved by Intel, denotes specifically Intel CPUs;
paths;
=item bit #33 denoting availability of PCLMULQDQ instruction; =item bit #33 denoting availability of PCLMULQDQ instruction;
=item bit #41 denoting SSSE3, Supplemental SSE3, support; =item bit #41 denoting SSSE3, Supplemental SSE3, support;
=item bit #43 denoting AMD XOP support (forced to zero on Intel); =item bit #43 denoting AMD XOP support (forced to zero on non-AMD CPUs);
=item bit #57 denoting AES-NI instruction set extension; =item bit #57 denoting AES-NI instruction set extension;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册