VirtualBox

Changeset 102271 in vbox for trunk


Ignore:
Timestamp:
Nov 23, 2023 12:41:45 AM (15 months ago)
Author:
vboxsync
Message:

ValKit/bs3-cpu-basic-3: Full 64-bit lea testcase. Use python (3+) to generate the bulk of it, as the nasm preprocessor is too slow and uses too much memory (19+ GiBs). bugref:10371

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/Makefile.kmk

    r102157 r102271  
    296296 MISCBINS += bs3-cpu-basic-3-high
    297297 bs3-cpu-basic-3-high_TEMPLATE = VBoxBS3KitHighImg
    298  bs3-cpu-basic-3-high_INCS     = .
     298 bs3-cpu-basic-3-high_INCS     = . $(bs3-cpu-basic-3-high_0_OUTDIR)
    299299 bs3-cpu-basic-3-high_SOURCES  = \
    300300        bs3kit/bs3-first-high-image.asm \
    301301        bs3-cpu-basic-3-high-asm.asm
     302 bs3-cpu-basic-3-high_INTERMEDIATES = $(bs3-cpu-basic-3-high_0_OUTDIR)/bs3-cpu-basic-3-high-lea64.inc
     303 bs3-cpu-basic-3-high_CLEANS        = $(bs3-cpu-basic-3-high_0_OUTDIR)/bs3-cpu-basic-3-high-lea64.inc
     304 $$(bs3-cpu-basic-3-high_0_OUTDIR)/bs3-cpu-basic-3-high-lea64.inc: \
     305                $(PATH_SUB_CURRENT)/bs3-cpu-basic-3-high-lea64.py | $$(dir $$@)
     306        $(call MSG_GENERATE,bs3-cpu-basic-3-high,$@)
     307        $(QUIET)$(REDIRECT) -0 /dev/null -- $(TIME) $(VBOX_BLD_PYTHON) "$<" "$@"
    302308
    303309 #
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-3-high-asm.asm

    r102201 r102271  
    115115
    116116        ;
     117        ; We generate all the permutations using a python script, as nasm ends
     118        ; up consuming >19 GiB of memory running the preprocessor code below.
     119        ;
     120%if 1
     121 %include "bs3-cpu-basic-3-high-lea64.inc"
     122%else
     123        ;
    117124        ; Loop thru all the modr/m memory encodings.
    118125        ;
     
    164171
    165172        ; lea
    166        %assign   iValue  iBase_Value + (iIndex_Value << cShift)
     173       %assign  iValue  iBase_Value + (iIndex_Value << cShift)
    167174        db      X86_OP_REX_W | ((iBase & 8) >> 3) | ((iIndex & 8) >> 2) | ((iDstReg & 8) >> 1)
    168175        db      8dh, X86_MODRM_MAKE(iMod, iDstReg & 7, iMemReg & 7), X86_SIB_MAKE(iBase & 7, iIndex & 7, cShift)
    169176       %if iMod == X86_MOD_MEM1
    170177        db      -128
    171         %assign  iValue  iValue - 128
     178        %assign iValue  iValue - 128
    172179       %elif iMod == X86_MOD_MEM4 || (iMod == 0 && (iBase & 7) == 5)
    173180        dd      -07ffef3ffh
    174         %assign  iValue  iValue - 07ffef3ffh
     181        %assign iValue  iValue - 07ffef3ffh
    175182       %endif
    176183
     
    185192        db      39h, X86_MODRM_MAKE(X86_MOD_REG, X86_GREG_xAX, iDstReg & 7)
    186193       %else
    187             mov     rcx, iValue
    188             cmp     rax, rcx
     194        mov     rcx, iValue
     195        cmp     rax, rcx
     196       %endif
     197       %if iBase == 4 || iDstReg == 4
     198        mov     rdx, rsp
     199        mov     rsp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
     200       %endif
     201        jz      $+3
     202        int3
     203
     204        ;
     205        ; LEA+SIB w/ 64-bit operand size and 32-bit address size.
     206        ;
     207       %ifdef WITH_TRACING
     208        mov     dword [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_trace))], $
     209       %endif
     210        call    .load_regs
     211       %if iBase == 4 || iDstReg == 4
     212        mov     rsp, LEA_RSP
     213       %endif
     214
     215        ; lea
     216       %assign  iValue  iBase_Value + (iIndex_Value << cShift)
     217        db      X86_OP_PRF_SIZE_ADDR
     218        db      X86_OP_REX_W | ((iBase & 8) >> 3) | ((iIndex & 8) >> 2) | ((iDstReg & 8) >> 1)
     219        db      8dh, X86_MODRM_MAKE(iMod, iDstReg & 7, iMemReg & 7), X86_SIB_MAKE(iBase & 7, iIndex & 7, cShift)
     220       %if iMod == X86_MOD_MEM1
     221        db      +127
     222        %assign iValue  iValue + 127
     223       %elif iMod == X86_MOD_MEM4 || (iMod == 0 && (iBase & 7) == 5)
     224        dd      +0356786aeh
     225        %assign iValue  iValue + 0356786aeh
     226       %endif
     227       %assign  iValue  (iValue & 0ffffffffh)
     228
     229        ; cmp iDstReg, iValue
     230       %if iValue <= 07fffffffh && iValue >= -080000000h
     231        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     232        db      81h, X86_MODRM_MAKE(X86_MOD_REG, 7, iDstReg & 7)
     233        dd      iValue & 0ffffffffh
     234       %elif iDstReg != X86_GREG_xAX
     235        mov     rax, iValue
     236        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     237        db      39h, X86_MODRM_MAKE(X86_MOD_REG, X86_GREG_xAX, iDstReg & 7)
     238       %else
     239        mov     rcx, iValue
     240        cmp     rax, rcx
     241       %endif
     242       %if iBase == 4 || iDstReg == 4
     243        mov     rdx, rsp
     244        mov     rsp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
     245       %endif
     246        jz      $+3
     247        int3
     248
     249        ;
     250        ; LEA+SIB w/ 32-bit operand size and 64-bit address size.
     251        ;
     252       %ifdef WITH_TRACING
     253        mov     dword [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_trace))], $
     254       %endif
     255        call    .load_regs
     256       %if iBase == 4 || iDstReg == 4
     257        mov     rsp, LEA_RSP
     258       %endif
     259
     260        ; lea
     261       %assign  iValue  iBase_Value + (iIndex_Value << cShift)
     262       %if (iBase | iIndex | iDstReg) & 8
     263        db      X86_OP_REX | ((iBase & 8) >> 3) | ((iIndex & 8) >> 2) | ((iDstReg & 8) >> 1)
     264       %endif
     265        db      8dh, X86_MODRM_MAKE(iMod, iDstReg & 7, iMemReg & 7), X86_SIB_MAKE(iBase & 7, iIndex & 7, cShift)
     266       %if iMod == X86_MOD_MEM1
     267        db      -18
     268        %assign iValue  iValue - 18
     269       %elif iMod == X86_MOD_MEM4 || (iMod == 0 && (iBase & 7) == 5)
     270        dd      -07fef3ffh
     271        %assign iValue  iValue - 07fef3ffh
     272       %endif
     273       %assign  iValue  (iValue & 0ffffffffh)
     274
     275        ; cmp iDstReg, iValue
     276       %if iValue <= 07fffffffh && iValue >= -080000000h
     277        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     278        db      81h, X86_MODRM_MAKE(X86_MOD_REG, 7, iDstReg & 7)
     279        dd      iValue & 0ffffffffh
     280       %elif iDstReg != X86_GREG_xAX
     281        mov     rax, iValue
     282        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     283        db      39h, X86_MODRM_MAKE(X86_MOD_REG, X86_GREG_xAX, iDstReg & 7)
     284       %else
     285        mov     rcx, iValue
     286        cmp     rax, rcx
     287       %endif
     288       %if iBase == 4 || iDstReg == 4
     289        mov     rdx, rsp
     290        mov     rsp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
     291       %endif
     292        jz      $+3
     293        int3
     294
     295        ;
     296        ; LEA+SIB w/ 32-bit operand size and 32-bit address size.
     297        ;
     298       %ifdef WITH_TRACING
     299        mov     dword [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_trace))], $
     300       %endif
     301        call    .load_regs
     302       %if iBase == 4 || iDstReg == 4
     303        mov     rsp, LEA_RSP
     304       %endif
     305
     306        ; lea
     307       %assign  iValue  iBase_Value + (iIndex_Value << cShift)
     308        db      X86_OP_PRF_SIZE_ADDR
     309       %if (iBase | iIndex | iDstReg) & 8
     310        db      X86_OP_REX | ((iBase & 8) >> 3) | ((iIndex & 8) >> 2) | ((iDstReg & 8) >> 1)
     311       %endif
     312        db      8dh, X86_MODRM_MAKE(iMod, iDstReg & 7, iMemReg & 7), X86_SIB_MAKE(iBase & 7, iIndex & 7, cShift)
     313       %if iMod == X86_MOD_MEM1
     314        db      +17
     315        %assign iValue  iValue + 17
     316       %elif iMod == X86_MOD_MEM4 || (iMod == 0 && (iBase & 7) == 5)
     317        dd      +0356786h
     318        %assign iValue  iValue + 0356786h
     319       %endif
     320       %assign  iValue  (iValue & 0ffffffffh)
     321
     322        ; cmp iDstReg, iValue
     323       %if iValue <= 07fffffffh && iValue >= -080000000h
     324        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     325        db      81h, X86_MODRM_MAKE(X86_MOD_REG, 7, iDstReg & 7)
     326        dd      iValue & 0ffffffffh
     327       %elif iDstReg != X86_GREG_xAX
     328        mov     rax, iValue
     329        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     330        db      39h, X86_MODRM_MAKE(X86_MOD_REG, X86_GREG_xAX, iDstReg & 7)
     331       %else
     332        mov     rcx, iValue
     333        cmp     rax, rcx
     334       %endif
     335       %if iBase == 4 || iDstReg == 4
     336        mov     rdx, rsp
     337        mov     rsp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
     338       %endif
     339        jz      $+3
     340        int3
     341
     342        ;
     343        ; LEA+SIB w/ 16-bit operand size and 64-bit address size.
     344        ;
     345       %ifdef WITH_TRACING
     346        mov     dword [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_trace))], $
     347       %endif
     348        call    .load_regs
     349       %if iBase == 4 || iDstReg == 4
     350        mov     rsp, LEA_RSP
     351       %endif
     352
     353        ; lea
     354       %assign  iValue  iBase_Value + (iIndex_Value << cShift)
     355        db      X86_OP_PRF_SIZE_OP
     356       %if (iBase | iIndex | iDstReg) & 8
     357        db      X86_OP_REX | ((iBase & 8) >> 3) | ((iIndex & 8) >> 2) | ((iDstReg & 8) >> 1)
     358       %endif
     359        db      8dh, X86_MODRM_MAKE(iMod, iDstReg & 7, iMemReg & 7), X86_SIB_MAKE(iBase & 7, iIndex & 7, cShift)
     360       %if iMod == X86_MOD_MEM1
     361        db      -18
     362        %assign iValue  iValue - 18
     363       %elif iMod == X86_MOD_MEM4 || (iMod == 0 && (iBase & 7) == 5)
     364        dd      -07fef3ffh
     365        %assign iValue  iValue - 07fef3ffh
     366       %endif
     367       %assign  iValue  (iValue & 0ffffh) | (iDstReg_Value & 0ffffffffffff0000h)
     368
     369        ; cmp iDstReg, iValue
     370       %if iValue <= 07fffffffh && iValue >= -080000000h
     371        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     372        db      81h, X86_MODRM_MAKE(X86_MOD_REG, 7, iDstReg & 7)
     373        dd      iValue & 0ffffffffh
     374       %elif iDstReg != X86_GREG_xAX
     375        mov     rax, iValue
     376        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     377        db      39h, X86_MODRM_MAKE(X86_MOD_REG, X86_GREG_xAX, iDstReg & 7)
     378       %else
     379        mov     rcx, iValue
     380        cmp     rax, rcx
     381       %endif
     382       %if iBase == 4 || iDstReg == 4
     383        mov     rdx, rsp
     384        mov     rsp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
     385       %endif
     386        jz      $+3
     387        int3
     388
     389        ;
     390        ; LEA+SIB w/ 16-bit operand size and 32-bit address size.
     391        ;
     392       %ifdef WITH_TRACING
     393        mov     dword [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_trace))], $
     394       %endif
     395        call    .load_regs
     396       %if iBase == 4 || iDstReg == 4
     397        mov     rsp, LEA_RSP
     398       %endif
     399
     400        ; lea
     401       %assign  iValue  iBase_Value + (iIndex_Value << cShift)
     402       %if cShift & 2
     403        db      X86_OP_PRF_SIZE_OP, X86_OP_PRF_SIZE_ADDR
     404       %else
     405        db      X86_OP_PRF_SIZE_ADDR, X86_OP_PRF_SIZE_OP
     406       %endif
     407       %if (iBase | iIndex | iDstReg) & 8
     408        db      X86_OP_REX | ((iBase & 8) >> 3) | ((iIndex & 8) >> 2) | ((iDstReg & 8) >> 1)
     409       %endif
     410        db      8dh, X86_MODRM_MAKE(iMod, iDstReg & 7, iMemReg & 7), X86_SIB_MAKE(iBase & 7, iIndex & 7, cShift)
     411       %if iMod == X86_MOD_MEM1
     412        db      +17
     413        %assign iValue  iValue + 17
     414       %elif iMod == X86_MOD_MEM4 || (iMod == 0 && (iBase & 7) == 5)
     415        dd      +0356786h
     416        %assign iValue  iValue + 0356786h
     417       %endif
     418       %assign  iValue  (iValue & 0ffffh) | (iDstReg_Value & 0ffffffffffff0000h)
     419
     420        ; cmp iDstReg, iValue
     421       %if iValue <= 07fffffffh && iValue >= -080000000h
     422        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     423        db      81h, X86_MODRM_MAKE(X86_MOD_REG, 7, iDstReg & 7)
     424        dd      iValue & 0ffffffffh
     425       %elif iDstReg != X86_GREG_xAX
     426        mov     rax, iValue
     427        db      X86_OP_REX_W | ((iDstReg & 8) >> 3)
     428        db      39h, X86_MODRM_MAKE(X86_MOD_REG, X86_GREG_xAX, iDstReg & 7)
     429       %else
     430        mov     rcx, iValue
     431        cmp     rax, rcx
    189432       %endif
    190433       %if iBase == 4 || iDstReg == 4
     
    467710 %assign iMod         iMod + 1
    468711%endrep
     712%endif ; !python
    469713
    470714        mov     rsp, [BS3_DATA16_WRT(BS3_DATA_NM(g_bs3CpuBasic3_lea_rsp))]
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