1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5// ==++==
6//
7
8//
9// ==--==
10
11// Include platform specific declarations based on the target platform rather than the host platform.
12
13#ifndef __PLATFORM_SPECIFIC_INCLUDED
14#define __PLATFORM_SPECIFIC_INCLUDED
15
16// The main debugger code already has target platform definitions for CONTEXT.
17#include "../../../debug/inc/dbgtargetcontext.h"
18
19#ifndef FEATURE_PAL
20
21// The various OS structure definitions below tend to differ based soley on the size of pointers. DT_POINTER
22// is a type whose size matches that of the target platform. It's integral rather than point since it is never
23// legal to dereference one of these on the host.
24#ifdef _TARGET_WIN64_
25typedef ULONG64 DT_POINTER;
26#else
27typedef ULONG32 DT_POINTER;
28#endif
29
30struct DT_LIST_ENTRY
31{
32 DT_POINTER Flink;
33 DT_POINTER Blink;
34};
35
36struct DT_UNICODE_STRING
37{
38 USHORT Length;
39 USHORT MaximumLength;
40 DT_POINTER Buffer;
41};
42
43#define DT_GDI_HANDLE_BUFFER_SIZE32 34
44#define DT_GDI_HANDLE_BUFFER_SIZE64 60
45
46#ifndef IMAGE_FILE_MACHINE_ARMNT
47#define IMAGE_FILE_MACHINE_ARMNT 0x01c4 // ARM Thumb-2 Little-Endian
48#endif
49
50#ifndef IMAGE_FILE_MACHINE_ARM64
51#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian
52#endif
53
54#ifdef _TARGET_WIN64_
55typedef ULONG DT_GDI_HANDLE_BUFFER[DT_GDI_HANDLE_BUFFER_SIZE64];
56#else
57typedef ULONG DT_GDI_HANDLE_BUFFER[DT_GDI_HANDLE_BUFFER_SIZE32];
58#endif
59
60struct DT_PEB
61{
62 BOOLEAN InheritedAddressSpace;
63 BOOLEAN ReadImageFileExecOptions;
64 BOOLEAN BeingDebugged;
65 BOOLEAN SpareBool;
66 DT_POINTER Mutant;
67 DT_POINTER ImageBaseAddress;
68 DT_POINTER Ldr;
69 DT_POINTER ProcessParameters;
70 DT_POINTER SubSystemData;
71 DT_POINTER ProcessHeap;
72 DT_POINTER FastPebLock;
73 DT_POINTER SparePtr1;
74 DT_POINTER SparePtr2;
75 ULONG EnvironmentUpdateCount;
76 DT_POINTER KernelCallbackTable;
77 ULONG SystemReserved[1];
78 struct _dummy {
79 ULONG ExecuteOptions : 2;
80 ULONG SpareBits : 30;
81 };
82 DT_POINTER FreeList;
83 ULONG TlsExpansionCounter;
84 DT_POINTER TlsBitmap;
85 ULONG TlsBitmapBits[2];
86 DT_POINTER ReadOnlySharedMemoryBase;
87 DT_POINTER ReadOnlySharedMemoryHeap;
88 DT_POINTER ReadOnlyStaticServerData;
89 DT_POINTER AnsiCodePageData;
90 DT_POINTER OemCodePageData;
91 DT_POINTER UnicodeCaseTableData;
92 ULONG NumberOfProcessors;
93 ULONG NtGlobalFlag;
94 LARGE_INTEGER CriticalSectionTimeout;
95 DT_POINTER HeapSegmentReserve;
96 DT_POINTER HeapSegmentCommit;
97 DT_POINTER HeapDeCommitTotalFreeThreshold;
98 DT_POINTER HeapDeCommitFreeBlockThreshold;
99 ULONG NumberOfHeaps;
100 ULONG MaximumNumberOfHeaps;
101 DT_POINTER ProcessHeaps;
102 DT_POINTER GdiSharedHandleTable;
103 DT_POINTER ProcessStarterHelper;
104 ULONG GdiDCAttributeList;
105 DT_POINTER LoaderLock;
106 ULONG OSMajorVersion;
107 ULONG OSMinorVersion;
108 USHORT OSBuildNumber;
109 USHORT OSCSDVersion;
110 ULONG OSPlatformId;
111 ULONG ImageSubsystem;
112 ULONG ImageSubsystemMajorVersion;
113 ULONG ImageSubsystemMinorVersion;
114 DT_POINTER ImageProcessAffinityMask;
115 DT_GDI_HANDLE_BUFFER GdiHandleBuffer;
116 DT_POINTER PostProcessInitRoutine;
117 DT_POINTER TlsExpansionBitmap;
118 ULONG TlsExpansionBitmapBits[32];
119 ULONG SessionId;
120 ULARGE_INTEGER AppCompatFlags;
121 ULARGE_INTEGER AppCompatFlagsUser;
122 DT_POINTER pShimData;
123 DT_POINTER AppCompatInfo;
124 DT_UNICODE_STRING CSDVersion;
125 DT_POINTER ActivationContextData;
126 DT_POINTER ProcessAssemblyStorageMap;
127 DT_POINTER SystemDefaultActivationContextData;
128 DT_POINTER SystemAssemblyStorageMap;
129 DT_POINTER MinimumStackCommit;
130 DT_POINTER FlsCallback;
131 DT_LIST_ENTRY FlsListHead;
132 DT_POINTER FlsBitmap;
133 ULONG FlsBitmapBits[FLS_MAXIMUM_AVAILABLE / (sizeof(ULONG) * 8)];
134 ULONG FlsHighIndex;
135};
136
137struct DT_PEB_LDR_DATA
138{
139 BYTE Reserved1[8];
140 DT_POINTER Reserved2[3];
141 DT_LIST_ENTRY InMemoryOrderModuleList;
142};
143
144struct DT_CURDIR
145{
146 DT_UNICODE_STRING DosPath;
147 DT_POINTER Handle;
148};
149
150struct DT_RTL_DRIVE_LETTER_CURDIR {
151 USHORT Flags;
152 USHORT Length;
153 ULONG TimeStamp;
154 STRING DosPath;
155};
156
157#define DT_RTL_MAX_DRIVE_LETTERS 32
158
159struct DT_RTL_USER_PROCESS_PARAMETERS
160{
161 ULONG MaximumLength;
162 ULONG Length;
163 ULONG Flags;
164 ULONG DebugFlags;
165 DT_POINTER ConsoleHandle;
166 ULONG ConsoleFlags;
167 DT_POINTER StandardInput;
168 DT_POINTER StandardOutput;
169 DT_POINTER StandardError;
170 DT_CURDIR CurrentDirectory;
171 DT_UNICODE_STRING DllPath;
172 DT_UNICODE_STRING ImagePathName;
173 DT_UNICODE_STRING CommandLine;
174 DT_POINTER Environment;
175 ULONG StartingX;
176 ULONG StartingY;
177 ULONG CountX;
178 ULONG CountY;
179 ULONG CountCharsX;
180 ULONG CountCharsY;
181 ULONG FillAttribute;
182 ULONG WindowFlags;
183 ULONG ShowWindowFlags;
184 DT_UNICODE_STRING WindowTitle;
185 DT_UNICODE_STRING DesktopInfo;
186 DT_UNICODE_STRING ShellInfo;
187 DT_UNICODE_STRING RuntimeData;
188 DT_RTL_DRIVE_LETTER_CURDIR CurrentDirectores[ DT_RTL_MAX_DRIVE_LETTERS ];
189};
190
191#endif // !FEATURE_PAL
192
193// TODO-ARM64-NYI Support for SOS on target with 64K pages
194//
195// This is probably as simple as redefining DT_OS_PAGE_SIZE to be a function
196// which returns the page size of the connected target
197#define DT_OS_PAGE_SIZE 4096
198#define DT_GC_PAGE_SIZE 0x1000
199
200#endif // !__PLATFORM_SPECIFIC_INCLUDED
201