Chameleon

Chameleon Commit Details

Date:2015-07-13 00:26:42 (4 years 10 days ago)
Author:ErmaC
Commit:2733
Parents: 2732
Message:Rename bootArgs struct from pre_Lion to Legacy.
Changes:
M/trunk/i386/libsaio/bootargs.h
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/bootstruct.c
M/trunk/i386/libsaio/bootstruct.h

File differences

trunk/i386/libsaio/bootstruct.c
3131
3232
3333
34
34
3535
3636
3737
38
38
3939
40
40
4141
4242
4343
......
4545
4646
4747
48
49
48
49
5050
51
51
5252
5353
5454
......
5757
5858
5959
60
6061
6162
6263
6364
6465
65
66
6667
67
68
69
70
6871
72
6973
7074
71
75
7276
7377
7478
......
9599
96100
97101
98
102
103
99104
100105
101106
102107
108
103109
104110
105111
......
109115
110116
111117
112
113
118
119
114120
115121
116122
......
123129
124130
125131
126
127
128
132
133
134
129135
130136
131137
......
143149
144150
145151
146
147
152
153
154
148155
149156
150157
......
156163
157164
158165
159
160
161
162
166
167
168
169
163170
164171
165172
......
201208
202209
203210
204
205211
206212
207213
......
213219
214220
215221
216
217
222
223
218224
219
220
221
222
225
226
227
228
223229
224
225
230
231
226232
227
228
233
234
229235
230
231
232
236
237
238
233239
234
240
235241
236
237
238
242
243
244
239245
#include "bootstruct.h"
#ifndef DEBUG_BOOTSTRUCT
#define DEBUG_BOOTSTRUCT 0
#define DEBUG_BOOTSTRUCT 0
#endif
#if DEBUG_BOOTSTRUCT
#define DBG(x...)printf(x)
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#define DBG(x...)msglog(x)
#endif
/*==========================================================================
* the kernel by the booter.
*/
boot_args*bootArgs;
boot_args_pre_lion*bootArgsPreLion;
boot_args*bootArgs= NULL;
boot_args_legacy*bootArgsLegacy= NULL;
PrivateBootInfo_t*bootInfo;
PrivateBootInfo_t*bootInfo= NULL;
Node*gMemoryMapNode;
static char platformName[64];
{
Node *node;
int nameLen;
static int init_done = 0;
if ( !init_done )
{
bootArgs = (boot_args *)malloc(sizeof(boot_args));
bootArgsPreLion = (boot_args_pre_lion *)malloc(sizeof(boot_args_pre_lion));
bootArgsLegacy = (boot_args_legacy *)malloc(sizeof(boot_args_legacy));
bootInfo = (PrivateBootInfo_t *)malloc(sizeof(PrivateBootInfo_t));
if (bootArgs == 0 || bootArgsPreLion == 0 || bootInfo == 0)
if (bootArgs == 0 || bootArgsLegacy == 0 || bootInfo == 0)
{
stop("Couldn't allocate boot info\n");
}
bzero(bootArgs, sizeof(boot_args));
bzero(bootArgsPreLion, sizeof(boot_args_pre_lion));
bzero(bootArgsLegacy, sizeof(boot_args_legacy));
bzero(bootInfo, sizeof(PrivateBootInfo_t));
// Get system memory map. Also update the size of the
DT__Initialize();
node = DT__FindNode("/", true);
if (node == 0) {
if (node == 0)
{
stop("Couldn't create root node");
}
getPlatformName(platformName, sizeof(platformName));
nameLen = strlen(platformName) + 1;
DT__AddProperty(node, "compatible", nameLen, platformName);
DT__AddProperty(node, "model", nameLen, platformName);
bootArgs->Version = kBootArgsVersion;
bootArgs->Revision = kBootArgsRevision;
bootArgsPreLion->Version = kBootArgsPreLionVersion;
bootArgsPreLion->Revision = kBootArgsPreLionRevision;
bootArgsLegacy->Version = kBootArgsLegacyVersion;
bootArgsLegacy->Revision = kBootArgsLegacyRevision;
init_done = 1;
}
if ( TIGER || LEOPARD || SNOW_LEOPARD )
{
// for 10.4 10.5 10.6
void *oldAddr = bootArgsPreLion;
bootArgsPreLion = (boot_args_pre_lion *)AllocateKernelMemory(sizeof(boot_args_pre_lion));
bcopy(oldAddr, bootArgsPreLion, sizeof(boot_args_pre_lion));
void *oldAddr = bootArgsLegacy;
bootArgsLegacy = (boot_args_legacy *)AllocateKernelMemory(sizeof(boot_args_legacy));
bcopy(oldAddr, bootArgsLegacy, sizeof(boot_args_legacy));
}
else
{
uint32_t size;
void *addr;
int i;
EfiMemoryRange *memoryMap;
MemoryRange *range;
EfiMemoryRange *memoryMap= NULL;
MemoryRange *range= NULL;
int memoryMapCount = bootInfo->memoryMapCount;
if (memoryMapCount == 0)
// convert memory map to boot_args memory map
memoryMap = (EfiMemoryRange *)AllocateKernelMemory(sizeof(EfiMemoryRange) * memoryMapCount);
bootArgs->MemoryMap= (uint32_t)memoryMap;
bootArgs->MemoryMapSize= sizeof(EfiMemoryRange) * memoryMapCount;
bootArgs->MemoryMapDescriptorSize= sizeof(EfiMemoryRange);
bootArgs->MemoryMapDescriptorVersion= 0;
bootArgs->MemoryMap= (uint32_t)memoryMap;
bootArgs->MemoryMapSize= sizeof(EfiMemoryRange) * memoryMapCount;
bootArgs->MemoryMapDescriptorSize= sizeof(EfiMemoryRange);
bootArgs->MemoryMapDescriptorVersion= 0;
for (i = 0; i < memoryMapCount; i++, memoryMap++)
{
// Flatten device tree
DT__FlattenDeviceTree(0, &size);
addr = (void *)AllocateKernelMemory(size);
if (addr == 0)
{
stop("Couldn't allocate device tree\n");
// Copy BootArgs values to older structure
memcpy(&bootArgsPreLion->CommandLine, &bootArgs->CommandLine, BOOT_LINE_LENGTH);
memcpy(&bootArgsPreLion->Video, &bootArgs->Video, sizeof(Boot_Video));
memcpy(&bootArgsLegacy->CommandLine, &bootArgs->CommandLine, BOOT_LINE_LENGTH);
memcpy(&bootArgsLegacy->Video, &bootArgs->Video, sizeof(Boot_Video));
bootArgsPreLion->MemoryMap = bootArgs->MemoryMap;
bootArgsPreLion->MemoryMapSize = bootArgs->MemoryMapSize;
bootArgsPreLion->MemoryMapDescriptorSize = bootArgs->MemoryMapDescriptorSize;
bootArgsPreLion->MemoryMapDescriptorVersion = bootArgs->MemoryMapDescriptorVersion;
bootArgsLegacy->MemoryMap = bootArgs->MemoryMap;
bootArgsLegacy->MemoryMapSize = bootArgs->MemoryMapSize;
bootArgsLegacy->MemoryMapDescriptorSize = bootArgs->MemoryMapDescriptorSize;
bootArgsLegacy->MemoryMapDescriptorVersion = bootArgs->MemoryMapDescriptorVersion;
bootArgsPreLion->deviceTreeP = bootArgs->deviceTreeP;
bootArgsPreLion->deviceTreeLength = bootArgs->deviceTreeLength;
bootArgsLegacy->deviceTreeP = bootArgs->deviceTreeP;
bootArgsLegacy->deviceTreeLength = bootArgs->deviceTreeLength;
bootArgsPreLion->kaddr = bootArgs->kaddr;
bootArgsPreLion->ksize = bootArgs->ksize;
bootArgsLegacy->kaddr = bootArgs->kaddr;
bootArgsLegacy->ksize = bootArgs->ksize;
bootArgsPreLion->efiRuntimeServicesPageStart = bootArgs->efiRuntimeServicesPageStart;
bootArgsPreLion->efiRuntimeServicesPageCount = bootArgs->efiRuntimeServicesPageCount;
bootArgsPreLion->efiSystemTable = bootArgs->efiSystemTable;
bootArgsLegacy->efiRuntimeServicesPageStart = bootArgs->efiRuntimeServicesPageStart;
bootArgsLegacy->efiRuntimeServicesPageCount = bootArgs->efiRuntimeServicesPageCount;
bootArgsLegacy->efiSystemTable = bootArgs->efiSystemTable;
bootArgsPreLion->efiMode = bootArgs->efiMode;
bootArgsLegacy->efiMode = bootArgs->efiMode;
bootArgsPreLion->performanceDataStart = bootArgs->performanceDataStart;
bootArgsPreLion->performanceDataSize = bootArgs->performanceDataSize;
bootArgsPreLion->efiRuntimeServicesVirtualPageStart = bootArgs->efiRuntimeServicesVirtualPageStart;
bootArgsLegacy->performanceDataStart = bootArgs->performanceDataStart;
bootArgsLegacy->performanceDataSize = bootArgs->performanceDataSize;
bootArgsLegacy->efiRuntimeServicesVirtualPageStart = bootArgs->efiRuntimeServicesVirtualPageStart;
}
trunk/i386/libsaio/bootstruct.h
3333
3434
3535
36
37
36
37
3838
3939
4040
/*
* Kernel boot args global also used by booter for its own data.
*/
extern boot_args *bootArgs;
extern boot_args_pre_lion *bootArgsPreLion;
extern boot_args*bootArgs;
extern boot_args_legacy*bootArgsLegacy;
extern Node *gMemoryMapNode;
#define VGA_TEXT_MODE 0
trunk/i386/libsaio/bootargs.h
116116
117117
118118
119
120
119
120
121121
122122
123123
......
187187
188188
189189
190
190
191191
192192
193193
......
220220
221221
222222
223
223
224224
225225
#define kBootArgsVersion2
// Snow Leopard and older
#define kBootArgsPreLionRevision6
#define kBootArgsPreLionVersion1
#define kBootArgsLegacyVersion1
#define kBootArgsLegacyRevision6
/* Snapshot constants of previous revisions that are supported */
#define kBootArgsVersion11
} boot_args;
typedef struct boot_args_pre_lion
typedef struct boot_args_legacy
{
uint16_t Revision;/* Revision of boot_args structure */
uint16_t Version;/* Version of boot_args structure */
uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */
uint32_t __reserved3[2];
} boot_args_pre_lion;
} boot_args_legacy;
#endif /* _PEXPERT_I386_BOOT_H */
trunk/i386/boot2/boot.c
236236
237237
238238
239
239
240240
241
241
242242
243243
244244
if ( TIGER || LEOPARD || SNOW_LEOPARD )
{
// Notify modules that the kernel is about to be started
execute_hook("Kernel Start", (void *)kernelEntry, (void *)bootArgsPreLion, NULL, NULL);
execute_hook("Kernel Start", (void *)kernelEntry, (void *)bootArgsLegacy, NULL, NULL);
startprog( kernelEntry, bootArgsPreLion );
startprog( kernelEntry, bootArgsLegacy );
}
else
{

Archive Download the corresponding diff file

Revision: 2733