added ebreak support
This commit is contained in:
@@ -170,6 +170,7 @@ function amach_imm(opcode, f3, rd, rs1, immval, r1, ur1, shamt) {
|
||||
pc = r1 + immval
|
||||
} else if(opcode == 115) { # 0x73, system call / csr
|
||||
if(immval == 0) handle_ecall(getreg(17), getreg(10), getreg(11), getreg(12), getreg(13), getreg(14), getreg(15))
|
||||
else if(immval == 1) trapout(sprintf("EBREAK at 0x%X", pc-4))
|
||||
else trapout(sprintf("Unimplemented external system call at 0x%X", pc-4))
|
||||
} else trapout(sprintf("Illegal instruction at 0x%X", pc-4))
|
||||
}
|
||||
@@ -317,9 +318,8 @@ function amach_comp(instr, op, f3, b12, r11_7, r9_7, r6_2, r4_2, shamt, imm, ba
|
||||
} else setreg(r11_7, getreg(r6_2)) # C.MV
|
||||
} else {
|
||||
if(r6_2 == 0) {
|
||||
if(r11_7 == 0) { # C.EBREAK
|
||||
trapout(sprintf("EBREAK at 0x%X", pc-2))
|
||||
} else { # C.JALR
|
||||
if(r11_7 == 0) trapout(sprintf("EBREAK at 0x%X", pc-2)) # C.EBREAK
|
||||
else { # C.JALR
|
||||
imm = getreg(r11_7)
|
||||
setreg(1, pc)
|
||||
pc = imm
|
||||
|
||||
Reference in New Issue
Block a user