1 | ; $Id: bs3-first-pe16.asm 98103 2023-01-17 14:15:46Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - First Object, calling 16-bit protected-mode main().
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2023 Oracle and/or its affiliates.
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox base platform packages, as
|
---|
10 | ; available from https://www.virtualbox.org.
|
---|
11 | ;
|
---|
12 | ; This program is free software; you can redistribute it and/or
|
---|
13 | ; modify it under the terms of the GNU General Public License
|
---|
14 | ; as published by the Free Software Foundation, in version 3 of the
|
---|
15 | ; License.
|
---|
16 | ;
|
---|
17 | ; This program is distributed in the hope that it will be useful, but
|
---|
18 | ; WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | ; General Public License for more details.
|
---|
21 | ;
|
---|
22 | ; You should have received a copy of the GNU General Public License
|
---|
23 | ; along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | ;
|
---|
25 | ; The contents of this file may alternatively be used under the terms
|
---|
26 | ; of the Common Development and Distribution License Version 1.0
|
---|
27 | ; (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | ; in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | ; CDDL are applicable instead of those of the GPL.
|
---|
30 | ;
|
---|
31 | ; You may elect to license modified versions of this file under the
|
---|
32 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | ;
|
---|
34 | ; SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | ;
|
---|
36 |
|
---|
37 |
|
---|
38 | ;*********************************************************************************************************************************
|
---|
39 | ;* Header Files *
|
---|
40 | ;*********************************************************************************************************************************
|
---|
41 |
|
---|
42 | ;
|
---|
43 | ; Segment defs, grouping and related variables.
|
---|
44 | ; Defines the entry point 'start' as well, leaving us in BS3TEXT16.
|
---|
45 | ;
|
---|
46 | %include "bs3-first-common.mac"
|
---|
47 |
|
---|
48 |
|
---|
49 | ;*********************************************************************************************************************************
|
---|
50 | ;* External Symbols *
|
---|
51 | ;*********************************************************************************************************************************
|
---|
52 | BS3_BEGIN_DATA16
|
---|
53 |
|
---|
54 | BS3_BEGIN_RMTEXT16
|
---|
55 | extern _Bs3CpuDetect_rm_far
|
---|
56 | extern _Bs3InitMemory_rm_far
|
---|
57 |
|
---|
58 | BS3_BEGIN_TEXT16
|
---|
59 | BS3_EXTERN_CMN Bs3PicMaskAll
|
---|
60 | BS3_EXTERN_CMN Bs3Trap16Init
|
---|
61 | extern _Bs3SwitchToPE16_rm
|
---|
62 | extern _Main_pe16
|
---|
63 | BS3_EXTERN_CMN Bs3Shutdown
|
---|
64 |
|
---|
65 |
|
---|
66 | BS3_BEGIN_TEXT16
|
---|
67 | ;
|
---|
68 | ; Zero return address and zero caller BP.
|
---|
69 | ;
|
---|
70 | xor ax, ax
|
---|
71 | push ax
|
---|
72 | push ax
|
---|
73 | mov bp, sp
|
---|
74 |
|
---|
75 | ;
|
---|
76 | ; Load DS and ES with data selectors.
|
---|
77 | ;
|
---|
78 | mov ax, BS3KIT_GRPNM_DATA16
|
---|
79 | mov ds, ax
|
---|
80 | mov es, ax
|
---|
81 |
|
---|
82 |
|
---|
83 | ;
|
---|
84 | ; Make sure interrupts are disabled as we cannot (don't want to) service
|
---|
85 | ; BIOS interrupts once we switch mode.
|
---|
86 | ;
|
---|
87 | cli
|
---|
88 | call Bs3PicMaskAll
|
---|
89 |
|
---|
90 | ;
|
---|
91 | ; Initialize 16-bit protected mode.
|
---|
92 | ;
|
---|
93 | call far _Bs3CpuDetect_rm_far
|
---|
94 | call far _Bs3InitMemory_rm_far
|
---|
95 | call Bs3Trap16Init
|
---|
96 |
|
---|
97 | ;
|
---|
98 | ; Switch to PE16 and call main.
|
---|
99 | ;
|
---|
100 | call _Bs3SwitchToPE16_rm
|
---|
101 | call _Main_pe16
|
---|
102 |
|
---|
103 | ; Try shutdown if it returns.
|
---|
104 | call Bs3Shutdown
|
---|
105 |
|
---|