VirtualBox

Changeset 97320 in vbox


Ignore:
Timestamp:
Oct 27, 2022 12:45:25 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154311
Message:

ValKit/bs3kit: Added a Bs3SelSetup32BitCode function for quickly setting up a 32-bit code segment.

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

Legend:

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

    r96412 r97320  
    194194       bs3-cmn-SelSetup16BitData.c \
    195195       bs3-cmn-SelSetup16BitCode.c \
     196       bs3-cmn-SelSetup32BitCode.c \
    196197       bs3-cmn-SlabInit.c \
    197198       bs3-cmn-SlabAlloc.c \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-SelSetup32BitCode.c

    r97285 r97320  
    11/* $Id$ */
    22/** @file
    3  * BS3Kit - Bs3SelSetup16BitCode
     3 * BS3Kit - Bs3SelSetup32BitCode
    44 */
    55
     
    4242
    4343
    44 #undef Bs3SelSetup16BitCode
    45 BS3_CMN_DEF(void, Bs3SelSetup16BitCode,(X86DESC BS3_FAR *pDesc, uint32_t uBaseAddr, uint8_t bDpl))
     44#undef Bs3SelSetup32BitCode
     45BS3_CMN_DEF(void, Bs3SelSetup32BitCode,(X86DESC BS3_FAR *pDesc, uint32_t uBaseAddr, uint32_t uLimit, uint8_t bDpl))
    4646{
    47     pDesc->Gen.u16LimitLow = UINT16_C(0xffff);
    48     pDesc->Gen.u16BaseLow  = (uint16_t)uBaseAddr;
    49     pDesc->Gen.u8BaseHigh1 = (uint8_t)(uBaseAddr >> 16);
    50     pDesc->Gen.u4Type      = X86_SEL_TYPE_ER_ACC;
    51     pDesc->Gen.u1DescType  = 1; /* data/code */
    52     pDesc->Gen.u2Dpl       = bDpl & 3;
    53     pDesc->Gen.u1Present   = 1;
    54     pDesc->Gen.u4LimitHigh = 0;
    55     pDesc->Gen.u1Available = 0;
    56     pDesc->Gen.u1Long      = 0;
    57     pDesc->Gen.u1DefBig    = 0;
    58     pDesc->Gen.u1Granularity = 0;
    59     pDesc->Gen.u8BaseHigh2 = (uint8_t)(uBaseAddr >> 24);
     47    uint8_t const cLimitShift = uLimit <= UINT32_C(0xfffff) ? 0 : 12;
     48    pDesc->Gen.u16LimitLow    = (uint16_t)(uLimit >> cLimitShift);
     49    pDesc->Gen.u16BaseLow     = (uint16_t)uBaseAddr;
     50    pDesc->Gen.u8BaseHigh1    = (uint8_t)(uBaseAddr >> 16);
     51    pDesc->Gen.u4Type         = X86_SEL_TYPE_ER_ACC;
     52    pDesc->Gen.u1DescType     = 1; /* data/code */
     53    pDesc->Gen.u2Dpl          = bDpl & 3;
     54    pDesc->Gen.u1Present      = 1;
     55    pDesc->Gen.u4LimitHigh    = (unsigned)(uLimit >> (16 + cLimitShift));
     56    pDesc->Gen.u1Available    = 0;
     57    pDesc->Gen.u1Long         = 0;
     58    pDesc->Gen.u1DefBig       = 1;
     59    pDesc->Gen.u1Granularity  = cLimitShift != 0;
     60    pDesc->Gen.u8BaseHigh2    = (uint8_t)(uBaseAddr >> 24);
    6061}
    6162
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk

    r96407 r97320  
    141141$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SelSetup16BitCode)
    142142$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SelSetup16BitData)
     143$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SelSetup32BitCode)
    143144$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabInit)
    144145$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3SlabListAdd)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h

    r96407 r97320  
    171171#define Bs3SelSetup16BitCode BS3_CMN_MANGLER(Bs3SelSetup16BitCode)
    172172#define Bs3SelSetup16BitData BS3_CMN_MANGLER(Bs3SelSetup16BitData)
     173#define Bs3SelSetup32BitCode BS3_CMN_MANGLER(Bs3SelSetup32BitCode)
    173174#define Bs3Shutdown BS3_CMN_MANGLER(Bs3Shutdown)
    174175#define Bs3SlabAlloc BS3_CMN_MANGLER(Bs3SlabAlloc)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h

    r96407 r97320  
    171171#undef Bs3SelSetup16BitCode
    172172#undef Bs3SelSetup16BitData
     173#undef Bs3SelSetup32BitCode
    173174#undef Bs3Shutdown
    174175#undef Bs3SlabAlloc
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r96407 r97320  
    19751975BS3_CMN_PROTO_STUB(void, Bs3SelSetup16BitCode,(X86DESC BS3_FAR *pDesc, uint32_t uBaseAddr, uint8_t bDpl));
    19761976
     1977/**
     1978 * Sets up a 32-bit execute-read selector with a user specified limit.
     1979 *
     1980 * @param   pDesc       Pointer to the descriptor table entry.
     1981 * @param   uBaseAddr   The base address of the descriptor.
     1982 * @param   uLimit      The limit. (This is included here and not in the 16-bit
     1983 *                      functions because we're more likely to want to set it
     1984 *                      than for 16-bit selectors.)
     1985 * @param   bDpl        The descriptor privilege level.
     1986 */
     1987BS3_CMN_PROTO_STUB(void, Bs3SelSetup32BitCode,(X86DESC BS3_FAR *pDesc, uint32_t uBaseAddr, uint32_t uLimit, uint8_t bDpl));
     1988
    19771989
    19781990/**
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