Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
NEMU
提交
f2231da1
N
NEMU
项目概览
OpenXiangShan
/
NEMU
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
f2231da1
编写于
11月 15, 2020
作者:
Z
Zhou Yaoyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Migrate to CPP
上级
70c3fff1
变更
37
隐藏空白更改
内联
并排
Showing
37 changed file
with
324 addition
and
21 deletion
+324
-21
Makefile
Makefile
+6
-5
include/rtl/rtl.h
include/rtl/rtl.h
+1
-0
src/device/device.c
src/device/device.c
+1
-1
src/device/keyboard.c
src/device/keyboard.c
+89
-4
src/device/timer.c
src/device/timer.c
+1
-1
src/isa/riscv64/clint.c
src/isa/riscv64/clint.c
+1
-1
src/isa/riscv64/reg.c
src/isa/riscv64/reg.c
+6
-4
src/isa/riscv64/softfloat/platform.h
src/isa/riscv64/softfloat/platform.h
+2
-1
src/isa/riscv64/softfloat/s_add128.c
src/isa/riscv64/softfloat/s_add128.c
+8
-0
src/isa/riscv64/softfloat/s_add256M.c
src/isa/riscv64/softfloat/s_add256M.c
+8
-0
src/isa/riscv64/softfloat/s_approxRecipSqrt32_1.c
src/isa/riscv64/softfloat/s_approxRecipSqrt32_1.c
+8
-0
src/isa/riscv64/softfloat/s_countLeadingZeros16.c
src/isa/riscv64/softfloat/s_countLeadingZeros16.c
+8
-0
src/isa/riscv64/softfloat/s_countLeadingZeros32.c
src/isa/riscv64/softfloat/s_countLeadingZeros32.c
+8
-0
src/isa/riscv64/softfloat/s_countLeadingZeros64.c
src/isa/riscv64/softfloat/s_countLeadingZeros64.c
+8
-0
src/isa/riscv64/softfloat/s_eq128.c
src/isa/riscv64/softfloat/s_eq128.c
+8
-0
src/isa/riscv64/softfloat/s_le128.c
src/isa/riscv64/softfloat/s_le128.c
+8
-0
src/isa/riscv64/softfloat/s_lt128.c
src/isa/riscv64/softfloat/s_lt128.c
+8
-0
src/isa/riscv64/softfloat/s_mul128By32.c
src/isa/riscv64/softfloat/s_mul128By32.c
+8
-0
src/isa/riscv64/softfloat/s_mul128To256M.c
src/isa/riscv64/softfloat/s_mul128To256M.c
+8
-0
src/isa/riscv64/softfloat/s_mul64ByShifted32To128.c
src/isa/riscv64/softfloat/s_mul64ByShifted32To128.c
+8
-0
src/isa/riscv64/softfloat/s_mul64To128.c
src/isa/riscv64/softfloat/s_mul64To128.c
+8
-0
src/isa/riscv64/softfloat/s_shiftRightJam128.c
src/isa/riscv64/softfloat/s_shiftRightJam128.c
+8
-0
src/isa/riscv64/softfloat/s_shiftRightJam128Extra.c
src/isa/riscv64/softfloat/s_shiftRightJam128Extra.c
+8
-0
src/isa/riscv64/softfloat/s_shiftRightJam256M.c
src/isa/riscv64/softfloat/s_shiftRightJam256M.c
+8
-0
src/isa/riscv64/softfloat/s_shiftRightJam32.c
src/isa/riscv64/softfloat/s_shiftRightJam32.c
+8
-0
src/isa/riscv64/softfloat/s_shiftRightJam64.c
src/isa/riscv64/softfloat/s_shiftRightJam64.c
+8
-0
src/isa/riscv64/softfloat/s_shiftRightJam64Extra.c
src/isa/riscv64/softfloat/s_shiftRightJam64Extra.c
+8
-0
src/isa/riscv64/softfloat/s_shortShiftLeft128.c
src/isa/riscv64/softfloat/s_shortShiftLeft128.c
+8
-0
src/isa/riscv64/softfloat/s_shortShiftRight128.c
src/isa/riscv64/softfloat/s_shortShiftRight128.c
+8
-0
src/isa/riscv64/softfloat/s_shortShiftRightJam128.c
src/isa/riscv64/softfloat/s_shortShiftRightJam128.c
+8
-0
src/isa/riscv64/softfloat/s_shortShiftRightJam128Extra.c
src/isa/riscv64/softfloat/s_shortShiftRightJam128Extra.c
+8
-0
src/isa/riscv64/softfloat/s_shortShiftRightJam64.c
src/isa/riscv64/softfloat/s_shortShiftRightJam64.c
+8
-0
src/isa/riscv64/softfloat/s_sub128.c
src/isa/riscv64/softfloat/s_sub128.c
+8
-0
src/isa/riscv64/softfloat/s_sub256M.c
src/isa/riscv64/softfloat/s_sub256M.c
+8
-0
src/main.c
src/main.c
+5
-0
src/memory/paddr.c
src/memory/paddr.c
+3
-3
src/monitor/cpu-exec.c
src/monitor/cpu-exec.c
+1
-1
未找到文件。
Makefile
浏览文件 @
f2231da1
...
...
@@ -17,7 +17,7 @@ $(info Building $(ISA)-$(NAME)-$(ENGINE))
endif
INC_DIR
+=
./include ./src/engine/
$(ENGINE)
INC_DIR
+=
./include ./src/engine/
$(ENGINE)
./src/isa/riscv64/softfloat
BUILD_DIR
?=
./build
ifdef
SHARE
...
...
@@ -61,14 +61,14 @@ include Makefile.git
.DEFAULT_GOAL
=
app
# Compilation flags
CC
=
g
cc
LD
=
g
cc
CC
=
g
++
LD
=
g
++
INCLUDES
=
$(
addprefix
-I
,
$(INC_DIR)
)
CFLAGS
+=
-O2
-MMD
-Wno-format
-Wall
\
-ggdb3
$(INCLUDES)
\
-D__ENGINE_
$(ENGINE)
__
\
-Wc
++-compat
\
-D__ISA__
=
$(ISA)
-D__ISA_
$(ISA)
__
-D_ISA_H_
=
\"
isa/
$(ISA)
.h
\"
# -Wc++-compat \
# Files to be compiled
SRCS
=
$(
shell
find src/
-name
"*.c"
|
grep
-v
"isa
\|
engine"
)
...
...
@@ -80,7 +80,7 @@ OBJS = $(SRCS:src/%.c=$(OBJ_DIR)/%.o)
$(OBJ_DIR)/isa/riscv64/softfloat/%.o
:
src/isa/riscv64/softfloat/%.c
@
mkdir
-p
$(
dir
$@
)
@
$(CC)
$(CFLAGS)
-w
-fPIC
-c
-o
$@
$<
@
$(CC)
$(CFLAGS)
-
D__cplusplus
-
w
-fPIC
-c
-o
$@
$<
$(OBJ_DIR)/%.o
:
src/%.c
@
echo
+ CC
$<
...
...
@@ -106,6 +106,7 @@ NEMU_EXEC := $(BINARY) $(ARGS) $(IMG)
$(BINARY)
:
$(OBJS)
$(
call
git_commit,
"compile"
)
@
echo
+ LD
$@
@
echo
+ LD inputs
$^
@
$(LD)
-O2
-rdynamic
$(SO_LDLAGS)
-o
$@
$^
-lSDL2
-lreadline
-ldl
run-env
:
$(BINARY) $(DIFF_REF_SO)
...
...
include/rtl/rtl.h
浏览文件 @
f2231da1
#ifndef __RTL_RTL_H__
#define __RTL_RTL_H__
#include <common.h>
#include <cpu/decode.h>
#define id_src1 (&s->src1)
...
...
src/device/device.c
浏览文件 @
f2231da1
...
...
@@ -60,7 +60,7 @@ void init_device() {
init_i8042
();
init_audio
();
add_alarm_handle
(
set_device_update_flag
);
add_alarm_handle
(
(
void
*
)
set_device_update_flag
);
init_alarm
();
}
#else
...
...
src/device/keyboard.c
浏览文件 @
f2231da1
...
...
@@ -6,7 +6,7 @@
#define I8042_DATA_MMIO 0xa1000060
#define KEYBOARD_IRQ 1
static
uint32_t
*
i8042_data_port_base
=
NULL
;
static
uint32_t
*
i8042_data_port_base
=
(
uint32_t
*
)
nullptr
;
// Note that this is not the standard
#define _KEYS(f) \
...
...
@@ -26,9 +26,94 @@ enum {
};
#define SDL_KEYMAP(k) [concat(SDL_SCANCODE_, k)] = concat(_KEY_, k),
static
uint32_t
keymap
[
256
]
=
{
MAP
(
_KEYS
,
SDL_KEYMAP
)
};
static
uint32_t
keymap
[
256
];
void
init_keymap
()
{
keymap
[
SDL_SCANCODE_ESCAPE
]
=
_KEY_ESCAPE
;
keymap
[
SDL_SCANCODE_F1
]
=
_KEY_F1
;
keymap
[
SDL_SCANCODE_F2
]
=
_KEY_F2
;
keymap
[
SDL_SCANCODE_F3
]
=
_KEY_F3
;
keymap
[
SDL_SCANCODE_F4
]
=
_KEY_F4
;
keymap
[
SDL_SCANCODE_F5
]
=
_KEY_F5
;
keymap
[
SDL_SCANCODE_F6
]
=
_KEY_F6
;
keymap
[
SDL_SCANCODE_F7
]
=
_KEY_F7
;
keymap
[
SDL_SCANCODE_F8
]
=
_KEY_F8
;
keymap
[
SDL_SCANCODE_F9
]
=
_KEY_F9
;
keymap
[
SDL_SCANCODE_F10
]
=
_KEY_F10
;
keymap
[
SDL_SCANCODE_F11
]
=
_KEY_F11
;
keymap
[
SDL_SCANCODE_F12
]
=
_KEY_F12
;
keymap
[
SDL_SCANCODE_GRAVE
]
=
_KEY_GRAVE
;
keymap
[
SDL_SCANCODE_1
]
=
_KEY_1
;
keymap
[
SDL_SCANCODE_2
]
=
_KEY_2
;
keymap
[
SDL_SCANCODE_3
]
=
_KEY_3
;
keymap
[
SDL_SCANCODE_4
]
=
_KEY_4
;
keymap
[
SDL_SCANCODE_5
]
=
_KEY_5
;
keymap
[
SDL_SCANCODE_6
]
=
_KEY_6
;
keymap
[
SDL_SCANCODE_7
]
=
_KEY_7
;
keymap
[
SDL_SCANCODE_8
]
=
_KEY_8
;
keymap
[
SDL_SCANCODE_9
]
=
_KEY_9
;
keymap
[
SDL_SCANCODE_0
]
=
_KEY_0
;
keymap
[
SDL_SCANCODE_MINUS
]
=
_KEY_MINUS
;
keymap
[
SDL_SCANCODE_EQUALS
]
=
_KEY_EQUALS
;
keymap
[
SDL_SCANCODE_BACKSPACE
]
=
_KEY_BACKSPACE
;
keymap
[
SDL_SCANCODE_TAB
]
=
_KEY_TAB
;
keymap
[
SDL_SCANCODE_Q
]
=
_KEY_Q
;
keymap
[
SDL_SCANCODE_W
]
=
_KEY_W
;
keymap
[
SDL_SCANCODE_E
]
=
_KEY_E
;
keymap
[
SDL_SCANCODE_R
]
=
_KEY_R
;
keymap
[
SDL_SCANCODE_T
]
=
_KEY_T
;
keymap
[
SDL_SCANCODE_Y
]
=
_KEY_Y
;
keymap
[
SDL_SCANCODE_U
]
=
_KEY_U
;
keymap
[
SDL_SCANCODE_I
]
=
_KEY_I
;
keymap
[
SDL_SCANCODE_O
]
=
_KEY_O
;
keymap
[
SDL_SCANCODE_P
]
=
_KEY_P
;
keymap
[
SDL_SCANCODE_LEFTBRACKET
]
=
_KEY_LEFTBRACKET
;
keymap
[
SDL_SCANCODE_RIGHTBRACKET
]
=
_KEY_RIGHTBRACKET
;
keymap
[
SDL_SCANCODE_BACKSLASH
]
=
_KEY_BACKSLASH
;
keymap
[
SDL_SCANCODE_CAPSLOCK
]
=
_KEY_CAPSLOCK
;
keymap
[
SDL_SCANCODE_A
]
=
_KEY_A
;
keymap
[
SDL_SCANCODE_S
]
=
_KEY_S
;
keymap
[
SDL_SCANCODE_D
]
=
_KEY_D
;
keymap
[
SDL_SCANCODE_F
]
=
_KEY_F
;
keymap
[
SDL_SCANCODE_G
]
=
_KEY_G
;
keymap
[
SDL_SCANCODE_H
]
=
_KEY_H
;
keymap
[
SDL_SCANCODE_J
]
=
_KEY_J
;
keymap
[
SDL_SCANCODE_K
]
=
_KEY_K
;
keymap
[
SDL_SCANCODE_L
]
=
_KEY_L
;
keymap
[
SDL_SCANCODE_SEMICOLON
]
=
_KEY_SEMICOLON
;
keymap
[
SDL_SCANCODE_APOSTROPHE
]
=
_KEY_APOSTROPHE
;
keymap
[
SDL_SCANCODE_RETURN
]
=
_KEY_RETURN
;
keymap
[
SDL_SCANCODE_LSHIFT
]
=
_KEY_LSHIFT
;
keymap
[
SDL_SCANCODE_Z
]
=
_KEY_Z
;
keymap
[
SDL_SCANCODE_X
]
=
_KEY_X
;
keymap
[
SDL_SCANCODE_C
]
=
_KEY_C
;
keymap
[
SDL_SCANCODE_V
]
=
_KEY_V
;
keymap
[
SDL_SCANCODE_B
]
=
_KEY_B
;
keymap
[
SDL_SCANCODE_N
]
=
_KEY_N
;
keymap
[
SDL_SCANCODE_M
]
=
_KEY_M
;
keymap
[
SDL_SCANCODE_COMMA
]
=
_KEY_COMMA
;
keymap
[
SDL_SCANCODE_PERIOD
]
=
_KEY_PERIOD
;
keymap
[
SDL_SCANCODE_SLASH
]
=
_KEY_SLASH
;
keymap
[
SDL_SCANCODE_RSHIFT
]
=
_KEY_RSHIFT
;
keymap
[
SDL_SCANCODE_LCTRL
]
=
_KEY_LCTRL
;
keymap
[
SDL_SCANCODE_APPLICATION
]
=
_KEY_APPLICATION
;
keymap
[
SDL_SCANCODE_LALT
]
=
_KEY_LALT
;
keymap
[
SDL_SCANCODE_SPACE
]
=
_KEY_SPACE
;
keymap
[
SDL_SCANCODE_RALT
]
=
_KEY_RALT
;
keymap
[
SDL_SCANCODE_RCTRL
]
=
_KEY_RCTRL
;
keymap
[
SDL_SCANCODE_UP
]
=
_KEY_UP
;
keymap
[
SDL_SCANCODE_DOWN
]
=
_KEY_DOWN
;
keymap
[
SDL_SCANCODE_LEFT
]
=
_KEY_LEFT
;
keymap
[
SDL_SCANCODE_RIGHT
]
=
_KEY_RIGHT
;
keymap
[
SDL_SCANCODE_INSERT
]
=
_KEY_INSERT
;
keymap
[
SDL_SCANCODE_DELETE
]
=
_KEY_DELETE
;
keymap
[
SDL_SCANCODE_HOME
]
=
_KEY_HOME
;
keymap
[
SDL_SCANCODE_END
]
=
_KEY_END
;
keymap
[
SDL_SCANCODE_PAGEUP
]
=
_KEY_PAGEUP
;
keymap
[
SDL_SCANCODE_PAGEDOWN
]
=
_KEY_PAGEDOWN
;
}
#define KEY_QUEUE_LEN 1024
static
int
key_queue
[
KEY_QUEUE_LEN
]
=
{};
...
...
src/device/timer.c
浏览文件 @
f2231da1
...
...
@@ -32,5 +32,5 @@ void init_timer() {
rtc_port_base
=
(
uint32_t
*
)
new_space
(
16
);
add_pio_map
(
"rtc"
,
RTC_PORT
,
(
uint8_t
*
)
rtc_port_base
,
16
,
rtc_io_handler
);
add_mmio_map
(
"rtc"
,
RTC_MMIO
,
(
uint8_t
*
)
rtc_port_base
,
16
,
rtc_io_handler
);
add_alarm_handle
(
timer_intr
);
add_alarm_handle
(
(
void
*
)
timer_intr
);
}
src/isa/riscv64/clint.c
浏览文件 @
f2231da1
...
...
@@ -27,5 +27,5 @@ static void clint_io_handler(uint32_t offset, int len, nemu_bool is_write) {
void
init_clint
(
void
)
{
clint_base
=
(
uint64_t
*
)
new_space
(
0x10000
);
add_mmio_map
(
"clint"
,
CLINT_MMIO
,
(
uint8_t
*
)
clint_base
,
0x10000
,
clint_io_handler
);
add_alarm_handle
(
clint_intr
);
add_alarm_handle
(
(
void
*
)
clint_intr
);
}
src/isa/riscv64/reg.c
浏览文件 @
f2231da1
...
...
@@ -63,13 +63,15 @@ rtlreg_t isa_reg_str2val(const char *s, nemu_bool *success) {
rtlreg_t
csr_array
[
4096
]
=
{};
#define CSRS_DEF(name, addr) \
concat(name, _t)* const name = (
void
*)&csr_array[addr];
concat(name, _t)* const name = (
concat(name, _t)
*)&csr_array[addr];
MAP
(
CSRS
,
CSRS_DEF
)
#define CSRS_EXIST(name, addr) [addr] = 1,
static
nemu_bool
csr_exist
[
4096
]
=
{
static
nemu_bool
csr_exist
[
4096
];
#define CSRS_EXIST(name, addr) csr_exist[addr] = 1;
void
init_csr_exist
()
{
MAP
(
CSRS
,
CSRS_EXIST
)
}
;
}
static
inline
word_t
*
csr_decode
(
uint32_t
addr
)
{
assert
(
addr
<
4096
);
...
...
src/isa/riscv64/softfloat/platform.h
浏览文件 @
f2231da1
...
...
@@ -38,11 +38,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*----------------------------------------------------------------------------*/
#define LITTLEENDIAN 1
#define INLINE_LEVEL
5
#define INLINE_LEVEL
0
#define SOFTFLOAT_FAST_INT64
#define SOFTFLOAT_FAST_DIV64TO32
/*----------------------------------------------------------------------------
*----------------------------------------------------------------------------*/
// #define INLINE static inline
#define INLINE static inline
src/isa/riscv64/softfloat/s_add128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_add128
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_add128
(
uint64_t
a64
,
uint64_t
a0
,
uint64_t
b64
,
uint64_t
b0
)
{
...
...
@@ -51,5 +55,9 @@ struct uint128
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_add256M.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_add256M
#ifdef __cplusplus
extern
"C"
{
#endif
void
softfloat_add256M
(
const
uint64_t
*
aPtr
,
const
uint64_t
*
bPtr
,
uint64_t
*
zPtr
)
...
...
@@ -61,5 +65,9 @@ void
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_approxRecipSqrt32_1.c
浏览文件 @
f2231da1
...
...
@@ -42,6 +42,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
extern
const
uint16_t
softfloat_approxRecipSqrt_1k0s
[];
extern
const
uint16_t
softfloat_approxRecipSqrt_1k1s
[];
#ifdef __cplusplus
extern
"C"
{
#endif
uint32_t
softfloat_approxRecipSqrt32_1
(
unsigned
int
oddExpA
,
uint32_t
a
)
{
int
index
;
...
...
@@ -69,5 +73,9 @@ uint32_t softfloat_approxRecipSqrt32_1( unsigned int oddExpA, uint32_t a )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_countLeadingZeros16.c
浏览文件 @
f2231da1
...
...
@@ -42,6 +42,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define softfloat_countLeadingZeros16 softfloat_countLeadingZeros16
#include "primitives.h"
#ifdef __cplusplus
extern
"C"
{
#endif
uint_fast8_t
softfloat_countLeadingZeros16
(
uint16_t
a
)
{
uint_fast8_t
count
;
...
...
@@ -56,5 +60,9 @@ uint_fast8_t softfloat_countLeadingZeros16( uint16_t a )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_countLeadingZeros32.c
浏览文件 @
f2231da1
...
...
@@ -42,6 +42,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define softfloat_countLeadingZeros32 softfloat_countLeadingZeros32
#include "primitives.h"
#ifdef __cplusplus
extern
"C"
{
#endif
uint_fast8_t
softfloat_countLeadingZeros32
(
uint32_t
a
)
{
uint_fast8_t
count
;
...
...
@@ -60,5 +64,9 @@ uint_fast8_t softfloat_countLeadingZeros32( uint32_t a )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_countLeadingZeros64.c
浏览文件 @
f2231da1
...
...
@@ -42,6 +42,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define softfloat_countLeadingZeros64 softfloat_countLeadingZeros64
#include "primitives.h"
#ifdef __cplusplus
extern
"C"
{
#endif
uint_fast8_t
softfloat_countLeadingZeros64
(
uint64_t
a
)
{
uint_fast8_t
count
;
...
...
@@ -69,5 +73,9 @@ uint_fast8_t softfloat_countLeadingZeros64( uint64_t a )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_eq128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_eq128
#ifdef __cplusplus
extern
"C"
{
#endif
bool
softfloat_eq128
(
uint64_t
a64
,
uint64_t
a0
,
uint64_t
b64
,
uint64_t
b0
)
{
...
...
@@ -47,5 +51,9 @@ bool softfloat_eq128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_le128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_le128
#ifdef __cplusplus
extern
"C"
{
#endif
bool
softfloat_le128
(
uint64_t
a64
,
uint64_t
a0
,
uint64_t
b64
,
uint64_t
b0
)
{
...
...
@@ -47,5 +51,9 @@ bool softfloat_le128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_lt128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_lt128
#ifdef __cplusplus
extern
"C"
{
#endif
bool
softfloat_lt128
(
uint64_t
a64
,
uint64_t
a0
,
uint64_t
b64
,
uint64_t
b0
)
{
...
...
@@ -47,5 +51,9 @@ bool softfloat_lt128( uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0 )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_mul128By32.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_mul128By32
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_mul128By32
(
uint64_t
a64
,
uint64_t
a0
,
uint32_t
b
)
{
struct
uint128
z
;
...
...
@@ -54,5 +58,9 @@ struct uint128 softfloat_mul128By32( uint64_t a64, uint64_t a0, uint32_t b )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_mul128To256M.c
浏览文件 @
f2231da1
...
...
@@ -42,6 +42,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define softfloat_mul128To256M softfloat_mul128To256M
#include "primitives.h"
#ifdef __cplusplus
extern
"C"
{
#endif
void
softfloat_mul128To256M
(
uint64_t
a64
,
uint64_t
a0
,
uint64_t
b64
,
uint64_t
b0
,
uint64_t
*
zPtr
)
...
...
@@ -67,5 +71,9 @@ void
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_mul64ByShifted32To128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_mul64ByShifted32To128
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_mul64ByShifted32To128
(
uint64_t
a
,
uint32_t
b
)
{
uint_fast64_t
mid
;
...
...
@@ -52,5 +56,9 @@ struct uint128 softfloat_mul64ByShifted32To128( uint64_t a, uint32_t b )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_mul64To128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_mul64To128
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_mul64To128
(
uint64_t
a
,
uint64_t
b
)
{
uint32_t
a32
,
a0
,
b32
,
b0
;
...
...
@@ -62,5 +66,9 @@ struct uint128 softfloat_mul64To128( uint64_t a, uint64_t b )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shiftRightJam128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shiftRightJam128
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_shiftRightJam128
(
uint64_t
a64
,
uint64_t
a0
,
uint_fast32_t
dist
)
{
...
...
@@ -65,5 +69,9 @@ struct uint128
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shiftRightJam128Extra.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shiftRightJam128Extra
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128_extra
softfloat_shiftRightJam128Extra
(
uint64_t
a64
,
uint64_t
a0
,
uint64_t
extra
,
uint_fast32_t
dist
)
...
...
@@ -73,5 +77,9 @@ struct uint128_extra
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shiftRightJam256M.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shiftRightJam256M
#ifdef __cplusplus
extern
"C"
{
#endif
static
void
softfloat_shortShiftRightJamM
(
...
...
@@ -122,5 +126,9 @@ void
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shiftRightJam32.c
浏览文件 @
f2231da1
...
...
@@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shiftRightJam32
#ifdef __cplusplus
extern
"C"
{
#endif
uint32_t
softfloat_shiftRightJam32
(
uint32_t
a
,
uint_fast16_t
dist
)
{
...
...
@@ -47,5 +51,9 @@ uint32_t softfloat_shiftRightJam32( uint32_t a, uint_fast16_t dist )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shiftRightJam64.c
浏览文件 @
f2231da1
...
...
@@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shiftRightJam64
#ifdef __cplusplus
extern
"C"
{
#endif
uint64_t
softfloat_shiftRightJam64
(
uint64_t
a
,
uint_fast32_t
dist
)
{
...
...
@@ -47,5 +51,9 @@ uint64_t softfloat_shiftRightJam64( uint64_t a, uint_fast32_t dist )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shiftRightJam64Extra.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shiftRightJam64Extra
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint64_extra
softfloat_shiftRightJam64Extra
(
uint64_t
a
,
uint64_t
extra
,
uint_fast32_t
dist
)
...
...
@@ -58,5 +62,9 @@ struct uint64_extra
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shortShiftLeft128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shortShiftLeft128
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_shortShiftLeft128
(
uint64_t
a64
,
uint64_t
a0
,
uint_fast8_t
dist
)
{
...
...
@@ -51,5 +55,9 @@ struct uint128
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shortShiftRight128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shortShiftRight128
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_shortShiftRight128
(
uint64_t
a64
,
uint64_t
a0
,
uint_fast8_t
dist
)
{
...
...
@@ -51,5 +55,9 @@ struct uint128
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shortShiftRightJam128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shortShiftRightJam128
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_shortShiftRightJam128
(
uint64_t
a64
,
uint64_t
a0
,
uint_fast8_t
dist
)
...
...
@@ -56,5 +60,9 @@ struct uint128
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shortShiftRightJam128Extra.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shortShiftRightJam128Extra
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128_extra
softfloat_shortShiftRightJam128Extra
(
uint64_t
a64
,
uint64_t
a0
,
uint64_t
extra
,
uint_fast8_t
dist
)
...
...
@@ -55,5 +59,9 @@ struct uint128_extra
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_shortShiftRightJam64.c
浏览文件 @
f2231da1
...
...
@@ -39,6 +39,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_shortShiftRightJam64
#ifdef __cplusplus
extern
"C"
{
#endif
uint64_t
softfloat_shortShiftRightJam64
(
uint64_t
a
,
uint_fast8_t
dist
)
{
...
...
@@ -46,5 +50,9 @@ uint64_t softfloat_shortShiftRightJam64( uint64_t a, uint_fast8_t dist )
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_sub128.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_sub128
#ifdef __cplusplus
extern
"C"
{
#endif
struct
uint128
softfloat_sub128
(
uint64_t
a64
,
uint64_t
a0
,
uint64_t
b64
,
uint64_t
b0
)
{
...
...
@@ -51,5 +55,9 @@ struct uint128
}
#ifdef __cplusplus
}
#endif
#endif
src/isa/riscv64/softfloat/s_sub256M.c
浏览文件 @
f2231da1
...
...
@@ -40,6 +40,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef softfloat_sub256M
#ifdef __cplusplus
extern
"C"
{
#endif
void
softfloat_sub256M
(
const
uint64_t
*
aPtr
,
const
uint64_t
*
bPtr
,
uint64_t
*
zPtr
)
...
...
@@ -61,5 +65,9 @@ void
}
#ifdef __cplusplus
}
#endif
#endif
src/main.c
浏览文件 @
f2231da1
void
init_monitor
(
int
,
char
*
[]);
void
init_csr_exist
();
void
init_keymap
();
void
engine_start
();
int
goodtrap
(
void
);
int
is_batch_mode
();
...
...
@@ -7,6 +9,9 @@ int main(int argc, char *argv[]) {
/* Initialize the monitor. */
init_monitor
(
argc
,
argv
);
init_csr_exist
();
init_keymap
();
/* Start engine. */
engine_start
();
...
...
src/memory/paddr.c
浏览文件 @
f2231da1
...
...
@@ -9,7 +9,7 @@ static uint8_t pmem[PMEM_SIZE] PG_ALIGN = {};
nemu_bool
pmem_dirty
[
PMEM_SIZE
]
PG_ALIGN
=
{
0
};
void
*
guest_to_host
(
paddr_t
addr
)
{
return
&
pmem
[
addr
];
}
paddr_t
host_to_guest
(
void
*
addr
)
{
return
(
void
*
)
pmem
-
addr
;
}
paddr_t
host_to_guest
(
void
*
addr
)
{
return
(
uint8_t
*
)
pmem
-
(
uint8_t
*
)
addr
;
}
IOMap
*
fetch_mmio_map
(
paddr_t
addr
);
...
...
@@ -78,12 +78,12 @@ void rtl_sfence() {
/* Memory accessing interfaces */
inline
word_t
paddr_read
(
paddr_t
addr
,
int
len
)
{
word_t
paddr_read
(
paddr_t
addr
,
int
len
)
{
if
(
in_pmem
(
addr
))
return
pmem_read
(
addr
,
len
);
else
return
map_read
(
addr
,
len
,
fetch_mmio_map
(
addr
));
}
inline
void
paddr_write
(
paddr_t
addr
,
word_t
data
,
int
len
)
{
void
paddr_write
(
paddr_t
addr
,
word_t
data
,
int
len
)
{
if
(
in_pmem
(
addr
))
pmem_write
(
addr
,
data
,
len
);
else
map_write
(
addr
,
data
,
len
,
fetch_mmio_map
(
addr
));
}
...
...
src/monitor/cpu-exec.c
浏览文件 @
f2231da1
...
...
@@ -19,7 +19,7 @@
CPU_state
cpu
;
NEMUState
nemu_state
=
{.
state
=
NEMU_STOP
};
static
uint64_t
g_nr_guest_instr
=
0
;
const
rtlreg_t
rzero
=
0
;
extern
const
rtlreg_t
rzero
=
0
;
void
asm_print
(
vaddr_t
ori_pc
,
int
instr_len
,
nemu_bool
print_flag
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录