From nobody Tue Oct 24 19:00:30 2023 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SFLwt3KD0z4yNLm; Tue, 24 Oct 2023 19:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SFLwt2Qpzz4HT0; Tue, 24 Oct 2023 19:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698174030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j1jWSLpCtqZ2nrlaS6r4SJwky2JXbI/XGg+zt8TLngc=; b=FWMBdQOKe0EL9ljtP6W+BSNEgdENlAlSg6feY5Q8ZgvX2Np7HcX2ReI4cbUCiKjbOn0o9G pBqzjCSNCulN4IogJYUmEyoLzHwJGShAQmsTlIAOnxzAp2y/zsWil+tx9FtZrALePUdNYn gGdNCOVvXFuABkcYLTWkXtnDXGqhTnyQRwKD9jgXo40cSf2ORM94q0n/LB+FfssaQgd434 MEJPN9b5oEui/teYd3Jp2BtIPTV/wpN5ual32Edgou0HG/wkwCDllXQJCE4tJ7TJ5Mv87F o8WENa46QGnWEZAYOc/Ybry854VxPRRKDUZvx5ODyiuFQY/MIeID6EbeFUDqgw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698174030; a=rsa-sha256; cv=none; b=pdYhEF9iYuDUeS/9K//Ew01LocLY9aQ5tqWHMWFSyRVPEIdFpXhqHH4/dbl8aQgrOs9nNx XoCJjJJdFkXHZpEH+mk8nJzEpOlqL8+jrHm+/c0uPP9iVhbU9qOqCd3bvoNsy8X6v4Y7+i FrBo9hn2xQ9u7dFh9aB1vV+nf2vKc4Ldwu1/02/xIJTYkD2EfdwDGjn4lPaPaijaNJlBb7 vnN4yws5n1t3opu9WORot7wo+zZg8V0k1w7iRJYIs49Ti5gTtJw2luhrB1a++QxZTWjIJe v/T52MV63GxpH6bIZe2jPQIUsOebgzbgIESjKsAH9qqkKYB/YvYejDKbCnRx/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698174030; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j1jWSLpCtqZ2nrlaS6r4SJwky2JXbI/XGg+zt8TLngc=; b=mW72wpJqzqAZ0N2RU1jrHp55z5MSEoVkS78tTxC8Iol/dPhRwUZGSUt5H/g1AkOJRyP2BB oAKdy2nr7q2Oi2/G3PA4O+UFLLHGeCeZTYvZaRIChPxSs0McNlDde2qbXyGRu09OgzKYoX 3DOm/4c8vKhTaoD3PUwPF7shAEKWh5VV+3N29vz2iJaqEFbysVCphHxqRIxFMsUCYqDPA6 UZEXGpyAF1WWM9n0WCPkmWToXQUV8/E8F6qitxfyxyimQIEPWpgGDFjaDREcIPDT4cUtUY jxqczNKn0BCwd/vBBZgCx/EgwFstc52wrhaQUl71+PQ71HiiDcIlY7gZVYjFvw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SFLwt1NH1zZdg; Tue, 24 Oct 2023 19:00:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39OJ0U0J033197; Tue, 24 Oct 2023 19:00:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39OJ0Ulk033194; Tue, 24 Oct 2023 19:00:30 GMT (envelope-from git) Date: Tue, 24 Oct 2023 19:00:30 GMT Message-Id: <202310241900.39OJ0Ulk033194@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: fd3fcf71cced - stable/13 - riscv: Tidy panic messages for exceptions List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fd3fcf71ccedfd0b2614f6d93632f8dd35648a77 Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fd3fcf71ccedfd0b2614f6d93632f8dd35648a77 commit fd3fcf71ccedfd0b2614f6d93632f8dd35648a77 Author: John Baldwin AuthorDate: 2023-10-11 21:21:12 +0000 Commit: John Baldwin CommitDate: 2023-10-24 18:37:53 +0000 riscv: Tidy panic messages for exceptions - Remove trailing newlines - Be consistent about the format used to print pointer values - Print the trap value for access faults (it is the faulting address if non-zero) and illegal instructions (it is the first N bytes of the decoded instruction if non-zero) Reviewed by: markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D41786 (cherry picked from commit ff79f35bdae5742f4e56e1dc18fffc5d9ea98876) --- sys/riscv/riscv/trap.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index ecf6b043d606..8c1cd51d4dfa 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -263,7 +263,7 @@ fatal: return; } #endif - panic("Fatal page fault at %#lx: %#016lx", frame->tf_sepc, stval); + panic("Fatal page fault at %#lx: %#lx", frame->tf_sepc, stval); } void @@ -290,7 +290,7 @@ do_trap_supervisor(struct trapframe *frame) return; #endif - CTR4(KTR_TRAP, "%s: exception=%lu, sepc=%lx, stval=%lx", __func__, + CTR4(KTR_TRAP, "%s: exception=%lu, sepc=%#lx, stval=%#lx", __func__, exception, frame->tf_sepc, frame->tf_stval); switch (exception) { @@ -298,13 +298,14 @@ do_trap_supervisor(struct trapframe *frame) case SCAUSE_STORE_ACCESS_FAULT: case SCAUSE_INST_ACCESS_FAULT: dump_regs(frame); - panic("Memory access exception at 0x%016lx\n", frame->tf_sepc); + panic("Memory access exception at %#lx: %#lx", + frame->tf_sepc, frame->tf_stval); break; case SCAUSE_LOAD_MISALIGNED: case SCAUSE_STORE_MISALIGNED: case SCAUSE_INST_MISALIGNED: dump_regs(frame); - panic("Misaligned address exception at %#016lx: %#016lx\n", + panic("Misaligned address exception at %#lx: %#lx", frame->tf_sepc, frame->tf_stval); break; case SCAUSE_STORE_PAGE_FAULT: @@ -322,16 +323,18 @@ do_trap_supervisor(struct trapframe *frame) kdb_trap(exception, 0, frame); #else dump_regs(frame); - panic("No debugger in kernel.\n"); + panic("No debugger in kernel."); #endif break; case SCAUSE_ILLEGAL_INSTRUCTION: dump_regs(frame); - panic("Illegal instruction at 0x%016lx\n", frame->tf_sepc); + panic("Illegal instruction 0x%0*lx at %#lx", + (frame->tf_stval & 0x3) != 0x3 ? 4 : 8, + frame->tf_stval, frame->tf_sepc); break; default: dump_regs(frame); - panic("Unknown kernel exception %lx trap value %lx\n", + panic("Unknown kernel exception %#lx trap value %#lx", exception, frame->tf_stval); } } @@ -364,7 +367,7 @@ do_trap_user(struct trapframe *frame) } intr_enable(); - CTR4(KTR_TRAP, "%s: exception=%lu, sepc=%lx, stval=%lx", __func__, + CTR4(KTR_TRAP, "%s: exception=%lu, sepc=%#lx, stval=%#lx", __func__, exception, frame->tf_sepc, frame->tf_stval); switch (exception) { @@ -416,7 +419,7 @@ do_trap_user(struct trapframe *frame) break; default: dump_regs(frame); - panic("Unknown userland exception %lx, trap value %lx\n", + panic("Unknown userland exception %#lx, trap value %#lx", exception, frame->tf_stval); } }