1 | ; $Id: bs3-first-pe16.asm 60539 2016-04-18 14:09:39Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - First Object, calling real-mode main().
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2015 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.virtualbox.org. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 | ; The contents of this file may alternatively be used under the terms
|
---|
18 | ; of the Common Development and Distribution License Version 1.0
|
---|
19 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | ; CDDL are applicable instead of those of the GPL.
|
---|
22 | ;
|
---|
23 | ; You may elect to license modified versions of this file under the
|
---|
24 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | ;
|
---|
26 |
|
---|
27 |
|
---|
28 | ;*********************************************************************************************************************************
|
---|
29 | ;* Header Files *
|
---|
30 | ;*********************************************************************************************************************************
|
---|
31 |
|
---|
32 | ;
|
---|
33 | ; Segment defs, grouping and related variables.
|
---|
34 | ; Defines the entry point 'start' as well, leaving us in BS3TEXT16.
|
---|
35 | ;
|
---|
36 | %include "bs3-first-common.mac"
|
---|
37 |
|
---|
38 |
|
---|
39 | ;*********************************************************************************************************************************
|
---|
40 | ;* External Symbols *
|
---|
41 | ;*********************************************************************************************************************************
|
---|
42 | BS3_EXTERN_SYSTEM16 Bs3Lgdt_Gdt
|
---|
43 | BS3_EXTERN_SYSTEM16 Bs3Lidt_Idt16
|
---|
44 |
|
---|
45 | extern Bs3SelProtFar32ToFlat32_c64
|
---|
46 | extern Bs3PrintChr_c64
|
---|
47 | extern Bs3Printf_c64
|
---|
48 | extern Bs3TestTerm_c64
|
---|
49 | extern Bs3TestSub_c64
|
---|
50 | extern Bs3TestInit_c64
|
---|
51 |
|
---|
52 | BS3_BEGIN_TEXT16
|
---|
53 | EXTERN Bs3InitMemory_rm
|
---|
54 |
|
---|
55 | %if 0
|
---|
56 | EXTERN Main_pe16
|
---|
57 | EXTERN Bs3SwitchToPE16_rm
|
---|
58 | EXTERN Bs3SwitchToRM_pe16
|
---|
59 | EXTERN Bs3SwitchToPE32_rm
|
---|
60 | EXTERN Bs3SwitchTo32Bit_c16
|
---|
61 | EXTERN Bs3SwitchTo32Bit_c32
|
---|
62 | EXTERN Bs3SwitchTo16Bit_c16
|
---|
63 | EXTERN Bs3SwitchTo16Bit_c32
|
---|
64 | EXTERN Bs3SwitchToPP16_rm
|
---|
65 | EXTERN Bs3SwitchToPP32_rm
|
---|
66 | EXTERN Bs3SwitchToPAE16_rm
|
---|
67 | EXTERN Bs3SwitchToPAE32_rm
|
---|
68 | EXTERN Bs3SwitchToLM64_rm
|
---|
69 | EXTERN Bs3SwitchToRM_pe32
|
---|
70 | EXTERN Bs3SwitchToRM_pp16
|
---|
71 | EXTERN Bs3SwitchToRM_pp32
|
---|
72 | EXTERN Bs3SwitchToRM_pae16
|
---|
73 | EXTERN Bs3SwitchToRM_pae32
|
---|
74 | extern Bs3SwitchToRM_lm64
|
---|
75 | extern _Bs3PrintChr_c16
|
---|
76 | extern _Bs3PrintChr_c32
|
---|
77 | extern Bs3PrintChr_c64
|
---|
78 | %endif
|
---|
79 |
|
---|
80 | BS3_EXTERN_CMN Bs3Shutdown
|
---|
81 | BS3_EXTERN_CMN Bs3Trap32Init
|
---|
82 |
|
---|
83 |
|
---|
84 | BS3_BEGIN_TEXT16
|
---|
85 | ;
|
---|
86 | ; We need to enter 16-bit protected mode before we can call Main_pe16.
|
---|
87 | ;
|
---|
88 | call NAME(Bs3InitMemory_rm) ; Initialize the memory (must be done from real mode).
|
---|
89 | call Bs3Trap32Init
|
---|
90 | sub xSP, 20h ; for 64-bit calls.
|
---|
91 | %if 0
|
---|
92 | call NAME(Bs3SwitchToPE16_rm)
|
---|
93 | push '1'
|
---|
94 | call NAME(Bs3PrintChr_c16)
|
---|
95 |
|
---|
96 | call NAME(Bs3SwitchTo32Bit_c16)
|
---|
97 | BS3_SET_BITS 32
|
---|
98 | call NAME(Bs3SwitchTo16Bit_c32)
|
---|
99 | BS3_SET_BITS 16
|
---|
100 | push '2'
|
---|
101 | call NAME(Bs3PrintChr_c16)
|
---|
102 |
|
---|
103 | call NAME(Bs3SwitchToRM_pe16)
|
---|
104 |
|
---|
105 | call NAME(Bs3SwitchToPE32_rm)
|
---|
106 | BS3_SET_BITS 32
|
---|
107 | push '3'
|
---|
108 | call NAME(Bs3PrintChr_c32)
|
---|
109 | call NAME(Bs3SwitchToRM_pe32)
|
---|
110 | BS3_SET_BITS 16
|
---|
111 | push '4'
|
---|
112 | call NAME(Bs3PrintChr_c16)
|
---|
113 |
|
---|
114 | call NAME(Bs3SwitchToPE16_rm)
|
---|
115 | push '5'
|
---|
116 | call NAME(Bs3PrintChr_c16)
|
---|
117 |
|
---|
118 | call NAME(Bs3SwitchToRM_pe16)
|
---|
119 | push '6'
|
---|
120 | call NAME(Bs3PrintChr_c16)
|
---|
121 |
|
---|
122 | call NAME(Bs3SwitchToPP16_rm)
|
---|
123 | push '7'
|
---|
124 | call NAME(Bs3PrintChr_c16)
|
---|
125 |
|
---|
126 | call NAME(Bs3SwitchToRM_pp16)
|
---|
127 | push '8'
|
---|
128 | call NAME(Bs3PrintChr_c16)
|
---|
129 |
|
---|
130 | call NAME(Bs3SwitchToPP32_rm)
|
---|
131 | BS3_SET_BITS 32
|
---|
132 | push '9'
|
---|
133 | call NAME(Bs3PrintChr_c32)
|
---|
134 |
|
---|
135 | call NAME(Bs3SwitchToRM_pp32)
|
---|
136 | BS3_SET_BITS 16
|
---|
137 | push 'a'
|
---|
138 | call NAME(Bs3PrintChr_c16)
|
---|
139 |
|
---|
140 | call NAME(Bs3SwitchToPAE32_rm)
|
---|
141 | BS3_SET_BITS 32
|
---|
142 | push 'b'
|
---|
143 | call NAME(Bs3PrintChr_c32)
|
---|
144 |
|
---|
145 | call NAME(Bs3SwitchToRM_pae32)
|
---|
146 | BS3_SET_BITS 16
|
---|
147 | push 'c'
|
---|
148 | call NAME(Bs3PrintChr_c16)
|
---|
149 |
|
---|
150 | call NAME(Bs3SwitchToPAE16_rm)
|
---|
151 | push 'd'
|
---|
152 | call NAME(Bs3PrintChr_c16)
|
---|
153 |
|
---|
154 | call NAME(Bs3SwitchToRM_pae16)
|
---|
155 | push 'e'
|
---|
156 | call NAME(Bs3PrintChr_c16)
|
---|
157 |
|
---|
158 | call NAME(Bs3SwitchToLM64_rm)
|
---|
159 | BS3_SET_BITS 64
|
---|
160 | push 'f'
|
---|
161 | BS3_CALL Bs3PrintChr_c64,1
|
---|
162 |
|
---|
163 | call Bs3SwitchToRM_lm64
|
---|
164 | BS3_SET_BITS 16
|
---|
165 | push 'g'
|
---|
166 | call NAME(Bs3PrintChr_c16)
|
---|
167 | %endif
|
---|
168 |
|
---|
169 | ;
|
---|
170 | ; Call main, if it returns shutdown the system.
|
---|
171 | ;
|
---|
172 | .halt:
|
---|
173 | hlt
|
---|
174 | jmp .halt
|
---|
175 | ; call NAME(Main_pe16)
|
---|
176 | call Bs3Shutdown
|
---|
177 |
|
---|