> compile NEMU
ysyx_22040000 李心杨 Linux calcite 6.1.71 #1-NixOS SMP PREEMPT_DYNAMIC Fri Jan 5 14:18:41 UTC 2024 x86_64 GNU/Linux 16:04:14 up 2 days 4:59, 2 users, load average: 1.20, 0.76, 0.69
This commit is contained in:
parent
9507e0e4ac
commit
294353437a
5 changed files with 747 additions and 28 deletions
3
nemu/.vscode/settings.json
vendored
Normal file
3
nemu/.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"digital-ide.welcome.show": false
|
||||
}
|
657
nemu/compile_commands.events.json
Normal file
657
nemu/compile_commands.events.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -52,19 +52,17 @@
|
|||
|
||||
configurePhase = ''
|
||||
echo NEMU_HOME=$NEMU_HOME
|
||||
make -f scripts/config.mk rv32_defconfig
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
make app
|
||||
echo pwd=$(pwd)
|
||||
mkdir -p $(pwd)/kconfig
|
||||
WORK_DIR=$(pwd) obj=$(pwd)/kconfig make --trace -e -f scripts/config.mk WORK_DIR=$(pwd) obj=$(pwd)/kconfig rv32_defconfig
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
make install
|
||||
BUILD_DIR=$out make install
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
make test
|
||||
BUILD_DIR=$out make test
|
||||
'';
|
||||
|
||||
NEMU_HOME = src;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "sdb.h"
|
||||
#include "common.h"
|
||||
#include "sys/types.h"
|
||||
#include <addrexp.h>
|
||||
#include <addrexp_lex.h>
|
||||
#include <cpu/cpu.h>
|
||||
#include <errno.h>
|
||||
#include <isa.h>
|
||||
|
@ -23,8 +25,6 @@
|
|||
#include <readline/history.h>
|
||||
#include <readline/readline.h>
|
||||
#include <stdint.h>
|
||||
#include <addrexp.h>
|
||||
#include <addrexp_lex.h>
|
||||
|
||||
static int is_batch_mode = false;
|
||||
|
||||
|
|
|
@ -2,17 +2,18 @@
|
|||
* 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:
|
||||
* 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.
|
||||
* 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 "common.h"
|
||||
#include "sdb.h"
|
||||
|
||||
#define NR_WP 32
|
||||
|
@ -20,13 +21,13 @@
|
|||
typedef struct watchpoint {
|
||||
int NO;
|
||||
struct watchpoint *next;
|
||||
|
||||
/* TODO: Add more members if necessary */
|
||||
|
||||
word_t val;
|
||||
char *expr;
|
||||
} WP;
|
||||
|
||||
static WP wp_pool[NR_WP] = {};
|
||||
static WP *head = NULL, *free_ = NULL;
|
||||
static WP *head = NULL, *tail = NULL, *free_ = NULL;
|
||||
static int wp_count = 0;
|
||||
|
||||
void init_wp_pool() {
|
||||
int i;
|
||||
|
@ -39,5 +40,65 @@ void init_wp_pool() {
|
|||
free_ = wp_pool;
|
||||
}
|
||||
|
||||
/* TODO: Implement the functionality of watchpoint */
|
||||
WP *wp_new() {
|
||||
if (free_ == NULL) {
|
||||
Log("wp_pool: Watchpoint pool not initialized or is full.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WP *ret = free_;
|
||||
free_ = free_->next;
|
||||
|
||||
ret->NO = 0;
|
||||
ret->next = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void wp_delete(WP *wp) {
|
||||
assert(wp);
|
||||
wp->next = free_;
|
||||
free_ = wp;
|
||||
}
|
||||
|
||||
int wp_add(char * expr) {
|
||||
WP *wp = wp_new();
|
||||
if (wp == NULL) {
|
||||
Log("watchpoint: Failed to add watchpoint, pool is full.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
wp->NO = wp_count++;
|
||||
if (tail == NULL) {
|
||||
head = wp;
|
||||
tail = wp;
|
||||
} else {
|
||||
tail->next = wp;
|
||||
tail = wp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wp_remove_by_number(int number) {
|
||||
WP *target_prev;
|
||||
// Find previous node of target number
|
||||
for (target_prev = head; target_prev != NULL && target_prev->next->NO != number; target_prev = target_prev->next) ;
|
||||
if (target_prev == NULL) {
|
||||
Log("Watchpoint not found, you can check current watchpoints with `info w`");
|
||||
return 1;
|
||||
}
|
||||
WP *target = target_prev->next;
|
||||
target_prev->next = target->next;
|
||||
if (target == head) {
|
||||
head = target->next;
|
||||
} else if (target == tail) {
|
||||
tail = target_prev;
|
||||
}
|
||||
wp_delete(target);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// int wp_eval_all(char *) {
|
||||
|
||||
// }
|
||||
|
||||
/* TODO: Implement the functionality of watchpoint */
|
||||
|
|
Loading…
Reference in a new issue