Deleted Added
full compact
support.s (330446) support.s (347568)
1/*-
2 * Copyright (c) 1993 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 1993 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: stable/11/sys/i386/i386/support.s 330446 2018-03-05 06:59:30Z eadler $
29 * $FreeBSD: stable/11/sys/i386/i386/support.s 347568 2019-05-14 17:05:02Z kib $
30 */
31
32#include <machine/asmacros.h>
33#include <machine/cputypes.h>
34#include <machine/pmap.h>
35#include <machine/specialreg.h>
36
37#include "assym.s"

--- 783 unchanged lines hidden (view full) ---

821
822ENTRY(handle_ibrs_entry)
823 ret
824END(handle_ibrs_entry)
825
826ENTRY(handle_ibrs_exit)
827 ret
828END(handle_ibrs_exit)
30 */
31
32#include <machine/asmacros.h>
33#include <machine/cputypes.h>
34#include <machine/pmap.h>
35#include <machine/specialreg.h>
36
37#include "assym.s"

--- 783 unchanged lines hidden (view full) ---

821
822ENTRY(handle_ibrs_entry)
823 ret
824END(handle_ibrs_entry)
825
826ENTRY(handle_ibrs_exit)
827 ret
828END(handle_ibrs_exit)
829
830ENTRY(mds_handler_void)
831 ret
832END(mds_handler_void)
833
834ENTRY(mds_handler_verw)
835 subl $4, %esp
836 movw %ds, (%esp)
837 verw (%esp)
838 addl $4, %esp
839 ret
840END(mds_handler_verw)
841
842ENTRY(mds_handler_ivb)
843 movl %cr0, %eax
844 testb $CR0_TS, %al
845 je 1f
846 clts
8471: movl PCPU(MDS_BUF), %edx
848 movdqa %xmm0, PCPU(MDS_TMP)
849 pxor %xmm0, %xmm0
850
851 lfence
852 orpd (%edx), %xmm0
853 orpd (%edx), %xmm0
854 mfence
855 movl $40, %ecx
856 addl $16, %edx
8572: movntdq %xmm0, (%edx)
858 addl $16, %edx
859 decl %ecx
860 jnz 2b
861 mfence
862
863 movdqa PCPU(MDS_TMP),%xmm0
864 testb $CR0_TS, %al
865 je 3f
866 movl %eax, %cr0
8673: ret
868END(mds_handler_ivb)
869
870ENTRY(mds_handler_bdw)
871 movl %cr0, %eax
872 testb $CR0_TS, %al
873 je 1f
874 clts
8751: movl PCPU(MDS_BUF), %ebx
876 movdqa %xmm0, PCPU(MDS_TMP)
877 pxor %xmm0, %xmm0
878
879 movl %ebx, %edi
880 movl %ebx, %esi
881 movl $40, %ecx
8822: movntdq %xmm0, (%ebx)
883 addl $16, %ebx
884 decl %ecx
885 jnz 2b
886 mfence
887 movl $1536, %ecx
888 rep; movsb
889 lfence
890
891 movdqa PCPU(MDS_TMP),%xmm0
892 testb $CR0_TS, %al
893 je 3f
894 movl %eax, %cr0
8953: ret
896END(mds_handler_bdw)
897
898ENTRY(mds_handler_skl_sse)
899 movl %cr0, %eax
900 testb $CR0_TS, %al
901 je 1f
902 clts
9031: movl PCPU(MDS_BUF), %edi
904 movl PCPU(MDS_BUF64), %edx
905 movdqa %xmm0, PCPU(MDS_TMP)
906 pxor %xmm0, %xmm0
907
908 lfence
909 orpd (%edx), %xmm0
910 orpd (%edx), %xmm0
911 xorl %eax, %eax
9122: clflushopt 5376(%edi, %eax, 8)
913 addl $8, %eax
914 cmpl $8 * 12, %eax
915 jb 2b
916 sfence
917 movl $6144, %ecx
918 xorl %eax, %eax
919 rep; stosb
920 mfence
921
922 movdqa PCPU(MDS_TMP), %xmm0
923 testb $CR0_TS, %al
924 je 3f
925 movl %eax, %cr0
9263: ret
927END(mds_handler_skl_sse)
928
929ENTRY(mds_handler_skl_avx)
930 movl %cr0, %eax
931 testb $CR0_TS, %al
932 je 1f
933 clts
9341: movl PCPU(MDS_BUF), %edi
935 movl PCPU(MDS_BUF64), %edx
936 vmovdqa %ymm0, PCPU(MDS_TMP)
937 vpxor %ymm0, %ymm0, %ymm0
938
939 lfence
940 vorpd (%edx), %ymm0, %ymm0
941 vorpd (%edx), %ymm0, %ymm0
942 xorl %eax, %eax
9432: clflushopt 5376(%edi, %eax, 8)
944 addl $8, %eax
945 cmpl $8 * 12, %eax
946 jb 2b
947 sfence
948 movl $6144, %ecx
949 xorl %eax, %eax
950 rep; stosb
951 mfence
952
953 vmovdqa PCPU(MDS_TMP), %ymm0
954 testb $CR0_TS, %al
955 je 3f
956 movl %eax, %cr0
9573: ret
958END(mds_handler_skl_avx)
959
960ENTRY(mds_handler_skl_avx512)
961 movl %cr0, %eax
962 testb $CR0_TS, %al
963 je 1f
964 clts
9651: movl PCPU(MDS_BUF), %edi
966 movl PCPU(MDS_BUF64), %edx
967 vmovdqa64 %zmm0, PCPU(MDS_TMP)
968 vpxor %zmm0, %zmm0, %zmm0
969
970 lfence
971 vorpd (%edx), %zmm0, %zmm0
972 vorpd (%edx), %zmm0, %zmm0
973 xorl %eax, %eax
9742: clflushopt 5376(%edi, %eax, 8)
975 addl $8, %eax
976 cmpl $8 * 12, %eax
977 jb 2b
978 sfence
979 movl $6144, %ecx
980 xorl %eax, %eax
981 rep; stosb
982 mfence
983
984 vmovdqa64 PCPU(MDS_TMP), %zmm0
985 testb $CR0_TS, %al
986 je 3f
987 movl %eax, %cr0
9883: ret
989END(mds_handler_skl_avx512)
990
991ENTRY(mds_handler_silvermont)
992 movl %cr0, %eax
993 testb $CR0_TS, %al
994 je 1f
995 clts
9961: movl PCPU(MDS_BUF), %edx
997 movdqa %xmm0, PCPU(MDS_TMP)
998 pxor %xmm0, %xmm0
999
1000 movl $16, %ecx
10012: movntdq %xmm0, (%edx)
1002 addl $16, %edx
1003 decl %ecx
1004 jnz 2b
1005 mfence
1006
1007 movdqa PCPU(MDS_TMP),%xmm0
1008 testb $CR0_TS, %al
1009 je 3f
1010 movl %eax, %cr0
10113: ret
1012END(mds_handler_silvermont)