Bug 243236

Summary: show devmap (ddb) prints garbage on a 32-bit arm system
Product: Base System Reporter: Thomas Skibo <thoma555-bsd>
Component: armAssignee: Mitchell Horne <mhorne>
Status: Closed FIXED    
Severity: Affects Only Me CC: mhorne
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: arm   
OS: Any   
Attachments:
Description Flags
potential fix for show devmap problem none

Description Thomas Skibo 2020-01-10 05:24:15 UTC
Created attachment 210583 [details]
potential fix for show devmap problem

When I break into the debugger on an armv7 machine, show devmap gives me this:

db> show devmap
Static device mappings:
  0xffc00000e02fffff - 0x00000001 mapped at VA 0xc006dffcd619c9d0
  0xfec00000f8ffffff - 0x00000001 mapped at VA 0xc006dffcd619c9d0

It should look like this:

db> show devmap
Static device mappings:
  0xe0000000 - 0xe02fffff mapped at VA 0xffc00000
  0xf8000000 - 0xf8ffffff mapped at VA 0xfec00000

Looks like its due to r355925.

I have attached a potential fix but I can't test it on an aarch64
system because mine doesn't have any static device mappings.
Comment 1 commit-hook freebsd_committer 2021-02-18 15:56:22 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=9976b42b697ce203b1d257b2a6fe64c8a2961645

commit 9976b42b697ce203b1d257b2a6fe64c8a2961645
Author:     Thomas Skibo <thomas-bsd@skibo.net>
AuthorDate: 2021-01-11 20:58:12 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2021-02-18 15:53:14 +0000

    ddb: fix show devmap output on 32-bit arm

    The output has been broken since 1b6dd6d772ca. Casting to uintmax_t
    before the call to printf is necessary to ensure that 32-bit addresses
    are interpreted correctly.

    PR:             243236
    MFC after:      3 days

 sys/kern/subr_devmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 2 commit-hook freebsd_committer 2021-02-23 14:36:41 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a223cf980b5ef8bea726a843fe5a7faf2278330

commit 0a223cf980b5ef8bea726a843fe5a7faf2278330
Author:     Thomas Skibo <thomas-bsd@skibo.net>
AuthorDate: 2021-01-11 20:58:12 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2021-02-23 14:30:14 +0000

    ddb: fix show devmap output on 32-bit arm

    The output has been broken since 1b6dd6d772ca. Casting to uintmax_t
    before the call to printf is necessary to ensure that 32-bit addresses
    are interpreted correctly.

    PR:             243236

    (cherry picked from commit 9976b42b697ce203b1d257b2a6fe64c8a2961645)

 sys/kern/subr_devmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 3 commit-hook freebsd_committer 2021-03-03 21:56:09 UTC
A commit in branch releng/13.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=661e2b8e1486cc966304ff98f766463de07e3f02

commit 661e2b8e1486cc966304ff98f766463de07e3f02
Author:     Thomas Skibo <thomas-bsd@skibo.net>
AuthorDate: 2021-01-11 20:58:12 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2021-03-03 21:54:45 +0000

    ddb: fix show devmap output on 32-bit arm

    The output has been broken since 1b6dd6d772ca. Casting to uintmax_t
    before the call to printf is necessary to ensure that 32-bit addresses
    are interpreted correctly.

    PR:             243236
    Approved by:    re (gjb)

    (cherry picked from commit 9976b42b697ce203b1d257b2a6fe64c8a2961645)
    (cherry picked from commit 0a223cf980b5ef8bea726a843fe5a7faf2278330)

 sys/kern/subr_devmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)