Changeset 39989 in vbox for trunk/src/VBox/VMM/testcase
- Timestamp:
- Feb 3, 2012 4:31:04 PM (13 years ago)
- Location:
- trunk/src/VBox/VMM/testcase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/testcase/tstX86-1.cpp
r39084 r39989 66 66 *******************************************************************************/ 67 67 DECLASM(int32_t) x861_Test1(void); 68 DECLASM(int32_t) x861_Test2(void); 68 69 69 70 … … 201 202 if (rc != 0) 202 203 RTTestFailed(hTest, "x861_Test1 -> %d", rc); 204 205 RTTestSub(hTest, "part 2"); 206 rc = x861_Test2(); 207 if (rc != 0) 208 RTTestFailed(hTest, "x861_Test2 -> %d", rc); 203 209 } 204 210 -
trunk/src/VBox/VMM/testcase/tstX86-1A.asm
r37955 r39989 86 86 %%resume: 87 87 %endmacro 88 89 90 ;; 91 ; Function prologue saving all registers except EAX. 92 ; 93 %macro SAVE_ALL_PROLOGUE 0 94 push xBP 95 mov xBP, xSP 96 pushf 97 push xBX 98 push xCX 99 push xDX 100 push xSI 101 push xDI 102 %ifdef RT_ARCH_AMD64 103 push r8 104 push r9 105 push r10 106 push r11 107 push r12 108 push r13 109 push r14 110 push r15 111 %endif 112 %endmacro 113 114 115 ;; 116 ; Function epilogue restoring all regisers except EAX. 117 ; 118 %macro SAVE_ALL_EPILOGUE 0 119 %ifdef RT_ARCH_AMD64 120 pop r15 121 pop r14 122 pop r13 123 pop r12 124 pop r11 125 pop r10 126 pop r9 127 pop r8 128 %endif 129 pop xDI 130 pop xSI 131 pop xDX 132 pop xCX 133 pop xBX 134 popf 135 leave 136 %endmacro 137 88 138 89 139 … … 146 196 147 197 198 ;; 199 ; Loads all general, MMX and SSE registers except xBP and xSP with unique values. 200 ; 201 x861_LoadUniqueRegValuesSSE: 202 movq mm0, [._mm0] 203 movq mm1, [._mm1] 204 movq mm2, [._mm2] 205 movq mm3, [._mm3] 206 movq mm4, [._mm4] 207 movq mm5, [._mm5] 208 movq mm6, [._mm6] 209 movq mm7, [._mm7] 210 movdqu xmm0, [._xmm0] 211 movdqu xmm1, [._xmm1] 212 movdqu xmm2, [._xmm2] 213 movdqu xmm3, [._xmm3] 214 movdqu xmm4, [._xmm4] 215 movdqu xmm5, [._xmm5] 216 movdqu xmm6, [._xmm6] 217 movdqu xmm7, [._xmm7] 218 %ifdef RT_ARCH_AMD64 219 movdqu xmm8, [._xmm8] 220 movdqu xmm9, [._xmm9] 221 movdqu xmm10, [._xmm10] 222 movdqu xmm11, [._xmm11] 223 movdqu xmm12, [._xmm12] 224 movdqu xmm13, [._xmm13] 225 movdqu xmm14, [._xmm14] 226 movdqu xmm15, [._xmm15] 227 %endif 228 call x861_LoadUniqueRegValues 229 ret 230 ._mm0: times 8 db 040h 231 ._mm1: times 8 db 041h 232 ._mm2: times 8 db 042h 233 ._mm3: times 8 db 043h 234 ._mm4: times 8 db 044h 235 ._mm5: times 8 db 045h 236 ._mm6: times 8 db 046h 237 ._mm7: times 8 db 047h 238 ._xmm0: times 16 db 080h 239 ._xmm1: times 16 db 081h 240 ._xmm2: times 16 db 082h 241 ._xmm3: times 16 db 083h 242 ._xmm4: times 16 db 084h 243 ._xmm5: times 16 db 085h 244 ._xmm6: times 16 db 086h 245 ._xmm7: times 16 db 087h 246 %ifdef RT_ARCH_AMD64 247 ._xmm8: times 16 db 088h 248 ._xmm9: times 16 db 089h 249 ._xmm10: times 16 db 08ah 250 ._xmm11: times 16 db 08bh 251 ._xmm12: times 16 db 08ch 252 ._xmm13: times 16 db 08dh 253 ._xmm14: times 16 db 08eh 254 ._xmm15: times 16 db 08fh 255 %endif 256 ; end x861_LoadUniqueRegValuesSSE 257 258 259 ;; 260 ; Clears all general, MMX and SSE registers except xBP and xSP. 261 ; 262 x861_ClearRegistersSSE: 263 call x861_ClearRegisters 264 movq mm0, [.zero] 265 movq mm1, [.zero] 266 movq mm2, [.zero] 267 movq mm3, [.zero] 268 movq mm4, [.zero] 269 movq mm5, [.zero] 270 movq mm6, [.zero] 271 movq mm7, [.zero] 272 movdqu xmm0, [.zero] 273 movdqu xmm1, [.zero] 274 movdqu xmm2, [.zero] 275 movdqu xmm3, [.zero] 276 movdqu xmm4, [.zero] 277 movdqu xmm5, [.zero] 278 movdqu xmm6, [.zero] 279 movdqu xmm7, [.zero] 280 %ifdef RT_ARCH_AMD64 281 movdqu xmm8, [.zero] 282 movdqu xmm9, [.zero] 283 movdqu xmm10, [.zero] 284 movdqu xmm11, [.zero] 285 movdqu xmm12, [.zero] 286 movdqu xmm13, [.zero] 287 movdqu xmm14, [.zero] 288 movdqu xmm15, [.zero] 289 %endif 290 call x861_LoadUniqueRegValues 291 ret 292 293 ret 294 .zero times 16 db 000h 295 ; x861_ClearRegistersSSE 296 297 148 298 BEGINPROC x861_Test1 149 299 push xBP … … 574 724 jmp .return 575 725 ENDPROC x861_Test1 726 727 728 729 ;; 730 ; Tests the effect of prefix order in group 14. 731 ; 732 BEGINPROC x861_Test2 733 SAVE_ALL_PROLOGUE 734 735 ; Check testcase preconditions. 736 call x861_LoadUniqueRegValuesSSE 737 mov eax, __LINE__ 738 db 00Fh, 073h, 0D0h, 080h ; psrlq mm0, 128 739 call .check_mm0_zero_and_xmm0_nz 740 741 call x861_LoadUniqueRegValuesSSE 742 mov eax, __LINE__ 743 db 066h, 00Fh, 073h, 0D0h, 080h ; psrlq xmm0, 128 744 call .check_xmm0_zero_and_mm0_nz 745 746 747 ; 748 ; Real test - Inject other prefixes before the 066h and see what 749 ; happens. 750 ; 751 752 ; General checks that order does not matter, etc. 753 call x861_LoadUniqueRegValuesSSE 754 mov eax, __LINE__ 755 db 026h, 066h, 00Fh, 073h, 0D0h, 080h 756 call .check_xmm0_zero_and_mm0_nz 757 758 call x861_LoadUniqueRegValuesSSE 759 mov eax, __LINE__ 760 db 066h, 026h, 00Fh, 073h, 0D0h, 080h 761 call .check_xmm0_zero_and_mm0_nz 762 763 call x861_LoadUniqueRegValuesSSE 764 mov eax, __LINE__ 765 db 066h, 067h, 00Fh, 073h, 0D0h, 080h 766 call .check_xmm0_zero_and_mm0_nz 767 768 call x861_LoadUniqueRegValuesSSE 769 mov eax, __LINE__ 770 db 067h, 066h, 00Fh, 073h, 0D0h, 080h 771 call .check_xmm0_zero_and_mm0_nz 772 773 call x861_LoadUniqueRegValuesSSE 774 mov eax, __LINE__ 775 db 067h, 066h, 065h, 00Fh, 073h, 0D0h, 080h 776 call .check_xmm0_zero_and_mm0_nz 777 778 %ifdef RT_ARCH_AMD64 779 call x861_LoadUniqueRegValuesSSE 780 mov eax, __LINE__ 781 db 048h, 066h, 00Fh, 073h, 0D0h, 080h ; REX.W 782 call .check_xmm0_zero_and_mm0_nz 783 784 call x861_LoadUniqueRegValuesSSE 785 mov eax, __LINE__ 786 db 044h, 066h, 00Fh, 073h, 0D0h, 080h ; REX.R 787 call .check_xmm0_zero_and_mm0_nz 788 789 call x861_LoadUniqueRegValuesSSE 790 mov eax, __LINE__ 791 db 042h, 066h, 00Fh, 073h, 0D0h, 080h ; REX.X 792 call .check_xmm0_zero_and_mm0_nz 793 794 ; Actually for REX, order does matter if the prefix is used. 795 call x861_LoadUniqueRegValuesSSE 796 mov eax, __LINE__ 797 db 041h, 066h, 00Fh, 073h, 0D0h, 080h ; REX.B 798 call .check_xmm0_zero_and_mm0_nz 799 800 call x861_LoadUniqueRegValuesSSE 801 mov eax, __LINE__ 802 db 066h, 041h, 00Fh, 073h, 0D0h, 080h ; REX.B 803 call .check_xmm8_zero_and_xmm0_nz 804 %endif 805 806 ; Check all ignored prefixes (repeates some of the above). 807 call x861_LoadUniqueRegValuesSSE 808 mov eax, __LINE__ 809 db 066h, 026h, 00Fh, 073h, 0D0h, 080h ; es 810 call .check_xmm0_zero_and_mm0_nz 811 812 call x861_LoadUniqueRegValuesSSE 813 mov eax, __LINE__ 814 db 066h, 065h, 00Fh, 073h, 0D0h, 080h ; gs 815 call .check_xmm0_zero_and_mm0_nz 816 817 call x861_LoadUniqueRegValuesSSE 818 mov eax, __LINE__ 819 db 066h, 064h, 00Fh, 073h, 0D0h, 080h ; fs 820 call .check_xmm0_zero_and_mm0_nz 821 822 call x861_LoadUniqueRegValuesSSE 823 mov eax, __LINE__ 824 db 066h, 02eh, 00Fh, 073h, 0D0h, 080h ; cs 825 call .check_xmm0_zero_and_mm0_nz 826 827 call x861_LoadUniqueRegValuesSSE 828 mov eax, __LINE__ 829 db 066h, 036h, 00Fh, 073h, 0D0h, 080h ; ss 830 call .check_xmm0_zero_and_mm0_nz 831 832 call x861_LoadUniqueRegValuesSSE 833 mov eax, __LINE__ 834 db 066h, 03eh, 00Fh, 073h, 0D0h, 080h ; ds 835 call .check_xmm0_zero_and_mm0_nz 836 837 call x861_LoadUniqueRegValuesSSE 838 mov eax, __LINE__ 839 db 066h, 067h, 00Fh, 073h, 0D0h, 080h ; addr size 840 call .check_xmm0_zero_and_mm0_nz 841 842 %ifdef RT_ARCH_AMD64 843 call x861_LoadUniqueRegValuesSSE 844 mov eax, __LINE__ 845 db 066h, 048h, 00Fh, 073h, 0D0h, 080h ; REX.W 846 call .check_xmm0_zero_and_mm0_nz 847 848 call x861_LoadUniqueRegValuesSSE 849 mov eax, __LINE__ 850 db 066h, 044h, 00Fh, 073h, 0D0h, 080h ; REX.R 851 call .check_xmm0_zero_and_mm0_nz 852 853 call x861_LoadUniqueRegValuesSSE 854 mov eax, __LINE__ 855 db 066h, 042h, 00Fh, 073h, 0D0h, 080h ; REX.X 856 call .check_xmm0_zero_and_mm0_nz 857 858 call x861_LoadUniqueRegValuesSSE 859 mov eax, __LINE__ 860 db 066h, 041h, 00Fh, 073h, 0D0h, 080h ; REX.B - has actual effect on the instruction. 861 call .check_xmm8_zero_and_xmm0_nz 862 %endif 863 864 ; Repeated prefix until we hit the max opcode limit. 865 call x861_LoadUniqueRegValuesSSE 866 mov eax, __LINE__ 867 db 066h, 066h, 00Fh, 073h, 0D0h, 080h 868 call .check_xmm0_zero_and_mm0_nz 869 870 call x861_LoadUniqueRegValuesSSE 871 mov eax, __LINE__ 872 db 066h, 066h, 066h, 00Fh, 073h, 0D0h, 080h 873 call .check_xmm0_zero_and_mm0_nz 874 875 call x861_LoadUniqueRegValuesSSE 876 mov eax, __LINE__ 877 db 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 00Fh, 073h, 0D0h, 080h 878 call .check_xmm0_zero_and_mm0_nz 879 880 call x861_LoadUniqueRegValuesSSE 881 mov eax, __LINE__ 882 db 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 00Fh, 073h, 0D0h, 080h 883 call .check_xmm0_zero_and_mm0_nz 884 885 ShouldTrap X86_XCPT_GP, db 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 066h, 00Fh, 073h, 0D0h, 080h 886 887 %ifdef RT_ARCH_AMD64 888 ; Repeated REX is parsed, but only the last byte matters. 889 call x861_LoadUniqueRegValuesSSE 890 mov eax, __LINE__ 891 db 066h, 041h, 048h, 00Fh, 073h, 0D0h, 080h ; REX.B, REX.W 892 call .check_xmm0_zero_and_mm0_nz 893 894 call x861_LoadUniqueRegValuesSSE 895 mov eax, __LINE__ 896 db 066h, 048h, 041h, 00Fh, 073h, 0D0h, 080h ; REX.B, REX.W 897 call .check_xmm8_zero_and_xmm0_nz 898 899 call x861_LoadUniqueRegValuesSSE 900 mov eax, __LINE__ 901 db 066h, 048h, 044h, 042h, 048h, 044h, 042h, 048h, 044h, 042h, 041h, 00Fh, 073h, 0D0h, 080h 902 call .check_xmm8_zero_and_xmm0_nz 903 904 call x861_LoadUniqueRegValuesSSE 905 mov eax, __LINE__ 906 db 066h, 041h, 041h, 041h, 041h, 041h, 041h, 041h, 041h, 041h, 04eh, 00Fh, 073h, 0D0h, 080h 907 call .check_xmm0_zero_and_mm0_nz 908 %endif 909 910 ; Undefined sequences with prefixes that counts. 911 ShouldTrap X86_XCPT_UD, db 0f0h, 066h, 00Fh, 073h, 0D0h, 080h ; LOCK 912 ShouldTrap X86_XCPT_UD, db 0f2h, 066h, 00Fh, 073h, 0D0h, 080h ; REPNZ 913 ShouldTrap X86_XCPT_UD, db 0f3h, 066h, 00Fh, 073h, 0D0h, 080h ; REPZ 914 ShouldTrap X86_XCPT_UD, db 066h, 0f2h, 00Fh, 073h, 0D0h, 080h 915 ShouldTrap X86_XCPT_UD, db 066h, 0f3h, 00Fh, 073h, 0D0h, 080h 916 ShouldTrap X86_XCPT_UD, db 066h, 0f3h, 0f2h, 00Fh, 073h, 0D0h, 080h 917 ShouldTrap X86_XCPT_UD, db 066h, 0f2h, 0f3h, 00Fh, 073h, 0D0h, 080h 918 ShouldTrap X86_XCPT_UD, db 0f2h, 066h, 0f3h, 00Fh, 073h, 0D0h, 080h 919 ShouldTrap X86_XCPT_UD, db 0f3h, 066h, 0f2h, 00Fh, 073h, 0D0h, 080h 920 ShouldTrap X86_XCPT_UD, db 0f3h, 0f2h, 066h, 00Fh, 073h, 0D0h, 080h 921 ShouldTrap X86_XCPT_UD, db 0f2h, 0f3h, 066h, 00Fh, 073h, 0D0h, 080h 922 ShouldTrap X86_XCPT_UD, db 0f0h, 0f2h, 066h, 0f3h, 00Fh, 073h, 0D0h, 080h 923 ShouldTrap X86_XCPT_UD, db 0f0h, 0f3h, 066h, 0f2h, 00Fh, 073h, 0D0h, 080h 924 ShouldTrap X86_XCPT_UD, db 0f0h, 0f3h, 0f2h, 066h, 00Fh, 073h, 0D0h, 080h 925 ShouldTrap X86_XCPT_UD, db 0f0h, 0f2h, 0f3h, 066h, 00Fh, 073h, 0D0h, 080h 926 927 .success: 928 xor eax, eax 929 .return: 930 SAVE_ALL_EPILOGUE 931 ret 932 .failed2: 933 mov eax, -1 934 .failed: 935 jmp .return 936 937 .check_xmm0_zero_and_mm0_nz: 938 sub xSP, 20h 939 movdqu [xSP], xmm0 940 cmp dword [xSP], 0 941 jne .failed3 942 cmp dword [xSP + 4], 0 943 jne .failed3 944 cmp dword [xSP + 8], 0 945 jne .failed3 946 cmp dword [xSP + 12], 0 947 jne .failed3 948 movq [xSP], mm0 949 cmp dword [xSP], 0 950 je .failed3 951 cmp dword [xSP + 4], 0 952 je .failed3 953 add xSP, 20h 954 ret 955 956 .check_mm0_zero_and_xmm0_nz: 957 sub xSP, 20h 958 movq [xSP], mm0 959 cmp dword [xSP], 0 960 jne .failed3 961 cmp dword [xSP + 4], 0 962 jne .failed3 963 movdqu [xSP], xmm0 964 cmp dword [xSP], 0 965 je .failed3 966 cmp dword [xSP + 4], 0 967 je .failed3 968 cmp dword [xSP + 8], 0 969 je .failed3 970 cmp dword [xSP + 12], 0 971 je .failed3 972 add xSP, 20h 973 ret 974 975 %ifdef RT_ARCH_AMD64 976 .check_xmm8_zero_and_xmm0_nz: 977 sub xSP, 20h 978 movdqu [xSP], xmm8 979 cmp dword [xSP], 0 980 jne .failed3 981 cmp dword [xSP + 4], 0 982 jne .failed3 983 cmp dword [xSP + 8], 0 984 jne .failed3 985 cmp dword [xSP + 12], 0 986 jne .failed3 987 movdqu [xSP], xmm0 988 cmp dword [xSP], 0 989 je .failed3 990 cmp dword [xSP + 4], 0 991 je .failed3 992 cmp dword [xSP + 8], 0 993 je .failed3 994 cmp dword [xSP + 12], 0 995 je .failed3 996 add xSP, 20h 997 ret 998 %endif 999 1000 .failed3: 1001 add xSP, 20h + xS 1002 jmp .return 1003 1004 1005 ENDPROC x861_Test2 576 1006 577 1007
Note:
See TracChangeset
for help on using the changeset viewer.