aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/amd64/support.S
diff options
context:
space:
mode:
authorAlan Cox <alc@FreeBSD.org>2004-03-31 02:03:49 +0000
committerAlan Cox <alc@FreeBSD.org>2004-03-31 02:03:49 +0000
commitc64b70130e1f12712db07270c46200d5dec76ab8 (patch)
treec60f77800b3e4f54cc8d54e63754fc67bd4948b8 /sys/amd64/amd64/support.S
parentdb48c0d2540a87b2f675860d60422b77d708c58f (diff)
downloadsrc-c64b70130e1f12712db07270c46200d5dec76ab8.tar.gz
src-c64b70130e1f12712db07270c46200d5dec76ab8.zip
- Add an optimized page copy function for use by pmap_copy_page(). It is
roughly four times faster than bcopy() for uncached pages. - Sort the function prototypes in md_var.h.
Notes
Notes: svn path=/head/; revision=127653
Diffstat (limited to 'sys/amd64/amd64/support.S')
-rw-r--r--sys/amd64/amd64/support.S26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S
index f30fbcd7a485..633f7b1c0529 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)