VirtualBox

Changeset 59482 in vbox


Ignore:
Timestamp:
Jan 26, 2016 3:02:43 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
105244
Message:

bs3kit: More CPU detection stuff. Compile for 8086 by default.

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

Legend:

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

    r59304 r59482  
    304304#       -ecw                   Sets the default calling convension to __watcall ()
    305305#       -q                     Quiet, no logos or stuff.
     306#       -0                     Use 8086 instruction set (16-bit only).
    306307#       -3                     Use 386 instruction set (16-bit only).
    307308#       -wx                    Maxium warning level.
     
    335336TEMPLATE_VBoxBS3KitImg_CXXTOOL      = Bs3Ow16
    336337TEMPLATE_VBoxBS3KitImg_CFLAGS       = \
    337         -nt=BS3TEXT16 -nd=BS3DATA16 -nc=BS3CODE16 -ecw -q -3 -wx -zl -zu -mc $(BS3_OW_DBG_OPT) -d1 -s -oa -ob -of -oi -ol -or -os
     338        -nt=BS3TEXT16 -nd=BS3DATA16 -nc=BS3CODE16 -ecw -q -0 -wx -zl -zu -mc $(BS3_OW_DBG_OPT) -d1 -s -oa -ob -of -oi -ol -or -os
    338339TEMPLATE_VBoxBS3KitImg_CXXFLAGS     = \
    339         -nt=BS3TEXT16 -nd=BS3DATA16 -nc=BS3CODE16 -ecw -q -3 -wx -zl -zu -mc $(BS3_OW_DBG_OPT) -d1 -s -oa -ob -of -oi -ol -or -os
     340        -nt=BS3TEXT16 -nd=BS3DATA16 -nc=BS3CODE16 -ecw -q -0 -wx -zl -zu -mc $(BS3_OW_DBG_OPT) -d1 -s -oa -ob -of -oi -ol -or -os
    340341TEMPLATE_VBoxBS3KitImg_INCS         = $(VBOX_PATH_BS3KIT_SRC)
    341342TEMPLATE_VBoxBS3KitImg_LDTOOL       = OPENWATCOM-WL
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/Makefile.kmk

    r59320 r59482  
    112112       ../../../Runtime/common/asm/ASMBitFirstSet.asm \
    113113       ../../../Runtime/common/asm/ASMBitNextClear.asm \
    114        ../../../Runtime/common/asm/ASMBitNextSet.asm
     114       ../../../Runtime/common/asm/ASMBitNextSet.asm \
     115       ../../../Runtime/common/asm/ASMBitFirstSetU16.asm \
     116       ../../../Runtime/common/asm/ASMBitFirstSetU32.asm \
     117       ../../../Runtime/common/asm/ASMBitFirstSetU64.asm \
     118       ../../../Runtime/common/asm/ASMBitLastSetU16.asm \
     119       ../../../Runtime/common/asm/ASMBitLastSetU32.asm \
     120       ../../../Runtime/common/asm/ASMBitLastSetU64.asm \
    115121
    116122# The 16-bit BS3Kit library.
     
    124130        bs3-rm-InitMemory.c \
    125131        bs3-cmn-hexdigits.c \
     132        bs3-cmn-CpuDetectData.c \
    126133        bs3-cmn-ConvertRMStackToP16UsingCxReturnToAx.asm \
    127134        bs3-wc16-U8DR.asm \
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-CpuDetect.asm

    r59311 r59482  
    2727%include "bs3kit-template-header.mac"
    2828
    29 %define BS3CPU_8086             1
    30 %define BS3CPU_V20              2
    31 %define BS3CPU_80186            3
    32 %define BS3CPU_80286            4
    33 %define BS3CPU_80386            5
    34 %define BS3CPU_80486            6
    35 %define BS3CPU_80486            7
    36 %define BS3CPU_Pentium          8
    37 %define BS3CPU_PPro             9
    38 %define BS3CPU_PProOrNewer      10
    39 %define BS3CPU_F_CPUID          0x80
    40 
     29BS3_EXTERN_DATA16 g_uBs3CpuDetected
     30TMPL_BEGIN_TEXT
    4131
    4232;;
     
    215205        mov     xAX, BS3CPU_PProOrNewer | BS3CPU_F_CPUID
    216206
    217         ;
    218         ; Epilogue.
    219         ;
    220207CPU 8086
    221208.return:
     209        ;
     210        ; Save the return value.
     211        ;
     212        BS3_ONLY_16BIT_STMT push    ds
     213        BS3_ONLY_16BIT_STMT mov     bx, seg g_uBs3CpuDetected
     214        BS3_ONLY_16BIT_STMT mov     ds, bx
     215        mov     [g_uBs3CpuDetected], ax
     216        BS3_ONLY_16BIT_STMT pop     ds
     217
     218        ;
     219        ; Epilogue.
     220        ;
    222221        popf
    223222        pop     xBX
     
    225224        pop     xCX
    226225        pop     xBP
    227 ;; @todo cache the return value.
    228226        ret
    229227BS3_PROC_END_MODE   Bs3EnteredMode
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitMemory.c

    r59239 r59482  
    7171BS3_DECL(uint32_t) Bs3BiosInt15hE820(INT15E820ENTRY BS3_FAR *pEntry, size_t cbEntry, uint32_t uContinuationValue);
    7272#pragma aux Bs3BiosInt15hE820 = \
     73    ".386" \
    7374    "shl    ebx, 10h" \
    7475    "mov    bx, ax" /* ebx = continutation */ \
     
    219220       and BS3_SEL_TILED_AREA_SIZE present.  This means we're only interested
    220221       in entries describing usable memory, ASSUMING of course no overlaps. */
    221     if (Bs3BiosInt15hE820(&Entry, sizeof(Entry), 0) != 0)
     222    if (   (BS3_DATA_NM(g_uBs3CpuDetected) & BS3CPU_TYPE_MASK) >= BS3CPU_80386
     223        && Bs3BiosInt15hE820(&Entry, sizeof(Entry), 0) != 0)
    222224    {
    223225        uint32_t uCont = 0;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r59287 r59482  
    730730uint16_t Bs3AsmSmsw(void);
    731731# pragma aux Bs3AsmSmsw = \
     732        ".286" \
    732733        "smsw ax" \
    733734        value [ax] modify exact [ax] nomemory;
     
    18581859/**
    18591860 * Initializes the REAL and TILED memory pools.
     1861 *
     1862 * For proper operation on OLDer CPUs, call #Bs3CpuDetect_mmm first.
    18601863 */
    18611864BS3_DECL(void) Bs3InitMemory_rm(void);
     
    18721875 */
    18731876
    1874 
     1877/**
     1878 * Macro for reducing typing.
     1879 *
     1880 * Doxygen knows how to expand this, well, kind of.
     1881 */
     1882#define BS3_MODE_EXPAND_PROTOTYPES(a_RetType, a_BaseFnNm, a_Parameters) \
     1883    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_rm)     a_Parameters; \
     1884    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe16)   a_Parameters; \
     1885    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pe32)   a_Parameters; \
     1886    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pev86)  a_Parameters; \
     1887    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp16)   a_Parameters; \
     1888    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pp32)   a_Parameters; \
     1889    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_ppv86)  a_Parameters; \
     1890    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae16)  a_Parameters; \
     1891    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_pae32)  a_Parameters; \
     1892    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_paev86) a_Parameters; \
     1893    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm16)   a_Parameters; \
     1894    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm32)   a_Parameters; \
     1895    BS3_DECL(a_RetType) RT_CONCAT(a_BaseFnNm,_lm64)   a_Parameters
     1896
     1897/**
     1898 * Basic CPU detection.
     1899 *
     1900 * This sets the #g_bBs3CpuDetected global variable to the return value.
     1901 *
     1902 * @returns BS3CPU_XXX value with the BS3CPU_F_CPUID flag set depending on
     1903 *          capabilities.
     1904 */
     1905BS3_MODE_EXPAND_PROTOTYPES(uint8_t, Bs3CpuDetect,(void));
     1906
     1907/** @name BS3CPU_XXX - CPU detected by BS3CpuDetect_c16() and friends.
     1908 * @{ */
     1909#define BS3CPU_8086             UINT16_C(0x0001)    /**< Both 8086 and 8088. */
     1910#define BS3CPU_V20              UINT16_C(0x0002)    /**< Both NEC V20, V30 and relatives. */
     1911#define BS3CPU_80186            UINT16_C(0x0003)    /**< Both 80186 and 80188. */
     1912#define BS3CPU_80286            UINT16_C(0x0004)
     1913#define BS3CPU_80386            UINT16_C(0x0005)
     1914#define BS3CPU_80486            UINT16_C(0x0006)
     1915#define BS3CPU_Pentium          UINT16_C(0x0007)
     1916#define BS3CPU_PPro             UINT16_C(0x0008)
     1917#define BS3CPU_PProOrNewer      UINT16_C(0x0009)
     1918/** CPU type mask.  This is a full byte so it's possible to use byte access
     1919 * without and AND'ing to get the type value. */
     1920#define BS3CPU_TYPE_MASK        UINT16_C(0x00ff)
     1921/** Flag indicating that the CPUID instruction is supported by the CPU. */
     1922#define BS3CPU_F_CPUID          UINT16_C(0x0100)
    18751923/** @} */
    18761924
     1925/** The return value of #Bs3CpuDetect_mmm. (Initial value is BS3CPU_TYPE_MASK.) */
     1926extern uint16_t BS3_DATA_NM(g_uBs3CpuDetected);
     1927
     1928
     1929/** @} */
     1930
    18771931RT_C_DECLS_END
    18781932
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac

    r59287 r59482  
    941941%define BS3TRAPRESUME_F_SKIP_CRX 1
    942942
    943 %endif
    944 
     943
     944;; @name BS3CPU_XXX - Bs3CpuDetect_mmm return value and g_bBs3CpuDetected.
     945;; @{
     946%define BS3CPU_8086             0x0001
     947%define BS3CPU_V20              0x0002
     948%define BS3CPU_80186            0x0003
     949%define BS3CPU_80286            0x0004
     950%define BS3CPU_80386            0x0005
     951%define BS3CPU_80486            0x0006
     952%define BS3CPU_Pentium          0x0007
     953%define BS3CPU_PPro             0x0008
     954%define BS3CPU_PProOrNewer      0x0009
     955%define BS3CPU_TYPE_MASK        0x00ff
     956%define BS3CPU_F_CPUID          0x0100
     957;; @}
     958
     959
     960%endif
     961
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