VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-rm-InitAll.c@ 102157

Last change on this file since 102157 was 102157, checked in by vboxsync, 13 months ago

ValKit/bs3kit,bs3-cpu-basic-3: Experimental support for loading a 2nd test image above 1MB (at 8MB by default). This should allow for larger testcases, esp. for 32-bit and 64-bit code. bugref:10371

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: bs3-rm-InitAll.c 102157 2023-11-20 16:16:55Z vboxsync $ */
2/** @file
3 * BS3Kit - Initialize all components, real mode.
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//#define BS3_USE_RM_TEXT_SEG 1
42#include "bs3kit-template-header.h"
43#include "bs3-cmn-test.h"
44#include <iprt/asm-amd64-x86.h>
45
46BS3_MODE_PROTO_NOSB(void, Bs3EnteredMode,(void));
47
48
49BS3_DECL(void) Bs3InitAll_rm(void)
50{
51 uint8_t volatile BS3_FAR *pcTicksFlpyOff;
52
53 /*
54 * Detect CPU first as the memory init code will otherwise use 386
55 * instrunctions and cause trouble on older CPUs.
56 */
57 Bs3CpuDetect_rm_far();
58 Bs3InitMemory_rm_far();
59 Bs3InitGdt_rm_far();
60
61#ifdef BS3_INIT_ALL_WITH_HIGH_DLLS
62 /*
63 * Load the high DLLs (if any) now, before we bugger up the PIC and
64 * replace the IVT.
65 */
66 Bs3InitHighDlls_rm_far();
67#endif
68
69 /*
70 * Before we disable all interrupts, try convince the BIOS to stop the
71 * floppy motor, as it is kind of disturbing when the floppy light remains
72 * on for the whole testcase execution.
73 */
74 ASMIntDisable(); /* (probably already disabled, but no guarantees) */
75 pcTicksFlpyOff = (uint8_t volatile BS3_FAR *)BS3_FP_MAKE(0x40, 0x40);
76 if (*pcTicksFlpyOff)
77 {
78 uint32_t volatile BS3_FAR *pcTicks = (uint32_t volatile BS3_FAR *)BS3_FP_MAKE(0x40, 0x6c);
79 uint32_t cInitialTicks;
80
81 *pcTicksFlpyOff = 1; /* speed up the countdown, don't want to wait for two seconds here. */
82 cInitialTicks = *pcTicks;
83 ASMIntEnable();
84
85 while (*pcTicks == cInitialTicks)
86 ASMHalt();
87 }
88 ASMIntDisable();
89 Bs3PicSetup(false /*fForcedReInit*/);
90
91 /*
92 * Initialize IDTs and such.
93 */
94 if (g_uBs3CpuDetected & BS3CPU_F_LONG_MODE)
95 Bs3Trap64Init();
96 if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386)
97 Bs3Trap32Init();
98 if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80286)
99 Bs3Trap16Init();
100 Bs3TrapRmV86Init();
101
102 /*
103 * Perform a real-mode enter to make some final environment adjustments
104 * (like installing our syscall).
105 */
106 Bs3EnteredMode_rm();
107}
108
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette