pa2.2: nemu small fixes
This commit is contained in:
parent
da0c42422d
commit
8545a92c1f
7 changed files with 11 additions and 4 deletions
|
@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
doCheck = true;
|
doCheck = true;
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
export IMAGES_PATH=${am-kernels}/share/images
|
export IMAGES_PATH=${am-kernels}/share/binary
|
||||||
make test
|
make test
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export NEMU_HOME=$(pwd)
|
export NEMU_HOME=$(pwd)
|
||||||
export IMAGES_PATH=${am-kernels}/share/images
|
export IMAGES_PATH=${am-kernels}/share/binary
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
|
#include <macro.h>
|
||||||
|
|
||||||
IFDEF(CONFIG_ITRACE, void log_itrace_print());
|
IFDEF(CONFIG_ITRACE, void log_itrace_print());
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ static void do_branch(Decode *s, bool condition, word_t offset) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_FTRACE
|
||||||
static void ftrace_jalr(Decode *s, int rd, vaddr_t dst) {
|
static void ftrace_jalr(Decode *s, int rd, vaddr_t dst) {
|
||||||
uint32_t i = s->isa.inst.val;
|
uint32_t i = s->isa.inst.val;
|
||||||
int rs1 = BITS(i, 19, 15);
|
int rs1 = BITS(i, 19, 15);
|
||||||
|
@ -71,6 +72,7 @@ static void ftrace_jalr(Decode *s, int rd, vaddr_t dst) {
|
||||||
ftrace_call(s->pc, dst);
|
ftrace_call(s->pc, dst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int decode_exec(Decode *s) {
|
static int decode_exec(Decode *s) {
|
||||||
int rd = 0;
|
int rd = 0;
|
||||||
|
|
|
@ -133,8 +133,12 @@ void init_monitor(int argc, char *argv[]) {
|
||||||
|
|
||||||
// printf("elf_file: %s\n", elf_file);
|
// printf("elf_file: %s\n", elf_file);
|
||||||
if(elf_file != NULL) {
|
if(elf_file != NULL) {
|
||||||
|
#ifdef CONFIG_FTRACE
|
||||||
void init_elf(const char *path);
|
void init_elf(const char *path);
|
||||||
init_elf(elf_file);
|
init_elf(elf_file);
|
||||||
|
#else
|
||||||
|
Warning("Elf file provided, but ftrace not turned on. Ignoring elf file.");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_ISA_loongarch32r
|
#ifndef CONFIG_ISA_loongarch32r
|
||||||
|
|
|
@ -10,7 +10,6 @@ static vaddr_t ftrace_stack[CONFIG_FTRACE_STACK_SIZE] = {0};
|
||||||
static vaddr_t ftrace_stack_len = 0;
|
static vaddr_t ftrace_stack_len = 0;
|
||||||
func_t *func_table = NULL;
|
func_t *func_table = NULL;
|
||||||
int func_table_len = 0, func_table_size = 8;
|
int func_table_len = 0, func_table_size = 8;
|
||||||
#endif
|
|
||||||
|
|
||||||
static int cmp_func_t(const void *a, const void *b) {
|
static int cmp_func_t(const void *a, const void *b) {
|
||||||
return ((func_t *)a)->start > ((func_t *)b)->start;
|
return ((func_t *)a)->start > ((func_t *)b)->start;
|
||||||
|
@ -122,3 +121,4 @@ void ftrace_return(vaddr_t pc, vaddr_t addr) {
|
||||||
Trace("%*s0x%x ret 0x%x <%s+0x%x>", ftrace_stack_len, "", pc, addr,
|
Trace("%*s0x%x ret 0x%x <%s+0x%x>", ftrace_stack_len, "", pc, addr,
|
||||||
f == NULL ? "???" : f->name, addr - f->start);
|
f == NULL ? "???" : f->name, addr - f->start);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue