Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
932cc129
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
大约 1 年 前同步成功
通知
9
Star
18
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
932cc129
编写于
5月 14, 2007
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
x86_64 assembler updates.
上级
1a42839b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
48 addition
and
73 deletion
+48
-73
crypto/perlasm/x86_64-xlate.pl
crypto/perlasm/x86_64-xlate.pl
+16
-3
crypto/x86_64cpuid.pl
crypto/x86_64cpuid.pl
+32
-70
未找到文件。
crypto/perlasm/x86_64-xlate.pl
浏览文件 @
932cc129
...
...
@@ -57,7 +57,13 @@
# lea .Label-.Lpic_point(%rcx),%rbp
my
$output
=
shift
;
open
STDOUT
,"
>
$output
"
||
die
"
can't open
$output
: $!
";
{
my
(
$stddev
,
$stdino
,
@junk
)
=
stat
(
STDOUT
);
my
(
$outdev
,
$outino
,
@junk
)
=
stat
(
$output
);
open
STDOUT
,"
>
$output
"
||
die
"
can't open
$output
: $!
"
if
(
$stddev
!=
$outdev
||
$stdino
!=
$outino
);
}
my
$masm
=
1
if
(
$output
=~
/\.asm/
);
...
...
@@ -70,7 +76,7 @@ my $current_function;
local
*line
=
shift
;
undef
$ret
;
if
(
$line
=~
/^([a-z]
+
)/i
)
{
if
(
$line
=~
/^([a-z]
[a-z0-9]*
)/i
)
{
$self
->
{
op
}
=
$
1
;
$ret
=
$self
;
$line
=
substr
(
$line
,
@
+
[
0
]);
$line
=~
s/^\s+//
;
...
...
@@ -95,8 +101,10 @@ my $current_function;
sub
out
{
my
$self
=
shift
;
if
(
!
$masm
)
{
if
(
$self
->
{
op
}
eq
"
movz
")
{
# movz i
n
pain...
if
(
$self
->
{
op
}
eq
"
movz
")
{
# movz i
s
pain...
sprintf
"
%s%s%s
",
$self
->
{
op
},
$self
->
{
sz
},
shift
;
}
elsif
(
$self
->
{
op
}
=~
/^set/
)
{
"
$self
->{op}
";
}
elsif
(
$self
->
{
op
}
eq
"
ret
")
{
"
.byte 0xf3,0xc3
";
}
else
{
...
...
@@ -198,6 +206,8 @@ my $current_function;
$self
->
{
label
},
$self
->
{
index
},
$self
->
{
scale
},
$self
->
{
base
};
}
elsif
(
$self
->
{
base
}
eq
"
rip
")
{
sprintf
"
%s PTR %s
",
$szmap
{
$sz
},
$self
->
{
label
};
}
else
{
sprintf
"
%s PTR %s[%s]
",
$szmap
{
$sz
},
$self
->
{
label
},
$self
->
{
base
};
...
...
@@ -325,6 +335,8 @@ my $current_function;
$self
->
{
value
}
=
sprintf
"
\t
.long
\t
0x%x,0x90000000
",
$opcode
{
$
1
};
}
elsif
(
$line
=~
/\.asciz\s+"(.*)"$/
)
{
$self
->
{
value
}
=
"
.byte
\t
"
.
join
("
,
",
unpack
("
C*
",
$
1
),
0
);
}
elsif
(
$line
=~
/\.extern/
)
{
$self
->
{
value
}
=
"";
# swallow extern
}
else
{
$self
->
{
value
}
=
$line
;
}
...
...
@@ -346,6 +358,7 @@ my $current_function;
$self
->
{
value
}
=
$v
;
last
;
};
/\.extern/
&&
do
{
$self
->
{
value
}
=
"
EXTRN
\t
"
.
$line
;
last
;
};
/\.globl/
&&
do
{
$self
->
{
value
}
=
"
PUBLIC
\t
"
.
$line
;
last
;
};
/\.type/
&&
do
{
(
$sym
,
$type
,
$narg
)
=
split
('
,
',
$line
);
if
(
$type
eq
"
\@
function
")
{
...
...
crypto/x86_64cpuid.pl
浏览文件 @
932cc129
#!/usr/bin/env perl
$output
=
shift
;
$
win64a
=
1
if
(
$output
=~
/win64a\.[s|asm]
/
);
$
masm
=
1
if
(
$output
=~
/\.asm
/
);
open
STDOUT
,"
>
$output
"
||
die
"
can't open
$output
: $!
";
print
<<
___
if
(
defined
(
$
win64a
));
print
<<
___
if
(
defined
(
$
masm
));
_TEXT
SEGMENT
PUBLIC
OPENSSL_rdtsc
ALIGN
16
OPENSSL_rdtsc
PROC
rdtsc
shl
rdx
,
32
or
rax
,
rdx
ret
OPENSSL_rdtsc
ENDP
PUBLIC
OPENSSL_atomic_add
ALIGN
16
...
...
@@ -45,64 +38,16 @@ OPENSSL_wipe_cpu PROC
lea
rax
,
QWORD
PTR
[
rsp
+
8
]
ret
OPENSSL_wipe_cpu
ENDP
OPENSSL_ia32_cpuid
PROC
mov
r8
,
rbx
xor
eax
,
eax
cpuid
xor
eax
,
eax
cmp
ebx
,
0756
e6547h
setne
al
mov
r9d
,
eax
cmp
edx
,
04
9656e69
h
setne
al
or
r9d
,
eax
cmp
ecx
,
06
c65746eh
setne
al
or
r9d
,
eax
mov
eax
,
1
cpuid
bt
edx
,
28
jnc
\
$Ldone
cmp
r9
,
0
jne
\
$Lnotintel
or
edx
,
000100000
h
and
ah
,
15
cmp
ah
,
15
je
\
$Lnotintel
or
edx
,
040000000
h
\
$Lnotintel:
shr
ebx
,
16
cmp
bl
,
1
ja
\
$Ldone
and
edx
,
0
efffffffh
\
$Ldone:
shl
rcx
,
32
mov
eax
,
edx
mov
rbx
,
r8
or
rax
,
rcx
ret
OPENSSL_ia32_cpuid
ENDP
_TEXT
ENDS
CRT
\
$XIU
SEGMENT
EXTRN
OPENSSL_cpuid_setup:PROC
DQ
OPENSSL_cpuid_setup
CRT
\
$XIU
ENDS
END
___
print
<<
___
if
(
!
defined
(
$
win64a
));
print
<<
___
if
(
!
defined
(
$
masm
));
.
text
.
globl
OPENSSL_rdtsc
.
align
16
OPENSSL_rdtsc:
rdtsc
shlq
\
$
32
,
%rdx
orq
%rdx
,
%rax
ret
.
size
OPENSSL_rdtsc
,
.-
OPENSSL_rdtsc
.
globl
OPENSSL_atomic_add
.
type
OPENSSL_atomic_add
,
\
@function
...
...
@@ -149,10 +94,30 @@ OPENSSL_wipe_cpu:
ret
.
size
OPENSSL_wipe_cpu
,
.-
OPENSSL_wipe_cpu
.
section
.
init
call
OPENSSL_cpuid_setup
___
open
STDOUT
,"
| $^X perlasm/x86_64-xlate.pl
$output
";
print
<<___;
.text
.globl OPENSSL_rdtsc
.type OPENSSL_rdtsc,\@abi-omnipotent
.align 16
OPENSSL_rdtsc:
rdtsc
shl \$32,%rdx
or %rdx,%rax
ret
.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
.globl OPENSSL_ia32_cpuid
.type OPENSSL_ia32_cpuid,\@abi-omnipotent
.align 16
OPENSSL_ia32_cpuid:
mov
q
%rbx
,
%r8
mov %rbx,%r8
xor %eax,%eax
cpuid
...
...
@@ -167,11 +132,11 @@ OPENSSL_ia32_cpuid:
setne %al
or %eax,%r9d
mov
l
\
$
1
,
%eax
mov \$1,%eax
cpuid
bt \$28,%edx # test hyper-threading bit
jnc .Ldone
cmp
\
$
0
,
%r9
cmp \$0,%r9
d
jne .Lnotintel
or \$1<<20,%edx # use reserved bit to engage RC4_CHAR
and \$15,%ah
...
...
@@ -182,15 +147,12 @@ OPENSSL_ia32_cpuid:
shr \$16,%ebx
cmp \$1,%bl # see if cache is shared
ja .Ldone
and
\
$
~
(
1
<<
28
),
%edx
and \$
0xefffffff,%edx # ~(1<<28)
.Ldone:
shl
q
\
$
32
,
%rcx
mov
l
%edx
,
%eax
mov
q
%r8
,
%rbx
or
q
%rcx
,
%rax
shl \$32,%rcx
mov %edx,%eax
mov %r8,%rbx
or %rcx,%rax
ret
.size OPENSSL_ia32_cpuid,.-OPENSSL_ia32_cpuid
.
section
.
init
call
OPENSSL_cpuid_setup
___
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录