VirtualBox

Ignore:
Timestamp:
Nov 22, 2015 2:56:17 AM (9 years ago)
Author:
vboxsync
Message:

bs3kit: Started on the switcher code.

Location:
trunk/src/VBox/ValidationKit/bootsectors/bs3kit
Files:
14 added
8 edited
1 copied

Legend:

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

    r58809 r58812  
    367367        $(PATH_OBJ)/bs3kit-common-32/bs3kit-common-32.lib \
    368368        $(PATH_OBJ)/bs3kit-common-64-asm/bs3kit-common-64-asm.lib \
    369         $(PATH_OBJ)/bs3kit-common-64-c/bs3kit-common-64-c.lib
     369        $(PATH_OBJ)/bs3kit-common-64-c/bs3kit-common-64-c.lib \
     370       \
     371        $(PATH_OBJ)/bs3kit-rm/bs3kit-rm.lib \
     372        $(PATH_OBJ)/bs3kit-pe16/bs3kit-pe16.lib \
     373        $(PATH_OBJ)/bs3kit-pe32/bs3kit-pe32.lib \
     374        $(PATH_OBJ)/bs3kit-pev86/bs3kit-pev86.lib \
     375        $(PATH_OBJ)/bs3kit-pp16/bs3kit-pp16.lib \
     376        $(PATH_OBJ)/bs3kit-pp32/bs3kit-pp32.lib \
     377        $(PATH_OBJ)/bs3kit-ppv86/bs3kit-ppv86.lib \
     378        $(PATH_OBJ)/bs3kit-pae16/bs3kit-pae16.lib \
     379        $(PATH_OBJ)/bs3kit-pae32/bs3kit-pae32.lib \
     380        $(PATH_OBJ)/bs3kit-paev86/bs3kit-paev86.lib \
     381        $(PATH_OBJ)/bs3kit-lm16/bs3kit-lm16.lib \
     382        $(PATH_OBJ)/bs3kit-lm32/bs3kit-lm32.lib \
     383        $(PATH_OBJ)/bs3kit-lm64-asm/bs3kit-lm64-asm.lib \
     384        $(PATH_OBJ)/bs3kit-lm64-c/bs3kit-lm64-c.lib
    370385
    371386# BS3Kit template for 32-bit code.
     
    441456bs3-bootsector_SOURCES  = bs3-bootsector.asm
    442457
     458#
    443459# Common sources to be compiled into _p16, _p32 and _p64 versions.
     460#
    444461VBOX_BS3KIT_COMMON_SOURCES = \
    445462        bs3-cmn-Shutdown.asm \
     
    473490       bs3-cmn-SlabListAllocEx.c \
    474491       bs3-cmn-SlabListFree.c \
     492       bs3-cmn-SwitchToRing0.asm \
     493       bs3-cmn-SwitchToRing1.asm \
     494       bs3-cmn-SwitchToRing2.asm \
     495       bs3-cmn-SwitchToRing3.asm \
     496       bs3-cmn-SwitchTo16Bit.asm \
     497       bs3-cmn-SwitchTo32Bit.asm \
     498       bs3-cmn-SwitchTo64Bit.asm \
    475499       bs3-cmn-TestData.c \
    476500       bs3-cmn-TestInit.c \
     
    482506       ../../../Runtime/common/asm/ASMBitNextSet.asm
    483507
    484 # The BS3Kit library.
     508# The 16-bit BS3Kit library.
    485509LIBRARIES += bs3kit-common-16
    486510bs3kit-common-16_TEMPLATE = VBoxBS3KitImg
     
    526550bs3kit-common-64-c_SOURCES  = $(filter-out %.asm,$(VBOX_BS3KIT_COMMON_SOURCES))
    527551
     552
     553#
     554# Common sources to be compiled for each CPU mode.
     555#
     556VBOX_BS3KIT_MODE_SOURCES = \
     557        bs3-mode-SwitchToRM.asm \
     558        bs3-mode-SwitchToPE16.asm \
     559        bs3-mode-SwitchToPE32.asm \
     560        bs3-mode-SwitchToPP16.asm \
     561        bs3-mode-SwitchToPP32.asm \
     562        bs3-mode-EnteredMode.asm \
     563
     564# The 16-bit real mode BS3Kit library.
     565LIBRARIES += bs3kit-rm
     566bs3kit-rm_TEMPLATE = VBoxBS3KitImg
     567bs3kit-rm_DEFS     = TMPL_RM
     568bs3kit-rm_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES) \
     569        bs3-first-rm.asm
     570
     571
     572# The 16-bit protected mode BS3Kit library.
     573LIBRARIES += bs3kit-pe16
     574bs3kit-pe16_TEMPLATE = VBoxBS3KitImg
     575bs3kit-pe16_DEFS     = TMPL_PE16
     576bs3kit-pe16_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES) \
     577        bs3-first-pe16.asm
     578
     579# The virtual 8086 under protected mode BS3Kit library.
     580LIBRARIES += bs3kit-pev86
     581bs3kit-pev86_TEMPLATE = VBoxBS3KitImg
     582bs3kit-pev86_DEFS     = TMPL_PEV86
     583bs3kit-pev86_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES) \
     584
     585# The 32-bit protected mode BS3Kit library.
     586LIBRARIES += bs3kit-pe32
     587bs3kit-pe32_TEMPLATE = VBoxBS3KitImg
     588bs3kit-pe32_DEFS     = TMPL_PE32
     589bs3kit-pe32_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES)
     590
     591
     592# The 16-bit paged protected mode BS3Kit library.
     593LIBRARIES += bs3kit-pp16
     594bs3kit-pp16_TEMPLATE = VBoxBS3KitImg
     595bs3kit-pp16_DEFS     = TMPL_PP16
     596bs3kit-pp16_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES) \
     597
     598# The 32-bit paged protected mode BS3Kit library.
     599LIBRARIES += bs3kit-pp32
     600bs3kit-pp32_TEMPLATE = VBoxBS3KitImg
     601bs3kit-pp32_DEFS     = TMPL_PP32
     602bs3kit-pp32_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES)
     603
     604# The virtual 8086 under protected mode BS3Kit library.
     605LIBRARIES += bs3kit-ppv86
     606bs3kit-ppv86_TEMPLATE = VBoxBS3KitImg
     607bs3kit-ppv86_DEFS     = TMPL_PPV86
     608bs3kit-ppv86_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES) \
     609
     610
     611# The 16-bit paged protected mode BS3Kit library.
     612LIBRARIES += bs3kit-pae16
     613bs3kit-pae16_TEMPLATE = VBoxBS3KitImg
     614bs3kit-pae16_DEFS     = TMPL_PAE16
     615bs3kit-pae16_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES)
     616
     617# The 32-bit paged protected mode BS3Kit library.
     618LIBRARIES += bs3kit-pae32
     619bs3kit-pae32_TEMPLATE = VBoxBS3KitImg
     620bs3kit-pae32_DEFS     = TMPL_PAE32
     621bs3kit-pae32_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES)
     622
     623# The virtual 8086 under protected mode BS3Kit library.
     624LIBRARIES += bs3kit-paev86
     625bs3kit-paev86_TEMPLATE = VBoxBS3KitImg
     626bs3kit-paev86_DEFS     = TMPL_PAEV86
     627bs3kit-paev86_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES) \
     628
     629
     630# The 16-bit long mode BS3Kit library.
     631LIBRARIES += bs3kit-lm16
     632bs3kit-lm16_TEMPLATE = VBoxBS3KitImg
     633bs3kit-lm16_DEFS     = TMPL_LM16
     634bs3kit-lm16_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES) \
     635
     636# The 32-bit long mode BS3Kit library.
     637LIBRARIES += bs3kit-lm32
     638bs3kit-lm32_TEMPLATE = VBoxBS3KitImg
     639bs3kit-lm32_DEFS     = TMPL_LM32
     640bs3kit-lm32_SOURCES  = $(VBOX_BS3KIT_MODE_SOURCES) \
     641
     642# The 64-bit long mode BS3Kit library.
     643LIBRARIES += bs3kit-lm64-asm
     644bs3kit-lm64-asm_TEMPLATE = VBoxBS3KitImg
     645bs3kit-lm64-asm_DEFS     = TMPL_LM64
     646bs3kit-lm64-asm_SOURCES  = $(filter %.asm,$(VBOX_BS3KIT_MODE_SOURCES)) \
     647
     648# The 64-bit long mode BS3Kit library.
     649LIBRARIES += bs3kit-lm64-c
     650bs3kit-lm64-c_TEMPLATE = VBoxBS3KitImg
     651bs3kit-lm64-c_DEFS     = TMPL_LM64
     652bs3kit-lm64-c_SOURCES  = $(filter-out %.asm, $(VBOX_BS3KIT_MODE_SOURCES)) \
     653
     654
    528655#
    529656# shutdown example.
     
    531658MISCBINS += bs3-shutdown
    532659bs3-shutdown_TEMPLATE = VBoxBS3KitImg
    533 bs3-shutdown_SOURCES = bs3-first-rm.asm bs3-shutdown.c
     660bs3-shutdown_SOURCES = \
     661        bs3-first-pe16.asm \
     662        bs3-shutdown.c
    534663
    535664
    536665include $(FILE_KBUILD_SUB_FOOTER)
    537666
     667.PRECIOUS: E:/vbox/svn/trunk/out/win.amd64/debug/obj/bs3-shutdown/bs3-shutdown.map
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-Printf.c

    r58811 r58812  
    2929
    3030
    31 BS3_DECL(size_t) bs3PrintFmtOutput(char ch, void BS3_FAR *pvUser)
     31static BS3_DECL_CALLBACK(size_t) bs3PrintFmtOutput(char ch, void BS3_FAR *pvUser)
    3232{
    3333    if (ch != '\0')
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-cmn-StrPrintf.c

    r58810 r58812  
    4747
    4848
    49 BS3_DECL(size_t) bs3StrPrintfFmtOutput(char ch, void BS3_FAR *pvUser)
     49static BS3_DECL_CALLBACK(size_t) bs3StrPrintfFmtOutput(char ch, void BS3_FAR *pvUser)
    5050{
    5151    PBS3STRPRINTFSTATE pState = (PBS3STRPRINTFSTATE)pvUser;
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-common.mac

    r58809 r58812  
    11; $Id$
    22;; @file
    3 ; BS3Kit - First Object, calling real-mode main().
     3; BS3Kit - First Object, common stuff.
    44;
    55
     
    2626
    2727
    28 
    2928%include "bs3kit.mac"
    3029
    3130
    3231;
     32;
    3333; Define all the segments and their grouping, just to get that right once at
    3434; the start of everything.
    3535;
     36;
    3637
     38;
    3739; 16-bit text
     40;
    3841BS3_BEGIN_TEXT16
    3942BS3_GLOBAL_DATA Bs3Text16_StartOfSegment, 0
     43
     44; Entry point with eye-catcher.
     45GLOBALNAME start
     46    jmp     .after_eye_catcher
     47    db      10,13,'eye-catcher: BS3TEXT16',10,13
     48.after_eye_catcher:
    4049
    4150%ifdef ASM_FORMAT_ELF
     
    5160%endif
    5261
     62
     63;
    5364; 16-bit data
     65;
    5466BS3_BEGIN_DATA16
    5567BS3_GLOBAL_DATA Bs3Data16_StartOfSegment, 0
     
    8496%endif
    8597
     98
     99;
    86100; 32-bit text
     101;
    87102BS3_BEGIN_TEXT32
    88103BS3_GLOBAL_DATA Bs3Text32_StartOfSegment, 0
     
    97112BS3_GLOBAL_DATA Bs3Text32_EndOfSegment, 0
    98113
     114
     115;
    99116; 64-bit text
     117;
    100118BS3_BEGIN_TEXT64
    101119BS3_GLOBAL_DATA Bs3Text64_StartOfSegment, 0
     
    109127BS3_GLOBAL_DATA Bs3Text64_EndOfSegment, 0
    110128
     129
     130;
    111131; 32-bit data
     132;
    112133BS3_BEGIN_DATA32
    113134BS3_GLOBAL_DATA Bs3Data32_StartOfSegment, 0
     
    120141BS3_GLOBAL_DATA Bs3Data32_EndOfSegment, 0
    121142
     143;
    122144; 64-bit data
     145;
    123146BS3_BEGIN_DATA64
    124147BS3_GLOBAL_DATA Bs3Data64_StartOfSegment, 0
     
    131154BS3_GLOBAL_DATA Bs3Data64_EndOfSegment, 0
    132155
     156
     157;
     158; 16-bit accessible system data.
     159; No need to do anything here.
     160;
    133161BS3_BEGIN_SYSTEM16
    134162
    135163
    136 
    137 ;*********************************************************************************************************************************
    138 ;*  External Symbols                                                                                                             *
    139 ;*********************************************************************************************************************************
    140 BS3_BEGIN_TEXT16
    141 extern BS3_CMN_NM(Bs3Shutdown)
    142 extern NAME(Main_rm)
    143 
    144 BS3_BEGIN_SYSTEM16
    145 extern BS3_DATA_NM(Bs3Gdt)
    146 extern BS3_DATA_NM(Bs3Lgdt_Gdt)
    147 
    148164;
    149 ; Nothing to init here, just call main and shutdown if it returns.
     165; Switch back to the 16-bit code segment.
    150166;
    151167BS3_BEGIN_TEXT16
    152 GLOBALNAME start
    153     jmp     .after_eye_catcher
    154     db      10,13,'eye-catcher: BS3TEXT16',10,13
    155 .after_eye_catcher:
    156     mov     ax, BS3DATA16
    157     mov     es, ax
    158     mov     ds, ax
    159     call    NAME(Main_rm)
    160     call    BS3_CMN_NM(Bs3Shutdown)
    161168
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-first-rm.asm

    r58809 r58812  
    2929%include "bs3kit.mac"
    3030
    31 
    3231;
    33 ; Define all the segments and their grouping, just to get that right once at
    34 ; the start of everything.
     32; Segment defs, grouping and related variables.
     33; Defines the entry point 'start' as well, leaving us in BS3TEXT16.
    3534;
    36 
    37 ; 16-bit text
    38 BS3_BEGIN_TEXT16
    39 BS3_GLOBAL_DATA Bs3Text16_StartOfSegment, 0
    40 
    41 %ifdef ASM_FORMAT_ELF
    42 section BS3TEXT16_END   align=2 progbits alloc exec nowrite
    43 %else
    44 section BS3TEXT16_END   align=2 CLASS=BS3CODE16 PUBLIC USE16
    45 %endif
    46 
    47 BS3_GLOBAL_DATA Bs3Text16_EndOfSegment, 0
    48 
    49 %ifndef ASM_FORMAT_ELF
    50 GROUP CGROUP16 BS3TEXT16 BS3TEXT16_END
    51 %endif
    52 
    53 ; 16-bit data
    54 BS3_BEGIN_DATA16
    55 BS3_GLOBAL_DATA Bs3Data16_StartOfSegment, 0
    56     db      10,13,'eye-catcher: BS3DATA16',10,13
    57 
    58 ALIGNDATA(16)
    59 BS3_GLOBAL_DATA Bs3Data16_Size, 4
    60     dd  BS3_DATA_NM(Bs3Data16_EndOfSegment) wrt BS3DATA16_GROUP
    61 BS3_GLOBAL_DATA Bs3Data16Thru64Text32And64_TotalSize, 4
    62     dd  BS3_DATA_NM(Bs3Data64_EndOfSegment) wrt BS3DATA16_GROUP
    63 BS3_GLOBAL_DATA Bs3TotalImageSize, 4
    64     dd  BS3_DATA_NM(Bs3Data64_EndOfSegment) wrt CGROUP16
    65 BS3_GLOBAL_DATA Bs3Text16_Size, 2
    66     dd  BS3_DATA_NM(Bs3Text16_EndOfSegment) wrt CGROUP16
    67 
    68 %ifdef ASM_FORMAT_ELF
    69 section BS3DATA16CONST  align=2   progbits alloc noexec write
    70 section BS3DATA16CONST2 align=2   progbits alloc noexec write
    71 section BS3DATA16_DATA  align=2   progbits alloc noexec write
    72 section BS3DATA16_END   align=2   progbits alloc noexec write
    73 %else
    74 section BS3DATA16CONST  align=2   CLASS=FAR_DATA PUBLIC USE16
    75 section BS3DATA16CONST2 align=2   CLASS=FAR_DATA PUBLIC USE16
    76 section BS3DATA16_DATA  align=2   CLASS=FAR_DATA PUBLIC USE16
    77 section BS3DATA16_END   align=2   CLASS=FAR_DATA PUBLIC USE16
    78 %endif
    79 
    80 BS3_GLOBAL_DATA Bs3Data16_EndOfSegment, 0
    81 
    82 %ifndef ASM_FORMAT_ELF
    83 GROUP BS3DATA16_GROUP BS3DATA16 BS3DATA16CONST BS3DATA16CONST2 BS3DATA16_END
    84 %endif
    85 
    86 ; 32-bit text
    87 BS3_BEGIN_TEXT32
    88 BS3_GLOBAL_DATA Bs3Text32_StartOfSegment, 0
    89     db      10,13,'eye-catcher: BS3TEXT32',10,13
    90 
    91 %ifdef ASM_FORMAT_ELF
    92 section BS3TEXT32_END   align=1 progbits alloc exec nowrite
    93 %else
    94 section BS3TEXT32_END   align=1 CLASS=BS3CODE32 PUBLIC USE32 FLAT
    95 %endif
    96 
    97 BS3_GLOBAL_DATA Bs3Text32_EndOfSegment, 0
    98 
    99 ; 64-bit text
    100 BS3_BEGIN_TEXT64
    101 BS3_GLOBAL_DATA Bs3Text64_StartOfSegment, 0
    102     db      10,13,'eye-catcher: BS3TEXT64',10,13
    103 
    104 %ifdef ASM_FORMAT_ELF
    105 section BS3TEXT64_END   align=1 progbits alloc exec nowrite
    106 %else
    107 section BS3TEXT64_END   align=1 CLASS=CODE PUBLIC USE32 FLAT
    108 %endif
    109 BS3_GLOBAL_DATA Bs3Text64_EndOfSegment, 0
    110 
    111 ; 32-bit data
    112 BS3_BEGIN_DATA32
    113 BS3_GLOBAL_DATA Bs3Data32_StartOfSegment, 0
    114     db      10,13,'eye-catcher: BS3DATA32',10,13
    115 %ifdef ASM_FORMAT_ELF
    116 section BS3DATA32_END   align=16   progbits alloc noexec write
    117 %else
    118 section BS3DATA32_END   align=16   CLASS=FAR_DATA PUBLIC USE32 FLAT
    119 %endif
    120 BS3_GLOBAL_DATA Bs3Data32_EndOfSegment, 0
    121 
    122 ; 64-bit data
    123 BS3_BEGIN_DATA64
    124 BS3_GLOBAL_DATA Bs3Data64_StartOfSegment, 0
    125     db      10,13,'eye-catcher: BS3DATA64',10,13
    126 %ifdef ASM_FORMAT_ELF
    127 section BS3DATA64_END   align=16   progbits alloc noexec write
    128 %else
    129 section BS3DATA64_END   align=16   CLASS=DATA PUBLIC USE32 FLAT
    130 %endif
    131 BS3_GLOBAL_DATA Bs3Data64_EndOfSegment, 0
    132 
    133 BS3_BEGIN_SYSTEM16
     35%include "bs3-first-common.mac"
    13436
    13537
     38EXTERN Main_rm
     39BS3_EXTERN_CMN Bs3Shutdown
    13640
    137 ;*********************************************************************************************************************************
    138 ;*  External Symbols                                                                                                             *
    139 ;*********************************************************************************************************************************
    140 BS3_BEGIN_TEXT16
    141 extern BS3_CMN_NM(Bs3Shutdown)
    142 extern NAME(Main_rm)
    143 
    144 BS3_BEGIN_SYSTEM16
    145 extern BS3_DATA_NM(Bs3Gdt)
    146 extern BS3_DATA_NM(Bs3Lgdt_Gdt)
    147 
    148 ;
    149 ; Nothing to init here, just call main and shutdown if it returns.
    150 ;
    151 BS3_BEGIN_TEXT16
    152 GLOBALNAME start
    153     jmp     .after_eye_catcher
    154     db      10,13,'eye-catcher: BS3TEXT16',10,13
    155 .after_eye_catcher:
     41    ;
     42    ; Nothing to init here, just call main and shutdown if it returns.
     43    ;
    15644    mov     ax, BS3DATA16
    15745    mov     es, ax
    15846    mov     ds, ax
    15947    call    NAME(Main_rm)
    160     call    BS3_CMN_NM(Bs3Shutdown)
     48    call    Bs3Shutdown
    16149
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-shutdown.c

    r58809 r58812  
    99
    1010/* Just a sample. */
    11 BS3_DECL(void) Main_rm(void)
     11BS3_DECL(void) Main_pe16(void)
    1212{
    1313    void BS3_FAR *pvTmp1;
     
    1515    void BS3_FAR *pvTmp3;
    1616    void BS3_FAR *pvTmp4;
    17     Bs3InitMemory_rm();
    1817
    1918    Bs3TestInit("bs3-shutdown");
     
    2322Bs3PrintStr("\r\n");
    2423
    25 Bs3Printf("Bs3Printf: RX32=%#'RX32 string='%s' d=%d p=%p\n", UINT32_C(0xfdb97531), "my string", 42, Main_rm);
     24Bs3Printf("Bs3Printf: RX32=%#'RX32 string='%s' d=%d p=%p\n", UINT32_C(0xfdb97531), "my string", 42, Main_pe16);
    2625
    2726pvTmp2 = Bs3MemAlloc(BS3MEMKIND_REAL, _4K);
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-template-header.mac

    r58628 r58812  
    502502  %error "Both 'TMPL_PAEV86' and 'TMPL_PAE16' are defined."
    503503 %endif
    504  %ifdef TMPL_PAEV86
    505   %error "Both 'TMPL_PAEV86' and 'TMPL_PAEV86' are defined."
     504 %ifdef TMPL_PAE32
     505  %error "Both 'TMPL_PAEV86' and 'TMPL_PAE32' are defined."
    506506 %endif
    507507 %ifdef TMPL_LM16
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.h

    r58811 r58812  
    131131
    132132#define BS3_SEL_VMMDEV_MMIO16       0x00f8 /**< Selector for accessing the VMMDev MMIO segment at 0100000h from 16-bit code. */
     133
     134#define BS3_SEL_RING_SHIFT          8      /**< For the formula: BS3_SEL_R0_XXX + ((cs & 3) << BS3_SEL_RING_SHIFT) */
    133135
    134136#define BS3_SEL_R0_FIRST            0x0100 /**< The first selector in the ring-0 block. */
     
    336338#else
    337339# define BS3_DECL(a_Type)   DECLIMPORT(a_Type) BS3_NEAR_CODE BS3_CALL
     340#endif
     341
     342/** @def BS3_DECL_CALLBACK
     343 * Declares a BS3Kit callback function (typically static).
     344 *
     345 * Until we outgrow BS3TEXT16, we use all near functions in 16-bit.
     346 *
     347 * @param a_Type        The return type. */
     348#ifdef IN_BS3KIT
     349# define BS3_DECL_CALLBACK(a_Type)   a_Type BS3_NEAR_CODE BS3_CALL
     350#else
     351# define BS3_DECL_CALLBACK(a_Type)   a_Type BS3_NEAR_CODE BS3_CALL
    338352#endif
    339353
  • trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit.mac

    r58750 r58812  
    160160        section BS3TEXT32 align=1 progbits alloc exec nowrite
    161161  %else
    162         section BS3TEXT32 align=1 CLASS=BS3CODE32 PUBLIC USE32
     162        section BS3TEXT32 align=1 CLASS=BS3CODE32 PUBLIC USE32 FLAT
    163163  %endif
    164164 %else
     
    174174        section BS3DATA32 align=16 progbits alloc noexec write
    175175  %else
    176         section BS3DATA32 align=16 CLASS=FAR_DATA PUBLIC USE32
     176        section BS3DATA32 align=16 CLASS=FAR_DATA PUBLIC USE32 FLAT
    177177  %endif
    178178 %else
     
    188188        section BS3TEXT64 align=1 progbits alloc exec nowrite
    189189  %else
    190         section BS3TEXT64 align=1 CLASS=CODE PUBLIC USE32       ; class=CODE here because of 64-bit cl and/or wlink.exe
     190        section BS3TEXT64 align=1 CLASS=CODE PUBLIC USE32 FLAT  ; class=CODE here because of 64-bit cl and/or wlink.exe
    191191  %endif
    192192 %else
     
    202202        section BS3DATA64 align=16 progbits alloc noexec write
    203203  %else
    204         section BS3DATA64 align=16 CLASS=DATA PUBLIC USE32      ; class=DATA here because of 64-bit cl and/or wlink.exe
     204        section BS3DATA64 align=16 CLASS=DATA PUBLIC USE32 FLAT  ; class=DATA here because of 64-bit cl and/or wlink.exe
    205205  %endif
    206206 %else
     
    312312
    313313;;
     314; Extern macro which mangles a BS3SYSTEM16 symbol correctly, redefining the
     315; unmangled name to the mangled one for ease of use.
     316;
     317; @param    %1  The unmangled common name.
     318;
     319; @remarks  Will change to the SYSTEM16 segment, use must switch back afterwards!
     320;
     321%macro BS3_EXTERN_SYSTEM16 1
     322 BS3_BEGIN_SYSTEM16
     323 extern _ %+ %1
     324 %undef  %1
     325 %define %1  _ %+ %1
     326%endmacro
     327
     328
     329;;
    314330; Global name with ELF attributes and size.
    315331;
     
    373389%endmacro
    374390
     391
    375392;; Convenience macro for defining common procedures.
    376393%macro BS3_PROC_BEGIN_CMN 1
     
    382399 BS3_PROC_END       BS3_CMN_NM(%1)
    383400%endmacro
     401
     402
     403;; Convenience macro for defining mode specific procedures.
     404%macro BS3_PROC_BEGIN_MODE 1
     405 BS3_PROC_BEGIN     TMPL_NM(%1)
     406%endmacro
     407
     408;; Convenience macro for defining mode specific procedures.
     409%macro BS3_PROC_END_MODE 1
     410 BS3_PROC_END       TMPL_NM(%1)
     411%endmacro
     412
    384413
    385414;;
     
    595624;; Print char (cl).
    596625%define BS3_SYSCALL_PRINT_CHR   0ca110001h
     626;; Switch to ring-0.
     627%define BS3_SYSCALL_TO_RING0    0ca110002h
     628;; Switch to ring-1.
     629%define BS3_SYSCALL_TO_RING1    0ca110003h
     630;; Switch to ring-2.
     631%define BS3_SYSCALL_TO_RING2    0ca110004h
     632;; Switch to ring-3.
     633%define BS3_SYSCALL_TO_RING3    0ca110005h
    597634;; @}
    598635
     
    624661%define BS3_SEL_TSS64               0040h ;;< The 64-bit TSS selector.
    625662%define BS3_SEL_VMMDEV_MMIO16       00f8h ;;< Selector for accessing the VMMDev MMIO segment at 0100000h from 16-bit code.
     663
     664%define BS3_SEL_RING_SHIFT          8     ;;< For the formula: BS3_SEL_R0_XXX + ((cs & 3) << BS3_SEL_RING_SHIFT)
    626665
    627666%define BS3_SEL_R0_FIRST            0100h ;;< The first selector in the ring-0 block.
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