From 2cdafcbbe0ec40481d8a5abb4b2f3eb1072db03a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 3 Apr 2004 05:33:10 +0000 Subject: [PATCH] Microoptimize pagezero() based upon something that I learned writing the optimized pagecopy(). This also has the virtual of making these two functions more similar in style. --- sys/amd64/amd64/support.S | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 633f7b1c052..7fcb4b9d07f 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -76,15 +76,15 @@ ENTRY(bzero) /* Address: %rdi */ ENTRY(pagezero) - lea 4096(%rdi),%rsi + movq $-PAGE_SIZE,%rdx + subq %rdx,%rdi xorq %rax,%rax 1: - movnti %rax,(%rdi) - movnti %rax,8(%rdi) - movnti %rax,16(%rdi) - movnti %rax,24(%rdi) - addq $32,%rdi - cmpq %rsi,%rdi + movnti %rax,(%rdi,%rdx) + movnti %rax,8(%rdi,%rdx) + movnti %rax,16(%rdi,%rdx) + movnti %rax,24(%rdi,%rdx) + addq $32,%rdx jne 1b sfence retq