VirtualBox

Changeset 97582 in vbox


Ignore:
Timestamp:
Nov 16, 2022 11:54:58 PM (2 years ago)
Author:
vboxsync
Message:

ValKit/bs3-cpu-basic-2: More working on near return tests. bugref:9898

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

Legend:

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

    r97579 r97582  
    17221722BS3_PROC_END_CMN   bs3CpuBasic2_retn_i0__ud2
    17231723
     1724 %if TMPL_BITS == 64
     1725
     1726BS3_CPUBAS2_UD_OFF bs3CpuBasic2_retn_rexw__ud2
     1727BS3_PROC_BEGIN_CMN bs3CpuBasic2_retn_rexw__ud2, BS3_PBC_NEAR
     1728        db      048h                        ; REX.W
     1729        ret
     1730.again: ud2
     1731        jmp     .again
     1732BS3_PROC_END_CMN   bs3CpuBasic2_retn_rexw__ud2
     1733
     1734BS3_CPUBAS2_UD_OFF bs3CpuBasic2_retn_i24_rexw__ud2
     1735BS3_PROC_BEGIN_CMN bs3CpuBasic2_retn_i24_rexw__ud2, BS3_PBC_NEAR
     1736        db      048h                        ; REX.W
     1737        ret     24
     1738.again: ud2
     1739        jmp     .again
     1740AssertCompile(.again - BS3_LAST_LABEL == 4)
     1741BS3_PROC_END_CMN   bs3CpuBasic2_retn_i24_rexw__ud2
     1742
     1743 %endif
     1744
    17241745; Mark the start of opsize tests as we end up below 64K in 32-bit and 64-bit when used.
    17251746BS3_BEGIN_TEXT16 TMPL_BITS
     
    17531774BS3_PROC_END_CMN   bs3CpuBasic2_retn_i0_opsize__ud2
    17541775
     1776 %if TMPL_BITS == 64
     1777BS3_CPUBAS2_UD_OFF bs3CpuBasic2_retn_opsize_rexw__ud2
     1778BS3_PROC_BEGIN_CMN bs3CpuBasic2_retn_opsize_rexw__ud2, BS3_PBC_NEAR
     1779        db      66h, 048h
     1780        ret
     1781.again: ud2
     1782        jmp     .again
     1783BS3_PROC_END_CMN   bs3CpuBasic2_retn_opsize_rexw__ud2
     1784
     1785BS3_CPUBAS2_UD_OFF bs3CpuBasic2_retn_i24_opsize_rexw__ud2
     1786BS3_PROC_BEGIN_CMN bs3CpuBasic2_retn_i24_opsize_rexw__ud2, BS3_PBC_NEAR
     1787        db      66h, 048h
     1788        ret     24
     1789.again: ud2
     1790        jmp     .again
     1791AssertCompile(.again - BS3_LAST_LABEL == 5)
     1792BS3_PROC_END_CMN   bs3CpuBasic2_retn_i24_opsize_rexw__ud2
     1793 %endif
     1794
    17551795; End of opsize tests.
    17561796BS3_GLOBAL_NAME_EX BS3_CMN_NM(bs3CpuBasic2_retn_opsize_end), , 1
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-x0.c

    r97580 r97582  
    46274627PROTO_ALL(bs3CpuBasic2_retn_i0__ud2);
    46284628PROTO_ALL(bs3CpuBasic2_retn_i0_opsize__ud2);
     4629FNBS3FAR  bs3CpuBasic2_retn_rexw__ud2_c64;
     4630FNBS3FAR  bs3CpuBasic2_retn_i24_rexw__ud2_c64;
     4631FNBS3FAR  bs3CpuBasic2_retn_opsize_rexw__ud2_c64;
     4632FNBS3FAR  bs3CpuBasic2_retn_i24_opsize_rexw__ud2_c64;
    46294633PROTO_ALL(bs3CpuBasic2_retn_opsize_end);
    46304634#undef PROTO_ALL
     
    48334837        {
    48344838            { 32, false,  0, bs3CpuBasic2_retn__ud2_c64, },
     4839            { 32, false,  0, bs3CpuBasic2_retn_rexw__ud2_c64, },
    48354840            { 32,  true,  0, bs3CpuBasic2_retn_opsize__ud2_c64, },
     4841            { 32,  true,  0, bs3CpuBasic2_retn_opsize_rexw__ud2_c64, },
    48364842            { 32, false, 24, bs3CpuBasic2_retn_i24__ud2_c64, },
     4843            { 32, false, 24, bs3CpuBasic2_retn_i24_rexw__ud2_c64, },
    48374844            { 32,  true, 24, bs3CpuBasic2_retn_i24_opsize__ud2_c64, },
     4845            { 32,  true, 24, bs3CpuBasic2_retn_i24_opsize_rexw__ud2_c64, },
    48384846            { 32, false,  0, bs3CpuBasic2_retn_i0__ud2_c64, },
    48394847            { 32,  true,  0, bs3CpuBasic2_retn_i0_opsize__ud2_c64, },
     
    48424850        bool const         fFix64OpSize = enmCpuVendor == BS3CPUVENDOR_INTEL; /** @todo what does VIA do? */
    48434851
    4844         /* Prepare a copy of the UD2 instructions in low memory for opsize prefixed tests. */
     4852        /* Prepare a copy of the UD2 instructions in low memory for opsize prefixed
     4853           tests, unless we're on intel where the opsize prefix is ignored. Here we
     4854           just fill low memory with int3's so we can detect non-intel behaviour.  */
    48454855        uint16_t const          offLow   = BS3_FP_OFF(bs3CpuBasic2_retn_opsize_begin_c64);
    48464856        uint16_t const          cbLow    = BS3_FP_OFF(bs3CpuBasic2_retn_opsize_end_c64) - offLow;
     
    48504860            Bs3TestFailedF("Opsize overriden jumps/calls are out of place: %#x LB %#x\n", offLow, cbLow);
    48514861        Bs3MemSet(&pbLow[offLow], 0xcc /*int3*/, cbLow);
    4852         for (iTest = 0; iTest < RT_ELEMENTS(s_aTests); iTest++)
    4853             if (s_aTests[iTest].fOpSizePfx)
    4854             {
    4855                 uint16_t const offFn = BS3_FP_OFF(s_aTests[iTest].pfnTest);
    4856                 uint16_t const offUd = offFn + (int16_t)(int8_t)pbCode16[offFn - 1];
    4857                 BS3_ASSERT(offUd - offLow + 1 < cbLow);
    4858                 pbCode16[offUd]     = 0xf1; /* replace original ud2 with icebp */
    4859                 pbCode16[offUd + 1] = 0xf1;
    4860                 pbLow[offUd]        = 0x0f; /* plant ud2 in low memory */
    4861                 pbLow[offUd + 1]    = 0x0b;
    4862             }
     4862        if (!fFix64OpSize)
     4863            for (iTest = 0; iTest < RT_ELEMENTS(s_aTests); iTest++)
     4864                if (s_aTests[iTest].fOpSizePfx)
     4865                {
     4866                    uint16_t const offFn = BS3_FP_OFF(s_aTests[iTest].pfnTest);
     4867                    uint16_t const offUd = offFn + (int16_t)(int8_t)pbCode16[offFn - 1];
     4868                    BS3_ASSERT(offUd - offLow + 1 < cbLow);
     4869                    pbCode16[offUd]     = 0xf1; /* replace original ud2 with icebp */
     4870                    pbCode16[offUd + 1] = 0xf1;
     4871                    pbLow[offUd]        = 0x0f; /* plant ud2 in low memory */
     4872                    pbLow[offUd + 1]    = 0x0b;
     4873                }
    48634874
    48644875        for (iTest = 0; iTest < RT_ELEMENTS(s_aTests); iTest++)
     
    48774888            }
    48784889            g_uBs3TrapEipHint = CtxExpected.rip.u32;
    4879             Bs3TestPrintf("cs:rip=%04RX16:%04RX64 -> %04RX16:%04RX64\n", Ctx.cs, Ctx.rip.u, CtxExpected.cs, CtxExpected.rip.u);
     4890            //Bs3TestPrintf("cs:rip=%04RX16:%04RX64 -> %04RX16:%04RX64\n", Ctx.cs, Ctx.rip.u, CtxExpected.cs, CtxExpected.rip.u);
    48804891            //Bs3TestPrintf("ss:rsp=%04RX16:%04RX64\n", Ctx.ss, Ctx.rsp.u);
    48814892            bs3CpuBasic2_retn_PrepStack(StkPtr, &CtxExpected, s_aTests[iTest].fOpSizePfx && !fFix64OpSize ? 2 : 8);
Note: See TracChangeset for help on using the changeset viewer.

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