1 | ; $Id: bs3-first-pe16.asm 60668 2016-04-23 00:06:18Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; BS3Kit - First Object, calling 16-bit protected-mode main().
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2007-2016 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_BEGIN_DATA16
|
---|
43 |
|
---|
44 | BS3_BEGIN_RMTEXT16
|
---|
45 | extern _Bs3CpuDetect_rm_far
|
---|
46 | extern _Bs3InitMemory_rm_far
|
---|
47 |
|
---|
48 | BS3_BEGIN_TEXT16
|
---|
49 | BS3_EXTERN_CMN Bs3PicMaskAll
|
---|
50 | BS3_EXTERN_CMN Bs3Trap16Init
|
---|
51 | extern _Bs3SwitchToPE16_rm
|
---|
52 | extern _Main_pe16
|
---|
53 | BS3_EXTERN_CMN Bs3Shutdown
|
---|
54 |
|
---|
55 |
|
---|
56 | BS3_BEGIN_TEXT16
|
---|
57 | ;
|
---|
58 | ; Zero return address and zero caller BP.
|
---|
59 | ;
|
---|
60 | xor ax, ax
|
---|
61 | push ax
|
---|
62 | push ax
|
---|
63 | mov bp, sp
|
---|
64 |
|
---|
65 | ;
|
---|
66 | ; Load DS and ES with data selectors.
|
---|
67 | ;
|
---|
68 | mov ax, BS3KIT_GRPNM_DATA16
|
---|
69 | mov ds, ax
|
---|
70 | mov es, ax
|
---|
71 |
|
---|
72 |
|
---|
73 | ;
|
---|
74 | ; Make sure interrupts are disabled as we cannot (don't want to) service
|
---|
75 | ; BIOS interrupts once we switch mode.
|
---|
76 | ;
|
---|
77 | cli
|
---|
78 | call Bs3PicMaskAll
|
---|
79 |
|
---|
80 | ;
|
---|
81 | ; Initialize 16-bit protected mode.
|
---|
82 | ;
|
---|
83 | call far _Bs3CpuDetect_rm_far
|
---|
84 | call far _Bs3InitMemory_rm_far
|
---|
85 | call Bs3Trap16Init
|
---|
86 |
|
---|
87 | ;
|
---|
88 | ; Switch to PE16 and call main.
|
---|
89 | ;
|
---|
90 | call _Bs3SwitchToPE16_rm
|
---|
91 | call _Main_pe16
|
---|
92 |
|
---|
93 | ; Try shutdown if it returns.
|
---|
94 | call Bs3Shutdown
|
---|
95 |
|
---|