summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2024-10-18 13:38:23 +0000
committerjsing <>2024-10-18 13:38:23 +0000
commit1387adbf66b874f8f42bfffea40941b18b02eaa2 (patch)
treee25ddd97df83b23b3087cc2435c7965bf43206a4
parentc3adbc1c81adde9927d8537128bb9cf20db03c1c (diff)
downloadopenbsd-1387adbf66b874f8f42bfffea40941b18b02eaa2.tar.gz
openbsd-1387adbf66b874f8f42bfffea40941b18b02eaa2.tar.bz2
openbsd-1387adbf66b874f8f42bfffea40941b18b02eaa2.zip
Remove now unused x86_64cpuid.pl.
-rw-r--r--src/lib/libcrypto/x86_64cpuid.pl147
1 files changed, 0 insertions, 147 deletions
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl
deleted file mode 100644
index a735a97f60..0000000000
--- a/src/lib/libcrypto/x86_64cpuid.pl
+++ /dev/null
@@ -1,147 +0,0 @@
1#!/usr/bin/env perl
2
3$flavour = shift;
4$output = shift;
5if ($flavour =~ /\./) { $output = $flavour; undef $flavour; }
6
7$0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1;
8( $xlate="${dir}x86_64-xlate.pl" and -f $xlate ) or
9( $xlate="${dir}perlasm/x86_64-xlate.pl" and -f $xlate) or
10die "can't locate x86_64-xlate.pl";
11
12open OUT,"| \"$^X\" $xlate $flavour $output";
13*STDOUT=*OUT;
14
15($arg1,$arg2,$arg3,$arg4)=("%rdi","%rsi","%rdx","%rcx"); # Unix order
16
17print<<___;
18.text
19.globl OPENSSL_ia32_cpuid
20.type OPENSSL_ia32_cpuid,\@abi-omnipotent
21.align 16
22OPENSSL_ia32_cpuid:
23 _CET_ENDBR
24 mov %rbx,%r8 # save %rbx
25
26 xor %eax,%eax
27 cpuid
28 mov %eax,%r11d # max value for standard query level
29
30 xor %eax,%eax
31 cmp \$0x756e6547,%ebx # "Genu"
32 setne %al
33 mov %eax,%r9d
34 cmp \$0x49656e69,%edx # "ineI"
35 setne %al
36 or %eax,%r9d
37 cmp \$0x6c65746e,%ecx # "ntel"
38 setne %al
39 or %eax,%r9d # 0 indicates Intel CPU
40 jz .Lintel
41
42 cmp \$0x68747541,%ebx # "Auth"
43 setne %al
44 mov %eax,%r10d
45 cmp \$0x69746E65,%edx # "enti"
46 setne %al
47 or %eax,%r10d
48 cmp \$0x444D4163,%ecx # "cAMD"
49 setne %al
50 or %eax,%r10d # 0 indicates AMD CPU
51 jnz .Lintel
52
53 # AMD specific
54 mov \$0x80000000,%eax
55 cpuid
56 cmp \$0x80000001,%eax
57 jb .Lintel
58 mov %eax,%r10d
59 mov \$0x80000001,%eax
60 cpuid
61 or %ecx,%r9d
62 and \$IA32CAP_MASK1_AMD_XOP,%r9d # isolate AMD XOP bit
63 or \$1,%r9d # make sure %r9d is not zero
64
65 cmp \$0x80000008,%r10d
66 jb .Lintel
67
68 mov \$0x80000008,%eax
69 cpuid
70 movzb %cl,%r10 # number of cores - 1
71 inc %r10 # number of cores
72
73 mov \$1,%eax
74 cpuid
75 bt \$IA32CAP_BIT0_HT,%edx # test hyper-threading bit
76 jnc .Lgeneric
77 shr \$16,%ebx # number of logical processors
78 cmp %r10b,%bl
79 ja .Lgeneric
80 xor \$IA32CAP_MASK0_HT,%edx
81 jmp .Lgeneric
82
83.Lintel:
84 cmp \$4,%r11d
85 mov \$-1,%r10d
86 jb .Lnocacheinfo
87
88 mov \$4,%eax
89 mov \$0,%ecx # query L1D
90 cpuid
91 mov %eax,%r10d
92 shr \$14,%r10d
93 and \$0xfff,%r10d # number of cores -1 per L1D
94
95.Lnocacheinfo:
96 mov \$1,%eax
97 cpuid
98 # force reserved bits to 0
99 and \$(~(IA32CAP_MASK0_INTELP4 | IA32CAP_MASK0_INTEL)),%edx
100 cmp \$0,%r9d
101 jne .Lnotintel
102 # set reserved bit#30 on Intel CPUs
103 or \$IA32CAP_MASK0_INTEL,%edx
104 and \$15,%ah
105 cmp \$15,%ah # examine Family ID
106 jne .Lnotintel
107 # set reserved bit#20 to engage RC4_CHAR
108 or \$IA32CAP_MASK0_INTELP4,%edx
109.Lnotintel:
110 bt \$IA32CAP_BIT0_HT,%edx # test hyper-threading bit
111 jnc .Lgeneric
112 xor \$IA32CAP_MASK0_HT,%edx
113 cmp \$0,%r10d
114 je .Lgeneric
115
116 or \$IA32CAP_MASK0_HT,%edx
117 shr \$16,%ebx
118 cmp \$1,%bl # see if cache is shared
119 ja .Lgeneric
120 xor \$IA32CAP_MASK0_HT,%edx # clear hyper-threading bit if not
121
122.Lgeneric:
123 and \$IA32CAP_MASK1_AMD_XOP,%r9d # isolate AMD XOP flag
124 and \$(~IA32CAP_MASK1_AMD_XOP),%ecx
125 or %ecx,%r9d # merge AMD XOP flag
126
127 mov %edx,%r10d # %r9d:%r10d is copy of %ecx:%edx
128 bt \$IA32CAP_BIT1_OSXSAVE,%r9d # check OSXSAVE bit
129 jnc .Lclear_avx
130 xor %ecx,%ecx # XCR0
131 .byte 0x0f,0x01,0xd0 # xgetbv
132 and \$6,%eax # isolate XMM and YMM state support
133 cmp \$6,%eax
134 je .Ldone
135.Lclear_avx:
136 mov \$(~(IA32CAP_MASK1_AVX | IA32CAP_MASK1_FMA3 | IA32CAP_MASK1_AMD_XOP)),%eax
137 and %eax,%r9d # clear AVX, FMA and AMD XOP bits
138.Ldone:
139 shl \$32,%r9
140 mov %r10d,%eax
141 mov %r8,%rbx # restore %rbx
142 or %r9,%rax
143 ret
144.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
145___
146
147close STDOUT; # flush