Module Name: src
Committed By: reinoud
Date: Thu Sep 15 15:34:20 UTC 2011
Modified Files:
src/sys/arch/usermode/usermode: pmap.c
Log Message:
Implement pmap_copy_page()! That was missing a long time!
To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/usermode/usermode/pmap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.69 src/sys/arch/usermode/usermode/pmap.c:1.70
--- src/sys/arch/usermode/usermode/pmap.c:1.69 Thu Sep 15 15:24:39 2011
+++ src/sys/arch/usermode/usermode/pmap.c Thu Sep 15 15:34:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.69 2011/09/15 15:24:39 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.70 2011/09/15 15:34:19 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.69 2011/09/15 15:24:39 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.70 2011/09/15 15:34:19 reinoud Exp $");
#include "opt_memsize.h"
#include "opt_kmempages.h"
@@ -1021,13 +1021,24 @@
memset(blob, 0, PAGE_SIZE);
num = thunk_pwrite(mem_fh, blob, PAGE_SIZE, pa);
if (num != PAGE_SIZE)
- panic("pmap_zero_page couldn't write out\n");
+ panic("%s: couldn't write out\n", __func__);
}
+/* XXX braindead copy page implementation but it works for now */
void
pmap_copy_page(paddr_t src, paddr_t dst)
{
-dprintf_debug("pmap_copy_page not implemented\n");
+ char blob[PAGE_SIZE];
+ int num;
+
+ dprintf_debug("pmap_copy_page: pa src %p, pa dst %p\n",
+ (void *) src, (void *) dst);
+ num = thunk_pread(mem_fh, blob, PAGE_SIZE, src);
+ if (num != PAGE_SIZE)
+ panic("%s: can't read in src\n", __func__);
+ num = thunk_pwrite(mem_fh, blob, PAGE_SIZE, dst);
+ if (num != PAGE_SIZE)
+ panic("%s: couldn't write out dst\n", __func__);
}
/* change access permissions on a given physical page */