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