VirtualBox

Ignore:
Timestamp:
Apr 19, 2016 3:26:34 PM (9 years ago)
Author:
vboxsync
Message:

bs3kit: made it easier to move 16-bit templated C code to other segments.

Location:
trunk/src/VBox/ValidationKit/bootsectors/bs3kit
Files:
8 edited
2 copied

Legend:

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

    r60557 r60578  
    201201        bs3-c16-CreateHybridFarRet.asm
    202202bs3kit-common-16_bs3-cmn-UInt64Div.c_CFLAGS = -oh -d0 # -d1+ vs -d0 saves 0x6a3-0x577 = 0x12C (300)!
    203 bs3kit-common-16_VBOX_NEAR_TO_FAR_FUNCTIONS := \
     203bs3kit-common-16_VBOX_NEAR_TO_FAR_CMN_FUNCTIONS := \
    204204        $(sort $(subst bs3-cmn-,Bs3,$(basename $(filter-out \
    205205                %Data.c \
     
    221221        Bs3TrapInit \
    222222
    223 $(call BS3KIT_FN_GEN_NEARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_NEAR_TO_FAR_FUNCTIONS))
     223bs3kit-common-16_VBOX_FAR_TO_NEAR_CMN_FUNCTIONS := \
     224        ASMMemFirstMismatchingU8:8 \
     225        ASMMemFirstNonZero:6 \
     226
     227$(call BS3KIT_FN_GEN_CMN_NEARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_NEAR_TO_FAR_CMN_FUNCTIONS))
    224228$(call BS3KIT_FN_GEN_MODE_NEARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_NEAR_TO_FAR_MODE_FUNCTIONS))
     229$(call BS3KIT_FN_GEN_CMN_FARSTUBS,bs3kit-common-16,$(bs3kit-common-16_VBOX_FAR_TO_NEAR_CMN_FUNCTIONS))
    225230
    226231# The 32-bit BS3Kit library.
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-instantiate-x0.c16

    r60566 r60578  
    11/* $Id$ */
    22/** @file
    3  * BS3Kit - 16-bit common C template instantiator.
     3 * BS3Kit - 16-bit common C template instantiator, using the BS3X0TEXT16 segment.
    44 */
    55
     
    2525 */
    2626
    27 
     27#define BS3_USE_X0_TEXT_SEG 1
    2828#include "bs3-cmn-instantiate-common.h"
    2929
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-instantiate-x1.c16

    r60566 r60578  
    11/* $Id$ */
    22/** @file
    3  * BS3Kit - 16-bit common C template instantiator.
     3 * BS3Kit - 16-bit common C template instantiator, using the BS3X1TEXT16 segment.
    44 */
    55
     
    2525 */
    2626
    27 
     27#define BS3_USE_X1_TEXT_SEG 1
    2828#include "bs3-cmn-instantiate-common.h"
    2929
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-SwitchToLM64.asm

    r60557 r60578  
    4141; @remarks  Does not require 20h of parameter scratch space in 64-bit mode.
    4242;
    43 BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToLM16_Safe), function, 0
     43BS3_GLOBAL_NAME_EX TMPL_NM(Bs3SwitchToLM64_Safe), function, 0
    4444BS3_PROC_BEGIN_MODE Bs3SwitchToLM64, BS3_PBC_NEAR
    4545%ifdef TMPL_LM64
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TestDoModes.c

    r60557 r60578  
    2525 */
    2626
    27 /** @todo get this mess into the RM segment! */
    28 
    2927
    3028/*********************************************************************************************************************************
    3129*   Header Files                                                                                                                 *
    3230*********************************************************************************************************************************/
    33 #if defined(__WATCOMC__) && TMPL_MODE == BS3_MODE_RM
    34 /* In real mode we move this blob of code to the RMTEXT16 segment to save space. */
    35 # define BS3_USE_RM_TEXT_SEG 1
     31#if TMPL_MODE == BS3_MODE_RM
     32# define BS3_USE_RM_TEXT_SEG 1 /* Real mode version in RMTEXT16 segment to save space. */
    3633# include "bs3kit-template-header.h"
    3734# include "bs3-cmn-test.h"
    38 # pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
    3935#else
    4036# include "bs3kit-template-header.h"
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c

    r60556 r60578  
    3434#include <iprt/asm-amd64-x86.h>
    3535
    36 //#ifdef __WATCOMC__
    37 //# pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
    38 //#endif
    39 
    4036
    4137BS3_DECL(void) Bs3InitAll_rm(void)
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitGdt.c

    r60557 r60578  
    3232#include <iprt/asm.h>
    3333
    34 #ifdef __WATCOMC__
    35 # pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
    36 #endif
    37 
    3834
    3935/*********************************************************************************************************************************
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c

    r60556 r60578  
    3232#include "bs3-cmn-memory.h"
    3333#include <iprt/asm.h>
    34 
    35 #ifdef __WATCOMC__
    36 # pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
    37 #endif
    3834
    3935
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-mangling-code.h

    r60527 r60578  
    3030 */
    3131#undef BS3_CMN_MANGLER
    32 #if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
     32#if ARCH_BITS != 16 || !defined(BS3_USE_ALT_16BIT_TEXT_SEG)
    3333# define BS3_CMN_MANGLER(a_Function)            BS3_CMN_NM(a_Function)
    3434#else
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r60557 r60578  
    4949#endif
    5050
     51/** @def BS3_USE_ALT_16BIT_TEXT_SEG
     52 * Combines the BS3_USE_RM_TEXT_SEG,  BS3_USE_X0_TEXT_SEG, and
     53 * BS3_USE_X1_TEXT_SEG indicators into a single one. */
     54#if defined(BS3_USE_RM_TEXT_SEG) || defined(BS3_USE_X0_TEXT_SEG) || defined(BS3_USE_X1_TEXT_SEG)
     55# define BS3_USE_ALT_16BIT_TEXT_SEG
     56#else
     57# undef  BS3_USE_ALT_16BIT_TEXT_SEG
     58#endif
     59
    5160/*
    5261 * We may want to reuse some IPRT code in the common name space, so we
     
    5564 * declarations before we can define it. Thus the duplciate effort.)
    5665 */
    57 #if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
     66#if ARCH_BITS != 16 || !defined(BS3_USE_ALT_16BIT_TEXT_SEG)
    5867# define RT_MANGLER(a_Name) RT_CONCAT3(a_Name,_c,ARCH_BITS)
    5968#else
    6069# define RT_MANGLER(a_Name) RT_CONCAT(a_Name,_f16)
     70# undef RTCALL
     71# define RTCALL __cdecl __far
    6172#endif
    6273#include <iprt/mangling.h>
     
    509520 *
    510521 * @param a_Type        The return type. */
    511 #if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
     522#if ARCH_BITS != 16 || !defined(BS3_USE_ALT_16BIT_TEXT_SEG)
    512523# define BS3_DECL(a_Type)  BS3_DECL_NEAR(a_Type)
    513524#else
     
    576587 * Constructs a common function name, far or near as defined by the source.
    577588 *
    578  * Which to use in 16-bit mode is defined by BS3_USE_RM_TEXT_SEG.  In 32-bit and
    579  * 64-bit mode there are no far symbols, only near ones.
     589 * Which to use in 16-bit mode is defined by BS3_USE_ALT_16BIT_TEXT_SEG.  In
     590 * 32-bit and 64-bit mode there are no far symbols, only near ones.
    580591 *
    581592 * Example: BS3_CMN_FN_NM(Bs3Shutdown)
     
    583594 * @param   a_Name      The name of the function.
    584595 */
    585 #if ARCH_BITS != 16 || !defined(BS3_USE_RM_TEXT_SEG)
     596#if ARCH_BITS != 16 || !defined(BS3_USE_ALT_16BIT_TEXT_SEG)
    586597# define BS3_CMN_FN_NM(a_Name)  BS3_CMN_NM(a_Name)
    587598#else
     
    26872698#include "bs3kit-mangling-code.h"
    26882699
    2689 
    2690 #endif
    2691 
     2700/*
     2701 * Change 16-bit text segment if requested.
     2702 */
     2703#if defined(BS3_USE_ALT_16BIT_TEXT_SEG) && ARCH_BITS == 16 && !defined(BS3_DONT_CHANGE_TEXT_SEG)
     2704# if (defined(BS3_USE_RM_TEXT_SEG) + defined(BS3_USE_X0_TEXT_SEG) + defined(BS3_USE_X1_TEXT_SEG)) != 1
     2705#  error "Cannot set more than one alternative 16-bit text segment!"
     2706# elif defined(BS3_USE_RM_TEXT_SEG)
     2707#  pragma code_seg("BS3RMTEXT16", "BS3CLASS16RMCODE")
     2708# elif defined(BS3_USE_X0_TEXT_SEG)
     2709#  pragma code_seg("BS3X0TEXT16", "BS3CLASS16X0CODE")
     2710# elif defined(BS3_USE_X1_TEXT_SEG)
     2711#  pragma code_seg("BS3X1TEXT16", "BS3CLASS16X1CODE")
     2712# else
     2713#  error "Huh? Which alternative text segment did you want again?"
     2714# endif
     2715#endif
     2716
     2717#endif
     2718
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