From owner-svn-src-all@freebsd.org Fri Jun 19 16:26:43 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F4633322EF; Fri, 19 Jun 2020 16:26:43 +0000 (UTC) (envelope-from mmel@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49pPMR1wFwz4SGm; Fri, 19 Jun 2020 16:26:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38AB11D867; Fri, 19 Jun 2020 16:26:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 05JGQhPv088474; Fri, 19 Jun 2020 16:26:43 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 05JGQhfY088473; Fri, 19 Jun 2020 16:26:43 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202006191626.05JGQhfY088473@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 19 Jun 2020 16:26:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362388 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 362388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2020 16:26:43 -0000 Author: mmel Date: Fri Jun 19 16:26:42 2020 New Revision: 362388 URL: https://svnweb.freebsd.org/changeset/base/362388 Log: Use native-sized accesses when accessing memory from kdb. Not all MMIO mapped devices supports byte access. MFC after: 4 weeks Modified: head/sys/arm64/arm64/db_interface.c Modified: head/sys/arm64/arm64/db_interface.c ============================================================================== --- head/sys/arm64/arm64/db_interface.c Fri Jun 19 16:15:06 2020 (r362387) +++ head/sys/arm64/arm64/db_interface.c Fri Jun 19 16:26:42 2020 (r362388) @@ -118,12 +118,25 @@ db_read_bytes(vm_offset_t addr, size_t size, char *dat void *prev_jb; const char *src; int ret; + uint64_t tmp64; + uint32_t tmp32; + uint16_t tmp16; prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { src = (const char *)addr; + if (size == 8 && (addr & 7) == 0) { + tmp64 = *((const int *)src); + src = (const char *)&tmp64; + } else if (size == 4 && (addr & 3) == 0) { + tmp32 = *((const int *)src); + src = (const char *)&tmp32; + } else if (size == 2 && (addr & 1) == 0) { + tmp16 = *((const short *)src); + src = (const char *)&tmp16; + } while (size-- > 0) *data++ = *src++; } @@ -142,14 +155,33 @@ db_write_bytes(vm_offset_t addr, size_t size, char *da void *prev_jb; char *dst; int ret; + uint64_t tmp64; + uint32_t tmp32; + uint16_t tmp16; prev_jb = kdb_jmpbuf(jb); ret = setjmp(jb); if (ret == 0) { - dst = (char *)addr; - while (size-- > 0) - *dst++ = *data++; - + if (size == 8 && (addr & 7) == 0) { + dst = (char *)&tmp64; + while (size-- > 0) + *dst++ = *data++; + *((uint64_t *)addr) = tmp64; + } else if (size == 4 && (addr & 3) == 0) { + dst = (char *)&tmp32; + while (size-- > 0) + *dst++ = *data++; + *((uint32_t *)addr) = tmp32; + } else if (size == 2 && (addr & 1) == 0) { + dst = (char *)&tmp16; + while (size-- > 0) + *dst++ = *data++; + *((uint32_t *)addr) = tmp16; + } else { + dst = (char *)addr; + while (size-- > 0) + *dst++ = *data++; + } dsb(ish); /* Clean D-cache and invalidate I-cache */