git: eb771bf6f496 - main - Implement suword16() for 32-bit and 64-bit PowerPC architecture.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 19 Dec 2021 12:19:47 UTC
The branch main has been updated by hselasky:
URL: https://cgit.FreeBSD.org/src/commit/?id=eb771bf6f496538d2f621780702200f5390ff435
commit eb771bf6f496538d2f621780702200f5390ff435
Author: Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2021-12-19 12:16:59 +0000
Commit: Hans Petter Selasky <hselasky@FreeBSD.org>
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)