[69300] | 1 | ; $Id: pmsetup.inc 96407 2022-08-22 17:43:14Z vboxsync $
|
---|
[38699] | 2 | ;; @file
|
---|
[69300] | 3 | ; Initial system setup which needs to run in protected mode.
|
---|
| 4 | ;
|
---|
[38699] | 5 |
|
---|
[69300] | 6 | ;
|
---|
[96407] | 7 | ; Copyright (C) 2004-2022 Oracle and/or its affiliates.
|
---|
[69300] | 8 | ;
|
---|
[96407] | 9 | ; This file is part of VirtualBox base platform packages, as
|
---|
| 10 | ; available from https://www.virtualbox.org.
|
---|
[69300] | 11 | ;
|
---|
[96407] | 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 | ;
|
---|
[38699] | 27 |
|
---|
[51725] | 28 | SVR equ 0FEE000F0h
|
---|
[51057] | 29 | LVT_LINT0 equ 0FEE00350h
|
---|
| 30 | LVT_LINT1 equ 0FEE00360h
|
---|
[38699] | 31 |
|
---|
| 32 | public pmode_setup
|
---|
| 33 |
|
---|
[51725] | 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.
|
---|
[38699] | 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
|
---|
[51057] | 46 |
|
---|
[38699] | 47 | mov eax, cr0 ; Clear CR0.CD and CR0.NW
|
---|
| 48 | and eax, 09FFFFFFFh
|
---|
| 49 | mov cr0, eax
|
---|
[51057] | 50 |
|
---|
[51725] | 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 |
|
---|
[51057] | 55 | mov esi, LVT_LINT0 ; Program LINT0 to ExtINT and unmask
|
---|
[38699] | 56 | mov eax, [esi]
|
---|
| 57 | and eax, 0FFFE00FFh
|
---|
| 58 | or ah, 7
|
---|
| 59 | mov [esi], eax
|
---|
[51057] | 60 |
|
---|
| 61 | mov esi, LVT_LINT1 ; Program LINT1 to NMI and unmask
|
---|
[38699] | 62 | mov eax, [esi]
|
---|
| 63 | and eax, 0FFFE00FFh
|
---|
| 64 | or ah, 4
|
---|
| 65 | mov [esi], eax
|
---|
[51057] | 66 |
|
---|
[38699] | 67 | call pmode_exit
|
---|
| 68 | popf
|
---|
| 69 | pop esi
|
---|
| 70 | pop eax
|
---|
[60422] | 71 | SET_DEFAULT_CPU_286
|
---|
[38699] | 72 | ret
|
---|
| 73 |
|
---|
| 74 | pmode_setup endp
|
---|
[69300] | 75 |
|
---|