Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
b4e2bd35
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b4e2bd35
编写于
9月 05, 2012
作者:
R
Richard Henderson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
target-s390: Send signals for divide
Signed-off-by:
N
Richard Henderson
<
rth@twiddle.net
>
上级
891452e5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
67 addition
and
6 deletion
+67
-6
target-s390x/cpu.h
target-s390x/cpu.h
+2
-0
target-s390x/int_helper.c
target-s390x/int_helper.c
+45
-6
target-s390x/misc_helper.c
target-s390x/misc_helper.c
+20
-0
未找到文件。
target-s390x/cpu.h
浏览文件 @
b4e2bd35
...
...
@@ -931,5 +931,7 @@ uint32_t set_cc_nz_f64(float64 v);
/* misc_helper.c */
void
program_interrupt
(
CPUS390XState
*
env
,
uint32_t
code
,
int
ilen
);
void
QEMU_NORETURN
runtime_exception
(
CPUS390XState
*
env
,
int
excp
,
uintptr_t
retaddr
);
#endif
target-s390x/int_helper.c
浏览文件 @
b4e2bd35
...
...
@@ -38,22 +38,54 @@ uint64_t HELPER(mul128)(CPUS390XState *env, uint64_t v1, uint64_t v2)
}
/* 64/32 -> 32 signed division */
int64_t
HELPER
(
divs32
)(
CPUS390XState
*
env
,
int64_t
a
,
int64_t
b
)
int64_t
HELPER
(
divs32
)(
CPUS390XState
*
env
,
int64_t
a
,
int64_t
b
64
)
{
env
->
retxl
=
a
%
(
int32_t
)
b
;
return
a
/
(
int32_t
)
b
;
int32_t
ret
,
b
=
b64
;
int64_t
q
;
if
(
b
==
0
)
{
runtime_exception
(
env
,
PGM_FIXPT_DIVIDE
,
GETPC
());
}
ret
=
q
=
a
/
b
;
env
->
retxl
=
a
%
b
;
/* Catch non-representable quotient. */
if
(
ret
!=
q
)
{
runtime_exception
(
env
,
PGM_FIXPT_DIVIDE
,
GETPC
());
}
return
ret
;
}
/* 64/32 -> 32 unsigned division */
uint64_t
HELPER
(
divu32
)(
CPUS390XState
*
env
,
uint64_t
a
,
uint64_t
b
)
uint64_t
HELPER
(
divu32
)(
CPUS390XState
*
env
,
uint64_t
a
,
uint64_t
b
64
)
{
env
->
retxl
=
a
%
(
uint32_t
)
b
;
return
a
/
(
uint32_t
)
b
;
uint32_t
ret
,
b
=
b64
;
uint64_t
q
;
if
(
b
==
0
)
{
runtime_exception
(
env
,
PGM_FIXPT_DIVIDE
,
GETPC
());
}
ret
=
q
=
a
/
b
;
env
->
retxl
=
a
%
b
;
/* Catch non-representable quotient. */
if
(
ret
!=
q
)
{
runtime_exception
(
env
,
PGM_FIXPT_DIVIDE
,
GETPC
());
}
return
ret
;
}
/* 64/64 -> 64 signed division */
int64_t
HELPER
(
divs64
)(
CPUS390XState
*
env
,
int64_t
a
,
int64_t
b
)
{
/* Catch divide by zero, and non-representable quotient (MIN / -1). */
if
(
b
==
0
||
(
b
==
-
1
&&
a
==
(
1ll
<<
63
)))
{
runtime_exception
(
env
,
PGM_FIXPT_DIVIDE
,
GETPC
());
}
env
->
retxl
=
a
%
b
;
return
a
/
b
;
}
...
...
@@ -63,6 +95,10 @@ uint64_t HELPER(divu64)(CPUS390XState *env, uint64_t ah, uint64_t al,
uint64_t
b
)
{
uint64_t
ret
;
/* Signal divide by zero. */
if
(
b
==
0
)
{
runtime_exception
(
env
,
PGM_FIXPT_DIVIDE
,
GETPC
());
}
if
(
ah
==
0
)
{
/* 64 -> 64/64 case */
env
->
retxl
=
al
%
b
;
...
...
@@ -75,6 +111,9 @@ uint64_t HELPER(divu64)(CPUS390XState *env, uint64_t ah, uint64_t al,
__uint128_t
q
=
a
/
b
;
env
->
retxl
=
a
%
b
;
ret
=
q
;
if
(
ret
!=
q
)
{
runtime_exception
(
env
,
PGM_FIXPT_DIVIDE
,
GETPC
());
}
#else
/* 32-bit hosts would need special wrapper functionality - just abort if
we encounter such a case; it's very unlikely anyways. */
...
...
target-s390x/misc_helper.c
浏览文件 @
b4e2bd35
...
...
@@ -41,6 +41,26 @@
#define HELPER_LOG(x...)
#endif
/* Raise an exception dynamically from a helper function. */
void
QEMU_NORETURN
runtime_exception
(
CPUS390XState
*
env
,
int
excp
,
uintptr_t
retaddr
)
{
int
t
;
env
->
exception_index
=
EXCP_PGM
;
env
->
int_pgm_code
=
excp
;
/* Use the (ultimate) callers address to find the insn that trapped. */
cpu_restore_state
(
env
,
retaddr
);
/* Advance past the insn. */
t
=
cpu_ldub_code
(
env
,
env
->
psw
.
addr
);
env
->
int_pgm_ilen
=
t
=
get_ilen
(
t
);
env
->
psw
.
addr
+=
2
*
t
;
cpu_loop_exit
(
env
);
}
/* Raise an exception statically from a TB. */
void
HELPER
(
exception
)(
CPUS390XState
*
env
,
uint32_t
excp
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录