mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-11 02:04:11 +00:00
m1n1.hv,proxyutils: Refactor how faults are printed re: context
Instead of directly taking a proxy entry code to determine what to decode, just take an is_fault argument and only show and decode ESR/FAR if true. Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
7c5d47ff85
commit
984b22cd51
2 changed files with 14 additions and 8 deletions
|
@ -849,7 +849,7 @@ class HV(Reloadable):
|
|||
handled = self.handle_sync(ctx)
|
||||
elif code == EXC.FIQ:
|
||||
self.u.msr(CNTV_CTL_EL0, 0)
|
||||
self.u.print_exception(code, ctx)
|
||||
self.u.print_context(ctx, False)
|
||||
handled = True
|
||||
elif reason == START.HV:
|
||||
code = HV_EVENT(code)
|
||||
|
@ -870,7 +870,7 @@ class HV(Reloadable):
|
|||
else:
|
||||
self.log(f"Guest exception: {reason.name}/{code.name}")
|
||||
self.update_pac_mask()
|
||||
self.u.print_exception(code, ctx)
|
||||
self.u.print_context(ctx, self.is_fault)
|
||||
|
||||
if self._sigint_pending or not handled or user_interrupt:
|
||||
self._sigint_pending = False
|
||||
|
@ -1022,6 +1022,12 @@ class HV(Reloadable):
|
|||
def decode_panic_call(self):
|
||||
xnutools.decode_panic_call(self.u, self.ctx)
|
||||
|
||||
def context(self):
|
||||
f = f" (orig: #{self.exc_orig_cpu})" if self.ctx.cpu_id != self.exc_orig_cpu else ""
|
||||
print(f" == On CPU #{self.ctx.cpu_id}{f} ==")
|
||||
print(f" Reason: {self.exc_reason.name}/{self.exc_code.name}")
|
||||
self.u.print_context(self.ctx, self.is_fault)
|
||||
|
||||
def bt(self, frame=None, lr=None):
|
||||
if frame is None:
|
||||
frame = self.ctx.regs[29]
|
||||
|
|
|
@ -223,14 +223,15 @@ class ProxyUtils(Reloadable):
|
|||
self.msr(L2C_ERR_STS_EL1, l2c_err_sts) # Clear the flag bits
|
||||
self.msr(DAIF, self.mrs(DAIF) | 0x100) # Re-enable SError exceptions
|
||||
|
||||
def print_exception(self, code, ctx, addr=lambda a: f"0x{a:x}"):
|
||||
def print_context(self, ctx, is_fault=True, addr=lambda a: f"0x{a:x}"):
|
||||
print(f" == Exception taken from {ctx.spsr.M.name} ==")
|
||||
el = ctx.spsr.M >> 2
|
||||
print(f" SPSR = {ctx.spsr}")
|
||||
print(f" ELR = {addr(ctx.elr)}" + (f" (0x{ctx.elr_phys:x})" if ctx.elr_phys else ""))
|
||||
print(f" ESR = {ctx.esr}")
|
||||
print(f" FAR = {addr(ctx.far)}" + (f" (0x{ctx.far_phys:x})" if ctx.far_phys else ""))
|
||||
print(f" SP_EL{el} = 0x{ctx.sp[el]:x}" + (f" (0x{ctx.sp_phys:x})" if ctx.sp_phys else ""))
|
||||
if is_fault:
|
||||
print(f" ESR = {ctx.esr}")
|
||||
print(f" FAR = {addr(ctx.far)}" + (f" (0x{ctx.far_phys:x})" if ctx.far_phys else ""))
|
||||
|
||||
for i in range(0, 31, 4):
|
||||
j = min(30, i + 3)
|
||||
|
@ -238,11 +239,11 @@ class ProxyUtils(Reloadable):
|
|||
|
||||
if ctx.elr_phys:
|
||||
print()
|
||||
print(" == Faulting code ==")
|
||||
print(" == Code context ==")
|
||||
|
||||
self.disassemble_at(ctx.elr_phys - 4 * 4, 9 * 4, ctx.elr_phys)
|
||||
|
||||
if code == EXC.SYNC:
|
||||
if is_fault:
|
||||
if ctx.esr.EC == ESR_EC.MSR or ctx.esr.EC == ESR_EC.IMPDEF and ctx.esr.ISS == 0x20:
|
||||
print()
|
||||
print(" == MRS/MSR fault decoding ==")
|
||||
|
@ -272,7 +273,6 @@ class ProxyUtils(Reloadable):
|
|||
if iss.DFSC == DABORT_DFSC.ECC_ERROR:
|
||||
self.print_l2c_regs()
|
||||
|
||||
elif code == EXC.SERROR:
|
||||
if ctx.esr.EC == ESR_EC.SERROR and ctx.esr.ISS == 0:
|
||||
self.print_l2c_regs()
|
||||
|
||||
|
|
Loading…
Reference in a new issue