summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim
diff options
context:
space:
mode:
authorbenno <benno@FreeBSD.org>2002-05-28 07:36:36 +0000
committerbenno <benno@FreeBSD.org>2002-05-28 07:36:36 +0000
commit56b6a77a908eea1194bbcb970e212bbb2eab2671 (patch)
treed5946132a18b8b53b8e4d5b7d123adcf74c5fbb0 /sys/powerpc/aim
parenteddf946bef3d95ca4a0b33e63b9fd6678d538861 (diff)
downloadFreeBSD-src-56b6a77a908eea1194bbcb970e212bbb2eab2671.zip
FreeBSD-src-56b6a77a908eea1194bbcb970e212bbb2eab2671.tar.gz
Move the kcopy() function from trap.c to machdep.c. Add a prototype.
Diffstat (limited to 'sys/powerpc/aim')
-rw-r--r--sys/powerpc/aim/machdep.c30
-rw-r--r--sys/powerpc/aim/trap.c30
2 files changed, 30 insertions, 30 deletions
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
index ac35d8f..cedcf73 100644
--- a/sys/powerpc/aim/machdep.c
+++ b/sys/powerpc/aim/machdep.c
@@ -961,3 +961,33 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz)
pcpu->pc_current_asngen = 1;
}
+
+/*
+ * kcopy(const void *src, void *dst, size_t len);
+ *
+ * Copy len bytes from src to dst, aborting if we encounter a fatal
+ * page fault.
+ *
+ * kcopy() _must_ save and restore the old fault handler since it is
+ * called by uiomove(), which may be in the path of servicing a non-fatal
+ * page fault.
+ */
+int
+kcopy(const void *src, void *dst, size_t len)
+{
+ struct thread *td;
+ faultbuf env, *oldfault;
+ int rv;
+
+ td = PCPU_GET(curthread);
+ oldfault = td->td_pcb->pcb_onfault;
+ if ((rv = setfault(env)) != 0) {
+ td->td_pcb->pcb_onfault = oldfault;
+ return rv;
+ }
+
+ memcpy(dst, src, len);
+
+ td->td_pcb->pcb_onfault = oldfault;
+ return (0);
+}
diff --git a/sys/powerpc/aim/trap.c b/sys/powerpc/aim/trap.c
index a93e24b..7cac790 100644
--- a/sys/powerpc/aim/trap.c
+++ b/sys/powerpc/aim/trap.c
@@ -570,36 +570,6 @@ setusr(u_int content)
:: "n"(USER_SR), "r"(content));
}
-/*
- * kcopy(const void *src, void *dst, size_t len);
- *
- * Copy len bytes from src to dst, aborting if we encounter a fatal
- * page fault.
- *
- * kcopy() _must_ save and restore the old fault handler since it is
- * called by uiomove(), which may be in the path of servicing a non-fatal
- * page fault.
- */
-int
-kcopy(const void *src, void *dst, size_t len)
-{
- struct thread *td;
- faultbuf env, *oldfault;
- int rv;
-
- td = PCPU_GET(curthread);
- oldfault = td->td_pcb->pcb_onfault;
- if ((rv = setfault(env)) != 0) {
- td->td_pcb->pcb_onfault = oldfault;
- return rv;
- }
-
- memcpy(dst, src, len);
-
- td->td_pcb->pcb_onfault = oldfault;
- return (0);
-}
-
int
badaddr(void *addr, size_t size)
{
OpenPOWER on IntegriCloud