Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Openssl
提交
5d0d60e2
T
Third Party Openssl
项目概览
OpenHarmony
/
Third Party Openssl
1 年多 前同步成功
通知
10
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看板
提交
5d0d60e2
编写于
5月 07, 2005
作者:
A
Andy Polyakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
x86_64 assembler translator update.
上级
57ee0070
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
19 deletion
+47
-19
crypto/perlasm/x86_64-xlate.pl
crypto/perlasm/x86_64-xlate.pl
+47
-19
未找到文件。
crypto/perlasm/x86_64-xlate.pl
浏览文件 @
5d0d60e2
...
...
@@ -42,6 +42,19 @@
# 6. Don't use [or hand-code with .byte] "rep ret." "ret" mnemonic is
# required to identify the spots, where to inject Win64 epilogue!
# But on the pros, it's then prefixed with rep automatically:-)
# 7. Due to MASM limitations [and certain general counter-intuitivity
# of ip-relative addressing] generation of position-independent
# code is assisted by synthetic directive, .picmeup, which puts
# address of the *next* instruction into target register.
#
# Example 1:
# .picmeup %rax
# lea .Label-.(%rax),%rax
# Example 2:
# .picmeup %rcx
# .Lpic_point:
# ...
# lea .Label-.Lpic_point(%rcx),%rbp
my
$output
=
shift
;
open
STDOUT
,"
>
$output
"
||
die
"
can't open
$output
: $!
";
...
...
@@ -113,14 +126,18 @@ my $current_function;
$self
->
{
value
}
=
$
1
;
$ret
=
$self
;
$line
=
substr
(
$line
,
@
+
[
0
]);
$line
=~
s/^\s+//
;
$self
->
{
value
}
=
oct
(
$self
->
{
value
})
if
(
$self
->
{
value
}
=~
/^0/
);
}
$ret
;
}
sub
out
{
my
$self
=
shift
;
sprintf
$masm
?"
0%xh
":"
\$
0x%x
",
$self
->
{
value
};
if
(
!
$masm
)
{
sprintf
"
\$
%s
",
$self
->
{
value
};
}
else
{
$self
->
{
value
}
=~
s/0x([0-9a-f]+)/0$1h/ig
;
sprintf
"
%s
",
$self
->
{
value
};
}
}
}
{
package
ea
;
# pick up effective addresses: expr(%reg,%reg,scale)
...
...
@@ -156,8 +173,7 @@ my $current_function;
sprintf
"
%s(%%%s,%%%s,%d)
",
$self
->
{
label
},
$self
->
{
base
},
$self
->
{
index
},
$self
->
{
scale
};
}
else
{
}
else
{
sprintf
"
%s(%%%s)
",
$self
->
{
label
},
$self
->
{
base
};
}
}
else
{
...
...
@@ -172,8 +188,7 @@ my $current_function;
$self
->
{
label
},
$self
->
{
index
},
$self
->
{
scale
},
$self
->
{
base
};
}
else
{
}
else
{
sprintf
"
%s PTR %s[%s]
",
$szmap
{
$sz
},
$self
->
{
label
},
$self
->
{
base
};
}
...
...
@@ -281,13 +296,26 @@ my $current_function;
local
*line
=
shift
;
undef
$ret
;
my
$dir
;
my
%opcode
=
# lea 2f-1f(%rip),%dst; 1: nop; 2:
(
"
%rax
"
=>
0x01058d48
,
"
%rcx
"
=>
0x010d8d48
,
"
%rdx
"
=>
0x01158d48
,
"
%rbx
"
=>
0x011d8d48
,
"
%rsp
"
=>
0x01258d48
,
"
%rbp
"
=>
0x012d8d48
,
"
%rsi
"
=>
0x01358d48
,
"
%rdi
"
=>
0x013d8d48
,
"
%r8
"
=>
0x01058d4c
,
"
%r9
"
=>
0x010d8d4c
,
"
%r10
"
=>
0x01158d4c
,
"
%r11
"
=>
0x011d8d4c
,
"
%r12
"
=>
0x01258d4c
,
"
%r13
"
=>
0x012d8d4c
,
"
%r14
"
=>
0x01358d4c
,
"
%r15
"
=>
0x013d8d4c
);
if
(
$line
=~
/^\s*(\.\w+)/
)
{
if
(
!
$masm
)
{
$self
->
{
value
}
=
$
1
;
$line
=~
s/\@abi\-omnipotent/\@function/
;
$line
=~
s/\@function.*/\@function/
;
$self
->
{
value
}
=
$line
;
if
(
$line
=~
/\.picmeup\s+(%r[\w]+)/i
)
{
$self
->
{
value
}
=
sprintf
"
\t
.long
\t
0x%x,0x90000000
",
$opcode
{
$
1
};
}
else
{
$self
->
{
value
}
=
$line
;
}
$line
=
"";
return
$self
;
}
...
...
@@ -308,20 +336,19 @@ my $current_function;
};
/\.globl/
&&
do
{
$self
->
{
value
}
=
"
PUBLIC
\t
"
.
$line
;
last
;
};
/\.type/
&&
do
{
(
$sym
,
$type
,
$narg
)
=
split
('
,
',
$line
);
if
(
$type
eq
"
\@
function
")
{
undef
$current_function
;
if
(
$type
eq
"
\@
function
")
{
undef
$current_function
;
$current_function
->
{
name
}
=
$sym
;
$current_function
->
{
abi
}
=
"
svr4
";
$current_function
->
{
narg
}
=
$narg
;
}
elsif
(
$type
eq
"
\@
abi-omnipotent
")
{
undef
$current_function
;
}
elsif
(
$type
eq
"
\@
abi-omnipotent
")
{
undef
$current_function
;
$current_function
->
{
name
}
=
$sym
;
}
last
;
};
/\.size/
&&
do
{
if
(
defined
(
$current_function
))
{
$self
->
{
value
}
=
"
$current_function
->{name}
\t
ENDP
";
/\.size/
&&
do
{
if
(
defined
(
$current_function
))
{
$self
->
{
value
}
=
"
$current_function
->{name}
\t
ENDP
";
undef
$current_function
;
}
last
;
...
...
@@ -338,6 +365,9 @@ my $current_function;
$self
->
{
value
}
.=
sprintf
"
0%Xh
",
oct
(
$last
);
last
;
};
/\.picmeup/
&&
do
{
$self
->
{
value
}
=
sprintf
"
\t
DD
\t
0%Xh,090000000h
",
$opcode
{
$line
};
last
;
};
}
$line
=
"";
}
...
...
@@ -391,13 +421,11 @@ while($line=<>) {
if
(
!
$masm
)
{
printf
"
\t
%s
\t
%s,%s
",
$opcode
->
out
(
$dst
->
size
()),
$src
->
out
(
$sz
),
$dst
->
out
(
$sz
);
}
else
{
}
else
{
printf
"
\t
%s
\t
%s,%s
",
$opcode
->
out
(),
$dst
->
out
(
$sz
),
$src
->
out
(
$sz
);
}
}
elsif
(
defined
(
$src
))
{
}
elsif
(
defined
(
$src
))
{
printf
"
\t
%s
\t
%s
",
$opcode
->
out
(),
$src
->
out
(
$sz
);
}
else
{
printf
"
\t
%s
",
$opcode
->
out
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录