From nobody Tue Oct 24 19:00:15 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 4SFLwc1XMPz4yMnX; Tue, 24 Oct 2023 19:00:16 +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 4SFLwc14jRz4GVb; Tue, 24 Oct 2023 19:00:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698174016; 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=jhUz8SUMazGK3x8DK9hFp/sstmBw8emuVkzxEyUoZA0=; b=PtEQqlhHEbM1+DFkZilJ6ZpQNlnfbjc/6NfAX/+WgbT9GHhx2XO/neE1AZkkML5wrNEI00 4Lfv5IgDBEhck5VlTHEDkzvX0GXsQu9KKYkbyUpGattTdMvB8GwDGvhFcfxuUhS3v+ev0v Yu5UZgS+l7pIZscMtNqZQWtqtBJQ9OYT0Rc1D0xVBMXDbsf80YYsa89yw1cXSZ43BtEOB5 tvOHmcBE/NeAFdoQ+cyatlhoab7PY8KYZltK9tYNqVtHBVjCXA/jQYEIYIco/Wf33A0ntv aFmB8YUBwyeWj7yS5RDGFB/cxgAC9u5oekogz9dpUXoHFqbRC6+nOlJp5qGWvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698174016; a=rsa-sha256; cv=none; b=q1a8GHoGGi6D1mAk2hWjy/hvKaCp3PmqdDDKWmYo9YxWHZ+8hWT2Da+1yujPqgXDgGxpYr 0DcvogGOfRguMGFhwSu5L5YKQhUddr38bLkbH0G5Ww84EqWNMnQWqMpUhJzJasel33NqBQ nbwJHasPOwdh5Aq9s2ACDoJcfNviq0AY3A5EQ4XBKXiN7oYEF1lkZeUHkVohf8gtqF0IE6 yYuz/2swge7Fn8PECMuOVl9PWNxMvfB6y/9xNHbIhICXjZk60Eylm+IRc2N5lj0GktH3Ce isoz9MYSLHHchRqziuJA0xQKNEpdvAWI/PEG86UwirC78itgKMl4RccF5zIfSQ== 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=1698174016; 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=jhUz8SUMazGK3x8DK9hFp/sstmBw8emuVkzxEyUoZA0=; b=M/WGaplvONvPx8SGrQoZ29a/1N0PQUV94mmW/ZKV9G/zgJnlE+XTsOnRhsk4Uh9w0Jtawx qkPGC24yLL6fPALaqYT7Ibe3hL6PorD+ObXId/OwlhB4XGeDs5hwmi2ohgM8fGEM7aWf68 yi7Sa6l0ycnvi9faShcQjOMR5ugjbr/sg5ykqVP1yNF3jdqvID0bjlfplTumlglbtFSjsK GtMnMJdaDYRR5cAK3H+KCXoxqoeXY/ONrP4pWboSYsgB+5hlhvJ7nkORRDFQ6LTgDHPzqu Jlds9qx9DyygQBxsGfbA+CEcp+wceyYxd2TAgp1nJOjJdFKWYTwx6daesTWzBQ== 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 4SFLwc07ywzZbH; Tue, 24 Oct 2023 19:00:16 +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 39OJ0Fn4031344; Tue, 24 Oct 2023 19:00:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39OJ0FCK031335; Tue, 24 Oct 2023 19:00:15 GMT (envelope-from git) Date: Tue, 24 Oct 2023 19:00:15 GMT Message-Id: <202310241900.39OJ0FCK031335@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: 92b8ce704a09 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 92b8ce704a091719d8e0d2d4957bacf4b9882a63 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=92b8ce704a091719d8e0d2d4957bacf4b9882a63 commit 92b8ce704a091719d8e0d2d4957bacf4b9882a63 Author: John Baldwin AuthorDate: 2023-10-11 21:21:12 +0000 Commit: John Baldwin CommitDate: 2023-10-24 18:37:43 +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 ea48b02ba29b..f54efc324942 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -299,7 +299,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 @@ -326,7 +326,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) { @@ -334,13 +334,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: @@ -358,16 +359,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); } } @@ -400,7 +403,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) { @@ -450,7 +453,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); } }