VirtualBox

source: vbox/trunk/src/VBox/ValidationKit/bootsectors/bs3kit/bs3kit-linker.h@ 102157

Last change on this file since 102157 was 102157, checked in by vboxsync, 16 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: 4.9 KB
Line 
1/* $Id: bs3kit-linker.h 102157 2023-11-20 16:16:55Z vboxsync $ */
2/** @file
3 * BS3Kit - Linker related structures and defines.
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#ifndef BS3KIT_INCLUDED_bs3kit_linker_h
38#define BS3KIT_INCLUDED_bs3kit_linker_h
39#ifndef RT_WITHOUT_PRAGMA_ONCE
40# pragma once
41#endif
42
43#pragma pack(1)
44typedef struct BS3BOOTSECTOR
45{
46 uint8_t abJmp[3];
47 char abOemId[8];
48 /** @name EBPB, DOS 4.0 style.
49 * @{ */
50 uint16_t cBytesPerSector; /**< 00bh */
51 uint8_t cSectorsPerCluster; /**< 00dh */
52 uint16_t cReservedSectors; /**< 00eh */
53 uint8_t cFATs; /**< 010h */
54 uint16_t cRootDirEntries; /**< 011h */
55 uint16_t cTotalSectors; /**< 013h */
56 uint8_t bMediaDescriptor; /**< 015h */
57 uint16_t cSectorsPerFAT; /**< 016h */
58 uint16_t cPhysSectorsPerTrack; /**< 018h */
59 uint16_t cHeads; /**< 01ah */
60 uint32_t cHiddentSectors; /**< 01ch */
61 uint32_t cLargeTotalSectors; /**< 020h - We (ab)use this to indicate the number of sectors to load. */
62 uint8_t bBootDrv; /**< 024h */
63 uint8_t bFlagsEtc; /**< 025h */
64 uint8_t bExtendedSignature; /**< 026h */
65 uint32_t dwSerialNumber; /**< 027h */
66 char abLabel[11]; /**< 02bh */
67 char abFSType[8]; /**< 036h */
68 /** @} */
69} BS3BOOTSECTOR;
70#pragma pack()
71typedef BS3BOOTSECTOR *PBS3BOOTSECTOR;
72
73AssertCompileMemberOffset(BS3BOOTSECTOR, cLargeTotalSectors, 0x20);
74AssertCompileMemberOffset(BS3BOOTSECTOR, abLabel, 0x2b);
75AssertCompileMemberOffset(BS3BOOTSECTOR, abFSType, 0x36);
76
77#define BS3_OEMID "BS3Kit\n\n"
78#define BS3_FSTYPE "RawCode\n"
79#define BS3_LABEL "VirtualBox\n"
80#define BS3_MAX_SIZE UINT32_C(491520) /* 480KB */
81
82
83/** The default address to start load high DLLs at.
84 * We start at 8MB to make sure the start is 16-bit tiled addressable, that we
85 * can load high DLLs on 286es, and to avoid using up the upper/tiled memory. */
86#define BS3HIGHDLL_LOAD_ADDRESS ( _8M )
87
88/**
89 * High DLL table entry.
90 * These are found at the end of the base image.
91 */
92typedef struct BS3HIGHDLLENTRY
93{
94 char achMagic[8]; /**< BS3HIGHDLLENTRY_MAGIC */
95 uint32_t uLoadAddr; /**< The load address. Set by the linker. */
96 uint32_t cbLoaded; /**< The number of bytes when loaded. */
97 uint32_t offInImage; /**< Byte offset in the linked image blob. */
98 uint32_t cbInImage; /**< The number of bytes to load from the linked image blob. */
99 uint32_t cImports; /**< Number of imports. */
100 int32_t offImports; /**< Relative address (to entry start) of the import table. */
101 uint32_t cExports; /**< Number of exports. */
102 int32_t offExports; /**< Relative address (to entry start) of the export table. */
103 uint32_t cbStrings; /**< Size of the string table in bytes. */
104 int32_t offStrings; /**< Relative address (to entry start) of the string table. */
105 uint32_t offFilename; /**< String table offset of the DLL name (sans path, with extension). */
106} BS3HIGHDLLENTRY;
107/** Magic value for BS3HIGHDLLENTRY. */
108#define BS3HIGHDLLENTRY_MAGIC "HighDLL"
109
110typedef struct BS3HIGHDLLIMPORTENTRY
111{
112 uint16_t offName;
113 uint16_t uSeg;
114 uint32_t offFlat;
115} BS3HIGHDLLIMPORTENTRY;
116
117typedef struct BS3HIGHDLLEXPORTENTRY
118{
119 uint32_t offFlat;
120 uint16_t offName;
121} BS3HIGHDLLEXPORTENTRY;
122
123
124#endif /* !BS3KIT_INCLUDED_bs3kit_linker_h */
125
Note: See TracBrowser for help on using the repository browser.

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