VirtualBox

Ignore:
Timestamp:
Jul 4, 2022 9:56:50 AM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152110
Message:

ValKit/bs3kit: Added some wrapper functions for better dealing with 32-bit test drivers needing to handle RM and general for restoring and saving extended state. bugref:9898

Location:
trunk/src/VBox/ValidationKit/bootsectors/bs3kit
Files:
4 added
5 edited

Legend:

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

    r95491 r95496  
    108108       bs3-cmn-RegCtxSave.asm \
    109109       bs3-cmn-RegCtxSaveEx.asm \
     110       bs3-cmn-RegCtxSaveForMode.c \
    110111       bs3-cmn-RegCtxSetGrpSegFromCurPtr.c \
    111112       bs3-cmn-RegCtxSetGrpSegFromFlat.c \
     
    241242        bs3-cmn-TrapSetJmpAndRestore.c \
    242243        bs3-cmn-TrapSetJmpAndRestoreInRm.c \
     244        bs3-cmn-TrapSetJmpAndRestoreWithRm.c \
     245        bs3-cmn-TrapSetJmpAndRestoreWithExtCtx.c \
     246        bs3-cmn-TrapSetJmpAndRestoreWithExtCtxAndRm.c \
    243247        bs3-cmn-TrapUnsetJmp.c \
    244248       bs3-cmn-UtilSetFullGdtr.asm \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-autostubs.kmk

    r95491 r95496  
    122122$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3RegCtxConvertV86ToRm)
    123123$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3RegCtxPrint)
     124$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3RegCtxSaveForMode)
    124125$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3RegCtxSetGrpDsFromCurPtr)
    125126$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3RegCtxSetGrpSegFromCurPtr)
     
    164165$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetJmpAndRestoreInRm)
    165166$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetJmpAndRestore)
     167$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetJmpAndRestoreWithExtCtxAndRm)
     168$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetJmpAndRestoreWithExtCtx)
     169$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapSetJmpAndRestoreWithRm)
    166170$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3TrapUnsetJmp)
    167171$(call BS3KIT_FN_GEN_CMN_NEARSTUB,bs3kit-common-16,Bs3UInt32Div)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-define.h

    r95491 r95496  
    108108#define Bs3RegCtxSave BS3_CMN_MANGLER(Bs3RegCtxSave)
    109109#define Bs3RegCtxSaveEx BS3_CMN_MANGLER(Bs3RegCtxSaveEx)
     110#define Bs3RegCtxSaveForMode BS3_CMN_MANGLER(Bs3RegCtxSaveForMode)
    110111#define Bs3RegCtxSetGpr BS3_CMN_MANGLER(Bs3RegCtxSetGpr)
    111112#define Bs3RegCtxSetGrpDsFromCurPtr BS3_CMN_MANGLER(Bs3RegCtxSetGrpDsFromCurPtr)
     
    219220#define Bs3TrapSetJmpAndRestore BS3_CMN_MANGLER(Bs3TrapSetJmpAndRestore)
    220221#define Bs3TrapSetJmpAndRestoreInRm BS3_CMN_MANGLER(Bs3TrapSetJmpAndRestoreInRm)
     222#define Bs3TrapSetJmpAndRestoreWithExtCtxAndRm BS3_CMN_MANGLER(Bs3TrapSetJmpAndRestoreWithExtCtxAndRm)
     223#define Bs3TrapSetJmpAndRestoreWithExtCtx BS3_CMN_MANGLER(Bs3TrapSetJmpAndRestoreWithExtCtx)
     224#define Bs3TrapSetJmpAndRestoreWithRm BS3_CMN_MANGLER(Bs3TrapSetJmpAndRestoreWithRm)
    221225#define Bs3TrapSetJmp BS3_CMN_MANGLER(Bs3TrapSetJmp)
    222226#define Bs3TrapUnsetJmp BS3_CMN_MANGLER(Bs3TrapUnsetJmp)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code-undef.h

    r95491 r95496  
    108108#undef Bs3RegCtxSave
    109109#undef Bs3RegCtxSaveEx
     110#undef Bs3RegCtxSaveForMode
    110111#undef Bs3RegCtxSetGpr
    111112#undef Bs3RegCtxSetGrpDsFromCurPtr
     
    219220#undef Bs3TrapSetJmpAndRestore
    220221#undef Bs3TrapSetJmpAndRestoreInRm
     222#undef Bs3TrapSetJmpAndRestoreWithExtCtxAndRm
     223#undef Bs3TrapSetJmpAndRestoreWithExtCtx
     224#undef Bs3TrapSetJmpAndRestoreWithRm
    221225#undef Bs3TrapSetJmp
    222226#undef Bs3TrapUnsetJmp
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r95491 r95496  
    26472647 * This is for writing more flexible test drivers that can test more than the
    26482648 * CPU bitcount (16-bit, 32-bit, 64-bit, and virtual 8086) of the driver itself.
    2649  * For instance a 32-bit driver can do V86 and 16-bit testing, thus saving more
    2650  * precious and problematic 16-bit code.
     2649 * For instance a 32-bit driver can do V86 and 16-bit testing, thus saving space
     2650 * by avoiding duplicate 16-bit driver code.
    26512651 *
    26522652 * @param   pRegCtx         Where to store the register context.
     
    26572657 */
    26582658BS3_CMN_PROTO_FARSTUB(8, void, Bs3RegCtxSaveEx,(PBS3REGCTX pRegCtx, uint8_t bBitMode, uint16_t cbExtraStack));
     2659
     2660/**
     2661 * This is Bs3RegCtxSaveEx with automatic Bs3RegCtxConvertV86ToRm thrown in.
     2662 *
     2663 * This is for simplifying writing 32-bit test drivers that covers real-mode as
     2664 * well as virtual 8086, 16-bit, 32-bit, and 64-bit modes.
     2665 *
     2666 * @param   pRegCtx         Where to store the register context.
     2667 * @param   bMode           The mode to get a context for.  If this isn't
     2668 *                          BS3_MODE_RM, the BS3_MODE_SYS_MASK has to match the
     2669 *                          one of the current mode.
     2670 * @param   cbExtraStack    Number of bytes of additional stack to allocate.
     2671 */
     2672BS3_CMN_PROTO_STUB(void, Bs3RegCtxSaveForMode,(PBS3REGCTX pRegCtx, uint8_t bMode, uint16_t cbExtraStack));
    26592673
    26602674/**
     
    29052919 * @remarks All GPRs preserved.
    29062920 */
    2907 BS3_CMN_PROTO_FARSTUB(4, void, Bs3ExtCtxRestore,(PBS3EXTCTX pExtCtx));
     2921BS3_CMN_PROTO_FARSTUB(4, void, Bs3ExtCtxRestore,(PCBS3EXTCTX pExtCtx));
    29082922
    29092923/**
     
    29182932 * @sa      Bs3ExtCtxSaveEx
    29192933 */
    2920 BS3_CMN_PROTO_FARSTUB(4, void, Bs3ExtCtxRestoreEx,(PBS3EXTCTX pExtCtx));
     2934BS3_CMN_PROTO_FARSTUB(4, void, Bs3ExtCtxRestoreEx,(PCBS3EXTCTX pExtCtx));
    29212935
    29222936/**
     
    34253439 */
    34263440BS3_CMN_PROTO_STUB(void, Bs3TrapSetJmpAndRestore,(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame));
     3441
     3442/**
     3443 * Variation of Bs3TrapSetJmpAndRestore that includes
     3444 * #Bs3TrapSetJmpAndRestoreInRm and calls is if pCtxRestore is a real mode
     3445 * context and we're not in real mode.
     3446 *
     3447 * This is useful for 32-bit test drivers running via #Bs3TestDoModesByOne using
     3448 * BS3TESTMODEBYONEENTRY_F_REAL_MODE_READY to allow them to test real-mode too.
     3449 *
     3450 * @param   pCtxRestore     The context to restore.
     3451 * @param   pTrapFrame      Where to store the trap information.
     3452 */
     3453BS3_CMN_PROTO_STUB(void, Bs3TrapSetJmpAndRestoreWithRm,(PCBS3REGCTX pCtxRestore, PBS3TRAPFRAME pTrapFrame));
     3454
     3455/**
     3456 * Combination of #Bs3ExtCtxRestoreEx, #Bs3TrapSetJmp, #Bs3RegCtxRestore and
     3457 * #Bs3ExtCtxSaveEx.
     3458 *
     3459 * @param   pCtxRestore     The context to restore.
     3460 * @param   pExtCtxRestore  The extended context to restore.
     3461 * @param   pTrapFrame      Where to store the trap information.
     3462 * @param   pExtCtxTrap     Where to store the extended context after the trap.
     3463 *                          Note, the saving isn't done from the trap handler,
     3464 *                          but after #Bs3TrapSetJmp returns zero (i.e. for the
     3465 *                          2nd time).
     3466 */
     3467BS3_CMN_PROTO_STUB(void, Bs3TrapSetJmpAndRestoreWithExtCtx,(PCBS3REGCTX pCtxRestore, PCBS3EXTCTX pExtCtxRestore,
     3468                                                            PBS3TRAPFRAME pTrapFrame, PBS3EXTCTX pExtCtxTrap));
     3469
     3470/**
     3471 * Variation of Bs3TrapSetJmpAndRestoreWithExtCtx that includes
     3472 * #Bs3TrapSetJmpAndRestoreInRm and calls is if pCtxRestore is a real mode
     3473 * context and we're not in real mode.
     3474 *
     3475 * This is useful for 32-bit test drivers running via #Bs3TestDoModesByOne using
     3476 * BS3TESTMODEBYONEENTRY_F_REAL_MODE_READY to allow them to test real-mode too.
     3477 *
     3478 * @param   pCtxRestore     The context to restore.
     3479 * @param   pExtCtxRestore  The extended context to restore.
     3480 * @param   pTrapFrame      Where to store the trap information.
     3481 * @param   pExtCtxTrap     Where to store the extended context after the trap.
     3482 *                          Note, the saving isn't done from the trap handler,
     3483 *                          but after #Bs3TrapSetJmp returns zero (i.e. for the
     3484 *                          2nd time).
     3485 */
     3486BS3_CMN_PROTO_STUB(void, Bs3TrapSetJmpAndRestoreWithExtCtxAndRm,(PCBS3REGCTX pCtxRestore, PCBS3EXTCTX pExtCtxRestore,
     3487                                                                 PBS3TRAPFRAME pTrapFrame, PBS3EXTCTX pExtCtxTrap));
    34273488
    34283489/**
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