1 | ; $Id: pmsetup.inc 98103 2023-01-17 14:15:46Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; Initial system setup which needs to run in protected mode.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2004-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 | ; SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | ;
|
---|
27 |
|
---|
28 | SVR equ 0FEE000F0h
|
---|
29 | LVT_LINT0 equ 0FEE00350h
|
---|
30 | LVT_LINT1 equ 0FEE00360h
|
---|
31 |
|
---|
32 | public pmode_setup
|
---|
33 |
|
---|
34 | ;; Enable the local APIC and program LINT0/LINT1 entries. Without that,
|
---|
35 | ;; virtual wire interrupts could not be delivered. Note that the APIC must
|
---|
36 | ;; be enabled first because when disabled, all LVTs are forced masked.
|
---|
37 |
|
---|
38 | pmode_setup proc near
|
---|
39 |
|
---|
40 | .386
|
---|
41 | push eax
|
---|
42 | push esi
|
---|
43 | pushf
|
---|
44 | cli ; Interrupts would kill us!
|
---|
45 | call pmode_enter
|
---|
46 |
|
---|
47 | mov eax, cr0 ; Clear CR0.CD and CR0.NW
|
---|
48 | and eax, 09FFFFFFFh
|
---|
49 | mov cr0, eax
|
---|
50 |
|
---|
51 | mov esi, SVR ; Program the SVR -- enable the APIC,
|
---|
52 | mov eax, 010Fh ; set spurious interrupt vector to 15
|
---|
53 | mov [esi], eax
|
---|
54 |
|
---|
55 | mov esi, LVT_LINT0 ; Program LINT0 to ExtINT and unmask
|
---|
56 | mov eax, [esi]
|
---|
57 | and eax, 0FFFE00FFh
|
---|
58 | or ah, 7
|
---|
59 | mov [esi], eax
|
---|
60 |
|
---|
61 | mov esi, LVT_LINT1 ; Program LINT1 to NMI and unmask
|
---|
62 | mov eax, [esi]
|
---|
63 | and eax, 0FFFE00FFh
|
---|
64 | or ah, 4
|
---|
65 | mov [esi], eax
|
---|
66 |
|
---|
67 | call pmode_exit
|
---|
68 | popf
|
---|
69 | pop esi
|
---|
70 | pop eax
|
---|
71 | SET_DEFAULT_CPU_286
|
---|
72 | ret
|
---|
73 |
|
---|
74 | pmode_setup endp
|
---|
75 |
|
---|