summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/pmap.c2
-rw-r--r--sys/amd64/amd64/support.S26
-rw-r--r--sys/amd64/include/md_var.h5
3 files changed, 30 insertions, 3 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 0fe6f65..831f3b9 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -2463,7 +2463,7 @@ pmap_copy_page(vm_page_t msrc, vm_page_t mdst)
vm_offset_t src = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(msrc));
vm_offset_t dst = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(mdst));
- bcopy((void *)src, (void *)dst, PAGE_SIZE);
+ pagecopy((void *)src, (void *)dst);
}
/*
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S
index f30fbcd..633f7b1 100644
--- a/sys/amd64/amd64/support.S
+++ b/sys/amd64/amd64/support.S
@@ -167,6 +167,32 @@ ENTRY(memcpy)
movsb
ret
+/*
+ * pagecopy(%rdi=from, %rsi=to)
+ */
+ENTRY(pagecopy)
+ movq $-PAGE_SIZE,%rax
+ movq %rax,%rdx
+ subq %rax,%rdi
+ subq %rax,%rsi
+1:
+ prefetchnta (%rdi,%rax)
+ addq $64,%rax
+ jne 1b
+2:
+ movq (%rdi,%rdx),%rax
+ movnti %rax,(%rsi,%rdx)
+ movq 8(%rdi,%rdx),%rax
+ movnti %rax,8(%rsi,%rdx)
+ movq 16(%rdi,%rdx),%rax
+ movnti %rax,16(%rsi,%rdx)
+ movq 24(%rdi,%rdx),%rax
+ movnti %rax,24(%rsi,%rdx)
+ addq $32,%rdx
+ jne 2b
+ sfence
+ ret
+
/* fillw(pat, base, cnt) */
/* %rdi,%rsi, %rdx */
ENTRY(fillw)
diff --git a/sys/amd64/include/md_var.h b/sys/amd64/include/md_var.h
index 9e0ab9e..d1c3a40 100644
--- a/sys/amd64/include/md_var.h
+++ b/sys/amd64/include/md_var.h
@@ -65,11 +65,12 @@ void doreti_iret(void) __asm(__STRING(doreti_iret));
void doreti_iret_fault(void) __asm(__STRING(doreti_iret_fault));
void enable_sse(void);
void fillw(int /*u_short*/ pat, void *base, size_t cnt);
-void pagezero(void *addr);
+void fpstate_drop(struct thread *td);
int is_physical_memory(vm_offset_t addr);
int isa_nmi(int cd);
+void pagecopy(void *from, void *to);
+void pagezero(void *addr);
void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist);
int user_dbreg_trap(void);
-void fpstate_drop(struct thread *td);
#endif /* !_MACHINE_MD_VAR_H_ */
OpenPOWER on IntegriCloud