pa2.2: fix ftrace switch
This commit is contained in:
parent
a62a132587
commit
18db852763
1 changed files with 8 additions and 3 deletions
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include "local-include/reg.h"
|
#include "local-include/reg.h"
|
||||||
|
#include "macro.h"
|
||||||
#include <cpu/cpu.h>
|
#include <cpu/cpu.h>
|
||||||
#include <cpu/ifetch.h>
|
#include <cpu/ifetch.h>
|
||||||
#include <cpu/decode.h>
|
#include <cpu/decode.h>
|
||||||
|
@ -61,7 +62,7 @@ static void do_branch(Decode *s, bool condition, word_t offset) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ftrace(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);
|
||||||
if(rs1 == 1 && rd == 0) {
|
if(rs1 == 1 && rd == 0) {
|
||||||
|
@ -86,8 +87,12 @@ static int decode_exec(Decode *s) {
|
||||||
INSTPAT("??????? ????? ????? ??? ????? 01101 11", lui , U, R(rd) = imm);
|
INSTPAT("??????? ????? ????? ??? ????? 01101 11", lui , U, R(rd) = imm);
|
||||||
INSTPAT("??????? ????? ????? ??? ????? 00101 11", auipc , U, R(rd) = s->pc + imm);
|
INSTPAT("??????? ????? ????? ??? ????? 00101 11", auipc , U, R(rd) = s->pc + imm);
|
||||||
|
|
||||||
INSTPAT("??????? ????? ????? ??? ????? 11011 11", jal , J, do {s->dnpc = s->pc + imm; R(rd) = s->pc + 4; ftrace_call(s->pc, s->pc + imm); } while(0));
|
INSTPAT("??????? ????? ????? ??? ????? 11011 11", jal , J, do {
|
||||||
INSTPAT("??????? ????? ????? ??? ????? 11001 11", jalr , I, do {s->dnpc = src1 + imm; R(rd) = s->pc + 4; ftrace(s, rd, src1 + imm); } while(0));
|
s->dnpc = s->pc + imm; R(rd) = s->pc + 4;
|
||||||
|
IFDEF(CONFIG_FTRACE, ftrace_call(s->pc, s->pc + imm)); } while(0));
|
||||||
|
INSTPAT("??????? ????? ????? ??? ????? 11001 11", jalr , I, do {
|
||||||
|
s->dnpc = src1 + imm; R(rd) = s->pc + 4;
|
||||||
|
IFDEF(CONFIG_FTRACE, ftrace_jalr(s, rd, src1 + imm)); } while(0));
|
||||||
INSTPAT("??????? ????? ????? 000 ????? 11000 11", beq , B, do_branch(s, src1 == src2, imm));
|
INSTPAT("??????? ????? ????? 000 ????? 11000 11", beq , B, do_branch(s, src1 == src2, imm));
|
||||||
INSTPAT("??????? ????? ????? 001 ????? 11000 11", bne , B, do_branch(s, src1 != src2, imm));
|
INSTPAT("??????? ????? ????? 001 ????? 11000 11", bne , B, do_branch(s, src1 != src2, imm));
|
||||||
INSTPAT("??????? ????? ????? 100 ????? 11000 11", blt , B, do_branch(s, (sword_t)src1 < (sword_t)src2, imm));
|
INSTPAT("??????? ????? ????? 100 ????? 11000 11", blt , B, do_branch(s, (sword_t)src1 < (sword_t)src2, imm));
|
||||||
|
|
Loading…
Reference in a new issue