VirtualBox

Changeset 104071 in vbox for trunk


Ignore:
Timestamp:
Mar 26, 2024 8:20:34 PM (10 months ago)
Author:
vboxsync
Message:

ValKit/bootsectors: Added Bs3TestQueryCfgU16 and made it and the existing Bs3TestQueryCfgU8/Bool/U32 variants take a default value and return it when the query fails. bugref:9898

Location:
trunk/src/VBox/ValidationKit/bootsectors
Files:
9 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-fpustate-1-template.c

    r98103 r104071  
    186186    BS3PTRUNION         MmioReg;
    187187    BS3CPUVENDOR const  enmCpuVendor            = Bs3GetCpuVendor();
    188     bool const          fSkipStorIdt            = Bs3TestQueryCfgBool(VMMDEV_TESTING_CFG_IS_NEM_LINUX);
    189     bool const          fMayHaveZeroStEnvSels   = Bs3TestQueryCfgBool(VMMDEV_TESTING_CFG_IS_NEM_LINUX);
     188    bool const          fSkipStorIdt            = Bs3TestQueryCfgBool(VMMDEV_TESTING_CFG_IS_NEM_LINUX, false);
     189    bool const          fMayHaveZeroStEnvSels   = Bs3TestQueryCfgBool(VMMDEV_TESTING_CFG_IS_NEM_LINUX, false);
    190190    bool const          fFastFxSaveRestore      = RT_BOOL(ASMCpuId_EDX(0x80000001) & X86_CPUID_AMD_FEATURE_EDX_FFXSR);
    191191    //bool const          fFdpXcptOnly       = (ASMCpuIdEx_EBX(7, 0) & X86_CPUID_STEXT_FEATURE_EBX_FDP_EXCPTN_ONLY)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk

    r103262 r104071  
    241241        bs3-cmn-TestCheckExtCtx.c \
    242242        bs3-cmn-TestQueryCfgU8.asm \
     243        bs3-cmn-TestQueryCfgU16.asm \
    243244        bs3-cmn-TestQueryCfgU32.asm \
    244245        bs3-cmn-TestHostPrintf.c \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestInit.c

    r104066 r104071  
    6666    if (g_fbBs3VMMDevTesting)
    6767    {
    68         uint16_t uValue;
    69 #if ARCH_BITS == 16
    70         ASMOutU16(VMMDEV_TESTING_IOPORT_CMD, (uint16_t)VMMDEV_TESTING_CMD_QUERY_CFG);
    71 #else
    72         ASMOutU32(VMMDEV_TESTING_IOPORT_CMD, VMMDEV_TESTING_CMD_QUERY_CFG);
    73 #endif
    74         ASMOutU16(VMMDEV_TESTING_IOPORT_DATA, VMMDEV_TESTING_CFG_THRESHOLD_NATIVE_RECOMPILER);
    75         uValue = ASMInU16(VMMDEV_TESTING_IOPORT_DATA);
    76 Bs3TestPrintf("VMMDEV_TESTING_CFG_THRESHOLD_NATIVE_RECOMPILER=%RU16\n", uValue);
     68        uint16_t uValue = Bs3TestQueryCfgU16(VMMDEV_TESTING_CFG_THRESHOLD_NATIVE_RECOMPILER, 0);
    7769        if (uValue > 0 && uValue < 1024)
    7870            g_cBs3ThresholdNativeRecompiler = uValue;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestQueryCfgU16.asm

    r104069 r104071  
    11; $Id$
    22;; @file
    3 ; BS3Kit - Bs3TestQueryCfgU8.
     3; BS3Kit - Bs3TestQueryCfgU16.
    44;
    55
     
    4242
    4343;;
    44 ; @cproto   BS3_DECL(uint32_t) Bs3TestQueryCfgU32(uint16_t uCfg);
     44; @cproto   BS3_DECL(uint16_t) Bs3TestQueryCfgU16(uint16_t uCfg, uint16_t uDefault);
    4545;
    46 BS3_PROC_BEGIN_CMN Bs3TestQueryCfgU32, BS3_PBC_HYBRID
    47         BS3_CALL_CONV_PROLOG 1
     46BS3_PROC_BEGIN_CMN Bs3TestQueryCfgU16, BS3_PBC_HYBRID
     47        BS3_CALL_CONV_PROLOG 2
    4848        push    xBP
    4949        mov     xBP, xSP
    50 TNOT16  push    xDX
     50        push    xDX
     51        push    xCX
    5152
    5253        cmp     byte [BS3_DATA16_WRT(g_fbBs3VMMDevTesting)], 0
     
    6970
    7071        ; Read back the result.
     72        in      ax, dx
    7173%if TMPL_BITS == 16
    72         in      ax, dx
    73         push    ax
    74         in      ax, dx
    75         mov     dx, ax
    76         pop     ax
     74        mov     cx, ax
     75        in      ax, dx                      ; read okay magic.
     76        cmp     ax, VMMDEV_TESTING_QUERY_CFG_OKAY_TAIL & 0xffff
     77        mov     ax, cx
    7778%else
    78         in      eax, dx
     79        movzx   ecx, ax
     80        in      eax, dx                     ; read okay magic.
     81        cmp     eax, VMMDEV_TESTING_QUERY_CFG_OKAY_TAIL
     82        mov     eax, ecx
    7983%endif
     84        jne     .no_vmmdev
    8085
    8186.return:
    82 TNOT16  pop     xDX
     87        pop     xCX
     88        pop     xDX
    8389        pop     xBP
    84         BS3_CALL_CONV_EPILOG 1
     90        BS3_CALL_CONV_EPILOG 2
    8591        BS3_HYBRID_RET
    8692
    8793.no_vmmdev:
    88         xor     xAX, xAX
    8994%if TMPL_BITS == 16
    90         xor     xDX, xDX
     95        mov     ax, [xBP + xCB + cbCurRetAddr + xCB]
     96%else
     97        movzx   eax, word [xBP + xCB + cbCurRetAddr + xCB]
    9198%endif
    9299        jmp     .return
    93 BS3_PROC_END_CMN   Bs3TestQueryCfgU32
     100BS3_PROC_END_CMN   Bs3TestQueryCfgU16
    94101
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestQueryCfgU32.asm

    r98103 r104071  
    11; $Id$
    22;; @file
    3 ; BS3Kit - Bs3TestQueryCfgU8.
     3; BS3Kit - Bs3TestQueryCfgU32.
    44;
    55
    66;
    7 ; Copyright (C) 2007-2023 Oracle and/or its affiliates.
     7; Copyright (C) 2007-2024 Oracle and/or its affiliates.
    88;
    99; This file is part of VirtualBox base platform packages, as
     
    4242
    4343;;
    44 ; @cproto   BS3_DECL(uint32_t) Bs3TestQueryCfgU32(uint16_t uCfg);
     44; @cproto   BS3_DECL(uint32_t) Bs3TestQueryCfgU32(uint16_t uCfg, uint32_t uDefault);
    4545;
    4646BS3_PROC_BEGIN_CMN Bs3TestQueryCfgU32, BS3_PBC_HYBRID
    47         BS3_CALL_CONV_PROLOG 1
     47        BS3_CALL_CONV_PROLOG 2
    4848        push    xBP
    4949        mov     xBP, xSP
    5050TNOT16  push    xDX
     51        push    xCX
    5152
    5253        cmp     byte [BS3_DATA16_WRT(g_fbBs3VMMDevTesting)], 0
     
    7071        ; Read back the result.
    7172%if TMPL_BITS == 16
    72         in      ax, dx
     73        in      ax, dx                      ; first word
    7374        push    ax
    74         in      ax, dx
    75         mov     dx, ax
     75        in      ax, dx                      ; second word
     76        mov     cx, ax
     77        in      ax, dx                      ; okay magic following the value.
     78        cmp     ax, VMMDEV_TESTING_QUERY_CFG_OKAY_TAIL & 0xffff
     79        mov     dx, cx
    7680        pop     ax
    7781%else
    7882        in      eax, dx
     83        mov     ecx, eax
     84        in      eax, dx
     85        cmp     eax, VMMDEV_TESTING_QUERY_CFG_OKAY_TAIL
     86        mov     eax, ecx
    7987%endif
     88        jne     .no_vmmdev
    8089
    8190.return:
     91        pop     xCX
    8292TNOT16  pop     xDX
    8393        pop     xBP
    84         BS3_CALL_CONV_EPILOG 1
     94        BS3_CALL_CONV_EPILOG 2
    8595        BS3_HYBRID_RET
    8696
    8797.no_vmmdev:
    88         xor     xAX, xAX
     98        mov     xAX, [xBP + xCB + cbCurRetAddr + xCB]
    8999%if TMPL_BITS == 16
    90         xor     xDX, xDX
     100        mov     xDX, [xBP + xCB + cbCurRetAddr + xCB + xCB]
    91101%endif
    92102        jmp     .return
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-TestQueryCfgU8.asm

    r98103 r104071  
    4242
    4343;;
    44 ; @cproto   BS3_DECL(uint8_t) Bs3TestQueryCfgU8(uint16_t uCfg);
    45 ; @cproto   BS3_DECL(bool)    Bs3TestQueryCfgBool(uint16_t uCfg);
     44; @cproto   BS3_DECL(uint8_t) Bs3TestQueryCfgU8(uint16_t uCfg, uint8_t bDefault);
     45; @cproto   BS3_DECL(bool)    Bs3TestQueryCfgBool(uint16_t uCfg, bool fDefault);
    4646;
    4747BS3_GLOBAL_NAME_EX BS3_CMN_NM(Bs3TestQueryCfgBool), function, 3
    4848BS3_PROC_BEGIN_CMN Bs3TestQueryCfgU8, BS3_PBC_HYBRID
    49         BS3_CALL_CONV_PROLOG 1
     49        BS3_CALL_CONV_PROLOG 2
    5050        push    xBP
    5151        mov     xBP, xSP
    5252        push    xDX
     53        push    xCX
    5354
    54         xor     al, al
    5555        cmp     byte [BS3_DATA16_WRT(g_fbBs3VMMDevTesting)], 0
    5656        je      .no_vmmdev
     
    7373        ; Read back the result.
    7474        in      al, dx
     75%if TMPL_BITS == 16
     76        mov     cl, al
     77        in      ax, dx                      ; check the 'okay'
     78        cmp     ax, VMMDEV_TESTING_QUERY_CFG_OKAY_TAIL & 0xffff
     79        mov     al, cl
     80        mov     ah, 0
     81%else
     82        movzx   ecx, al
     83        in      eax, dx                     ; check the 'okay'
     84        cmp     eax, VMMDEV_TESTING_QUERY_CFG_OKAY_TAIL
     85        mov     eax, ecx
     86%endif
     87        jne     .no_vmmdev
     88
     89.return:
     90        pop     xCX
     91        pop     xDX
     92        pop     xBP
     93        BS3_CALL_CONV_EPILOG 2
     94        BS3_HYBRID_RET
    7595
    7696.no_vmmdev:
    77         pop     xDX
    78         pop     xBP
    79         BS3_CALL_CONV_EPILOG 1
    80         BS3_HYBRID_RET
     97%if TMPL_BITS == 16
     98        mov     al, [xBP + xCB + cbCurRetAddr + xCB]
     99%else
     100        movzx   eax, byte [xBP + xCB + cbCurRetAddr + xCB]
     101%endif
     102        jmp     .return
    81103BS3_PROC_END_CMN   Bs3TestQueryCfgU8
    82104
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk

    r103262 r104071  
    9999$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabAllocFixed)
    100100$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabFree)
     101$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestQueryCfgU16)
    101102$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TestSubErrorCount)
    102103$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3ExtCtxGetMxCsr)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h

    r103262 r104071  
    208208#define Bs3TestPrintfV BS3_CMN_MANGLER(Bs3TestPrintfV)
    209209#define Bs3TestQueryCfgBool BS3_CMN_MANGLER(Bs3TestQueryCfgBool)
     210#define Bs3TestQueryCfgU16 BS3_CMN_MANGLER(Bs3TestQueryCfgU16)
    210211#define Bs3TestQueryCfgU32 BS3_CMN_MANGLER(Bs3TestQueryCfgU32)
    211212#define Bs3TestQueryCfgU8 BS3_CMN_MANGLER(Bs3TestQueryCfgU8)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h

    r103262 r104071  
    208208#undef Bs3TestPrintfV
    209209#undef Bs3TestQueryCfgBool
     210#undef Bs3TestQueryCfgU16
    210211#undef Bs3TestQueryCfgU32
    211212#undef Bs3TestQueryCfgU8
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r104066 r104071  
    36993699 * @returns Value.
    37003700 * @param   uCfg        A VMMDEV_TESTING_CFG_XXX value.
    3701  */
    3702 BS3_CMN_PROTO_STUB(uint8_t, Bs3TestQueryCfgU8,(uint16_t uCfg));
    3703 
    3704 /**
    3705  * Queries an unsigned 8-bit configuration value.
     3701 * @param   bDefault    The default value to return if the VMMDev isn't
     3702 *                      available or the query failed.
     3703 */
     3704BS3_CMN_PROTO_STUB(uint8_t, Bs3TestQueryCfgU8,(uint16_t uCfg, uint8_t bDefault));
     3705
     3706/**
     3707 * Queries a boolean configuration value.
    37063708 *
    37073709 * @returns Value.
    37083710 * @param   uCfg        A VMMDEV_TESTING_CFG_XXX value.
    3709  */
    3710 BS3_CMN_PROTO_STUB(bool, Bs3TestQueryCfgBool,(uint16_t uCfg));
    3711 
    3712 /**
    3713  * Queries an unsigned 32-bit configuration value.
     3711 * @param   fDefault    The default value to return if the VMMDev isn't
     3712 *                      available or the query failed.
     3713 */
     3714BS3_CMN_PROTO_STUB(bool, Bs3TestQueryCfgBool,(uint16_t uCfg, bool fDefault));
     3715
     3716/**
     3717 * Queries an unsigned 16-bit configuration value.
    37143718 *
    37153719 * @returns Value.
    37163720 * @param   uCfg        A VMMDEV_TESTING_CFG_XXX value.
    3717  */
    3718 BS3_CMN_PROTO_STUB(uint32_t, Bs3TestQueryCfgU32,(uint16_t uCfg));
     3721 * @param   uDefault    The default value to return if the VMMDev isn't
     3722 *                      available or the query failed.
     3723 */
     3724BS3_CMN_PROTO_STUB(uint16_t, Bs3TestQueryCfgU16,(uint16_t uCfg, uint16_t uDefault));
     3725
     3726/**
     3727 * Queries an unsigned 32-bit configuration value.
     3728 *
     3729 * @returns Value.
     3730 * @param   uCfg        A VMMDEV_TESTING_CFG_XXX value.
     3731 * @param   uDefault    The default value to return if the VMMDev isn't
     3732 *                      available or the query failed.
     3733 */
     3734BS3_CMN_PROTO_STUB(uint32_t, Bs3TestQueryCfgU32,(uint16_t uCfg, uint32_t uDefault));
    37193735
    37203736/**
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