From nobody Sun Dec 19 12:19:47 2021 X-Original-To: dev-commits-src-all@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 2FC7E18F6A63; Sun, 19 Dec 2021 12:19:48 +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 4JH1xb6Qh3z4fSd; Sun, 19 Dec 2021 12:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 BDC55222F8; Sun, 19 Dec 2021 12:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BJCJlRf073791; Sun, 19 Dec 2021 12:19:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BJCJl9J073790; Sun, 19 Dec 2021 12:19:47 GMT (envelope-from git) Date: Sun, 19 Dec 2021 12:19:47 GMT Message-Id: <202112191219.1BJCJl9J073790@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: eb771bf6f496 - main - Implement suword16() for 32-bit and 64-bit PowerPC architecture. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eb771bf6f496538d2f621780702200f5390ff435 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639916387; 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=+H5Kbk+RqkhmkUHkbXOm3VuLbo42Jfz9iJJpMRGOjOo=; b=ehXZALOCwYKp9tDBQS4/W6fWBvKK6gqRbOOybblyVkdRkvLqZx7zIlJ9prs8sQSujArzA/ xIqgBH+F9nkR2lR2GZZzGASAJUrWo06QTA/cE2h1fbmYeHP1TG1JXF0rSBqcXxGG4EevIN d5hsgkUQh2VSV2P7a6WgQXCHCa5JhDRRX56k4IoMOMhlNUeUuDXCTlvQM87ewkr7wUDt7F KbZlwmtC6sXPYs+FxA2D0tlUN8noWB6l6R2XpS4y7kXy0GcPEdGTpD2enMi8U6NG+IcQQ2 4KQKOCR3MtwH0WBJOUBqCwkb15P63gAw1AR/FbBSBMWA1S/CK0U2wwnLCPriJQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639916387; a=rsa-sha256; cv=none; b=qgBsMQf9EmJPdh2mZvQWXvNqmflqiEu4uT7Tti8lxJWZWFwzyKMG0jxi0ktzpkKkh4Z/FS HFZAKM7ogTHb6lGFCT9hUuucQHTPXQ90lLSbe+05EHzq5b0CwP60YaurVKVarMkxOyE/9C vY5uSTstw6WpgpPrha0GXkMSP8BQ4hWKfq6Pox7i5GfD0tWE41QihtXkGMtOgccoiKD82B XGB7QX9AMzt1gp2uaBwt0W/XISGEFcjWd1hwOCSN5yy65QKHJHwyi0KKqDNwfKmnLvhsh0 s2bfzF7g/jvCsGbOCUpJuPsBu1CuN4E8LwISs53oCY3eKQwUX0xM8BjoOs/wTg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=eb771bf6f496538d2f621780702200f5390ff435 commit eb771bf6f496538d2f621780702200f5390ff435 Author: Hans Petter Selasky AuthorDate: 2021-12-19 12:16:59 +0000 Commit: Hans Petter Selasky CommitDate: 2021-12-19 12:17:55 +0000 Implement suword16() for 32-bit and 64-bit PowerPC architecture. This fixes compilation of usb(4) after 0ec590d24e415dd36e38648630a0b963412ad87e . MFC after: 1 week Sponsored by: NVIDIA Networking --- sys/powerpc/powerpc/copyinout.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sys/powerpc/powerpc/copyinout.c b/sys/powerpc/powerpc/copyinout.c index 1528accc0e0e..f6720e8ba09e 100644 --- a/sys/powerpc/powerpc/copyinout.c +++ b/sys/powerpc/powerpc/copyinout.c @@ -99,6 +99,8 @@ int copyout_remap(const void *kaddr, void *udaddr, size_t len); int copyout_direct(const void *kaddr, void *udaddr, size_t len); int copyin_remap(const void *uaddr, void *kaddr, size_t len); int copyin_direct(const void *uaddr, void *kaddr, size_t len); +int suword16_remap(volatile void *addr, int word); +int suword16_direct(volatile void *addr, int word); int suword32_remap(volatile void *addr, int word); int suword32_direct(volatile void *addr, int word); int suword_remap(volatile void *addr, long word); @@ -139,6 +141,7 @@ DEFINE_COPY_FUNC(int, copyinstr, (const void *, void *, size_t, size_t *)) DEFINE_COPY_FUNC(int, copyin, (const void *, void *, size_t)) DEFINE_COPY_FUNC(int, copyout, (const void *, void *, size_t)) DEFINE_COPY_FUNC(int, suword, (volatile void *, long)) +DEFINE_COPY_FUNC(int, suword16, (volatile void *, int)) DEFINE_COPY_FUNC(int, suword32, (volatile void *, int)) DEFINE_COPY_FUNC(int, suword64, (volatile void *, int64_t)) DEFINE_COPY_FUNC(int, fubyte, (volatile const void *)) @@ -314,6 +317,34 @@ REMAP(subyte)(volatile void *addr, int byte) return (0); } +int +REMAP(suword16)(volatile void *addr, int word) +{ + struct thread *td; + pmap_t pm; + jmp_buf env; + int16_t *p; + + td = curthread; + pm = &td->td_proc->p_vmspace->vm_pmap; + + td->td_pcb->pcb_onfault = &env; + if (setjmp(env)) { + td->td_pcb->pcb_onfault = NULL; + return (-1); + } + + if (pmap_map_user_ptr(pm, addr, (void **)&p, sizeof(*p), NULL)) { + td->td_pcb->pcb_onfault = NULL; + return (-1); + } + + *p = (int16_t)word; + + td->td_pcb->pcb_onfault = NULL; + return (0); +} + #ifdef __powerpc64__ int REMAP(suword32)(volatile void *addr, int word)