2 * Copyright (c) 2003 Peter Wemm.
3 * Copyright (c) 1993 The Regents of the University of California.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the University nor the names of its contributors
15 * may be used to endorse or promote products derived from this software
16 * without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 #include <machine/asmacros.h>
36 #include <machine/specialreg.h>
37 #include <machine/pmap.h>
46 movq $PAGE_SIZE/8,%rcx
65 * pagecopy(%rdi=from, %rsi=to)
69 movq $PAGE_SIZE/8,%rcx
87 * The loop takes 29 bytes. Ensure that it doesn't cross a 32-byte
92 movnti %rax,(%rdi,%rdx)
93 movnti %rax,8(%rdi,%rdx)
94 movnti %rax,16(%rdi,%rdx)
95 movnti %rax,24(%rdi,%rdx)
104 * memcmpy(b1, b2, len)
116 movzbl (%rdi,%rcx,1),%eax
117 movzbl (%rsi,%rcx,1),%r8d
123 movzbl (%rdi,%rcx,1),%eax
124 movzbl (%rsi,%rcx,1),%r8d
130 movzbl (%rdi,%rcx,1),%eax
131 movzbl (%rsi,%rcx,1),%r8d
137 movzbl (%rdi,%rcx,1),%eax
138 movzbl (%rsi,%rcx,1),%r8d
198 * memmove(dst, src, cnt)
200 * Adapted from bcopy written by:
201 * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
210 cmpq %rcx,%r8 /* overlapping && src < dst? */
215 shrq $3,%rcx /* copy by 64-bit words */
219 andq $7,%rcx /* any bytes left? */
232 addq %rcx,%rdi /* copy backwards */
237 andq $7,%rcx /* any fractional bytes? */
242 movq %rdx,%rcx /* copy remainder by 32-bit words */
260 cmpq %rcx,%r8 /* overlapping && src < dst? */
269 addq %rcx,%rdi /* copy backwards */
282 * memcpy(dst, src, len)
285 * Note: memcpy does not support overlapping copies
293 shrq $3,%rcx /* copy by 64-bit words */
297 andq $7,%rcx /* any bytes left? */
320 * memset(dst, c, len)
328 movabs $0x0101010101010101,%rax
362 /* fillw(pat, base, cnt) */
363 /* %rdi,%rsi, %rdx */
375 /*****************************************************************************/
376 /* copyout and fubyte family */
377 /*****************************************************************************/
379 * Access user memory from inside the kernel. These routines should be
380 * the only places that do this.
382 * These routines set curpcb->pcb_onfault for the time they execute. When a
383 * protection violation occurs inside the functions, the trap handler
384 * returns to *curpcb->pcb_onfault instead of the function.
387 .macro SMAP_DISABLE smap
394 .macro SMAP_ENABLE smap
401 * copyout(from_kernel, to_user, len)
404 .macro COPYOUT smap erms
406 movq PCPU(CURPCB),%r9
407 movq $copy_fault,PCB_ONFAULT(%r9)
410 * Check explicitly for non-user addresses. If 486 write protection
411 * is being used, this check is essential because we are in kernel
412 * mode so the h/w does not provide any protection against writing
417 * First, prevent address wrapping.
423 * XXX STOP USING VM_MAXUSER_ADDRESS.
424 * It is an end address, not a max, so every time it is used correctly it
425 * looks like there is an off by one error, and of course it caused an off
426 * by one error in several places.
428 movq $VM_MAXUSER_ADDRESS,%rcx
433 * Set up arguments for rep movs*.
441 * Set return value to zero. Remaining failure mode goes through
457 movq %rax,PCB_ONFAULT(%r9)
467 movq %rax,PCB_ONFAULT(%r9)
472 ENTRY(copyout_nosmap_std)
473 COPYOUT smap=0 erms=0
474 END(copyout_nosmap_std)
476 ENTRY(copyout_smap_std)
477 COPYOUT smap=1 erms=0
478 END(copyout_smap_std)
480 ENTRY(copyout_nosmap_erms)
481 COPYOUT smap=0 erms=1
482 END(copyout_nosmap_erms)
484 ENTRY(copyout_smap_erms)
485 COPYOUT smap=1 erms=1
486 END(copyout_smap_erms)
489 * copyin(from_user, to_kernel, len)
492 .macro COPYIN smap erms
494 movq PCPU(CURPCB),%r9
495 movq $copy_fault,PCB_ONFAULT(%r9)
498 * make sure address is valid
503 movq $VM_MAXUSER_ADDRESS,%rcx
518 shrq $3,%rcx /* copy longword-wise */
522 andb $7,%cl /* copy remaining bytes */
525 movq %rax,PCB_ONFAULT(%r9)
535 movq %rax,PCB_ONFAULT(%r9)
540 ENTRY(copyin_nosmap_std)
542 END(copyin_nosmap_std)
544 ENTRY(copyin_smap_std)
548 ENTRY(copyin_nosmap_erms)
550 END(copyin_nosmap_erms)
552 ENTRY(copyin_smap_erms)
554 END(copyin_smap_erms)
557 /* Trap entry clears PSL.AC */
559 movq $0,PCB_ONFAULT(%r9)
565 * casueword32. Compare and set user integer. Returns -1 on fault,
566 * 0 if access was successful. Old value is written to *oldp.
567 * dst = %rdi, old = %esi, oldp = %rdx, new = %ecx
569 ENTRY(casueword32_nosmap)
571 movq PCPU(CURPCB),%r8
572 movq $fusufault,PCB_ONFAULT(%r8)
574 movq $VM_MAXUSER_ADDRESS-4,%rax
575 cmpq %rax,%rdi /* verify address is valid */
578 movl %esi,%eax /* old */
582 cmpxchgl %ecx,(%rdi) /* new = %ecx */
585 * The old value is in %eax. If the store succeeded it will be the
586 * value we expected (old) from before the store, otherwise it will
587 * be the current value. Save %eax into %esi to prepare the return
592 movq %rax,PCB_ONFAULT(%r8)
595 * Access the oldp after the pcb_onfault is cleared, to correctly
596 * catch corrupted pointer.
598 movl %esi,(%rdx) /* oldp = %rdx */
601 END(casueword32_nosmap)
603 ENTRY(casueword32_smap)
605 movq PCPU(CURPCB),%r8
606 movq $fusufault,PCB_ONFAULT(%r8)
608 movq $VM_MAXUSER_ADDRESS-4,%rax
609 cmpq %rax,%rdi /* verify address is valid */
612 movl %esi,%eax /* old */
617 cmpxchgl %ecx,(%rdi) /* new = %ecx */
621 * The old value is in %eax. If the store succeeded it will be the
622 * value we expected (old) from before the store, otherwise it will
623 * be the current value. Save %eax into %esi to prepare the return
628 movq %rax,PCB_ONFAULT(%r8)
631 * Access the oldp after the pcb_onfault is cleared, to correctly
632 * catch corrupted pointer.
634 movl %esi,(%rdx) /* oldp = %rdx */
637 END(casueword32_smap)
640 * casueword. Compare and set user long. Returns -1 on fault,
641 * 0 if access was successful. Old value is written to *oldp.
642 * dst = %rdi, old = %rsi, oldp = %rdx, new = %rcx
644 ENTRY(casueword_nosmap)
646 movq PCPU(CURPCB),%r8
647 movq $fusufault,PCB_ONFAULT(%r8)
649 movq $VM_MAXUSER_ADDRESS-4,%rax
650 cmpq %rax,%rdi /* verify address is valid */
653 movq %rsi,%rax /* old */
657 cmpxchgq %rcx,(%rdi) /* new = %rcx */
660 * The old value is in %rax. If the store succeeded it will be the
661 * value we expected (old) from before the store, otherwise it will
662 * be the current value.
666 movq %rax,PCB_ONFAULT(%r8)
670 END(casueword_nosmap)
672 ENTRY(casueword_smap)
674 movq PCPU(CURPCB),%r8
675 movq $fusufault,PCB_ONFAULT(%r8)
677 movq $VM_MAXUSER_ADDRESS-4,%rax
678 cmpq %rax,%rdi /* verify address is valid */
681 movq %rsi,%rax /* old */
686 cmpxchgq %rcx,(%rdi) /* new = %rcx */
690 * The old value is in %rax. If the store succeeded it will be the
691 * value we expected (old) from before the store, otherwise it will
692 * be the current value.
696 movq %rax,PCB_ONFAULT(%r8)
703 * Fetch (load) a 64-bit word, a 32-bit word, a 16-bit word, or an 8-bit
704 * byte from user memory.
705 * addr = %rdi, valp = %rsi
708 ENTRY(fueword_nosmap)
710 movq PCPU(CURPCB),%rcx
711 movq $fusufault,PCB_ONFAULT(%rcx)
713 movq $VM_MAXUSER_ADDRESS-8,%rax
714 cmpq %rax,%rdi /* verify address is valid */
719 movq %rax,PCB_ONFAULT(%rcx)
727 movq PCPU(CURPCB),%rcx
728 movq $fusufault,PCB_ONFAULT(%rcx)
730 movq $VM_MAXUSER_ADDRESS-8,%rax
731 cmpq %rax,%rdi /* verify address is valid */
738 movq %rax,PCB_ONFAULT(%rcx)
744 ENTRY(fueword32_nosmap)
746 movq PCPU(CURPCB),%rcx
747 movq $fusufault,PCB_ONFAULT(%rcx)
749 movq $VM_MAXUSER_ADDRESS-4,%rax
750 cmpq %rax,%rdi /* verify address is valid */
755 movq %rax,PCB_ONFAULT(%rcx)
759 END(fueword32_nosmap)
761 ENTRY(fueword32_smap)
763 movq PCPU(CURPCB),%rcx
764 movq $fusufault,PCB_ONFAULT(%rcx)
766 movq $VM_MAXUSER_ADDRESS-4,%rax
767 cmpq %rax,%rdi /* verify address is valid */
774 movq %rax,PCB_ONFAULT(%rcx)
780 ENTRY(fuword16_nosmap)
782 movq PCPU(CURPCB),%rcx
783 movq $fusufault,PCB_ONFAULT(%rcx)
785 movq $VM_MAXUSER_ADDRESS-2,%rax
790 movq $0,PCB_ONFAULT(%rcx)
797 movq PCPU(CURPCB),%rcx
798 movq $fusufault,PCB_ONFAULT(%rcx)
800 movq $VM_MAXUSER_ADDRESS-2,%rax
807 movq $0,PCB_ONFAULT(%rcx)
814 movq PCPU(CURPCB),%rcx
815 movq $fusufault,PCB_ONFAULT(%rcx)
817 movq $VM_MAXUSER_ADDRESS-1,%rax
822 movq $0,PCB_ONFAULT(%rcx)
829 movq PCPU(CURPCB),%rcx
830 movq $fusufault,PCB_ONFAULT(%rcx)
832 movq $VM_MAXUSER_ADDRESS-1,%rax
839 movq $0,PCB_ONFAULT(%rcx)
845 * Store a 64-bit word, a 32-bit word, a 16-bit word, or an 8-bit byte to
847 * addr = %rdi, value = %rsi
851 movq PCPU(CURPCB),%rcx
852 movq $fusufault,PCB_ONFAULT(%rcx)
854 movq $VM_MAXUSER_ADDRESS-8,%rax
855 cmpq %rax,%rdi /* verify address validity */
860 movq PCPU(CURPCB),%rcx
861 movq %rax,PCB_ONFAULT(%rcx)
868 movq PCPU(CURPCB),%rcx
869 movq $fusufault,PCB_ONFAULT(%rcx)
871 movq $VM_MAXUSER_ADDRESS-8,%rax
872 cmpq %rax,%rdi /* verify address validity */
879 movq PCPU(CURPCB),%rcx
880 movq %rax,PCB_ONFAULT(%rcx)
885 ENTRY(suword32_nosmap)
887 movq PCPU(CURPCB),%rcx
888 movq $fusufault,PCB_ONFAULT(%rcx)
890 movq $VM_MAXUSER_ADDRESS-4,%rax
891 cmpq %rax,%rdi /* verify address validity */
896 movq PCPU(CURPCB),%rcx
897 movq %rax,PCB_ONFAULT(%rcx)
904 movq PCPU(CURPCB),%rcx
905 movq $fusufault,PCB_ONFAULT(%rcx)
907 movq $VM_MAXUSER_ADDRESS-4,%rax
908 cmpq %rax,%rdi /* verify address validity */
915 movq PCPU(CURPCB),%rcx
916 movq %rax,PCB_ONFAULT(%rcx)
921 ENTRY(suword16_nosmap)
923 movq PCPU(CURPCB),%rcx
924 movq $fusufault,PCB_ONFAULT(%rcx)
926 movq $VM_MAXUSER_ADDRESS-2,%rax
927 cmpq %rax,%rdi /* verify address validity */
932 movq PCPU(CURPCB),%rcx /* restore trashed register */
933 movq %rax,PCB_ONFAULT(%rcx)
940 movq PCPU(CURPCB),%rcx
941 movq $fusufault,PCB_ONFAULT(%rcx)
943 movq $VM_MAXUSER_ADDRESS-2,%rax
944 cmpq %rax,%rdi /* verify address validity */
951 movq PCPU(CURPCB),%rcx /* restore trashed register */
952 movq %rax,PCB_ONFAULT(%rcx)
959 movq PCPU(CURPCB),%rcx
960 movq $fusufault,PCB_ONFAULT(%rcx)
962 movq $VM_MAXUSER_ADDRESS-1,%rax
963 cmpq %rax,%rdi /* verify address validity */
969 movq PCPU(CURPCB),%rcx /* restore trashed register */
970 movq %rax,PCB_ONFAULT(%rcx)
977 movq PCPU(CURPCB),%rcx
978 movq $fusufault,PCB_ONFAULT(%rcx)
980 movq $VM_MAXUSER_ADDRESS-1,%rax
981 cmpq %rax,%rdi /* verify address validity */
989 movq PCPU(CURPCB),%rcx /* restore trashed register */
990 movq %rax,PCB_ONFAULT(%rcx)
996 /* Fault entry clears PSL.AC */
998 movq PCPU(CURPCB),%rcx
1000 movq %rax,PCB_ONFAULT(%rcx)
1006 * copyinstr(from, to, maxlen, int *lencopied)
1007 * %rdi, %rsi, %rdx, %rcx
1009 * copy a string from 'from' to 'to', stop when a 0 character is reached.
1010 * return ENAMETOOLONG if string is longer than maxlen, and
1011 * EFAULT on protection violations. If lencopied is non-zero,
1012 * return the actual length in *lencopied.
1014 ENTRY(copyinstr_nosmap)
1016 movq %rdx,%r8 /* %r8 = maxlen */
1017 movq %rcx,%r9 /* %r9 = *len */
1018 xchgq %rdi,%rsi /* %rdi = from, %rsi = to */
1019 movq PCPU(CURPCB),%rcx
1020 movq $cpystrflt,PCB_ONFAULT(%rcx)
1022 movq $VM_MAXUSER_ADDRESS,%rax
1024 /* make sure 'from' is within bounds */
1028 /* restrict maxlen to <= VM_MAXUSER_ADDRESS-from */
1038 jz copyinstr_toolong
1046 END(copyinstr_nosmap)
1048 ENTRY(copyinstr_smap)
1050 movq %rdx,%r8 /* %r8 = maxlen */
1051 movq %rcx,%r9 /* %r9 = *len */
1052 xchgq %rdi,%rsi /* %rdi = from, %rsi = to */
1053 movq PCPU(CURPCB),%rcx
1054 movq $cpystrflt,PCB_ONFAULT(%rcx)
1056 movq $VM_MAXUSER_ADDRESS,%rax
1058 /* make sure 'from' is within bounds */
1064 /* restrict maxlen to <= VM_MAXUSER_ADDRESS-from */
1074 jz copyinstr_toolong_smap
1084 /* Success -- 0 byte reached */
1089 /* set *lencopied and return %eax */
1090 movq PCPU(CURPCB),%rcx
1091 movq $0,PCB_ONFAULT(%rcx)
1100 /* Fault entry clears PSL.AC */
1105 copyinstr_toolong_smap:
1108 /* rdx is zero - return ENAMETOOLONG or EFAULT */
1109 movq $VM_MAXUSER_ADDRESS,%rax
1112 movq $ENAMETOOLONG,%rax
1118 * copystr(from, to, maxlen, int *lencopied)
1119 * %rdi, %rsi, %rdx, %rcx
1123 movq %rdx,%r8 /* %r8 = maxlen */
1136 /* Success -- 0 byte reached */
1142 /* set *lencopied and return %rax */
1149 /* rdx is zero -- return ENAMETOOLONG */
1150 movl $ENAMETOOLONG,%eax
1155 * Handling of special amd64 registers and descriptor tables etc
1157 /* void lgdt(struct region_descriptor *rdp); */
1159 /* reload the descriptor table */
1162 /* flush the prefetch q */
1169 movl %eax,%fs /* Beware, use wrmsr to set 64 bit base */
1173 /* reload code selector by turning return into intersegmental return */
1181 /*****************************************************************************/
1182 /* setjump, longjump */
1183 /*****************************************************************************/
1186 movq %rbx,0(%rdi) /* save rbx */
1187 movq %rsp,8(%rdi) /* save rsp */
1188 movq %rbp,16(%rdi) /* save rbp */
1189 movq %r12,24(%rdi) /* save r12 */
1190 movq %r13,32(%rdi) /* save r13 */
1191 movq %r14,40(%rdi) /* save r14 */
1192 movq %r15,48(%rdi) /* save r15 */
1193 movq 0(%rsp),%rdx /* get rta */
1194 movq %rdx,56(%rdi) /* save rip */
1195 xorl %eax,%eax /* return(0); */
1200 movq 0(%rdi),%rbx /* restore rbx */
1201 movq 8(%rdi),%rsp /* restore rsp */
1202 movq 16(%rdi),%rbp /* restore rbp */
1203 movq 24(%rdi),%r12 /* restore r12 */
1204 movq 32(%rdi),%r13 /* restore r13 */
1205 movq 40(%rdi),%r14 /* restore r14 */
1206 movq 48(%rdi),%r15 /* restore r15 */
1207 movq 56(%rdi),%rdx /* get rta */
1208 movq %rdx,0(%rsp) /* put in return frame */
1209 xorl %eax,%eax /* return(1); */
1215 * Support for reading MSRs in the safe manner. (Instead of panic on #gp,
1219 /* int rdmsr_safe(u_int msr, uint64_t *data) */
1221 movq PCPU(CURPCB),%r8
1222 movq $msr_onfault,PCB_ONFAULT(%r8)
1224 rdmsr /* Read MSR pointed by %ecx. Returns
1225 hi byte in edx, lo in %eax */
1226 salq $32,%rdx /* sign-shift %rdx left */
1227 movl %eax,%eax /* zero-extend %eax -> %rax */
1231 movq %rax,PCB_ONFAULT(%r8)
1236 * Support for writing MSRs in the safe manner. (Instead of panic on #gp,
1240 /* int wrmsr_safe(u_int msr, uint64_t data) */
1242 movq PCPU(CURPCB),%r8
1243 movq $msr_onfault,PCB_ONFAULT(%r8)
1248 wrmsr /* Write MSR pointed by %ecx. Accepts
1249 hi byte in edx, lo in %eax. */
1251 movq %rax,PCB_ONFAULT(%r8)
1256 * MSR operations fault handler
1260 movq $0,PCB_ONFAULT(%r8)
1266 * void pmap_pti_pcid_invalidate(uint64_t ucr3, uint64_t kcr3);
1267 * Invalidates address space addressed by ucr3, then returns to kcr3.
1268 * Done in assembler to ensure no other memory accesses happen while
1272 ENTRY(pmap_pti_pcid_invalidate)
1275 movq %rdi,%cr3 /* to user page table */
1276 movq %rsi,%cr3 /* back to kernel */
1281 * void pmap_pti_pcid_invlpg(uint64_t ucr3, uint64_t kcr3, vm_offset_t va);
1282 * Invalidates virtual address va in address space ucr3, then returns to kcr3.
1285 ENTRY(pmap_pti_pcid_invlpg)
1288 movq %rdi,%cr3 /* to user page table */
1290 movq %rsi,%cr3 /* back to kernel */
1295 * void pmap_pti_pcid_invlrng(uint64_t ucr3, uint64_t kcr3, vm_offset_t sva,
1297 * Invalidates virtual addresses between sva and eva in address space ucr3,
1298 * then returns to kcr3.
1301 ENTRY(pmap_pti_pcid_invlrng)
1304 movq %rdi,%cr3 /* to user page table */
1306 addq $PAGE_SIZE,%rdx
1309 movq %rsi,%cr3 /* back to kernel */
1314 .macro ibrs_seq_label l
1317 .macro ibrs_call_label l
1320 .macro ibrs_seq count
1323 ibrs_call_label %(ll)
1325 ibrs_seq_label %(ll)
1331 /* all callers already saved %rax, %rdx, and %rcx */
1332 ENTRY(handle_ibrs_entry)
1333 cmpb $0,hw_ibrs_active(%rip)
1335 movl $MSR_IA32_SPEC_CTRL,%ecx
1337 orl $(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax
1338 orl $(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32,%edx
1340 movb $1,PCPU(IBPB_SET)
1341 testl $CPUID_STDEXT_SMEP,cpu_stdext_feature(%rip)
1345 END(handle_ibrs_entry)
1347 ENTRY(handle_ibrs_exit)
1348 cmpb $0,PCPU(IBPB_SET)
1350 movl $MSR_IA32_SPEC_CTRL,%ecx
1352 andl $~(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax
1353 andl $~((IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32),%edx
1355 movb $0,PCPU(IBPB_SET)
1357 END(handle_ibrs_exit)
1359 /* registers-neutral version, but needs stack */
1360 ENTRY(handle_ibrs_exit_rs)
1361 cmpb $0,PCPU(IBPB_SET)
1366 movl $MSR_IA32_SPEC_CTRL,%ecx
1368 andl $~(IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP),%eax
1369 andl $~((IA32_SPEC_CTRL_IBRS|IA32_SPEC_CTRL_STIBP)>>32),%edx
1374 movb $0,PCPU(IBPB_SET)
1376 END(handle_ibrs_exit_rs)
1381 * Flush L1D cache. Load enough of the data from the kernel text
1382 * to flush existing L1D content.
1384 * N.B. The function does not follow ABI calling conventions, it corrupts %rbx.
1385 * The vmm.ko caller expects that only %rax, %rdx, %rbx, %rcx, %r9, and %rflags
1386 * registers are clobbered. The NMI handler caller only needs %r13 preserved.
1389 #define L1D_FLUSH_SIZE (64 * 1024)
1391 movq $-L1D_FLUSH_SIZE, %rcx
1393 * pass 1: Preload TLB.
1394 * Kernel text is mapped using superpages. TLB preload is
1395 * done for the benefit of older CPUs which split 2M page
1396 * into 4k TLB entries.
1398 1: movb L1D_FLUSH_SIZE(%r9, %rcx), %al
1399 addq $PAGE_SIZE, %rcx
1403 movq $-L1D_FLUSH_SIZE, %rcx
1404 /* pass 2: Read each cache line. */
1405 2: movb L1D_FLUSH_SIZE(%r9, %rcx), %al
1410 #undef L1D_FLUSH_SIZE