VirtualBox

Changeset 102133 in vbox


Ignore:
Timestamp:
Nov 17, 2023 10:05:20 AM (17 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160257
Message:

ValKit/bs3-cpu-basic-3: 32-bit LEA test fixes and completion. bugref:10371

Location:
trunk/src/VBox/ValidationKit/bootsectors
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-3-template.c

    r102130 r102133  
    5959
    6060# if ARCH_BITS != 64
    61     FPFNBS3FAR pfnWorker16 = Bs3SelLnkCodePtrToCurPtr(BS3_CMN_FAR_NM(bs3CpuBasic3_lea_16));
    62     FPFNBS3FAR pfnWorker32 = Bs3SelLnkCodePtrToCurPtr(BS3_CMN_FAR_NM(bs3CpuBasic3_lea_32));
    63     for (i = 0; i < 64; i++)
    64         pfnWorker16();
    65     for (i = 0; i < 64; i++)
    66         pfnWorker32();
     61    {
     62        FPFNBS3FAR pfnWorker16 = Bs3SelLnkCodePtrToCurPtr(BS3_CMN_FAR_NM(bs3CpuBasic3_lea_16));
     63        for (i = 0; i < 64; i++)
     64            pfnWorker16();
     65    }
     66    {
     67        FPFNBS3FAR pfnWorker32 = Bs3SelLnkCodePtrToCurPtr(BS3_CMN_FAR_NM(bs3CpuBasic3_lea_32));
     68        for (i = 0; i < 64; i++)
     69            pfnWorker32();
     70    }
    6771# else
    6872    //for (i = 0; i < 64; i++)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-3-template.mac

    r102130 r102133  
    196196BS3_PROC_BEGIN_CMN bs3CpuBasic3_lea_32, BS3_PBC_FAR
    197197        pushad
    198         mov     [BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp)], esp
     198        mov     [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))], esp
    199199
    200200        ;
     
    278278          %endif
    279279
     280        ;
     281        ; We don't test all shift combinations, there just isn't enough space
     282        ; in the image (32-bit case) or the segment (16-bit case) unfortunately.
     283        ;
    280284          %if TMPL_BITS == 32
    281             %assign cShiftLoops 1 ;; @todo split out the LEA tests, they are too big and we haven't done 64-bit mode yet.
     285            %assign cShiftLoops 2
    282286          %else
    283287            %assign cShiftLoops 1
     
    286290
    287291        ;
    288         ; We don't have room to test both 32-bit and 16-bit operand sizes here for 16-bit code.
    289         ;
    290         call    .load_regs
    291           %if iBase == 4 || iDstReg == 4
    292         mov     esp, LEA_ESP
    293           %endif
    294 
    295         ; lea
    296           %assign   iValue  iBase_Value + (iIndex_Value << cShift)
    297         db      MY_O32 8dh, X86_MODRM_MAKE(iMod, iDstReg, iMemReg), X86_SIB_MAKE(iBase, iIndex, cShift)
    298           %if iMod == X86_MOD_MEM1
    299         db      -119
    300            %assign  iValue  iValue - 119
    301           %elif iMod == X86_MOD_MEM4 || (iMod == 0 && iBase == 5)
    302         dd      -04353f1ech
    303            %assign  iValue  iValue - 04353f1ech
    304           %endif
    305 
    306         ; cmp iDstReg, iValue
    307         db      MY_CMP_O32 81h, X86_MODRM_MAKE(X86_MOD_REG, 7, iDstReg)
    308         dd      iValue & 0ffffffffh
    309           %if iBase == 4 || iDstReg == 4
    310         mov     esp, [BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp)]
    311           %endif
    312         jz      $+3
    313         int3
    314 
    315           %if TMPL_BITS == 32
     292        ; LEA+SIB w/ 32-bit operand size.
     293        ;
    316294        call    .load_regs
    317295           %if iBase == 4 || iDstReg == 4
     
    334312        dd      iValue & 0ffffffffh
    335313           %if iBase == 4 || iDstReg == 4
    336         mov     esp, [BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp)]
     314        mov     esp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
    337315           %endif
    338316        jz      $+3
    339317        int3
    340           %endif ; TMPL_BITS == 32
    341 
    342            %assign cShift    (cShift + 1) & 3
     318            %assign cShift    (cShift + 1) & 3
     319
     320        ;
     321        ; LEA+SIB w/ 16-bit operand size.
     322        ;
     323           %if TMPL_BITS == 32   ; No room in the 16-bit segment for all of this.
     324        call    .load_regs
     325            %if iBase == 4 || iDstReg == 4
     326        mov     esp, LEA_ESP
     327            %endif
     328
     329        ; lea
     330            %assign   iValue  iBase_Value + (iIndex_Value << cShift)
     331        db      MY_O16 8dh, X86_MODRM_MAKE(iMod, iDstReg, iMemReg), X86_SIB_MAKE(iBase, iIndex, cShift)
     332            %if iMod == X86_MOD_MEM1
     333        db      -7
     334             %assign  iValue  iValue - 7
     335            %elif iMod == X86_MOD_MEM4 || (iMod == 0 && iBase == 5)
     336        dd      -073d676e4h
     337             %assign  iValue  iValue - 073d676e4h
     338            %endif
     339
     340        ; cmp iDstReg, iValue
     341        db      MY_CMP_O32 81h, X86_MODRM_MAKE(X86_MOD_REG, 7, iDstReg)
     342        dd      (iValue & 00000ffffh) | (iDstReg_Value & 0ffff0000h)
     343            %if 1 || iBase == 4 || iDstReg == 4
     344        mov     esp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
     345            %endif
     346        jz      $+3
     347        int3
     348            %assign cShift    (cShift + 2) & 3
     349           %endif ; TMPL_BITS == 32
    343350          %endrep
    344351          %assign iIndex    iIndex + 1
     
    347354        %endrep
    348355
    349      %else
     356     %else ; !SIB
    350357        ;
    351358        ; Plain lea reg, [reg] with disp according to iMod,
     
    395402        dd      iValue & 0ffffffffh
    396403      %if iDstReg == 4
    397         mov     esp, [BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp)]
     404        mov     esp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
    398405      %endif
    399406        jz      $+3
     
    423430        dd      (iValue & 00000ffffh) | (iDstReg_Value & 0ffff0000h)
    424431      %if iDstReg == 4
    425         mov     esp, [BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp)]
     432        mov     esp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
    426433      %endif
    427434        jz      $+3
    428435        int3
    429436
    430      %endif
     437     %endif ; !SIB
    431438     %assign iMemReg    iMemReg + 1
    432439    %endrep
     
    436443  %endrep
    437444
    438         mov     esp, [BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp)]
     445        mov     esp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
    439446        popad
    440447        BS3_HYBRID_RET
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette