Changeset 41716 in vbox
- Timestamp:
- Jun 14, 2012 5:58:39 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 78524
- Location:
- trunk/src/VBox/Disassembler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Disassembler/DisasmTest.cpp
r41715 r41716 21 21 #include <VBox/dis.h> 22 22 #include <iprt/test.h> 23 #include <iprt/ asm.h>23 #include <iprt/ctype.h> 24 24 #include <iprt/string.h> 25 #include < VBox/err.h>25 #include <iprt/err.h> 26 26 27 27 … … 46 46 int rc = DISInstrToStr(&pabInstrs[off], enmDisCpuMode, &Cpu, &cb, szOutput, sizeof(szOutput)); 47 47 48 49 48 RTTESTI_CHECK_RC(rc, VINF_SUCCESS); 50 49 RTTESTI_CHECK(cb == Cpu.opsize); 51 50 RTTESTI_CHECK(cb > 0); 52 51 RTTESTI_CHECK(cb <= 16); 52 RTStrStripR(szOutput); 53 RTTESTI_CHECK(szOutput[0]); 54 if (szOutput[0]) 55 { 56 char *pszBytes = strchr(szOutput, '['); 57 RTTESTI_CHECK(pszBytes); 58 if (pszBytes) 59 { 60 RTTESTI_CHECK(pszBytes[-1] == ' '); 61 RTTESTI_CHECK(RT_C_IS_XDIGIT(pszBytes[1])); 62 RTTESTI_CHECK(pszBytes[cb * 3] == ']'); 63 RTTESTI_CHECK(pszBytes[cb * 3 + 1] == ' '); 64 65 size_t cch = strlen(szOutput); 66 RTTESTI_CHECK(szOutput[cch - 1] != ','); 67 } 68 } 53 69 if (cErrBefore != RTTestIErrorCount()) 54 RTTestIFailureDetails("rc=%Rrc, off=%#x (%u) cbInstr=%u enmDisCpuMode=%d ",70 RTTestIFailureDetails("rc=%Rrc, off=%#x (%u) cbInstr=%u enmDisCpuMode=%d\n", 55 71 rc, off, Cpu.opsize, enmDisCpuMode); 56 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s ", szOutput);72 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s\n", szOutput); 57 73 off += cb; 58 74 } -
trunk/src/VBox/Disassembler/DisasmTestA.asm
r41715 r41716 32 32 align 16 33 33 BEGINPROC TestProc32 34 xor eax, eax35 mov al, 436 lea edx, [4]37 mov edx, 438 mov eax, 439 shl eax, 440 shl edx, 441 shr edx, 442 mov eax, edx43 mov eax, ecx44 mov edx, eax45 mov ecx, eax46 DB 0xF0, 0x0F, 0x22, 0xC047 DB 0xF0, 0x0F, 0x20, 0xC048 smsw word [edx+16]49 ; invept eax, qword [ecx]50 DB 0x66, 0x0F, 0x38, 0x80, 0x151 ; invept eax, qword [ecx]52 DB 0x66, 0x0F, 0x38, 0x81, 0x153 mov eax, dword [ecx]54 mov word [edi], 0123ah55 movzx eax,byte [edx]56 movzx eax,word [edx]57 ; mov dword es:[ebx + 1234h], 0789h58 ; mov word fs:[ebx + ecx], 0654h59 ; mov byte [esi + eax*4], 0654h60 ; mov bl, byte ds:[ebp + 1234h]61 ; mov al, cs:[1234h + ecx*8]62 ; mov al, cs:[1234h]63 ; mov ax, cs:[1234h]64 ; mov eax, cs:[1234h]65 lock cmpxchg [ecx], eax66 lock cmpxchg [ecx], ax67 lock cmpxchg [ecx], dl68 movzx ESI,word [EAX]69 in al, dx70 in ax, dx71 in eax, dx72 mov ebx, [ecx + eax*4 + 17]73 mov ebx, [ebp + eax*4 + 4]74 mov ebx, [ebp + eax*4]75 int 80h76 in al, 60h77 in ax, dx78 out 64h, eax34 xor eax, eax 35 mov al, 4 36 lea edx, [4] 37 mov edx, 4 38 mov eax, 4 39 shl eax, 4 40 shl edx, 4 41 shr edx, 4 42 mov eax, edx 43 mov eax, ecx 44 mov edx, eax 45 mov ecx, eax 46 DB 0xF0, 0x0F, 0x22, 0xC0 47 DB 0xF0, 0x0F, 0x20, 0xC0 48 smsw word [edx+16] 49 ; invept eax, qword [ecx] 50 DB 0x66, 0x0F, 0x38, 0x80, 0x1 51 ; invept eax, qword [ecx] 52 DB 0x66, 0x0F, 0x38, 0x81, 0x1 53 mov eax, dword [ecx] 54 mov word [edi], 0123ah 55 movzx eax,byte [edx] 56 movzx eax,word [edx] 57 mov dword [es:ebx + 1234h], 0789h 58 mov word [fs:ebx + ecx], 0654h 59 mov byte [esi + eax*4], 054h 60 mov bl, byte [ds:ebp + 1234h] 61 mov al, [cs:1234h + ecx*8] 62 mov al, [cs:1234h] 63 mov ax, [cs:1234h] 64 mov eax, [cs:1234h] 65 lock cmpxchg [ecx], eax 66 lock cmpxchg [ecx], ax 67 lock cmpxchg [ecx], dl 68 movzx ESI,word [EAX] 69 in al, dx 70 in ax, dx 71 in eax, dx 72 mov ebx, [ecx + eax*4 + 17] 73 mov ebx, [ebp + eax*4 + 4] 74 mov ebx, [ebp + eax*4] 75 int 80h 76 in al, 60h 77 in ax, dx 78 out 64h, eax 79 79 80 movss xmm0, xmm181 movsd xmm6, xmm180 movss xmm0, xmm1 81 movsd xmm6, xmm1 82 82 83 pause 83 pause 84 nop 84 85 ENDPROC TestProc32 85 86 … … 89 90 align 16 90 91 BEGINPROC TestProc64 91 mov cr8, rax92 mov cr8, rbx93 mov [0xfffe0080], rax94 mov [0xfffe0080], rbx95 mov rax, cr896 mov rbx, cr897 mov rax, [0xfffe0080]98 mov rbx, [0xfffe0080]99 divsd xmm1, xmm0100 ; invept rdi, qword [rsi]101 DB 0x66, 0x0F, 0x38, 0x80, 0x3E102 ; invept rcx, qword [rdx]103 DB 0x66, 0x0F, 0x38, 0x80, 0xA104 ;invvpid rdi, qword [rsi]105 DB 0x66, 0x0F, 0x38, 0x81, 0x3E106 ; invvpid rcx, qword [rdx]107 DB 0x66, 0x0F, 0x38, 0x81, 0xA108 mov rdi, [rsi]109 mov rcx, [rdx]110 db 48h111 db 0c7h112 db 42h113 db 18h114 db 20h115 db 3eh116 db 23h117 db 80h118 call qword [r8+10h]119 ; test120 db 48h121 db 8bh122 db 44h123 db 0ah124 db 0f8h125 ;incorrectly assembled by yasm; REX.W should not be added!126 ;test rax, dword 0cc90cc90h127 db 8bh128 db 04h129 db 8dh130 db 00h131 db 00h132 db 0feh133 db 0ffh134 mov qword [rcx+rdx], 0135 mov dword [rcx+rdx], 0136 and [r15], rax137 movzx rcx, sil138 and sil, 3139 movzx ecx, ah140 and ah, 392 mov cr8, rax 93 mov cr8, rbx 94 mov [0xfffe0080], rax 95 mov [0xfffe0080], rbx 96 mov rax, cr8 97 mov rbx, cr8 98 mov rax, [0xfffe0080] 99 mov rbx, [0xfffe0080] 100 divsd xmm1, xmm0 101 ; invept rdi, qword [rsi] 102 DB 0x66, 0x0F, 0x38, 0x80, 0x3E 103 ; invept rcx, qword [rdx] 104 DB 0x66, 0x0F, 0x38, 0x80, 0xA 105 ;invvpid rdi, qword [rsi] 106 DB 0x66, 0x0F, 0x38, 0x81, 0x3E 107 ; invvpid rcx, qword [rdx] 108 DB 0x66, 0x0F, 0x38, 0x81, 0xA 109 mov rdi, [rsi] 110 mov rcx, [rdx] 111 db 48h 112 db 0c7h 113 db 42h 114 db 18h 115 db 20h 116 db 3eh 117 db 23h 118 db 80h 119 call qword [r8+10h] 120 ; test 121 db 48h 122 db 8bh 123 db 44h 124 db 0ah 125 db 0f8h 126 ;incorrectly assembled by yasm; REX.W should not be added! 127 ;test rax, dword 0cc90cc90h 128 db 8bh 129 db 04h 130 db 8dh 131 db 00h 132 db 00h 133 db 0feh 134 db 0ffh 135 mov qword [rcx+rdx], 0 136 mov dword [rcx+rdx], 0 137 and [r15], rax 138 movzx rcx, sil 139 and sil, 3 140 movzx ecx, ah 141 and ah, 3 141 142 142 sub rcx, 1234h143 mov rax, qword [0cc90cc90h]144 mov rax, qword [00c90cc90h]145 mov rax, dword 0cc90cc90h146 mov rax, qword 0ffffcc90cc90h143 sub rcx, 1234h 144 mov rax, qword [0cc90cc90h] 145 mov rax, qword [00c90cc90h] 146 mov rax, dword 0cc90cc90h 147 mov rax, qword 0ffffcc90cc90h 147 148 148 movzx rax,byte [edx]149 movzx rax,word [edx]150 movzx rax,byte [rdx]151 lock cmpxchg [rcx], rax152 lock cmpxchg [rcx], ax153 lock cmpxchg [r15], dl154 movzx RSI, word [R8]155 in al, dx156 in ax, dx157 in eax, dx158 mov rbx, [rcx + rax*4 + 17]159 mov rbx, [rbp + rax*4 + 4]160 mov rbx, [rbp + rax*4]161 mov rbx, [ebp + eax*4]162 int 80h163 in al, 60h164 in ax, dx165 out 64h, eax149 movzx rax,byte [edx] 150 movzx rax,word [edx] 151 movzx rax,byte [rdx] 152 lock cmpxchg [rcx], rax 153 lock cmpxchg [rcx], ax 154 lock cmpxchg [r15], dl 155 movzx RSI, word [R8] 156 in al, dx 157 in ax, dx 158 in eax, dx 159 mov rbx, [rcx + rax*4 + 17] 160 mov rbx, [rbp + rax*4 + 4] 161 mov rbx, [rbp + rax*4] 162 mov rbx, [ebp + eax*4] 163 int 80h 164 in al, 60h 165 in ax, dx 166 out 64h, eax 166 167 167 movss xmm0, xmm14168 movsd xmm6, xmm1168 movss xmm0, xmm14 169 movsd xmm6, xmm1 169 170 170 ret171 ret 171 172 ENDPROC TestProc64 172 173 %endif ; !OS2
Note:
See TracChangeset
for help on using the changeset viewer.