Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/thorpej-i2c-spi-conf]: src/sys/uvm/pmap Sync with HEAD.



details:   https://anonhg.NetBSD.org/src/rev/ab1ad7a8b31b
branches:  thorpej-i2c-spi-conf
changeset: 1020798:ab1ad7a8b31b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu May 13 00:47:20 2021 +0000

description:
Sync with HEAD.

diffstat:

 sys/arch/aarch64/aarch64/db_interface.c        |   396 ++++++++-
 sys/arch/aarch64/aarch64/db_machdep.c          |     8 +-
 sys/arch/aarch64/aarch64/pmap.c                |   383 +--------
 sys/arch/aarch64/aarch64/pmapboot.c            |     6 +-
 sys/arch/aarch64/include/asan.h                |     5 +-
 sys/arch/aarch64/include/db_machdep.h          |    19 +-
 sys/arch/aarch64/include/pmap.h                |    45 +-
 sys/arch/alpha/alpha/cpu.c                     |     6 +-
 sys/arch/alpha/alpha/interrupt.c               |    14 +-
 sys/arch/alpha/alpha/machdep.c                 |    30 +-
 sys/arch/alpha/common/bus_dma.c                |    12 +-
 sys/arch/alpha/common/shared_intr.c            |     6 +-
 sys/arch/alpha/conf/Makefile.alpha             |     7 +-
 sys/arch/alpha/conf/kern.ldscript              |    86 ++
 sys/arch/alpha/include/alpha.h                 |     3 +-
 sys/arch/alpha/include/userret.h               |     4 +-
 sys/arch/alpha/isa/isa_machdep.c               |    12 +-
 sys/arch/alpha/isa/isadma_bounce.c             |    14 +-
 sys/arch/alpha/isa/mcclock_isa.c               |    20 +-
 sys/arch/alpha/jensenio/com_jensenio.c         |    12 +-
 sys/arch/alpha/jensenio/jensenio.c             |     8 +-
 sys/arch/alpha/jensenio/jensenio_dma.c         |     8 +-
 sys/arch/alpha/jensenio/jensenio_intr.c        |    49 +-
 sys/arch/alpha/jensenio/lpt_jensenio.c         |    12 +-
 sys/arch/alpha/jensenio/mcclock_jensenio.c     |    20 +-
 sys/arch/alpha/jensenio/pckbc_jensenio.c       |    17 +-
 sys/arch/alpha/pci/apecs_dma.c                 |    36 +-
 sys/arch/alpha/pci/apecs_pci.c                 |    28 +-
 sys/arch/alpha/pci/cia_dma.c                   |    52 +-
 sys/arch/alpha/pci/cia_pci.c                   |    28 +-
 sys/arch/alpha/pci/dwlpx_dma.c                 |    36 +-
 sys/arch/alpha/pci/dwlpx_pci.c                 |    32 +-
 sys/arch/alpha/pci/irongate_dma.c              |     8 +-
 sys/arch/alpha/pci/irongate_pci.c              |    28 +-
 sys/arch/alpha/pci/lca_dma.c                   |    36 +-
 sys/arch/alpha/pci/lca_pci.c                   |    28 +-
 sys/arch/alpha/pci/mcpcia_dma.c                |    36 +-
 sys/arch/alpha/pci/mcpcia_pci.c                |    23 +-
 sys/arch/alpha/pci/pci_bwx_bus_io_chipdep.c    |   122 +-
 sys/arch/alpha/pci/pci_bwx_bus_mem_chipdep.c   |   122 +-
 sys/arch/alpha/pci/pci_swiz_bus_io_chipdep.c   |   122 +-
 sys/arch/alpha/pci/pci_swiz_bus_mem_chipdep.c  |   122 +-
 sys/arch/alpha/pci/sio.c                       |    44 +-
 sys/arch/alpha/pci/sio_pic.c                   |    54 +-
 sys/arch/alpha/pci/tsp_dma.c                   |    40 +-
 sys/arch/alpha/pci/tsp_pci.c                   |    30 +-
 sys/arch/alpha/pci/ttwoga.c                    |    34 +-
 sys/arch/alpha/pci/ttwoga_dma.c                |    36 +-
 sys/arch/alpha/pci/ttwoga_pci.c                |    34 +-
 sys/arch/alpha/pci/ttwogavar.h                 |     3 +-
 sys/arch/alpha/sableio/com_sableio.c           |    12 +-
 sys/arch/alpha/sableio/fdc_sableio.c           |    12 +-
 sys/arch/alpha/sableio/lpt_sableio.c           |    12 +-
 sys/arch/alpha/sableio/pckbc_sableio.c         |    17 +-
 sys/arch/alpha/sableio/sableio.c               |    20 +-
 sys/arch/alpha/tc/ioasic.c                     |    28 +-
 sys/arch/alpha/tc/mcclock_ioasic.c             |    20 +-
 sys/arch/alpha/tc/tc_3000_300.c                |    20 +-
 sys/arch/alpha/tc/tc_3000_500.c                |    38 +-
 sys/arch/alpha/tc/tc_bus_mem.c                 |   122 +-
 sys/arch/alpha/tc/tc_conf.h                    |    22 +-
 sys/arch/alpha/tc/tcasic.c                     |    18 +-
 sys/arch/alpha/tlsb/gbus.c                     |     6 +-
 sys/arch/alpha/tlsb/mcclock_tlsb.c             |    12 +-
 sys/arch/amd64/include/gdt.h                   |    51 +-
 sys/arch/amd64/stand/prekern/console.c         |    23 +-
 sys/arch/amd64/stand/prekern/elf.c             |    12 +-
 sys/arch/amd64/stand/prekern/mm.c              |    10 +-
 sys/arch/amd64/stand/prekern/prekern.c         |     6 +-
 sys/arch/amd64/stand/prekern/prekern.h         |    12 +-
 sys/arch/amd64/stand/prekern/prng.c            |    16 +-
 sys/arch/amiga/amiga/autoconf.c                |    35 +-
 sys/arch/amiga/amiga/device.h                  |     4 +-
 sys/arch/amiga/clockport/files.clockport       |     4 +-
 sys/arch/amiga/dev/grf.c                       |    12 +-
 sys/arch/amiga/dev/grf_cc.c                    |     6 +-
 sys/arch/amiga/dev/grf_cl.c                    |     7 +-
 sys/arch/amiga/dev/grf_cv.c                    |     7 +-
 sys/arch/amiga/dev/grf_cv3d.c                  |     7 +-
 sys/arch/amiga/dev/grf_et.c                    |     7 +-
 sys/arch/amiga/dev/grf_rh.c                    |     6 +-
 sys/arch/amiga/dev/grf_rt.c                    |     6 +-
 sys/arch/amiga/dev/grf_ul.c                    |     6 +-
 sys/arch/amiga/dev/zbus.c                      |     7 +-
 sys/arch/amiga/stand/bootblock/Makefile        |    10 +-
 sys/arch/amigappc/amigappc/autoconf.c          |    32 +-
 sys/arch/arm/acpi/acpi_platform.c              |     6 +-
 sys/arch/arm/acpi/acpipchb.c                   |     8 +-
 sys/arch/arm/broadcom/bcm2838_pcie.c           |     9 +-
 sys/arch/arm/fdt/files.fdt                     |     4 +-
 sys/arch/arm/fdt/pcihost_fdt.c                 |     8 +-
 sys/arch/arm/include/arm32/pmap.h              |    16 +-
 sys/arch/arm/include/lock.h                    |    49 +-
 sys/arch/arm/nvidia/tegra_pcie.c               |     8 +-
 sys/arch/arm/nxp/imxpcie.c                     |     8 +-
 sys/arch/arm/rockchip/rk_drm.c                 |     8 +-
 sys/arch/arm/sunxi/files.sunxi                 |    13 +-
 sys/arch/arm/sunxi/sun6i_dma.c                 |    16 +-
 sys/arch/arm/sunxi/sun8i_crypto.c              |    47 +-
 sys/arch/arm/sunxi/sun8i_v3s_ccu.c             |   417 +++++++++
 sys/arch/arm/sunxi/sun8i_v3s_ccu.h             |   133 +++
 sys/arch/arm/sunxi/sun8i_v3s_codec.c           |   447 ++++++++++
 sys/arch/arm/sunxi/sunxi_codec.c               |    11 +-
 sys/arch/arm/sunxi/sunxi_codec.h               |    18 +-
 sys/arch/atari/atari/autoconf.c                |    35 +-
 sys/arch/atari/atari/device.h                  |     4 +-
 sys/arch/atari/dev/grf.c                       |    11 +-
 sys/arch/atari/dev/ite_cc.c                    |     7 +-
 sys/arch/atari/dev/ite_et.c                    |     7 +-
 sys/arch/evbarm/conf/GENERIC                   |     5 +-
 sys/arch/evbarm/conf/files.fdt                 |     3 +-
 sys/arch/evbmips/cavium/machdep.c              |    12 +-
 sys/arch/evbmips/conf/std.malta                |     4 +-
 sys/arch/hpcmips/dev/it8368.c                  |     7 +-
 sys/arch/hppa/include/param.h                  |     8 +-
 sys/arch/i386/i386/gdt.c                       |     6 +-
 sys/arch/i386/include/gdt.h                    |    50 +-
 sys/arch/mac68k/mac68k/machdep.c               |    37 +-
 sys/arch/macppc/conf/files.macppc              |     3 +-
 sys/arch/macppc/dev/snapper.c                  |     5 +-
 sys/arch/mips/cavium/dev/octeon_cib.c          |     6 +-
 sys/arch/mips/cavium/dev/octeon_gmx.c          |    16 +-
 sys/arch/mips/cavium/dev/octeon_intc.c         |     6 +-
 sys/arch/mips/cavium/mainbus.c                 |     8 +-
 sys/arch/mips/conf/Makefile.mips               |    10 +-
 sys/arch/mips/conf/std.octeon                  |     3 +-
 sys/arch/mips/include/locore.h                 |     4 +-
 sys/arch/mips/include/mips_param.h             |    43 +-
 sys/arch/mips/mips/fp.S                        |    19 +-
 sys/arch/mips/mips/mips_fpu.c                  |    10 +-
 sys/arch/mvme68k/stand/Makefile                |     6 +-
 sys/arch/mvme68k/stand/Makefile.booters        |    11 +-
 sys/arch/mvme68k/stand/wrtvid/Makefile         |    14 +-
 sys/arch/mvme68k/stand/wrtvid/wrtvid.c         |     6 +-
 sys/arch/ofppc/conf/files.ofppc                |     3 +-
 sys/arch/ofppc/pci/ofwpci.c                    |     8 +-
 sys/arch/pmax/stand/Makefile.booters           |     4 +-
 sys/arch/riscv/conf/Makefile.riscv             |    10 +-
 sys/arch/riscv/conf/kern.ldscript              |    46 +-
 sys/arch/riscv/include/asm.h                   |     7 +-
 sys/arch/riscv/include/loadfile_machdep.h      |    33 +
 sys/arch/riscv/include/locore.h                |    17 +-
 sys/arch/riscv/include/param.h                 |    11 +-
 sys/arch/riscv/include/pmap.h                  |    59 +-
 sys/arch/riscv/include/pte.h                   |    78 +-
 sys/arch/riscv/include/sysreg.h                |    30 +-
 sys/arch/riscv/include/types.h                 |    35 +-
 sys/arch/riscv/include/vmparam.h               |    40 +-
 sys/arch/riscv/riscv/autoconf.c                |     6 +-
 sys/arch/riscv/riscv/db_disasm.c               |    14 +-
 sys/arch/riscv/riscv/locore.S                  |     5 +-
 sys/arch/riscv/riscv/pmap_machdep.c            |    16 +-
 sys/arch/riscv/riscv/riscv_machdep.c           |     6 +-
 sys/arch/sgimips/dev/crime.c                   |    14 +-
 sys/arch/shark/conf/GENERIC                    |    32 +-
 sys/arch/shark/conf/INSTALL                    |    14 +-
 sys/arch/shark/conf/files.shark                |    25 +-
 sys/arch/shark/ofw/ofisapc.c                   |   126 --
 sys/arch/shark/shark/hat.c                     |    21 +-
 sys/arch/shark/shark/kbdreg.h                  |    32 -
 sys/arch/shark/shark/opms.c                    |  1011 ------------------------
 sys/arch/shark/shark/sequoia.c                 |   235 +++--
 sys/arch/shark/shark/sequoia.h                 |    18 +-
 sys/arch/shark/shark/shark_iic.c               |   291 ++++++
 sys/arch/sparc/dev/bootbus.c                   |     5 +-
 sys/arch/sparc/dev/ebus.c                      |     8 +-
 sys/arch/sparc/dev/sbus.c                      |     6 +-
 sys/arch/sparc/dev/vme_machdep.c               |     8 +-
 sys/arch/sparc/include/promlib.h               |    15 +-
 sys/arch/sparc/sparc/autoconf.c                |    22 +-
 sys/arch/sparc/sparc/iommu.c                   |    12 +-
 sys/arch/sparc/sparc/locore.s                  |     4 +-
 sys/arch/sparc/sparc/msiiep.c                  |     8 +-
 sys/arch/sparc/sparc/promlib.c                 |   126 ++-
 sys/arch/sparc64/conf/files.sparc64            |     3 +-
 sys/arch/sparc64/dev/cbus.c                    |     9 +-
 sys/arch/sparc64/dev/central.c                 |     8 +-
 sys/arch/sparc64/dev/ebus.c                    |     8 +-
 sys/arch/sparc64/dev/ebus_mainbus.c            |     8 +-
 sys/arch/sparc64/dev/fhc.c                     |     5 +-
 sys/arch/sparc64/dev/iommu.c                   |     9 +-
 sys/arch/sparc64/dev/iommuvar.h                |     4 +-
 sys/arch/sparc64/dev/psycho.c                  |     8 +-
 sys/arch/sparc64/dev/pyro.c                    |     8 +-
 sys/arch/sparc64/dev/sbus.c                    |     8 +-
 sys/arch/sparc64/dev/schizo.c                  |     8 +-
 sys/arch/sparc64/dev/upa.c                     |     8 +-
 sys/arch/sparc64/dev/vbus.c                    |     6 +-
 sys/arch/sparc64/dev/vpci.c                    |     8 +-
 sys/arch/sparc64/include/hypervisor.h          |    10 +-
 sys/arch/sparc64/sparc64/autoconf.c            |   204 +---
 sys/arch/sparc64/sparc64/hvcall.S              |     9 +-
 sys/arch/vax/vsa/tc_vsbus.c                    |     5 +-
 sys/arch/x86/acpi/acpi_machdep.c               |     6 +-
 sys/arch/x86/include/Makefile                  |     3 +-
 sys/arch/x86/include/gdt.h                     |    67 +
 sys/arch/x86/include/pmap.h                    |    10 +-
 sys/arch/x86/x86/mpacpi.c                      |    36 +-
 sys/compat/netbsd32/netbsd32.mk                |     4 +-
 sys/conf/lint.mk                               |     7 +-
 sys/dev/acpi/acpi.c                            |    41 +-
 sys/dev/acpi/acpi_pci.c                        |    40 +-
 sys/dev/acpi/acpivar.h                         |     3 +-
 sys/dev/acpi/genet_acpi.c                      |     6 +-
 sys/dev/audio/audio.c                          |    16 +-
 sys/dev/dm/device-mapper.c                     |    49 +-
 sys/dev/dm/dm_ioctl.c                          |    33 +-
 sys/dev/fdt/files.fdt                          |     8 +-
 sys/dev/fdt/genet_fdt.c                        |     6 +-
 sys/dev/hid/hidkbdmap.c                        |    59 +-
 sys/dev/ic/bcmgenet.c                          |    17 +-
 sys/dev/ic/bcmgenetvar.h                       |     4 +-
 sys/dev/isa/ess.c                              |    12 +-
 sys/dev/isa/files.isa                          |     4 +-
 sys/dev/isa/wss.c                              |     8 +-
 sys/dev/isa/ym.c                               |     9 +-
 sys/dev/midi.c                                 |     8 +-
 sys/dev/ofisa/files.ofisa                      |    12 +-
 sys/dev/ofisa/if_cs_ofisa.c                    |     8 +-
 sys/dev/ofisa/mcclock_ofisa.c                  |   188 ++++
 sys/dev/ofisa/ofisa.c                          |    22 +-
 sys/dev/ofisa/ofisavar.h                       |     6 +-
 sys/dev/ofw/files.ofw                          |     5 +-
 sys/dev/ofw/ofbus.c                            |    75 +-
 sys/dev/ofw/ofw_pci_subr.c                     |    86 ++
 sys/dev/pci/eso.c                              |    16 +-
 sys/dev/pci/files.pci                          |     4 +-
 sys/dev/pci/if_bwfm_pci.c                      |    25 +-
 sys/dev/pci/if_bwi_pci.c                       |    65 +-
 sys/dev/pci/if_cas.c                           |    49 +-
 sys/dev/pci/if_dge.c                           |    71 +-
 sys/dev/pci/if_et.c                            |    35 +-
 sys/dev/pci/if_fxp_pci.c                       |   260 +++--
 sys/dev/pci/if_iwi.c                           |    32 +-
 sys/dev/pci/if_iwn.c                           |   179 ++-
 sys/dev/pci/if_jme.c                           |    56 +-
 sys/dev/pci/if_kse.c                           |    22 +-
 sys/dev/pci/if_malo_pci.c                      |    27 +-
 sys/dev/pci/if_msk.c                           |   152 ++-
 sys/dev/pci/if_mtd_pci.c                       |    22 +-
 sys/dev/pci/if_rge.c                           |    24 +-
 sys/dev/pci/if_sk.c                            |    62 +-
 sys/dev/pci/if_tlp_pci.c                       |   158 +-
 sys/dev/pci/if_vr.c                            |    50 +-
 sys/dev/pci/if_wm.c                            |    14 +-
 sys/dev/pci/ixgbe/if_bypass.c                  |     3 +
 sys/dev/pci/ixgbe/if_fdir.c                    |     4 +
 sys/dev/pci/ixgbe/if_sriov.c                   |     4 +
 sys/dev/pci/ixgbe/ix_txrx.c                    |     8 +-
 sys/dev/pci/ixgbe/ixgbe.c                      |     8 +-
 sys/dev/pci/ixgbe/ixgbe_82598.c                |     5 +-
 sys/dev/pci/ixgbe/ixgbe_82599.c                |     5 +-
 sys/dev/pci/ixgbe/ixgbe_api.c                  |     5 +-
 sys/dev/pci/ixgbe/ixgbe_bypass.h               |     1 +
 sys/dev/pci/ixgbe/ixgbe_common.c               |     5 +-
 sys/dev/pci/ixgbe/ixgbe_dcb.c                  |     3 +
 sys/dev/pci/ixgbe/ixgbe_dcb.h                  |     1 +
 sys/dev/pci/ixgbe/ixgbe_dcb_82598.c            |     3 +
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.c            |     3 +
 sys/dev/pci/ixgbe/ixgbe_dcb_82599.h            |     1 +
 sys/dev/pci/ixgbe/ixgbe_fdir.h                 |     1 +
 sys/dev/pci/ixgbe/ixgbe_features.h             |     1 +
 sys/dev/pci/ixgbe/ixgbe_mbx.c                  |     5 +-
 sys/dev/pci/ixgbe/ixgbe_netbsd.c               |     6 +-
 sys/dev/pci/ixgbe/ixgbe_netmap.c               |     4 +
 sys/dev/pci/ixgbe/ixgbe_netmap.h               |     1 +
 sys/dev/pci/ixgbe/ixgbe_osdep.c                |     5 +-
 sys/dev/pci/ixgbe/ixgbe_phy.c                  |     5 +-
 sys/dev/pci/ixgbe/ixgbe_rss.h                  |     1 +
 sys/dev/pci/ixgbe/ixgbe_sriov.h                |     1 +
 sys/dev/pci/ixgbe/ixgbe_vf.c                   |     4 +-
 sys/dev/pci/ixgbe/ixgbe_x540.c                 |     3 +
 sys/dev/pci/ixgbe/ixgbe_x540.h                 |     1 +
 sys/dev/pci/ixgbe/ixgbe_x550.c                 |     3 +
 sys/dev/pci/ixgbe/ixgbe_x550.h                 |     1 +
 sys/dev/pci/ixgbe/ixv.c                        |     5 +-
 sys/dev/pci/joy_eap.c                          |     8 +-
 sys/dev/pci/pci.c                              |    28 +-
 sys/dev/pci/pcivar.h                           |    27 +-
 sys/dev/pci/ppb.c                              |    12 +-
 sys/dev/pci/siisata_pci.c                      |    30 +-
 sys/dev/pckbport/wskbdmap_mfii.c               |    61 +-
 sys/dev/raidframe/rf_netbsdkintf.c             |     6 +-
 sys/dev/sbus/dma_sbus.c                        |     5 +-
 sys/dev/sbus/lebuffer.c                        |     8 +-
 sys/dev/sbus/qec.c                             |     8 +-
 sys/dev/sbus/xbox.c                            |     8 +-
 sys/dev/tc/ioasic_subr.c                       |     8 +-
 sys/dev/tc/ioasicvar.h                         |     4 +-
 sys/dev/tc/tc.c                                |    13 +-
 sys/dev/tc/tcvar.h                             |     8 +-
 sys/dev/wscons/wsksymdef.h                     |     5 +-
 sys/kern/exec_script.c                         |     8 +-
 sys/kern/kern_event.c                          |    54 +-
 sys/kern/kern_exec.c                           |     6 +-
 sys/kern/subr_autoconf.c                       |    27 +-
 sys/lib/libsa/ufs.c                            |    51 +-
 sys/miscfs/fdesc/fdesc_vnops.c                 |    19 +-
 sys/modules/dtrace/Makefile                    |     4 +-
 sys/net/if_sppp.h                              |    13 +-
 sys/net/if_spppsubr.c                          |   617 +++++++++-----
 sys/net/if_spppvar.h                           |    10 +-
 sys/net/if_wg.c                                |    14 +-
 sys/stand/efiboot/Makefile.efiboot             |     4 +-
 sys/stand/efiboot/bootriscv64/Makefile         |    20 +
 sys/stand/efiboot/bootriscv64/efibootriscv64.c |    78 +
 sys/stand/efiboot/exec.c                       |    10 +-
 sys/sys/device.h                               |    16 +-
 sys/sys/eventvar.h                             |     6 +-
 sys/uvm/pmap/pmap_tlb.c                        |     6 +-
 310 files changed, 6374 insertions(+), 4485 deletions(-)

diffs (truncated from 21412 to 300 lines):

diff -r 06acc817ac36 -r ab1ad7a8b31b sys/arch/aarch64/aarch64/db_interface.c
--- a/sys/arch/aarch64/aarch64/db_interface.c   Sun May 09 23:26:53 2021 +0000
+++ b/sys/arch/aarch64/aarch64/db_interface.c   Thu May 13 00:47:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.12 2021/02/05 21:44:34 joerg Exp $ */
+/* $NetBSD: db_interface.c,v 1.12.4.1 2021/05/13 00:47:20 thorpej Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,13 +27,17 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.12 2021/02/05 21:44:34 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.12.4.1 2021/05/13 00:47:20 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
 
 #include <uvm/uvm.h>
+#include <uvm/uvm_ddb.h>
 #include <uvm/uvm_prot.h>
+#ifdef __HAVE_PMAP_PV_TRACK
+#include <uvm/pmap/pmap_pvt.h>
+#endif
 
 #include <aarch64/db_machdep.h>
 #include <aarch64/machdep.h>
@@ -53,6 +57,21 @@
 
 db_regs_t ddb_regs;
 
+static int
+db_validate_address(vaddr_t addr)
+{
+       struct proc *p = curproc;
+       struct pmap *pmap;
+
+       if (!p || !p->p_vmspace || !p->p_vmspace->vm_map.pmap ||
+           addr >= VM_MAXUSER_ADDRESS)
+               pmap = pmap_kernel();
+       else
+               pmap = p->p_vmspace->vm_map.pmap;
+
+       return (pmap_extract(pmap, addr, NULL) == false);
+}
+
 void
 db_read_bytes(vaddr_t addr, size_t size, char *data)
 {
@@ -60,31 +79,31 @@
        const char *src;
 
        for (src = (const char *)addr; size > 0;) {
+               const vaddr_t va = (vaddr_t)src;
                uintptr_t tmp;
 
-               if ((lastpage != atop((vaddr_t)src)) &&
-                   vtophys((vaddr_t)src) == VTOPHYS_FAILED) {
+               if (lastpage != atop(va) && db_validate_address(va)) {
                        db_printf("address %p is invalid\n", src);
                        memset(data, 0, size);  /* stubs are filled by zero */
                        return;
                }
-               lastpage = atop((vaddr_t)src);
+               lastpage = atop(va);
 
                if (aarch64_pan_enabled)
                        reg_pan_write(0); /* disable PAN */
 
                tmp = (uintptr_t)src | (uintptr_t)data;
-               if ((size >= 8) && ((tmp & 7) == 0)) {
+               if (size >= 8 && (tmp & 7) == 0) {
                        *(uint64_t *)data = *(const uint64_t *)src;
                        src += 8;
                        data += 8;
                        size -= 8;
-               } else if ((size >= 4) && ((tmp & 3) == 0)) {
+               } else if (size >= 4 && (tmp & 3) == 0) {
                        *(uint32_t *)data = *(const uint32_t *)src;
                        src += 4;
                        data += 4;
                        size -= 4;
-               } else if ((size >= 2) && ((tmp & 1) == 0)) {
+               } else if (size >= 2 && (tmp & 1) == 0) {
                        *(uint16_t *)data = *(const uint16_t *)src;
                        src += 2;
                        data += 2;
@@ -120,9 +139,6 @@
                ptep = kvtopte(addr);
                KASSERT(ptep != NULL);
 
-               /* save pte */
-               pte = *ptep;
-
                /*
                 * change to writable.  it is required to keep execute permission.
                 * because if the block/page to which the target address belongs is
@@ -130,7 +146,8 @@
                 * if PROT_EXECUTE is dropped and TLB is invalidated, the program
                 * will stop...
                 */
-               pmap_kvattr(addr, VM_PROT_EXECUTE|VM_PROT_READ|VM_PROT_WRITE);
+               /* old pte is returned by pmap_kvattr */
+               pte = pmap_kvattr(ptep, VM_PROT_EXECUTE|VM_PROT_READ|VM_PROT_WRITE);
                aarch64_tlbi_all();
 
                s = size;
@@ -175,27 +192,27 @@
 
        /* XXX: need to check read only block/page */
        for (dst = (char *)addr; size > 0;) {
+               const vaddr_t va = (vaddr_t)dst;
                uintptr_t tmp;
 
-               if ((lastpage != atop((vaddr_t)dst)) &&
-                   (vtophys((vaddr_t)dst) == VTOPHYS_FAILED)) {
+               if (lastpage != atop(va) && db_validate_address(va)) {
                        db_printf("address %p is invalid\n", dst);
                        return;
                }
-               lastpage = atop((vaddr_t)dst);
+               lastpage = atop(va);
 
                tmp = (uintptr_t)dst | (uintptr_t)data;
-               if ((size >= 8) && ((tmp & 7) == 0)) {
+               if (size >= 8 && (tmp & 7) == 0) {
                        *(uint64_t *)dst = *(const uint64_t *)data;
                        dst += 8;
                        data += 8;
                        size -= 8;
-               } else if ((size >= 4) && ((tmp & 3) == 0)) {
+               } else if (size >= 4 && (tmp & 3) == 0) {
                        *(uint32_t *)dst = *(const uint32_t *)data;
                        dst += 4;
                        data += 4;
                        size -= 4;
-               } else if ((size >= 2) && ((tmp & 1) == 0)) {
+               } else if (size >= 2 && (tmp & 1) == 0) {
                        *(uint16_t *)dst = *(const uint16_t *)data;
                        dst += 2;
                        data += 2;
@@ -244,25 +261,25 @@
 #define INSN_FMT_IMM19(insn)   (((insn) >> 5) & 0x7ffff)
 #define INSN_FMT_IMM14(insn)   (((insn) >> 5) & 0x3fff)
 
-       if (((inst & 0xfffffc1f) == 0xd65f0000) ||      /* ret xN */
-           ((inst & 0xfffffc1f) == 0xd63f0000) ||      /* blr xN */
-           ((inst & 0xfffffc1f) == 0xd61f0000)) {      /* br xN */
+       if ((inst & 0xfffffc1f) == 0xd65f0000 ||        /* ret xN */
+           (inst & 0xfffffc1f) == 0xd63f0000 ||        /* blr xN */
+           (inst & 0xfffffc1f) == 0xd61f0000) {        /* br xN */
                return db_fetch_reg(INSN_FMT_RN(inst), regs, false);
        }
 
-       if (((inst & 0xfc000000) == 0x94000000) ||      /* bl imm */
-           ((inst & 0xfc000000) == 0x14000000)) {      /* b imm */
+       if ((inst & 0xfc000000) == 0x94000000 ||        /* bl imm */
+           (inst & 0xfc000000) == 0x14000000) {        /* b imm */
                return SignExtend(26, INSN_FMT_IMM26(inst), 4) + pc;
        }
 
-       if (((inst & 0xff000010) == 0x54000000) ||      /* b.cond */
-           ((inst & 0x7f000000) == 0x35000000) ||      /* cbnz */
-           ((inst & 0x7f000000) == 0x34000000)) {      /* cbz */
+       if ((inst & 0xff000010) == 0x54000000 ||        /* b.cond */
+           (inst & 0x7f000000) == 0x35000000 ||        /* cbnz */
+           (inst & 0x7f000000) == 0x34000000) {        /* cbz */
                return SignExtend(19, INSN_FMT_IMM19(inst), 4) + pc;
        }
 
-       if (((inst & 0x7f000000) == 0x37000000) ||      /* tbnz */
-           ((inst & 0x7f000000) == 0x36000000)) {      /* tbz */
+       if ((inst & 0x7f000000) == 0x37000000 ||        /* tbnz */
+           (inst & 0x7f000000) == 0x36000000) {        /* tbz */
                return SignExtend(14, INSN_FMT_IMM14(inst), 4) + pc;
        }
 
@@ -274,19 +291,328 @@
 {
        LE32TOH(inst);
 
-       if (((inst & 0xfffffc1f) == 0xd65f0000) ||      /* ret xN */
-           ((inst & 0xfc000000) == 0x94000000) ||      /* bl */
-           ((inst & 0xfffffc1f) == 0xd63f0000) ||      /* blr */
-           ((inst & 0xfc000000) == 0x14000000) ||      /* b imm */
-           ((inst & 0xfffffc1f) == 0xd61f0000))        /* br */
+       if ((inst & 0xfffffc1f) == 0xd65f0000 ||        /* ret xN */
+           (inst & 0xfc000000) == 0x94000000 ||        /* bl */
+           (inst & 0xfffffc1f) == 0xd63f0000 ||        /* blr */
+           (inst & 0xfc000000) == 0x14000000 ||        /* b imm */
+           (inst & 0xfffffc1f) == 0xd61f0000)          /* br */
                return true;
 
 #define INSN_FMT_COND(insn)    ((insn) & 0xf)
 #define CONDITION_AL   14
 
-       if (((inst & 0xff000010) == 0x54000000) &&      /* b.cond */
-           (INSN_FMT_COND(inst) == CONDITION_AL))      /* always? */
+       if ((inst & 0xff000010) == 0x54000000 &&        /* b.cond */
+           INSN_FMT_COND(inst) == CONDITION_AL)        /* always? */
                return true;
 
        return false;
 }
+
+void
+db_pte_print(pt_entry_t pte, int level,
+    void (*pr)(const char *, ...) __printflike(1, 2))
+{
+       if (pte == 0) {
+               pr(" UNUSED\n");
+               return;
+       }
+
+       pr(" %s", (pte & LX_VALID) ? "VALID" : "**INVALID**");
+
+       if (level == 0 ||
+           (level == 1 && l1pde_is_table(pte)) ||
+           (level == 2 && l2pde_is_table(pte))) {
+
+               /* L0/L1/L2 TABLE */
+               if (level == 0 && (pte & LX_TYPE) != LX_TYPE_TBL)
+                       pr(" **ILLEGAL TYPE**"); /* L0 doesn't support block */
+               else
+                       pr(" L%d-TABLE", level);
+
+               pr(", PA=%lx", l0pde_pa(pte));
+
+               if (pte & LX_TBL_NSTABLE)
+                       pr(", NSTABLE");
+               if (pte & LX_TBL_APTABLE)
+                       pr(", APTABLE");
+               if (pte & LX_TBL_UXNTABLE)
+                       pr(", UXNTABLE");
+               if (pte & LX_TBL_PXNTABLE)
+                       pr(", PXNTABLE");
+
+       } else if ((level == 1 && l1pde_is_block(pte)) ||
+           (level == 2 && l2pde_is_block(pte)) ||
+           level == 3) {
+
+               /* L1/L2 BLOCK or L3 PAGE */
+               switch (level) {
+               case 1:
+                       pr(" L1(1G)-BLOCK");
+                       break;
+               case 2:
+                       pr(" L2(2M)-BLOCK");
+                       break;
+               case 3:
+                       pr(" %s", l3pte_is_page(pte) ?
+                           "L3(4K)-PAGE" : "**ILLEGAL TYPE**");
+                       break;
+               }
+
+               pr(", PA=%lx", l3pte_pa(pte));
+
+               pr(", %s", (pte & LX_BLKPAG_UXN) ?
+                   "UXN" : "UX ");
+               pr(", %s", (pte & LX_BLKPAG_PXN) ?
+                  "PXN" :  "PX ");
+
+               if (pte & LX_BLKPAG_CONTIG)
+                       pr(", CONTIG");
+
+               pr(", %s", (pte & LX_BLKPAG_NG) ? "NG" : "global");
+               pr(", %s", (pte & LX_BLKPAG_AF) ?
+                   "accessible" :
+                   "**fault** ");
+
+               switch (pte & LX_BLKPAG_SH) {
+               case LX_BLKPAG_SH_NS:
+                       pr(", SH_NS");
+                       break;
+               case LX_BLKPAG_SH_OS:
+                       pr(", SH_OS");
+                       break;
+               case LX_BLKPAG_SH_IS:
+                       pr(", SH_IS");
+                       break;
+               default:
+                       pr(", SH_??");
+                       break;
+               }
+
+               pr(", %s", (pte & LX_BLKPAG_AP_RO) ? "RO" : "RW");
+               pr(", %s", (pte & LX_BLKPAG_APUSER) ? "EL0" : "EL1");
+               pr(", %s", (pte & LX_BLKPAG_NS) ? "NS" : "secure");
+
+               switch (pte & LX_BLKPAG_ATTR_MASK) {
+               case LX_BLKPAG_ATTR_NORMAL_WB:
+                       pr(", WB");
+                       break;
+               case LX_BLKPAG_ATTR_NORMAL_NC:
+                       pr(", NC");
+                       break;
+               case LX_BLKPAG_ATTR_NORMAL_WT:
+                       pr(", WT");
+                       break;



Home | Main Index | Thread Index | Old Index