VirtualBox

source: vbox/trunk/src/VBox/Runtime/common/compiler/vcc/loadcfg-vcc.c@ 96407

最後變更 在這個檔案從96407是 96407,由 vboxsync 提交於 3 年 前

scm copyright and license note update

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 8.5 KB
 
1/* $Id: loadcfg-vcc.c 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * IPRT - Visual C++ Compiler - PE/Windows Load Configuration.
4 *
5 * @note This is a C file and not C++ because the compiler generates fixups
6 * that upsets the linker (ADDR32 + ADDR32_4 instead of ADDR64).
7 */
8
9/*
10 * Copyright (C) 2022 Oracle and/or its affiliates.
11 *
12 * This file is part of VirtualBox base platform packages, as
13 * available from https://www.alldomusa.eu.org.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation, in version 3 of the
18 * License.
19 *
20 * This program is distributed in the hope that it will be useful, but
21 * WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see <https://www.gnu.org/licenses>.
27 *
28 * The contents of this file may alternatively be used under the terms
29 * of the Common Development and Distribution License Version 1.0
30 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
31 * in the VirtualBox distribution, in which case the provisions of the
32 * CDDL are applicable instead of those of the GPL.
33 *
34 * You may elect to license modified versions of this file under the
35 * terms and conditions of either the GPL or the CDDL or both.
36 *
37 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
38 */
39
40
41/*********************************************************************************************************************************
42* Header Files *
43*********************************************************************************************************************************/
44#include "internal/iprt.h"
45#include <iprt/formats/pecoff.h>
46
47#include "internal/compiler-vcc.h"
48
49
50/*********************************************************************************************************************************
51* Global Variables *
52*********************************************************************************************************************************/
53extern uintptr_t __security_cookie; /**< nocrt-stack-win.asm */
54#ifdef RT_ARCH_X86
55extern uintptr_t __safe_se_handler_table[]; /**< Linker generated. */
56extern uint8_t __safe_se_handler_count; /**< Absolute "address" defined by the linker representing the table size. */
57#endif
58extern uintptr_t __guard_check_icall_fptr; /**< nocrt-guard-win.asm */
59#ifdef RT_ARCH_AMD64
60extern uintptr_t __guard_dispatch_icall_fptr;/**< nocrt-guard-win.asm */
61#endif
62extern uintptr_t __guard_fids_table[]; /**< Linker generated. */
63extern uint8_t __guard_fids_count; /** Another absolute "address" generated by the linker for a table size. */
64extern uint8_t __guard_flags; /** Another absolute "address" generated by the linker, flags value this time. */
65extern uintptr_t __guard_iat_table[]; /**< Linker generated. */
66extern uint8_t __guard_iat_count; /** Another absolute "address" generated by the linker for a table size. */
67extern uintptr_t __guard_longjmp_table[]; /**< Linker generated. */
68extern uint8_t __guard_longjmp_count; /** Another absolute "address" generated by the linker for a table size. */
69extern uint8_t __enclave_config; /** Another absolute "address" generated by the linker, flags value this time. */
70extern uintptr_t __guard_eh_cont_table[]; /**< Linker generated. */
71extern uint8_t __guard_eh_cont_count; /** Another absolute "address" generated by the linker for a table size. */
72#ifdef RT_ARCH_AMD64
73extern uintptr_t __guard_xfg_check_icall_fptr; /**< nocrt-guard-win.asm */
74extern uintptr_t __guard_xfg_dispatch_icall_fptr; /**< nocrt-guard-win.asm */
75extern uintptr_t __guard_xfg_table_dispatch_icall_fptr; /**< nocrt-guard-win.asm */
76#endif
77
78
79/**
80 * The load configuration for the PE image.
81 *
82 * The name of this is dictated by the linker, as it looks for a
83 * _load_config_used symbol and puts it's address and (somehow) size in the load
84 * config data dir entry.
85 *
86 * @todo use _MSC_VER to reduce this for older linkers which doesn't support all
87 * the machinactions we include here for the 2019 (14.29.30139.0) linker.
88 */
89RT_CONCAT(IMAGE_LOAD_CONFIG_DIRECTORY, ARCH_BITS) const _load_config_used =
90{
91 /* .Size = */ sizeof(_load_config_used),
92 /* .TimeDateStamp = */ 0,
93 /* .MajorVersion = */ 0,
94 /* .MinorVersion = */ 0,
95 /* .GlobalFlagsClear = */ 0,
96 /* .GlobalFlagsSet = */ 0,
97 /* .CriticalSectionDefaultTimeout = */ 0,
98 /* .DeCommitFreeBlockThreshold = */ 0,
99 /* .DeCommitTotalFreeThreshold = */ 0,
100 /* .LockPrefixTable = */ 0,
101 /* .MaximumAllocationSize = */ 0,
102 /* .VirtualMemoryThreshold = */ 0,
103 /* .ProcessHeapFlags = */ 0,
104 /* .ProcessAffinityMask = */ 0,
105 /* .CSDVersion = */ 0,
106 /* .DependentLoadFlags = */ 0,
107 /* .EditList = */ 0,
108 /* .SecurityCookie = */ (uintptr_t)&__security_cookie,
109#ifdef RT_ARCH_X86
110 /* .SEHandlerTable = */ (uintptr_t)&__safe_se_handler_table[0],
111 /* .SEHandlerCount = */ (uintptr_t)&__safe_se_handler_count, /* Absolute "address", remember. */
112#else
113 /* .SEHandlerTable = */ 0,
114 /* .SEHandlerCount = */ 0,
115#endif
116 /* .GuardCFCCheckFunctionPointer = */ (uintptr_t)&__guard_check_icall_fptr,
117#ifdef RT_ARCH_AMD64
118 /* .GuardCFDispatchFunctionPointer = */ (uintptr_t)&__guard_dispatch_icall_fptr,
119#else
120 /* .GuardCFDispatchFunctionPointer = */ 0,
121#endif
122 /* .GuardCFFunctionTable = */ (uintptr_t)&__guard_fids_table[0],
123 /* .GuardCFFunctionCount = */ (uintptr_t)&__guard_fids_count, /* Absolute "address", remember. */
124 /* .GuardFlags = */ (uint32_t)(uintptr_t)&__guard_flags, /* Ditto. */
125 /* .CodeIntegrity = */ { 0, 0, 0, 0 },
126 /* .GuardAddressTakenIatEntryTable = */ (uintptr_t)__guard_iat_table,
127 /* .GuardAddressTakenIatEntryCount = */ (uintptr_t)&__guard_iat_count, /* The same. */
128 /* .GuardLongJumpTargetTable = */ (uintptr_t)&__guard_longjmp_table[0],
129 /* .GuardLongJumpTargetCount = */ (uintptr_t)&__guard_longjmp_count, /* Another one. */
130 /* .DynamicValueRelocTable = */ 0,
131 /* .CHPEMetadataPointer = */ 0, /** @todo ARM */
132 /* .GuardRFFailureRoutine = */ 0,
133 /* .GuardRFFailureRoutineFunctionPointer= */ 0,
134 /* .DynamicValueRelocTableOffset = */ 0,
135 /* .DynamicValueRelocTableSection = */ 0,
136 /* .Reserved2 = */ 0,
137 /* .GuardRFVerifyStackPointerFunctionPointer=*/ 0,
138 /* .HotPatchTableOffset = */ 0,
139 /* .Reserved3 = */ 0,
140 /* .EnclaveConfigurationPointer = */ (uintptr_t)&__enclave_config, /* And another one. */
141 /* .VolatileMetadataPointer = */ 0,
142 /* .GuardEHContinuationTable = */ (uintptr_t)&__guard_eh_cont_table[0],
143 /* .GuardEHContinuationCount = */ (uintptr_t)&__guard_eh_cont_count, /* Yet another one. */
144#ifdef RT_ARCH_AMD64
145 /* .GuardXFGCheckFunctionPointer = */ (uintptr_t)&__guard_xfg_check_icall_fptr,
146 /* .GuardXFGDispatchFunctionPointer = */ (uintptr_t)&__guard_xfg_dispatch_icall_fptr,
147 /* .GuardXFGTableDispatchFunctionPointer= */ (uintptr_t)&__guard_xfg_table_dispatch_icall_fptr,
148#else
149 /* .GuardXFGCheckFunctionPointer = */ 0,
150 /* .GuardXFGDispatchFunctionPointer = */ 0,
151 /* .GuardXFGTableDispatchFunctionPointer= */ 0,
152#endif
153 /* .CastGuardOsDeterminedFailureMode = */ 0,
154};
155
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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