forked from Github_Repos/cvw
progress on recovering from QEMU's errors
This commit is contained in:
parent
f9b6bd91f5
commit
82ce85c24f
@ -30,10 +30,11 @@ outDir="../linux-testvectors"
|
||||
# - Makes qemu_in_gdb_format.txt
|
||||
# - Splits qemu_in_gdb_format.txt into chunks of 100,000 instrs
|
||||
#cat $intermedDir/qemu_output.txt | ./parse_qemu.py >$intermedDir/qemu_in_gdb_format.txt
|
||||
cd $intermedDir
|
||||
split -d -l 5000000 ./qemu_in_gdb_format.txt --verbose
|
||||
cd ../../testvector-generation
|
||||
#cd $intermedDir
|
||||
#split -d -l 5000000 ./qemu_in_gdb_format.txt --verbose
|
||||
#cd ../../testvector-generation
|
||||
|
||||
# Uncomment this version for parse_gdb_output.py debugging
|
||||
# - Uses qemu_in_gdb_format.txt
|
||||
# - Makes testvectors#cat $intermedDir/qemu_in_gdb_format.txt | ./parse_gdb_output.py "$outDir"
|
||||
# - Makes testvectors
|
||||
#cat $intermedDir/qemu_in_gdb_format.txt | ./parse_gdb_output.py "$outDir"
|
||||
|
@ -1,10 +1,12 @@
|
||||
set pagination off
|
||||
file ../buildroot-image-output/fw_jump.elf
|
||||
target extended-remote :1237
|
||||
b irqchip_plic_warm_init
|
||||
b *0x80200040
|
||||
c
|
||||
file ../buildroot-image-output/vmlinux
|
||||
b plic_init
|
||||
c
|
||||
#b irqchip_plic_warm_init
|
||||
#c
|
||||
#b plic_init
|
||||
#c
|
||||
b do_idle
|
||||
c
|
||||
|
@ -36,12 +36,15 @@ def printCSRs():
|
||||
|
||||
def parseCSRs(l):
|
||||
global parseState, inPageFault, CSRs, pageFaultCSRs, regs, pageFaultCSRs, instrs
|
||||
if l.strip() and (not l.startswith("Disassembler")) and (not l.startswith("Please")) and not inPageFault:
|
||||
if l.strip() and (not l.startswith("Disassembler")) and (not l.startswith("Please")):
|
||||
# If we've hit the register file
|
||||
if l.startswith(' x0/zero'):
|
||||
parseState = "regFile"
|
||||
instr = instrs[CSRs["pc"]]
|
||||
printPC(instr)
|
||||
if not inPageFault:
|
||||
instr = instrs[CSRs["pc"]]
|
||||
printPC(instr)
|
||||
parseRegs(l)
|
||||
# If we've hit a CSR
|
||||
else:
|
||||
csr = l.split()[0]
|
||||
val = int(l.split()[1],16)
|
||||
@ -64,11 +67,16 @@ def parseCSRs(l):
|
||||
# However SEPC and STVAL do get corrupted upon exiting
|
||||
if endPageFault and ((csr == 'sepc') or (csr == 'stval')):
|
||||
CSRs[csr] = returnAdr
|
||||
pageFaultCSRs[csr] = val
|
||||
elif pageFaultCSRs and (csr in pageFaultCSRs):
|
||||
if (val != pageFaultCSRs[csr]):
|
||||
del pageFaultCSRs[csr]
|
||||
CSRs[csr] = val
|
||||
else:
|
||||
CSRs[csr] = val
|
||||
|
||||
def parseRegs(l):
|
||||
global parseState, inPageFault, CSRs, pageFaultCSRs, regs, pageFaultCSRs, instrs
|
||||
global parseState, inPageFault, CSRs, pageFaultCSRs, regs, pageFaultCSRs, instrs, pageFaultRegs
|
||||
if "pc" in l:
|
||||
printCSRs()
|
||||
# New non-disassembled instruction
|
||||
@ -86,6 +94,7 @@ def parseRegs(l):
|
||||
val = int(s[i+1], 16)
|
||||
if inPageFault:
|
||||
pageFaultRegs[reg] = val
|
||||
sys.stderr.write(str(pageFaultRegs))
|
||||
else:
|
||||
if pageFaultRegs and (reg in pageFaultRegs):
|
||||
if (val != pageFaultRegs[reg]):
|
||||
@ -110,9 +119,10 @@ for l in fileinput.input():
|
||||
elif (parseState == "instr") and l.startswith('0x'):
|
||||
if "out of bounds" in l:
|
||||
sys.stderr.write("Detected QEMU page fault error\n")
|
||||
beginPageFault = ~(inPageFault)
|
||||
beginPageFault = not inPageFault
|
||||
if beginPageFault:
|
||||
returnAdr = int(l.split()[0][2:-1], 16)
|
||||
sys.stderr.write('Saving SEPC of '+hex(returnAdr)+'\n')
|
||||
inPageFault = 1
|
||||
else:
|
||||
endPageFault = inPageFault
|
||||
|
Loading…
Reference in New Issue
Block a user