Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
NEMU
提交
8da72079
N
NEMU
项目概览
OpenXiangShan
/
NEMU
11 个月 前同步成功
通知
7
Star
171
Fork
67
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NEMU
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8da72079
编写于
9月 13, 2019
作者:
Z
Zihao Yu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
monitor,diff-test: add port to QEMU
* now different instances can connect to QEMU via different ports
上级
9738abcc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
13 deletion
+18
-13
src/monitor/diff-test/diff-test.c
src/monitor/diff-test/diff-test.c
+3
-3
src/monitor/monitor.c
src/monitor/monitor.c
+5
-3
tools/qemu-diff/src/diff-test.c
tools/qemu-diff/src/diff-test.c
+8
-5
tools/qemu-diff/src/gdb-host.c
tools/qemu-diff/src/gdb-host.c
+2
-2
未找到文件。
src/monitor/diff-test/diff-test.c
浏览文件 @
8da72079
...
...
@@ -45,7 +45,7 @@ void difftest_skip_dut(int nr_ref, int nr_dut) {
bool
isa_difftest_checkregs
(
CPU_state
*
ref_r
,
vaddr_t
pc
);
void
isa_difftest_attach
(
void
);
void
init_difftest
(
char
*
ref_so_file
,
long
img_size
)
{
void
init_difftest
(
char
*
ref_so_file
,
long
img_size
,
int
port
)
{
#ifndef DIFF_TEST
return
;
#endif
...
...
@@ -68,7 +68,7 @@ void init_difftest(char *ref_so_file, long img_size) {
ref_difftest_exec
=
dlsym
(
handle
,
"difftest_exec"
);
assert
(
ref_difftest_exec
);
void
(
*
ref_difftest_init
)(
void
)
=
dlsym
(
handle
,
"difftest_init"
);
void
(
*
ref_difftest_init
)(
int
)
=
dlsym
(
handle
,
"difftest_init"
);
assert
(
ref_difftest_init
);
Log
(
"Differential testing:
\33
[1;32m%s
\33
[0m"
,
"ON"
);
...
...
@@ -76,7 +76,7 @@ void init_difftest(char *ref_so_file, long img_size) {
"This will help you a lot for debugging, but also significantly reduce the performance. "
"If it is not necessary, you can turn it off in include/common.h."
,
ref_so_file
);
ref_difftest_init
();
ref_difftest_init
(
port
);
ref_difftest_memcpy_from_dut
(
PC_START
,
guest_to_host
(
IMAGE_START
),
img_size
);
char
*
mainargs
=
guest_to_host
(
0
);
ref_difftest_memcpy_from_dut
(
PC_START
-
IMAGE_START
,
mainargs
,
strlen
(
mainargs
)
+
1
);
...
...
src/monitor/monitor.c
浏览文件 @
8da72079
...
...
@@ -7,13 +7,14 @@ void init_isa();
void
init_regex
();
void
init_wp_pool
();
void
init_device
();
void
init_difftest
(
char
*
ref_so_file
,
long
img_size
);
void
init_difftest
(
char
*
ref_so_file
,
long
img_size
,
int
port
);
static
char
*
mainargs
=
""
;
static
char
*
log_file
=
NULL
;
static
char
*
diff_so_file
=
NULL
;
static
char
*
img_file
=
NULL
;
static
int
is_batch_mode
=
false
;
static
int
difftest_port
=
1234
;
static
inline
void
welcome
()
{
#ifdef DEBUG
...
...
@@ -64,10 +65,11 @@ static inline long load_img() {
static
inline
void
parse_args
(
int
argc
,
char
*
argv
[])
{
int
o
;
while
(
(
o
=
getopt
(
argc
,
argv
,
"-bl:d:a:"
))
!=
-
1
)
{
while
(
(
o
=
getopt
(
argc
,
argv
,
"-bl:d:a:
p:
"
))
!=
-
1
)
{
switch
(
o
)
{
case
'b'
:
is_batch_mode
=
true
;
break
;
case
'a'
:
mainargs
=
optarg
;
break
;
case
'p'
:
sscanf
(
optarg
,
"%d"
,
&
difftest_port
);
break
;
case
'l'
:
log_file
=
optarg
;
break
;
case
'd'
:
diff_so_file
=
optarg
;
break
;
case
1
:
...
...
@@ -105,7 +107,7 @@ int init_monitor(int argc, char *argv[]) {
init_device
();
/* Initialize differential testing. */
init_difftest
(
diff_so_file
,
img_size
);
init_difftest
(
diff_so_file
,
img_size
,
difftest_port
);
/* Display welcome message. */
welcome
();
...
...
tools/qemu-diff/src/diff-test.c
浏览文件 @
8da72079
...
...
@@ -3,7 +3,7 @@
#include <signal.h>
#include "isa.h"
bool
gdb_connect_qemu
(
void
);
bool
gdb_connect_qemu
(
int
);
bool
gdb_memcpy_to_qemu
(
uint32_t
,
void
*
,
int
);
bool
gdb_getregs
(
union
isa_gdb_regs
*
);
bool
gdb_setregs
(
union
isa_gdb_regs
*
);
...
...
@@ -34,7 +34,10 @@ void difftest_exec(uint64_t n) {
while
(
n
--
)
gdb_si
();
}
void
difftest_init
(
void
)
{
void
difftest_init
(
int
port
)
{
char
buf
[
32
];
sprintf
(
buf
,
"tcp::%d"
,
port
);
int
ppid_before_fork
=
getpid
();
int
pid
=
fork
();
if
(
pid
==
-
1
)
{
...
...
@@ -57,15 +60,15 @@ void difftest_init(void) {
}
close
(
STDIN_FILENO
);
execlp
(
ISA_QEMU_BIN
,
ISA_QEMU_BIN
,
ISA_QEMU_ARGS
"-S"
,
"-
s"
,
"-nographic"
,
NULL
);
execlp
(
ISA_QEMU_BIN
,
ISA_QEMU_BIN
,
ISA_QEMU_ARGS
"-S"
,
"-
gdb"
,
buf
,
"-nographic"
,
NULL
);
perror
(
"exec"
);
assert
(
0
);
}
else
{
// father
gdb_connect_qemu
();
printf
(
"Connect to QEMU
successfully
\n
"
);
gdb_connect_qemu
(
port
);
printf
(
"Connect to QEMU
with %s tcpsuccessfully
\n
"
,
buf
);
atexit
(
gdb_exit
);
...
...
tools/qemu-diff/src/gdb-host.c
浏览文件 @
8da72079
...
...
@@ -2,9 +2,9 @@
static
struct
gdb_conn
*
conn
;
bool
gdb_connect_qemu
(
void
)
{
bool
gdb_connect_qemu
(
int
port
)
{
// connect to gdbserver on localhost port 1234
while
((
conn
=
gdb_begin_inet
(
"127.0.0.1"
,
1234
))
==
NULL
)
{
while
((
conn
=
gdb_begin_inet
(
"127.0.0.1"
,
port
))
==
NULL
)
{
usleep
(
1
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录