Changeset 39958 in vbox for trunk/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h
- Timestamp:
- Feb 2, 2012 4:48:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImplStrInstr.cpp.h
r38092 r39958 64 64 * Setup. 65 65 */ 66 ADDR_TYPE uCounterReg = pCtx->ADDR_rCX;66 ADDR_TYPE uCounterReg = pCtx->ADDR_rCX; 67 67 if (uCounterReg == 0) 68 68 { … … 71 71 } 72 72 73 PCCPUMSELREGHID pSrc1Hid = iemSRegGetHid(pIemCpu, iEffSeg);74 VBOXSTRICTRC rcStrict= iemMemSegCheckReadAccessEx(pIemCpu, pSrc1Hid, iEffSeg);73 PCCPUMSELREGHID pSrc1Hid = iemSRegGetHid(pIemCpu, iEffSeg); 74 VBOXSTRICTRC rcStrict = iemMemSegCheckReadAccessEx(pIemCpu, pSrc1Hid, iEffSeg); 75 75 if (rcStrict != VINF_SUCCESS) 76 76 return rcStrict; … … 80 80 return rcStrict; 81 81 82 int8_t const cbIncr = pCtx->eflags.Bits.u1DF ? -(OP_SIZE / 8) : (OP_SIZE / 8);82 int8_t const cbIncr = pCtx->eflags.Bits.u1DF ? -(OP_SIZE / 8) : (OP_SIZE / 8); 83 83 ADDR_TYPE uSrc1AddrReg = pCtx->ADDR_rSI; 84 84 ADDR_TYPE uSrc2AddrReg = pCtx->ADDR_rDI; 85 uint32_t uEFlags = pCtx->eflags.u;85 uint32_t uEFlags = pCtx->eflags.u; 86 86 87 87 /* … … 104 104 cLeftSrc1Page = uCounterReg; 105 105 uint32_t cLeftSrc2Page = (PAGE_SIZE - (uVirtSrc2Addr & PAGE_OFFSET_MASK)) / (OP_SIZE / 8); 106 uint32_t cLeftPage = RT_MIN(cLeftSrc1Page, cLeftSrc2Page);106 uint32_t cLeftPage = RT_MIN(cLeftSrc1Page, cLeftSrc2Page); 107 107 108 108 if ( cLeftPage > 0 /* can be null if unaligned, do one fallback round. */ … … 119 119 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtSrc1Addr, IEM_ACCESS_DATA_R, &GCPhysSrc1Mem); 120 120 if (rcStrict != VINF_SUCCESS) 121 break;121 return rcStrict; 122 122 123 123 RTGCPHYS GCPhysSrc2Mem; 124 124 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtSrc2Addr, IEM_ACCESS_DATA_R, &GCPhysSrc2Mem); 125 125 if (rcStrict != VINF_SUCCESS) 126 break;126 return rcStrict; 127 127 128 128 /* … … 144 144 uSrc1AddrReg += cLeftPage * cbIncr; 145 145 uSrc2AddrReg += cLeftPage * cbIncr; 146 uCounterReg -= cLeftPage;146 uCounterReg -= cLeftPage; 147 147 } 148 148 else … … 150 150 /* Some mismatch, compare each item (and keep volatile 151 151 memory in mind). */ 152 uint32_t off = 0; 152 153 do 153 154 { 154 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)puSrc1Mem, *puSrc2Mem, &uEFlags); 155 uSrc1AddrReg += cbIncr; 156 uSrc2AddrReg += cbIncr; 157 uCounterReg--; 158 puSrc1Mem++; 159 puSrc2Mem++; 160 cLeftPage--; 161 } while ( (int32_t)cLeftPage > 0 155 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)&puSrc1Mem[off], puSrc2Mem[off], &uEFlags); 156 off++; 157 } while ( off < cLeftPage 162 158 && (uEFlags & X86_EFL_ZF)); 159 uSrc1AddrReg += cbIncr * off; 160 uSrc2AddrReg += cbIncr * off; 161 uCounterReg -= off; 163 162 } 163 164 /* Update the registers before looping. */ 165 pCtx->ADDR_rCX = uCounterReg; 166 pCtx->ADDR_rSI = uSrc1AddrReg; 167 pCtx->ADDR_rDI = uSrc2AddrReg; 168 pCtx->eflags.u = uEFlags; 169 170 iemMemPageUnmap(pIemCpu, GCPhysSrc1Mem, IEM_ACCESS_DATA_R, puSrc1Mem); 171 iemMemPageUnmap(pIemCpu, GCPhysSrc2Mem, IEM_ACCESS_DATA_R, puSrc2Mem); 164 172 continue; 165 173 } 166 174 } 175 iemMemPageUnmap(pIemCpu, GCPhysSrc2Mem, IEM_ACCESS_DATA_R, puSrc2Mem); 167 176 } 168 177 … … 177 186 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uValue1, iEffSeg, uSrc1AddrReg); 178 187 if (rcStrict != VINF_SUCCESS) 179 break;188 return rcStrict; 180 189 OP_TYPE uValue2; 181 190 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uValue2, X86_SREG_ES, uSrc2AddrReg); 182 191 if (rcStrict != VINF_SUCCESS) 183 break;192 return rcStrict; 184 193 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)(&uValue1, uValue2, &uEFlags); 185 194 186 uSrc1AddrReg += cbIncr; 187 uSrc2AddrReg += cbIncr; 188 uCounterReg--; 195 pCtx->ADDR_rSI = uSrc1AddrReg += cbIncr; 196 pCtx->ADDR_rDI = uSrc2AddrReg += cbIncr; 197 pCtx->ADDR_rCX = --uCounterReg; 198 pCtx->eflags.u = uEFlags; 189 199 cLeftPage--; 190 200 } while ( (int32_t)cLeftPage > 0 191 201 && (uEFlags & X86_EFL_ZF)); 192 if (rcStrict != VINF_SUCCESS)193 break;194 202 } while ( uCounterReg != 0 195 203 && (uEFlags & X86_EFL_ZF)); 196 204 197 205 /* 198 * Update the registers. 199 */ 200 pCtx->ADDR_rCX = uCounterReg; 201 pCtx->ADDR_rSI = uSrc1AddrReg; 202 pCtx->ADDR_rDI = uSrc2AddrReg; 203 pCtx->eflags.u = uEFlags; 204 if (rcStrict == VINF_SUCCESS) 205 iemRegAddToRip(pIemCpu, cbInstr); 206 207 return rcStrict; 206 * Done. 207 */ 208 iemRegAddToRip(pIemCpu, cbInstr); 209 return VINF_SUCCESS; 208 210 } 209 211 … … 274 276 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtSrc1Addr, IEM_ACCESS_DATA_R, &GCPhysSrc1Mem); 275 277 if (rcStrict != VINF_SUCCESS) 276 break;278 return rcStrict; 277 279 278 280 RTGCPHYS GCPhysSrc2Mem; 279 281 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtSrc2Addr, IEM_ACCESS_DATA_R, &GCPhysSrc2Mem); 280 282 if (rcStrict != VINF_SUCCESS) 281 break;283 return rcStrict; 282 284 283 285 /* … … 295 297 if (memcmp(puSrc2Mem, puSrc1Mem, cLeftPage * (OP_SIZE / 8))) 296 298 { 297 /* All matches, only compare the last it meto get the right eflags. */299 /* All matches, only compare the last item to get the right eflags. */ 298 300 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)&puSrc1Mem[cLeftPage-1], puSrc2Mem[cLeftPage-1], &uEFlags); 299 301 uSrc1AddrReg += cLeftPage * cbIncr; 300 302 uSrc2AddrReg += cLeftPage * cbIncr; 301 uCounterReg -= cLeftPage;303 uCounterReg -= cLeftPage; 302 304 } 303 305 else … … 305 307 /* Some mismatch, compare each item (and keep volatile 306 308 memory in mind). */ 309 uint32_t off = 0; 307 310 do 308 311 { 309 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)puSrc1Mem, *puSrc2Mem, &uEFlags); 310 uSrc1AddrReg += cbIncr; 311 uSrc2AddrReg += cbIncr; 312 uCounterReg--; 313 puSrc1Mem++; 314 puSrc2Mem++; 315 cLeftPage--; 316 } while ( (int32_t)cLeftPage > 0 312 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)&puSrc1Mem[off], puSrc2Mem[off], &uEFlags); 313 off++; 314 } while ( off < cLeftPage 317 315 && !(uEFlags & X86_EFL_ZF)); 316 uSrc1AddrReg += cbIncr * off; 317 uSrc2AddrReg += cbIncr * off; 318 uCounterReg -= off; 318 319 } 320 321 /* Update the registers before looping. */ 322 pCtx->ADDR_rCX = uCounterReg; 323 pCtx->ADDR_rSI = uSrc1AddrReg; 324 pCtx->ADDR_rDI = uSrc2AddrReg; 325 pCtx->eflags.u = uEFlags; 326 327 iemMemPageUnmap(pIemCpu, GCPhysSrc1Mem, IEM_ACCESS_DATA_R, puSrc1Mem); 328 iemMemPageUnmap(pIemCpu, GCPhysSrc2Mem, IEM_ACCESS_DATA_R, puSrc2Mem); 319 329 continue; 320 330 } 331 iemMemPageUnmap(pIemCpu, GCPhysSrc2Mem, IEM_ACCESS_DATA_R, puSrc2Mem); 321 332 } 322 333 } … … 332 343 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uValue1, iEffSeg, uSrc1AddrReg); 333 344 if (rcStrict != VINF_SUCCESS) 334 break;345 return rcStrict; 335 346 OP_TYPE uValue2; 336 347 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uValue2, X86_SREG_ES, uSrc2AddrReg); 337 348 if (rcStrict != VINF_SUCCESS) 338 break;349 return rcStrict; 339 350 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)(&uValue1, uValue2, &uEFlags); 340 351 341 uSrc1AddrReg += cbIncr; 342 uSrc2AddrReg += cbIncr; 343 uCounterReg--; 352 pCtx->ADDR_rSI = uSrc1AddrReg += cbIncr; 353 pCtx->ADDR_rDI = uSrc2AddrReg += cbIncr; 354 pCtx->ADDR_rCX = --uCounterReg; 355 pCtx->eflags.u = uEFlags; 344 356 cLeftPage--; 345 357 } while ( (int32_t)cLeftPage > 0 346 358 && !(uEFlags & X86_EFL_ZF)); 347 if (rcStrict != VINF_SUCCESS)348 break;349 359 } while ( uCounterReg != 0 350 360 && !(uEFlags & X86_EFL_ZF)); 351 361 352 362 /* 353 * Update the registers. 354 */ 355 pCtx->ADDR_rCX = uCounterReg; 356 pCtx->ADDR_rSI = uSrc1AddrReg; 357 pCtx->ADDR_rDI = uSrc2AddrReg; 358 pCtx->eflags.u = uEFlags; 359 if (rcStrict == VINF_SUCCESS) 360 iemRegAddToRip(pIemCpu, cbInstr); 361 362 return rcStrict; 363 * Done. 364 */ 365 iemRegAddToRip(pIemCpu, cbInstr); 366 return VINF_SUCCESS; 363 367 } 364 368 … … 417 421 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtAddr, IEM_ACCESS_DATA_R, &GCPhysMem); 418 422 if (rcStrict != VINF_SUCCESS) 419 break;423 return rcStrict; 420 424 421 425 /* … … 439 443 /* Update the regs. */ 440 444 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)&uValueReg, uTmpValue, &uEFlags); 441 uCounterReg -= i; 442 uAddrReg += i * cbIncr; 445 pCtx->ADDR_rCX = uCounterReg -= i; 446 pCtx->ADDR_rDI = uAddrReg += i * cbIncr; 447 pCtx->eflags.u = uEFlags; 443 448 Assert(!(uEFlags & X86_EFL_ZF) == (i < cLeftPage)); 449 iemMemPageUnmap(pIemCpu, GCPhysMem, IEM_ACCESS_DATA_R, puMem); 444 450 if (fQuit) 445 451 break; … … 466 472 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uTmpValue, X86_SREG_ES, uAddrReg); 467 473 if (rcStrict != VINF_SUCCESS) 468 break;474 return rcStrict; 469 475 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)&uValueReg, uTmpValue, &uEFlags); 470 476 471 uAddrReg += cbIncr; 472 uCounterReg--; 477 pCtx->ADDR_rDI = uAddrReg += cbIncr; 478 pCtx->ADDR_rCX = --uCounterReg; 479 pCtx->eflags.u = uEFlags; 473 480 cLeftPage--; 474 481 } while ( (int32_t)cLeftPage > 0 475 482 && (uEFlags & X86_EFL_ZF)); 476 if (rcStrict != VINF_SUCCESS)477 break;478 483 } while ( uCounterReg != 0 479 484 && (uEFlags & X86_EFL_ZF)); 480 485 481 486 /* 482 * Update the registers. 483 */ 484 pCtx->ADDR_rCX = uCounterReg; 485 pCtx->ADDR_rDI = uAddrReg; 486 pCtx->eflags.u = uEFlags; 487 if (rcStrict == VINF_SUCCESS) 488 iemRegAddToRip(pIemCpu, cbInstr); 489 490 return rcStrict; 487 * Done. 488 */ 489 iemRegAddToRip(pIemCpu, cbInstr); 490 return VINF_SUCCESS; 491 491 } 492 492 … … 545 545 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtAddr, IEM_ACCESS_DATA_R, &GCPhysMem); 546 546 if (rcStrict != VINF_SUCCESS) 547 break;547 return rcStrict; 548 548 549 549 /* … … 567 567 /* Update the regs. */ 568 568 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)&uValueReg, uTmpValue, &uEFlags); 569 uCounterReg -= i; 570 uAddrReg += i * cbIncr; 569 pCtx->ADDR_rCX = uCounterReg -= i; 570 pCtx->ADDR_rDI = uAddrReg += i * cbIncr; 571 pCtx->eflags.u = uEFlags; 571 572 Assert((!(uEFlags & X86_EFL_ZF) != (i < cLeftPage)) || (i == cLeftPage)); 573 iemMemPageUnmap(pIemCpu, GCPhysMem, IEM_ACCESS_DATA_R, puMem); 572 574 if (fQuit) 573 575 break; … … 594 596 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uTmpValue, X86_SREG_ES, uAddrReg); 595 597 if (rcStrict != VINF_SUCCESS) 596 break;598 return rcStrict; 597 599 RT_CONCAT(iemAImpl_cmp_u,OP_SIZE)((OP_TYPE *)&uValueReg, uTmpValue, &uEFlags); 598 600 599 uAddrReg += cbIncr; 600 uCounterReg--; 601 pCtx->ADDR_rDI = uAddrReg += cbIncr; 602 pCtx->ADDR_rCX = --uCounterReg; 603 pCtx->eflags.u = uEFlags; 601 604 cLeftPage--; 602 605 } while ( (int32_t)cLeftPage > 0 603 606 && !(uEFlags & X86_EFL_ZF)); 604 if (rcStrict != VINF_SUCCESS)605 break;606 607 } while ( uCounterReg != 0 607 608 && !(uEFlags & X86_EFL_ZF)); 608 609 609 610 /* 610 * Update the registers. 611 */ 612 pCtx->ADDR_rCX = uCounterReg; 613 pCtx->ADDR_rDI = uAddrReg; 614 pCtx->eflags.u = uEFlags; 615 if (rcStrict == VINF_SUCCESS) 616 iemRegAddToRip(pIemCpu, cbInstr); 617 618 return rcStrict; 611 * Done. 612 */ 613 iemRegAddToRip(pIemCpu, cbInstr); 614 return VINF_SUCCESS; 619 615 } 620 616 … … 686 682 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtSrcAddr, IEM_ACCESS_DATA_R, &GCPhysSrcMem); 687 683 if (rcStrict != VINF_SUCCESS) 688 break;684 return rcStrict; 689 685 690 686 RTGCPHYS GCPhysDstMem; 691 687 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtDstAddr, IEM_ACCESS_DATA_W, &GCPhysDstMem); 692 688 if (rcStrict != VINF_SUCCESS) 693 break;689 return rcStrict; 694 690 695 691 /* … … 709 705 710 706 /* Update the registers. */ 711 uSrcAddrReg += cLeftPage * cbIncr; 712 uDstAddrReg += cLeftPage * cbIncr; 713 uCounterReg -= cLeftPage; 707 pCtx->ADDR_rSI = uSrcAddrReg += cLeftPage * cbIncr; 708 pCtx->ADDR_rDI = uDstAddrReg += cLeftPage * cbIncr; 709 pCtx->ADDR_rCX = uCounterReg -= cLeftPage; 710 711 iemMemPageUnmap(pIemCpu, GCPhysSrcMem, IEM_ACCESS_DATA_R, puSrcMem); 712 iemMemPageUnmap(pIemCpu, GCPhysDstMem, IEM_ACCESS_DATA_W, puDstMem); 714 713 continue; 715 714 } 715 iemMemPageUnmap(pIemCpu, GCPhysDstMem, IEM_ACCESS_DATA_W, puDstMem); 716 716 } 717 717 } … … 727 727 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uValue, iEffSeg, uSrcAddrReg); 728 728 if (rcStrict != VINF_SUCCESS) 729 break;729 return rcStrict; 730 730 rcStrict = RT_CONCAT(iemMemStoreDataU,OP_SIZE)(pIemCpu, X86_SREG_ES, uDstAddrReg, uValue); 731 731 if (rcStrict != VINF_SUCCESS) 732 break;733 734 uSrcAddrReg += cbIncr;735 uDstAddrReg += cbIncr;736 uCounterReg--;732 return rcStrict; 733 734 pCtx->ADDR_rSI = uSrcAddrReg += cbIncr; 735 pCtx->ADDR_rDI = uDstAddrReg += cbIncr; 736 pCtx->ADDR_rCX = --uCounterReg; 737 737 cLeftPage--; 738 738 } while ((int32_t)cLeftPage > 0); 739 if (rcStrict != VINF_SUCCESS)740 break;741 739 } while (uCounterReg != 0); 742 740 743 741 /* 744 * Update the registers. 745 */ 746 pCtx->ADDR_rCX = uCounterReg; 747 pCtx->ADDR_rDI = uDstAddrReg; 748 pCtx->ADDR_rSI = uSrcAddrReg; 749 if (rcStrict == VINF_SUCCESS) 750 iemRegAddToRip(pIemCpu, cbInstr); 751 752 return rcStrict; 742 * Done. 743 */ 744 iemRegAddToRip(pIemCpu, cbInstr); 745 return VINF_SUCCESS; 753 746 } 754 747 … … 806 799 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtAddr, IEM_ACCESS_DATA_W, &GCPhysMem); 807 800 if (rcStrict != VINF_SUCCESS) 808 break;801 return rcStrict; 809 802 810 803 /* … … 817 810 { 818 811 /* Update the regs first so we can loop on cLeftPage. */ 819 uCounterReg -= cLeftPage;820 uAddrReg += cLeftPage * cbIncr;812 pCtx->ADDR_rCX = uCounterReg -= cLeftPage; 813 pCtx->ADDR_rDI = uAddrReg += cLeftPage * cbIncr; 821 814 822 815 /* Do the memsetting. */ … … 829 822 *puMem++ = uValue; 830 823 #endif 824 825 iemMemPageUnmap(pIemCpu, GCPhysMem, IEM_ACCESS_DATA_W, puMem); 831 826 832 827 /* If unaligned, we drop thru and do the page crossing access … … 849 844 rcStrict = RT_CONCAT(iemMemStoreDataU,OP_SIZE)(pIemCpu, X86_SREG_ES, uAddrReg, uValue); 850 845 if (rcStrict != VINF_SUCCESS) 851 break;852 uAddrReg += cbIncr;853 uCounterReg--;846 return rcStrict; 847 pCtx->ADDR_rDI = uAddrReg += cbIncr; 848 pCtx->ADDR_rCX = --uCounterReg; 854 849 cLeftPage--; 855 850 } while ((int32_t)cLeftPage > 0); 856 if (rcStrict != VINF_SUCCESS)857 break;858 851 } while (uCounterReg != 0); 859 852 860 853 /* 861 * Update the registers. 862 */ 863 pCtx->ADDR_rCX = uCounterReg; 864 pCtx->ADDR_rDI = uAddrReg; 865 if (rcStrict == VINF_SUCCESS) 866 iemRegAddToRip(pIemCpu, cbInstr); 867 868 return rcStrict; 854 * Done. 855 */ 856 iemRegAddToRip(pIemCpu, cbInstr); 857 return VINF_SUCCESS; 869 858 } 870 859 … … 893 882 894 883 int8_t const cbIncr = pCtx->eflags.Bits.u1DF ? -(OP_SIZE / 8) : (OP_SIZE / 8); 895 OP_TYPE uValueReg = pCtx->OP_rAX;896 884 ADDR_TYPE uAddrReg = pCtx->ADDR_rSI; 897 885 … … 923 911 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtAddr, IEM_ACCESS_DATA_R, &GCPhysMem); 924 912 if (rcStrict != VINF_SUCCESS) 925 break;913 return rcStrict; 926 914 927 915 /* … … 934 922 { 935 923 /* Only get the last byte, the rest doesn't matter in direct access mode. */ 936 uValueReg = puMem[cLeftPage - 1]; 937 938 /* Update the regs. */ 939 uCounterReg -= cLeftPage; 940 uAddrReg += cLeftPage * cbIncr; 924 #if OP_SIZE == 32 925 pCtx->rax = puMem[cLeftPage - 1]; 926 #else 927 pCtx->OP_rAX = puMem[cLeftPage - 1]; 928 #endif 929 pCtx->ADDR_rCX = uCounterReg -= cLeftPage; 930 pCtx->ADDR_rSI = uAddrReg += cLeftPage * cbIncr; 931 iemMemPageUnmap(pIemCpu, GCPhysMem, IEM_ACCESS_DATA_R, puMem); 941 932 942 933 /* If unaligned, we drop thru and do the page crossing access … … 960 951 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uTmpValue, iEffSeg, uAddrReg); 961 952 if (rcStrict != VINF_SUCCESS) 962 break; 963 uValueReg = uTmpValue; 964 uAddrReg += cbIncr; 965 uCounterReg--; 953 return rcStrict; 954 #if OP_SIZE == 32 955 pCtx->rax = uTmpValue; 956 #else 957 pCtx->OP_rAX = uTmpValue; 958 #endif 959 pCtx->ADDR_rSI = uAddrReg += cbIncr; 960 pCtx->ADDR_rCX = --uCounterReg; 966 961 cLeftPage--; 967 962 } while ((int32_t)cLeftPage > 0); … … 971 966 972 967 /* 973 * Update the registers. 974 */ 975 pCtx->ADDR_rCX = uCounterReg; 976 pCtx->ADDR_rDI = uAddrReg; 977 #if OP_SIZE == 32 978 pCtx->rax = uValueReg; 979 #else 980 pCtx->OP_rAX = uValueReg; 981 #endif 982 if (rcStrict == VINF_SUCCESS) 983 iemRegAddToRip(pIemCpu, cbInstr); 984 985 return rcStrict; 968 * Done. 969 */ 970 iemRegAddToRip(pIemCpu, cbInstr); 971 return VINF_SUCCESS; 986 972 } 987 973 … … 1033 1019 we fail with an internal error here instead. */ 1034 1020 else 1035 AssertLogRelFailedReturn(VERR_I NTERNAL_ERROR_3);1021 AssertLogRelFailedReturn(VERR_IEM_IPE_1); 1036 1022 } 1037 1023 return rcStrict; … … 1096 1082 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtAddr, IEM_ACCESS_DATA_W, &GCPhysMem); 1097 1083 if (rcStrict != VINF_SUCCESS) 1098 break;1084 return rcStrict; 1099 1085 1100 1086 /* … … 1111 1097 if (rcStrict == VINF_SUCCESS) 1112 1098 { 1113 while (cLeftPage-- > 0) 1099 uint32_t off = 0; 1100 while (off < cLeftPage) 1114 1101 { 1115 1102 uint32_t u32Value; … … 1118 1105 else 1119 1106 rcStrict = iemVerifyFakeIOPortRead(pIemCpu, u16Port, &u32Value, OP_SIZE / 8); 1120 if ( !IOM_SUCCESS(rcStrict))1121 break;1122 *puMem++= (OP_TYPE)u32Value;1123 uAddrReg+= cbIncr;1124 uCounterReg -= 1;1125 1107 if (IOM_SUCCESS(rcStrict)) 1108 { 1109 puMem[off] = (OP_TYPE)u32Value; 1110 pCtx->ADDR_rDI = uAddrReg += cbIncr; 1111 pCtx->ADDR_rCX = --uCounterReg; 1112 } 1126 1113 if (rcStrict != VINF_SUCCESS) 1127 1114 { 1128 1115 /** @todo massage rc */ 1129 break; 1116 if (uCounterReg == 0) 1117 iemRegAddToRip(pIemCpu, cbInstr); 1118 iemMemPageUnmap(pIemCpu, GCPhysMem, IEM_ACCESS_DATA_W, puMem); 1119 return rcStrict; 1130 1120 } 1121 off++; 1131 1122 } 1132 if (rcStrict != VINF_SUCCESS) 1133 break; 1123 iemMemPageUnmap(pIemCpu, GCPhysMem, IEM_ACCESS_DATA_W, puMem); 1134 1124 1135 1125 /* If unaligned, we drop thru and do the page crossing access … … 1158 1148 rcStrict = iemMemMap(pIemCpu, (void **)&puMem, OP_SIZE / 8, X86_SREG_ES, uAddrReg, IEM_ACCESS_DATA_W); 1159 1149 if (rcStrict != VINF_SUCCESS) 1160 break;1150 return rcStrict; 1161 1151 1162 1152 uint32_t u32Value; … … 1166 1156 rcStrict = iemVerifyFakeIOPortRead(pIemCpu, u16Port, &u32Value, OP_SIZE / 8); 1167 1157 if (!IOM_SUCCESS(rcStrict)) 1168 break; 1169 1158 return rcStrict; 1159 1160 *puMem = u32Value; 1170 1161 VBOXSTRICTRC rcStrict2 = iemMemCommitAndUnmap(pIemCpu, puMem, IEM_ACCESS_DATA_W); 1171 AssertLogRelBreakStmt(rcStrict2 == VINF_SUCCESS, rcStrict = VERR_INTERNAL_ERROR_3); /* See non-rep version. */ 1172 1173 uAddrReg += cbIncr; 1174 uCounterReg--; 1162 AssertLogRelReturn(rcStrict2 == VINF_SUCCESS, VERR_IEM_IPE_1); /* See non-rep version. */ 1163 1164 pCtx->ADDR_rDI = uAddrReg += cbIncr; 1165 pCtx->ADDR_rCX = --uCounterReg; 1166 1175 1167 cLeftPage--; 1176 1168 if (rcStrict != VINF_SUCCESS) 1177 1169 { 1178 1170 /** @todo massage IOM status codes! */ 1179 break; 1171 if (uCounterReg == 0) 1172 iemRegAddToRip(pIemCpu, cbInstr); 1173 return rcStrict; 1180 1174 } 1181 1175 } while ((int32_t)cLeftPage > 0); 1182 if (rcStrict != VINF_SUCCESS)1183 break;1184 1176 } while (uCounterReg != 0); 1185 1177 1186 1178 /* 1187 * Update the registers. 1188 */ 1189 pCtx->ADDR_rCX = uCounterReg; 1190 pCtx->ADDR_rDI = uAddrReg; 1191 if (rcStrict == VINF_SUCCESS) 1192 iemRegAddToRip(pIemCpu, cbInstr); 1193 1194 return rcStrict; 1179 * Done. 1180 */ 1181 iemRegAddToRip(pIemCpu, cbInstr); 1182 return VINF_SUCCESS; 1195 1183 } 1196 1184 … … 1294 1282 rcStrict = iemMemPageTranslateAndCheckAccess(pIemCpu, uVirtAddr, IEM_ACCESS_DATA_R, &GCPhysMem); 1295 1283 if (rcStrict != VINF_SUCCESS) 1296 break;1284 return rcStrict; 1297 1285 1298 1286 /* … … 1309 1297 if (rcStrict == VINF_SUCCESS) 1310 1298 { 1311 while (cLeftPage-- > 0) 1299 uint32_t off = 0; 1300 while (off < cLeftPage) 1312 1301 { 1313 1302 uint32_t u32Value = *puMem++; … … 1316 1305 else 1317 1306 rcStrict = iemVerifyFakeIOPortWrite(pIemCpu, u16Port, u32Value, OP_SIZE / 8); 1318 if ( !IOM_SUCCESS(rcStrict))1319 break;1320 uAddrReg+= cbIncr;1321 uCounterReg -= 1;1322 1307 if (IOM_SUCCESS(rcStrict)) 1308 { 1309 pCtx->ADDR_rSI = uAddrReg += cbIncr; 1310 pCtx->ADDR_rCX = --uCounterReg; 1311 } 1323 1312 if (rcStrict != VINF_SUCCESS) 1324 1313 { 1325 1314 /** @todo massage IOM rc */ 1326 break; 1315 if (uCounterReg == 0) 1316 iemRegAddToRip(pIemCpu, cbInstr); 1317 iemMemPageUnmap(pIemCpu, GCPhysMem, IEM_ACCESS_DATA_R, puMem); 1318 return rcStrict; 1327 1319 } 1320 off++; 1328 1321 } 1329 if (rcStrict != VINF_SUCCESS) 1330 break; 1322 iemMemPageUnmap(pIemCpu, GCPhysMem, IEM_ACCESS_DATA_R, puMem); 1331 1323 1332 1324 /* If unaligned, we drop thru and do the page crossing access … … 1355 1347 rcStrict = RT_CONCAT(iemMemFetchDataU,OP_SIZE)(pIemCpu, &uValue, iEffSeg, uAddrReg); 1356 1348 if (rcStrict != VINF_SUCCESS) 1357 break;1349 return rcStrict; 1358 1350 1359 1351 if (!IEM_VERIFICATION_ENABLED(pIemCpu)) … … 1361 1353 else 1362 1354 rcStrict = iemVerifyFakeIOPortWrite(pIemCpu, u16Port, uValue, OP_SIZE / 8); 1363 if ( !IOM_SUCCESS(rcStrict))1364 break;1365 1366 uAddrReg += cbIncr;1367 uCounterReg--;1368 cLeftPage--;1355 if (IOM_SUCCESS(rcStrict)) 1356 { 1357 pCtx->ADDR_rSI = uAddrReg += cbIncr; 1358 pCtx->ADDR_rCX = --uCounterReg; 1359 cLeftPage--; 1360 } 1369 1361 if (rcStrict != VINF_SUCCESS) 1370 1362 { 1371 1363 /** @todo massage IOM status codes! */ 1372 break; 1364 if (uCounterReg == 0) 1365 iemRegAddToRip(pIemCpu, cbInstr); 1366 return rcStrict; 1373 1367 } 1374 1368 } while ((int32_t)cLeftPage > 0); 1375 if (rcStrict != VINF_SUCCESS)1376 break;1377 1369 } while (uCounterReg != 0); 1378 1370 1379 1371 /* 1380 * Update the registers. 1381 */ 1382 pCtx->ADDR_rCX = uCounterReg; 1383 pCtx->ADDR_rSI = uAddrReg; 1384 if (rcStrict == VINF_SUCCESS) 1385 iemRegAddToRip(pIemCpu, cbInstr); 1386 1387 return rcStrict; 1372 * Done. 1373 */ 1374 iemRegAddToRip(pIemCpu, cbInstr); 1375 return VINF_SUCCESS; 1388 1376 } 1389 1377
Note:
See TracChangeset
for help on using the changeset viewer.