NJU-ProjectN/nemu ics2023 initialized
NJU-ProjectN/nemu eb63cf3568dbf4e0c3c6ef462e6ec685550fabbc Merge pull request #76 from rijuyuezhu/master
This commit is contained in:
parent
1efe03efb9
commit
2824efad33
141 changed files with 19573 additions and 0 deletions
17
nemu/src/engine/filelist.mk
Normal file
17
nemu/src/engine/filelist.mk
Normal file
|
@ -0,0 +1,17 @@
|
|||
#***************************************************************************************
|
||||
# Copyright (c) 2014-2022 Zihao Yu, Nanjing University
|
||||
#
|
||||
# NEMU is licensed under Mulan PSL v2.
|
||||
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
# You may obtain a copy of Mulan PSL v2 at:
|
||||
# http://license.coscl.org.cn/MulanPSL2
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# See the Mulan PSL v2 for more details.
|
||||
#**************************************************************************************/
|
||||
|
||||
INC_PATH += $(NEMU_HOME)/src/engine/$(ENGINE)
|
||||
DIRS-y += src/engine/$(ENGINE)
|
51
nemu/src/engine/interpreter/hostcall.c
Normal file
51
nemu/src/engine/interpreter/hostcall.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/***************************************************************************************
|
||||
* Copyright (c) 2014-2022 Zihao Yu, Nanjing University
|
||||
*
|
||||
* NEMU is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the Mulan PSL v2 for more details.
|
||||
***************************************************************************************/
|
||||
|
||||
#include <utils.h>
|
||||
#include <cpu/ifetch.h>
|
||||
#include <isa.h>
|
||||
#include <cpu/difftest.h>
|
||||
|
||||
void set_nemu_state(int state, vaddr_t pc, int halt_ret) {
|
||||
difftest_skip_ref();
|
||||
nemu_state.state = state;
|
||||
nemu_state.halt_pc = pc;
|
||||
nemu_state.halt_ret = halt_ret;
|
||||
}
|
||||
|
||||
__attribute__((noinline))
|
||||
void invalid_inst(vaddr_t thispc) {
|
||||
uint32_t temp[2];
|
||||
vaddr_t pc = thispc;
|
||||
temp[0] = inst_fetch(&pc, 4);
|
||||
temp[1] = inst_fetch(&pc, 4);
|
||||
|
||||
uint8_t *p = (uint8_t *)temp;
|
||||
printf("invalid opcode(PC = " FMT_WORD "):\n"
|
||||
"\t%02x %02x %02x %02x %02x %02x %02x %02x ...\n"
|
||||
"\t%08x %08x...\n",
|
||||
thispc, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], temp[0], temp[1]);
|
||||
|
||||
printf("There are two cases which will trigger this unexpected exception:\n"
|
||||
"1. The instruction at PC = " FMT_WORD " is not implemented.\n"
|
||||
"2. Something is implemented incorrectly.\n", thispc);
|
||||
printf("Find this PC(" FMT_WORD ") in the disassembling result to distinguish which case it is.\n\n", thispc);
|
||||
printf(ANSI_FMT("If it is the first case, see\n%s\nfor more details.\n\n"
|
||||
"If it is the second case, remember:\n"
|
||||
"* The machine is always right!\n"
|
||||
"* Every line of untested code is always wrong!\n\n", ANSI_FG_RED), isa_logo);
|
||||
|
||||
set_nemu_state(NEMU_ABORT, thispc, -1);
|
||||
}
|
27
nemu/src/engine/interpreter/init.c
Normal file
27
nemu/src/engine/interpreter/init.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/***************************************************************************************
|
||||
* Copyright (c) 2014-2022 Zihao Yu, Nanjing University
|
||||
*
|
||||
* NEMU is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* See the Mulan PSL v2 for more details.
|
||||
***************************************************************************************/
|
||||
|
||||
#include <cpu/cpu.h>
|
||||
|
||||
void sdb_mainloop();
|
||||
|
||||
void engine_start() {
|
||||
#ifdef CONFIG_TARGET_AM
|
||||
cpu_exec(-1);
|
||||
#else
|
||||
/* Receive commands from user. */
|
||||
sdb_mainloop();
|
||||
#endif
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue