Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
recolic-hust
hust-x86-simulator
Commits
5b11c6b8
Verified
Commit
5b11c6b8
authored
Dec 29, 2019
by
Recolic Keghart
Browse files
trial
parent
6f8b0120
Changes
4
Hide whitespace changes
Inline
Side-by-side
nemu/Makefile
View file @
5b11c6b8
...
...
@@ -19,8 +19,8 @@ include Makefile.git
CXX
?=
g++
LD
=
$(CXX)
INCLUDES
=
$(
addprefix
-I
,
$(INC_DIR)
)
CFLAGS
+=
-O
2
-MMD
-Wall
-ggdb
3
$(INCLUDES)
-fomit-frame-pointer
-std
=
c++17
CFLAGS
+=
-DDIFF_TEST_QEMU
CFLAGS
+=
-O
3
-MMD
-Wall
-ggdb
$(INCLUDES)
-fomit-frame-pointer
-std
=
c++17
#
CFLAGS += -DDIFF_TEST_QEMU
# Source code generation before any targets.
SUBDIRS
=
src/monitor/debug/expr_impl
...
...
nemu/include/common.h
View file @
5b11c6b8
#ifndef __COMMON_H__
#define __COMMON_H__
#define DEBUG
//
#define DEBUG
//#define DIFF_TEST
#if _SHARE
...
...
nemu/src/cpu/exec/exec.cc
View file @
5b11c6b8
...
...
@@ -14,10 +14,8 @@ typedef struct {
#define EMPTY EX(inv)
static
inline
void
set_width
(
int
width
)
{
if
(
width
==
0
)
{
width
=
decoding
.
is_operand_size_16
?
2
:
4
;
}
decoding
.
src
.
width
=
decoding
.
dest
.
width
=
decoding
.
src2
.
width
=
width
;
const
auto
tmp
=
width
==
0
?
(
decoding
.
is_operand_size_16
?
2
:
4
)
:
width
;
decoding
.
src
.
width
=
decoding
.
dest
.
width
=
decoding
.
src2
.
width
=
tmp
;
}
/* Instruction Decode and EXecute */
...
...
@@ -211,7 +209,7 @@ namespace EHelperImpl {
idex
(
eip
,
&
opcode_table
[
opcode
]);
}
make_EHelper
(
real
)
{
__attribute__
((
hot
))
make_EHelper
(
real
)
{
uint32_t
opcode
=
instr_fetch
(
eip
,
1
);
decoding
.
opcode
=
opcode
;
set_width
(
opcode_table
[
opcode
].
width
);
...
...
nemu/src/memory/memory.cc
View file @
5b11c6b8
...
...
@@ -11,7 +11,14 @@ uint8_t pmem[PMEM_SIZE];
/* 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
));
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment