Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hust-x86-simulator
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
recolic-hust
hust-x86-simulator
Commits
5b11c6b8
There was an error fetching the commit references. Please try again later.
Verified
Commit
5b11c6b8
authored
5 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
trial
parent
6f8b0120
No related branches found
No related tags found
1 merge request
!2
Performance tune
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
nemu/Makefile
+2
-2
2 additions, 2 deletions
nemu/Makefile
nemu/include/common.h
+1
-1
1 addition, 1 deletion
nemu/include/common.h
nemu/src/cpu/exec/exec.cc
+3
-5
3 additions, 5 deletions
nemu/src/cpu/exec/exec.cc
nemu/src/memory/memory.cc
+8
-1
8 additions, 1 deletion
nemu/src/memory/memory.cc
with
14 additions
and
9 deletions
nemu/Makefile
+
2
−
2
View file @
5b11c6b8
...
@@ -19,8 +19,8 @@ include Makefile.git
...
@@ -19,8 +19,8 @@ include Makefile.git
CXX
?=
g++
CXX
?=
g++
LD
=
$(
CXX
)
LD
=
$(
CXX
)
INCLUDES
=
$(
addprefix
-I
,
$(
INC_DIR
))
INCLUDES
=
$(
addprefix
-I
,
$(
INC_DIR
))
CFLAGS
+=
-O
2
-MMD
-Wall
-ggdb
3
$(
INCLUDES
)
-fomit-frame-pointer
-std
=
c++17
CFLAGS
+=
-O
3
-MMD
-Wall
-ggdb
$(
INCLUDES
)
-fomit-frame-pointer
-std
=
c++17
CFLAGS
+=
-DDIFF_TEST_QEMU
#
CFLAGS += -DDIFF_TEST_QEMU
# Source code generation before any targets.
# Source code generation before any targets.
SUBDIRS
=
src/monitor/debug/expr_impl
SUBDIRS
=
src/monitor/debug/expr_impl
...
...
This diff is collapsed.
Click to expand it.
nemu/include/common.h
+
1
−
1
View file @
5b11c6b8
#ifndef __COMMON_H__
#ifndef __COMMON_H__
#define __COMMON_H__
#define __COMMON_H__
#define DEBUG
//
#define DEBUG
//#define DIFF_TEST
//#define DIFF_TEST
#if _SHARE
#if _SHARE
...
...
This diff is collapsed.
Click to expand it.
nemu/src/cpu/exec/exec.cc
+
3
−
5
View file @
5b11c6b8
...
@@ -14,10 +14,8 @@ typedef struct {
...
@@ -14,10 +14,8 @@ typedef struct {
#define EMPTY EX(inv)
#define EMPTY EX(inv)
static
inline
void
set_width
(
int
width
)
{
static
inline
void
set_width
(
int
width
)
{
if
(
width
==
0
)
{
const
auto
tmp
=
width
==
0
?
(
decoding
.
is_operand_size_16
?
2
:
4
)
:
width
;
width
=
decoding
.
is_operand_size_16
?
2
:
4
;
decoding
.
src
.
width
=
decoding
.
dest
.
width
=
decoding
.
src2
.
width
=
tmp
;
}
decoding
.
src
.
width
=
decoding
.
dest
.
width
=
decoding
.
src2
.
width
=
width
;
}
}
/* Instruction Decode and EXecute */
/* Instruction Decode and EXecute */
...
@@ -211,7 +209,7 @@ namespace EHelperImpl {
...
@@ -211,7 +209,7 @@ namespace EHelperImpl {
idex
(
eip
,
&
opcode_table
[
opcode
]);
idex
(
eip
,
&
opcode_table
[
opcode
]);
}
}
make_EHelper
(
real
)
{
__attribute__
((
hot
))
make_EHelper
(
real
)
{
uint32_t
opcode
=
instr_fetch
(
eip
,
1
);
uint32_t
opcode
=
instr_fetch
(
eip
,
1
);
decoding
.
opcode
=
opcode
;
decoding
.
opcode
=
opcode
;
set_width
(
opcode_table
[
opcode
].
width
);
set_width
(
opcode_table
[
opcode
].
width
);
...
...
This diff is collapsed.
Click to expand it.
nemu/src/memory/memory.cc
+
8
−
1
View file @
5b11c6b8
...
@@ -11,7 +11,14 @@ uint8_t pmem[PMEM_SIZE];
...
@@ -11,7 +11,14 @@ uint8_t pmem[PMEM_SIZE];
/* Memory accessing interfaces */
/* Memory accessing interfaces */
uint32_t
paddr_read
(
paddr_t
addr
,
int
len
)
{
__attribute__
((
hot
))
uint32_t
paddr_read
(
paddr_t
addr
,
int
len
)
{
switch
(
len
)
{
case
4
:
return
pmem_rw
(
addr
,
uint32_t
);
case
2
:
return
pmem_rw
(
addr
,
uint32_t
)
&
0x0000ffff
;
case
1
:
return
pmem_rw
(
addr
,
uint32_t
)
&
0x000000ff
;
case
3
:
return
pmem_rw
(
addr
,
uint32_t
)
&
0x00ffffff
;
case
0
:
return
0
;
}
return
pmem_rw
(
addr
,
uint32_t
)
&
(
~
0u
>>
((
4
-
len
)
<<
3
));
return
pmem_rw
(
addr
,
uint32_t
)
&
(
~
0u
>>
((
4
-
len
)
<<
3
));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment