Chameleon

Chameleon Commit Details

Date:2014-10-20 21:20:51 (9 years 6 months ago)
Author:ErmaC
Commit:2412
Parents: 2411
Message:Typo.
Changes:
M/trunk/i386/boot2/picopng.c
M/trunk/i386/libsaio/console.c
M/trunk/i386/boot2/graphics.c
M/trunk/i386/boot0/boot0.s
M/trunk/i386/libsaio/bootstruct.c
M/trunk/i386/boot2/graphics.h
M/trunk/i386/boot2/modules.c
M/trunk/CHANGES
M/trunk/i386/libsaio/bootstruct.h
M/trunk/i386/boot1/boot1h.s
M/trunk/i386/libsaio/device_tree.c
M/trunk/i386/libsaio/load.c
M/trunk/i386/boot2/drivers.c
M/trunk/i386/libsaio/acpi_patcher.c
M/trunk/i386/libsaio/saio_types.h
M/trunk/i386/libsaio/bootargs.h
M/trunk/i386/libsaio/cpu.c
M/trunk/i386/boot2/modules_support.s
M/trunk/i386/libsaio/md5c.c
M/trunk/i386/libsaio/fake_efi.c
M/trunk/i386/boot2/appleClut8.h
M/trunk/i386/libsaio/disk.c
M/trunk/i386/libsaio/device_inject.c
M/trunk/i386/libsaio/smbios.c
M/trunk/i386/libsaio/saio_internal.h
M/trunk/i386/libsa/zalloc.c
M/trunk/i386/boot1/boot1hp.s
M/trunk/i386/boot2/options.c
M/trunk/i386/libsaio/smbios_decode.c

File differences

trunk/i386/libsaio/console.c
247247
248248
249249
250
251
252
253
250254
251
252
255
256
253257
254
255
256
258
259
260
261
257262
258
259
260
263
264
265
266
261267
262
263
264
265
266
267
268268
269269
270270
vprf(fmt, ap);
}
// Kabyl: BooterLog
struct putc_info pi;
if (!msgbuf)
{
// Kabyl: BooterLog
struct putc_info pi;
return 0;
}
if (!msgbuf) {
return 0;
}
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
{
return 0;
}
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) {
return 0;
}
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
}
va_end(ap);
return(0);
}
trunk/i386/libsaio/bootstruct.c
4444
4545
4646
47
47
4848
4949
50
50
5151
5252
5353
......
5656
5757
5858
59
59
6060
6161
6262
......
6464
6565
6666
67
67
6868
6969
7070
71
71
7272
7373
7474
......
7676
7777
7878
79
79
8080
8181
8282
8383
8484
85
86
87
85
86
87
8888
89
90
91
92
89
90
91
92
9393
94
94
9595
9696
9797
......
100100
101101
102102
103
103
104104
105
105
106106
107107
108
108
109109
110110
111
111
112112
113113
114114
115115
116
117116
118117
119118
......
132131
133132
134133
135
136
134
135
136
137137
138138
139139
......
141141
142142
143143
144
145
144
145
146
146147
147148
148149
149
150
150151
151152
152
153
154
155
156
153
154
155
156
157
158
157159
158160
159161
160
162
163
164
161165
162166
163167
168
164169
165170
166171
172
167173
168174
169175
176
170177
178
171179
172180
173181
174182
175
176
177
178
183
184
185
186
187
179188
180
189
181190
182191
183
192
184193
185194
186
195
187196
188197
189198
190
199
200
201
191202
192203
193
204
194205
195206
196207
197208
198209
199
210
200211
201212
202
213
203214
204215
205216
......
207218
208219
209220
210
221
211222
212223
213
224
214225
215226
216227
217
228
218229
219
230
220231
221232
222233
* the kernel by the booter.
*/
boot_args*bootArgs;
boot_args*bootArgs;
boot_args_pre_lion*bootArgsPreLion;
PrivateBootInfo_t*bootInfo;
Node*gMemoryMapNode;
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));
bootInfo = (PrivateBootInfo_t *)malloc(sizeof(PrivateBootInfo_t));
if (bootArgs == 0 || bootArgsPreLion == 0 || bootInfo == 0)
stop("Couldn't allocate boot info\n");
bzero(bootArgs, sizeof(boot_args));
bzero(bootArgsPreLion, sizeof(boot_args_pre_lion));
bzero(bootInfo, sizeof(PrivateBootInfo_t));
// Get system memory map. Also update the size of the
// conventional/extended memory for backwards compatibility.
getMemoryMap( bootInfo->memoryMap, kMemoryMapCountMax,
(unsigned long *) &bootInfo->convmem,
(unsigned long *) &bootInfo->extmem );
if ( bootInfo->memoryMapCount == 0 )
{
// BIOS did not provide a memory map, systems with
// discontiguous memory or unusual memory hole locations
// may have problems.
bootInfo->convmem = getConventionalMemorySize();
bootInfo->extmem = getExtendedMemorySize();
bootInfo->convmem= getConventionalMemorySize();
bootInfo->extmem= getExtendedMemorySize();
}
bootInfo->configEnd = bootInfo->config;
bootArgs->Video.v_display = VGA_TEXT_MODE;
bootInfo->configEnd= bootInfo->config;
bootArgs->Video.v_display= VGA_TEXT_MODE;
DT__Initialize();
node = DT__FindNode("/", true);
if (node == 0) {
stop("Couldn't create root node");
nameLen = strlen(platformName) + 1;
DT__AddProperty(node, "compatible", nameLen, platformName);
DT__AddProperty(node, "model", nameLen, platformName);
gMemoryMapNode = DT__FindNode("/chosen/memory-map", true);
bootArgs->Version = kBootArgsVersion;
bootArgs->Revision = kBootArgsRevision;
bootArgsPreLion->Version = kBootArgsPreLionVersion;
bootArgsPreLion->Revision = kBootArgsPreLionRevision;
init_done = 1;
}
}
/* Copy boot args after kernel and record address. */
void
}
}
void
finalizeBootStruct(void)
//==============================================================================
void finalizeBootStruct(void)
{
uint32_t size;
void *addr;
EfiMemoryRange *memoryMap;
MemoryRange *range;
int memoryMapCount = bootInfo->memoryMapCount;
if (memoryMapCount == 0) {
if (memoryMapCount == 0)
{
// XXX could make a two-part map here
stop("Unable to convert memory map into proper format\n");
}
// 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++)
{
range = &bootInfo->memoryMap[i];
switch(range->type) {
switch(range->type)
{
case kMemoryRangeACPI:
memoryMap->Type = kEfiACPIReclaimMemory;
break;
case kMemoryRangeNVS:
memoryMap->Type = kEfiACPIMemoryNVS;
break;
case kMemoryRangeUsable:
memoryMap->Type = kEfiConventionalMemory;
break;
case kMemoryRangeReserved:
default:
memoryMap->Type = kEfiReservedMemoryType;
break;
}
memoryMap->PhysicalStart = range->base;
memoryMap->VirtualStart = range->base;
memoryMap->NumberOfPages = range->length >> I386_PGSHIFT;
memoryMap->Attribute = 0;
memoryMap->PhysicalStart= range->base;
memoryMap->VirtualStart= range->base;
memoryMap->NumberOfPages= range->length >> I386_PGSHIFT;
memoryMap->Attribute= 0;
}
// copy bootFile into device tree
// XXX
// add PCI info somehow into device tree
// XXX
// Flatten device tree
DT__FlattenDeviceTree(0, &size);
addr = (void *)AllocateKernelMemory(size);
if (addr == 0) {
if (addr == 0)
{
stop("Couldn't allocate device tree\n");
}
DT__FlattenDeviceTree((void **)&addr, &size);
bootArgs->deviceTreeP = (uint32_t)addr;
bootArgs->deviceTreeLength = size;
// Copy BootArgs values to older structure
memcpy(&bootArgsPreLion->CommandLine, &bootArgs->CommandLine, BOOT_LINE_LENGTH);
memcpy(&bootArgsPreLion->Video, &bootArgs->Video, sizeof(Boot_Video));
bootArgsPreLion->MemoryMap = bootArgs->MemoryMap;
bootArgsPreLion->MemoryMapSize = bootArgs->MemoryMapSize;
bootArgsPreLion->MemoryMapDescriptorSize = bootArgs->MemoryMapDescriptorSize;
bootArgsPreLion->deviceTreeP = bootArgs->deviceTreeP;
bootArgsPreLion->deviceTreeLength = bootArgs->deviceTreeLength;
bootArgsPreLion->kaddr = bootArgs->kaddr;
bootArgsPreLion->ksize = bootArgs->ksize;
bootArgsPreLion->efiRuntimeServicesPageStart = bootArgs->efiRuntimeServicesPageStart;
bootArgsPreLion->efiRuntimeServicesPageCount = bootArgs->efiRuntimeServicesPageCount;
bootArgsPreLion->efiSystemTable = bootArgs->efiSystemTable;
bootArgsPreLion->efiMode = bootArgs->efiMode;
bootArgsPreLion->performanceDataStart = bootArgs->performanceDataStart;
bootArgsPreLion->performanceDataSize = bootArgs->performanceDataSize;
bootArgsPreLion->efiRuntimeServicesVirtualPageStart = bootArgs->efiRuntimeServicesVirtualPageStart;
trunk/i386/libsaio/bootstruct.h
4747
4848
4949
50
50
5151
5252
5353
......
7474
7575
7676
77
78
79
80
77
78
79
80
81
82
8183
8284
8385
......
9092
9193
9294
93
94
95
96
97
95
96
97
98
99
100
98101
99102
100103
/*
* Maximum number of boot drivers that can be loaded.
*/
#define NDRIVERS 500
#define NDRIVERS500
#define CONFIG_SIZE (40 * 4096)
unsigned char BIOSPresent;
} PCI_bus_info_t;
typedef struct {
unsigned long address; // address where driver was loaded
unsigned long size; // number of bytes
unsigned long type; // driver type
typedef struct
{
unsigned long address;// address where driver was loaded
unsigned long size;// number of bytes
unsigned long type;// driver type
} driver_config_t;
/*
/*
* ACPI defined memory range types.
*/
enum {
kMemoryRangeUsable = 1, // RAM usable by the OS.
kMemoryRangeReserved = 2, // Reserved. (Do not use)
kMemoryRangeACPI = 3, // ACPI tables. Can be reclaimed.
kMemoryRangeNVS = 4, // ACPI NVS memory. (Do not use)
enum
{
kMemoryRangeUsable= 1,// RAM usable by the OS.
kMemoryRangeReserved= 2,// Reserved. (Do not use)
kMemoryRangeACPI= 3,// ACPI tables. Can be reclaimed.
kMemoryRangeNVS= 4,// ACPI NVS memory. (Do not use)
/* Undefined types should be treated as kMemoryRangeReserved */
};
trunk/i386/libsaio/device_tree.c
403403
404404
405405
406
406
407407
408408
409409
......
411411
412412
413413
414
414
415415
416416
417417
DT__GetProperty(Node *node, const char *name)
{
Property *prop;
for (prop = node->properties; prop; prop = prop->next)
{
if (strcmp(prop->name, name) == 0)
return prop;
}
}
return NULL;
}
trunk/i386/libsaio/acpi_patcher.c
10351035
10361036
10371037
1038
10381039
10391040
10401041
......
11131114
11141115
11151116
1117
11161118
11171119
11181120
}
DBG("TABLE %c%c%c%c@%x \n", table[0],table[1],table[2],table[3],xsdt_entries[i]);
continue;
}
if (tableSign(table, "FACP")) {
DBG("\n");
// Correct the checksum of RSDP
DBG("RSDP: Original checksum %d, ", rsdp_mod->Checksum);
rsdp_mod->Checksum=0;
rsdp_mod->Checksum=256-checksum8(rsdp_mod,20);
trunk/i386/libsaio/bootargs.h
109109
110110
111111
112
113
112
113
114114
115115
116116
/* Snapshot constants of previous revisions that are supported */
#define kBootArgsEfiMode3232
#define kBootArgsEfiMode6464
#define kBootArgsEfiMode32 32
#define kBootArgsEfiMode64 64
typedef struct boot_args {
uint16_t Revision;/* Revision of boot_args structure */
trunk/i386/libsaio/device_inject.c
2323
2424
2525
26
27
28
29
30
26
27
28
29
30
3131
3232
3333
#define DBG(x...)msglog(x)
#endif
uint32_t devices_number = 1;
uint32_t builtin_set = 0;
DevPropString *string = 0;
uint8_t *stringdata = 0;
uint32_t stringlength = 0;
uint32_t devices_number= 1;
uint32_t builtin_set= 0;
DevPropString *string= 0;
uint8_t *stringdata= 0;
uint32_t stringlength= 0;
char *efi_inject_get_devprop_string(uint32_t *len)
{
trunk/i386/libsaio/load.c
1818
1919
2020
21
22
23
2421
25
22
2623
24
25
2726
2827
2928
......
5958
6059
6160
62
63
61
62
63
6464
6565
66
66
67
6768
6869
6970
7071
7172
7273
73
74
74
75
76
77
7578
7679
7780
......
8184
8285
8386
84
87
88
8589
8690
8791
8892
8993
9094
91
95
96
9297
9398
9499
......
113118
114119
115120
116
121
117122
118123
119124
......
121126
122127
123128
124
129
125130
126
127
131
132
128133
129134
130135
131136
132
137
138
133139
134140
135141
......
139145
140146
141147
142
148
149
143150
144151
145152
146
153
154
147155
148156
149157
......
167175
168176
169177
170
178
179
171180
172181
173182
......
194203
195204
196205
197
206
207
198208
199209
200210
......
207217
208218
209219
210
220
221
211222
212223
213
214
215
224
225
226
227
228
216229
217230
218231
219232
220233
221234
222
235
223236
224237
225238
......
234247
235248
236249
237
250
251
238252
239253
240254
......
267281
268282
269283
270
284
285
271286
272287
273288
274289
275290
276
277
278
279
291
292
293
294
280295
281
282
283
296
297
298
284299
285300
286301
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* load.c - Functions for decoding a Mach-o Kernel.
*
* Copyright (c) 1998-2003 Apple Computer, Inc.
* load.c - Functions for decoding a Mach-o Kernel.
*
* Copyright (c) 1998-2003 Apple Computer, Inc.
*
*/
#include <mach-o/fat.h>
cpu_type_t fapcputype;
uint32_t fapoffset;
uint32_t fapsize;
if (fhp->magic == FAT_MAGIC)/* 0xcafebabe */{
if (fhp->magic == FAT_MAGIC)/* 0xcafebabe */
{
nfat = fhp->nfat_arch;
swapped = 0;
} else if (fhp->magic == FAT_CIGAM)/* 0xbebafeca */{
} else if (fhp->magic == FAT_CIGAM)/* 0xbebafeca */
{
nfat = OSSwapInt32(fhp->nfat_arch);
swapped = 1;
} else {
return -1;
}
for (; nfat > 0; nfat--, fap++) {
if (swapped) {
for (; nfat > 0; nfat--, fap++)
{
if (swapped)
{
fapcputype = OSSwapInt32(fap->cputype);
fapoffset = OSSwapInt32(fap->offset);
fapsize = OSSwapInt32(fap->size);
fapsize = fap->size;
}
if (fapcputype == archCpuType) {
if (fapcputype == archCpuType)
{
*binary = (void *) ((unsigned long)*binary + fapoffset);
size = fapsize;
break;
}
}
if (length != 0) {
if (length != 0)
{
*length = size;
}
mH = (struct mach_header *)(gBinaryAddress);
/*#if DEBUG
/*#if DEBUG
DBG("magic: 0x%x\n", (unsigned)mH->magic);
DBG("cputype: 0x%x\n", (unsigned)mH->cputype);
DBG("cpusubtype: 0x%x\n", (unsigned)mH->cpusubtype);
DBG("ncmds: 0x%x\n", (unsigned)mH->ncmds);
DBG("sizeofcmds: 0x%x\n", (unsigned)mH->sizeofcmds);
DBG("flags: 0x%x\n", (unsigned)mH->flags);
DBG("archCpuType: 0x%x\n", archCpuType);
DBG("archCpuType: 0x%x\n", archCpuType);
//getchar();
#endif*/
#endif*/
switch (archCpuType)
{
case CPU_TYPE_I386:
if (mH->magic != MH_MAGIC) {
if (mH->magic != MH_MAGIC)
{
error("Mach-O file has bad magic number\n");
return -1;
}
case CPU_TYPE_X86_64:
/*
if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC) {
if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC)
{
return -1;
}
*/
if (mH->magic != MH_MAGIC_64) {
if (mH->magic != MH_MAGIC_64)
{
error("Mach-O file has bad magic number\n");
return -1;
}
unsigned int load_addr;
unsigned int load_size;
switch (cmd) {
switch (cmd)
{
case LC_SEGMENT_64:
case LC_SEGMENT:
ret = DecodeSegment(cmdBase, &load_addr, &load_size);
}
if (ret != 0) {
if (ret != 0)
{
return -1;
}
cmdBase = cmdstart;
for (cnt = 0; cnt < ncmds; cnt++) {
for (cnt = 0; cnt < ncmds; cnt++)
{
cmd = ((long *)cmdBase)[0];
cmdsize = ((long *)cmdBase)[1];
if (cmd == LC_SYMTAB) {
if (DecodeSymbolTable(cmdBase) != 0) {
if (cmd == LC_SYMTAB)
{
if (DecodeSymbolTable(cmdBase) != 0)
{
return -1;
}
}
cmdBase += cmdsize;
}
return ret;
}
long vmsize, filesize;
unsigned long vmaddr, fileaddr;
if (((long *)cmdBase)[0] == LC_SEGMENT_64) {
if (((long *)cmdBase)[0] == LC_SEGMENT_64)
{
struct segment_command_64 *segCmd;
segCmd = (struct segment_command_64 *)cmdBase;
vmaddr = (segCmd->vmaddr & 0x3fffffff);
#endif
}
if (vmsize == 0 || filesize == 0) {
if (vmsize == 0 || filesize == 0)
{
*load_addr = ~0;
*load_size = 0;
return 0;
}
if (! ((vmaddr >= KERNEL_ADDR && (vmaddr + vmsize) <= (KERNEL_ADDR + KERNEL_LEN)) ||
(vmaddr >= HIB_ADDR && (vmaddr + vmsize) <= (HIB_ADDR + HIB_LEN)))) {
stop("Kernel overflows available space");
}
if (! ((vmaddr >= KERNEL_ADDR && (vmaddr + vmsize) <= (KERNEL_ADDR + KERNEL_LEN)) ||
(vmaddr >= HIB_ADDR && (vmaddr + vmsize) <= (HIB_ADDR + HIB_LEN)))) {
stop("Kernel overflows available space");
}
if (vmsize && ((strcmp(segname, "__PRELINK_INFO") == 0) || (strcmp(segname, "__PRELINK") == 0))) {
gHaveKernelCache = true;
}
if (vmsize && ((strcmp(segname, "__PRELINK_INFO") == 0) || (strcmp(segname, "__PRELINK") == 0))) {
gHaveKernelCache = true;
}
// Copy from file load area.
if (vmsize>0 && filesize > 0) {
trunk/i386/libsaio/cpu.c
106106
107107
108108
109
109
110110
111111
112112
......
176176
177177
178178
179
179
180180
181181
182182
......
210210
211211
212212
213
213
214214
215215
216216
......
244244
245245
246246
247
247248
248249
249250
251
250252
251253
252254
......
321323
322324
323325
324
326
325327
326328
327329
328330
329331
330
332
331333
332334
333335
......
352354
353355
354356
355
357
356358
357359
358360
unsigned long pollCount;
uint64_t retval = 0;
int i;
/* Time how many TSC ticks elapse in 30 msec using the 8254 PIT
* counter 2. We run this loop 3 times to make sure the cache
* is hot and we take the minimum delta from all of the runs.
unsigned long pollCount;
uint64_t retval = 0;
int i;
/* Time how many APERF ticks elapse in 30 msec using the 8254 PIT
* counter 2. We run this loop 3 times to make sure the cache
* is hot and we take the minimum delta from all of the runs.
/* mperfDelta is now the least number of MPERF ticks the processor made in
* a timespan of 0.03 s (e.g. 30 milliseconds)
*/
if (aperfDelta > (1ULL<<32)) {
retval = 0;
} else {
/* get cpuid values */
do_cpuid(0x00000000, p->CPU.CPUID[CPUID_0]);
do_cpuid(0x00000001, p->CPU.CPUID[CPUID_1]);
do_cpuid(0x00000002, p->CPU.CPUID[CPUID_2]);
do_cpuid(0x00000003, p->CPU.CPUID[CPUID_3]);
do_cpuid2(0x00000004, 0, p->CPU.CPUID[CPUID_4]);
do_cpuid(0x80000000, p->CPU.CPUID[CPUID_80]);
if (p->CPU.CPUID[CPUID_0][0] >= 0x5) {
do_cpuid(5, p->CPU.CPUID[CPUID_5]);
p->CPU.NoCores= bitfield(p->CPU.CPUID[CPUID_4][0], 31, 26) + 1;
}
/* get brand string (if supported) */
/* get BrandString (if supported) */
/* Copyright: from Apple's XNU cpuid.c */
if (p->CPU.CPUID[CPUID_80][0] > 0x80000004) {
uint32_treg[4];
charstr[128], *s;
/*
* The brand string 48 bytes (max), guaranteed to
* The BrandString 48 bytes (max), guaranteed to
* be NULL terminated.
*/
do_cpuid(0x80000002, reg);
p->CPU.BrandString[0] = '\0';
}
}
/* setup features */
if ((bit(23) & p->CPU.CPUID[CPUID_1][3]) != 0) {
p->CPU.Features |= CPU_FEATURE_MMX;
trunk/i386/libsaio/disk.c
681681
682682
683683
684
684
685685
686686
687
687
688688
689689
690
690
691691
692692
693
693
694694
695695
696
696
697697
698698
699699
// GUID's in LE form:
// HFS+ partition - 48465300-0000-11AA-AA11-00306543ECAC
EFI_GUID const GPT_HFS_GUID = { 0x48465300, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } };
EFI_GUID const GPT_HFS_GUID= { 0x48465300, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } }; // 0xAF00 "Apple HFS/HFS+"
// turbo - Apple Boot Partition - 426F6F74-0000-11AA-AA11-00306543ECAC
EFI_GUID const GPT_BOOT_GUID = { 0x426F6F74, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } };
EFI_GUID const GPT_BOOT_GUID= { 0x426F6F74, 0x0000, 0x11AA, { 0xAA, 0x11, 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC } }; // 0xAB00 "Apple boot"
// turbo - or an EFI System Partition - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
EFI_GUID const GPT_EFISYS_GUID = { 0xC12A7328, 0xF81F, 0x11D2, { 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } };
EFI_GUID const GPT_EFISYS_GUID= { 0xC12A7328, 0xF81F, 0x11D2, { 0xBA, 0x4B, 0x00, 0xA0, 0xC9, 0x3E, 0xC9, 0x3B } }; // 0xEF00 "EFI System"
// zef - Basic Data Partition - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 for foreign OS support
EFI_GUID const GPT_BASICDATA_GUID = { 0xEBD0A0A2, 0xB9E5, 0x4433, { 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7 } };
EFI_GUID const GPT_BASICDATA_GUID= { 0xEBD0A0A2, 0xB9E5, 0x4433, { 0x87, 0xC0, 0x68, 0xB6, 0xB7, 0x26, 0x99, 0xC7 } }; // 0x0100 "Microsoft basic data"
// Microsoft Reserved Partition - E3C9E316-0B5C-4DB8-817DF92DF00215AE
EFI_GUID const GPT_BASICDATA2_GUID = { 0xE3C9E316, 0x0B5C, 0x4DB8, { 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE } };
EFI_GUID const GPT_BASICDATA2_GUID= { 0xE3C9E316, 0x0B5C, 0x4DB8, { 0x81, 0x7D, 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE } }; // 0x0C01 "Microsoft reserved"
BVRef newGPTBVRef( int biosdev, int partno, unsigned int blkoff,
trunk/i386/libsaio/smbios.c
267267
268268
269269
270
270
271271
272272
273273
kSMBBaseBoardSerialNumberKey, NULL, &defaultBaseBoard.serialNumber }, // SMboardserial - C02140302D5DMT31M
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, assetTag),
kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag }, // SMboardassetag - Base Board Asset Tag#
kSMBBaseBoardAssetTagKey, NULL, &defaultBaseBoard.assetTag }, // SMboardassettag - Base Board Asset Tag#
{kSMBTypeBaseBoard,kSMBString,getFieldOffset(SMBBaseBoard, locationInChassis),
kSMBBaseBoardLocationInChassisKey, NULL, &defaultBaseBoard.locationInChassis }, // SMboardlocation - Part Component
trunk/i386/libsaio/smbios_decode.c
401401
402402
403403
404
405
406
407
404408
405409
406410
......
417421
418422
419423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
420440
421441
422442
......
431451
432452
433453
454
455
456
434457
435458
459
460
461
462
463
464
465
466
436467
437468
438469
}
//-------------------------------------------------------------------------------------------------------------------------
// Memory Controller Information (Type 5)
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// Memory Module Information (Type 6)
//-------------------------------------------------------------------------------------------------------------------------
//void decodeMemoryModule(SMBStructHeader *structHeader)
//}
//-------------------------------------------------------------------------------------------------------------------------
// Cache Information (Type 7)
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// Port Connector Information (Type 8)
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// System Slot Information (Type 9)
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// On Board Device Information (Type 10)
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// OEM Strings (Type 11)
//-------------------------------------------------------------------------------------------------------------------------
void decodeSMBOEMStrings(SMBStructHeader *structHeader)
}
DBG("\n");
}
//-------------------------------------------------------------------------------------------------------------------------
// System Configuration Options (Type 12)
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// BIOS Language Information (Type 13)
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// Physical Memory Array (Type 16)
//-------------------------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------------------------
// MemoryDevice (Type 17)
//-------------------------------------------------------------------------------------------------------------------------
void decodeMemoryDevice(SMBStructHeader *structHeader)
trunk/i386/libsaio/saio_types.h
4141
4242
4343
44
44
45
4546
4647
4748
4849
4950
50
51
52
53
5154
5255
5356
......
7780
7881
7982
80
81
83
84
85
86
8287
8388
8489
......
100105
101106
102107
103
108
109
104110
105111
106112
......
120126
121127
122128
123
129
130
131
124132
125133
126134
......
129137
130138
131139
132
140
141
142
133143
134144
135145
......
205215
206216
207217
208
218
219
209220
210221
211222
......
216227
217228
218229
219
230
231
220232
221233
222234
......
225237
226238
227239
228
240
241
229242
230243
231244
......
248261
249262
250263
251
264
265
252266
253267
254268
......
277291
278292
279293
280
294
295
281296
282297
283298
typedef unsigned long entry_t;
typedef struct {
typedef struct
{
unsigned int sectors:8;
unsigned int heads:8;
unsigned int cylinders:16;
} compact_diskinfo_t;
struct driveParameters {
struct driveParameters
{
int cylinders;
int sectors;
int heads;
/*
* BIOS drive information.
*/
struct boot_drive_info {
struct drive_params {
struct boot_drive_info
{
struct drive_params
{
unsigned short buf_size;
unsigned short info_flags;
unsigned long phys_cyls;
unsigned char checksum;
} params;
struct drive_dpte {
struct drive_dpte
{
unsigned short io_port_base;
unsigned short control_port_base;
unsigned char head_flags;
} __attribute__((packed));
typedef struct boot_drive_info boot_drive_info_t;
struct driveInfo {
struct driveInfo
{
boot_drive_info_t di;
int uses_ebios;
int valid;
};
typedef struct FinderInfo {
typedef struct FinderInfo
{
unsigned char data[16];
} FinderInfo;
};
enum {
enum
{
kBVFlagPrimary= 0x01,
kBVFlagNativeBoot= 0x02,
kBVFlagForeignBoot= 0x04,
kBVFlagInstallVolume= 0x80
};
enum {
enum
{
kBIOSDevTypeFloppy= 0x00,
kBIOSDevTypeHardDrive= 0x80,
kBIOSDevTypeNetwork= 0xE0,
kBIOSDevMask= 0xFF
};
enum {
enum
{
//KPartitionTypeFAT12= 0x01, // FAT12
kPartitionTypeHPFS= 0x07, // Mac OS X
kPartitionTypeFAT16= 0x06, // FAT16
// KernBootStruct device types.
enum {
enum
{
DEV_SD = 0,
DEV_HD = 1,
DEV_FD = 2,
kBlockDeviceType = kBIOSDevTypeHardDrive
}; //gBootFileType_t;
enum {
enum
{
kCursorTypeHidden = 0x0100,
kCursorTypeUnderline = 0x0607
};
trunk/i386/libsaio/md5c.c
5050
5151
5252
53
54
5553
5654
5755
......
151149
152150
153151
154
152
153
155154
156155
157156
......
161160
162161
163162
164
163
164
165165
166166
167167
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*
* $Id: md5c.c,v 1.1 2005/06/24 22:47:12 curtisg Exp $
*
* This code is the same as the code published by RSA Inc. It has been
* edited for clarity and style only.
*/
index = (unsigned int)((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3)) {
if ((context->count[0] += ((u_int32_t)inputLen << 3)) < ((u_int32_t)inputLen << 3))
{
context->count[1]++;
}
/* Transform as many times as possible. */
if (inputLen >= partLen) {
if (inputLen >= partLen)
{
memcpy((void *)&context->buffer[index], (const void *)input,
partLen);
MD5Transform (context->state, context->buffer);
trunk/i386/libsaio/fake_efi.c
9393
9494
9595
96
97
9698
9799
98100
......
146148
147149
148150
151
152
149153
150154
151155
EFI_SYSTEM_TABLE_64 *gST64 = NULL;
Node *gEfiConfigurationTableNode = NULL;
// ==========================================================================
extern EFI_STATUS addConfigurationTable(EFI_GUID const *pGuid, void *table, char const *alias)
{
EFI_UINTN i = 0;
return EFI_UNSUPPORTED;
}
// ==========================================================================
//Azi: crc32 done in place, on the cases were it wasn't.
/*static inline void fixupEfiSystemTableCRC32(EFI_SYSTEM_TABLE_64 *efiSystemTable)
{
trunk/i386/libsaio/saio_internal.h
2828
2929
3030
31
32
33
34
35
31
32
33
34
35
3636
3737
3838
......
7979
8080
8181
82
83
84
85
82
83
84
8685
86
8787
8888
8989
#include "saio_types.h"
/* asm.s */
extern void real_to_prot(void);
extern void prot_to_real(void);
extern void halt(void);
extern void startprog(unsigned int address, void *arg);
extern void loader(UInt32 code, UInt32 cmdptr);
extern voidreal_to_prot(void);
extern voidprot_to_real(void);
extern voidhalt(void);
extern voidstartprog(unsigned int address, void *arg);
extern voidloader(UInt32 code, UInt32 cmdptr);
/* bios.s */
extern void bios(biosBuf_t *bb);
extern void finalizeBootStruct(void);
/* cache.c */
extern void CacheReset();
extern void CacheInit(CICell ih, long blockSize);
extern long CacheRead(CICell ih, char *buffer, long long offset,
long length, long cache);
extern voidCacheReset();
extern voidCacheInit(CICell ih, long blockSize);
extern longCacheRead(CICell ih, char *buffer, long long offset, long length, long cache);
/* console.c */
extern bool gVerboseMode;
extern bool gErrors;
trunk/i386/boot0/boot0.s
322322
323323
324324
325
325
326326
327327
328328
......
740740
741741
742742
743
743
744744
745745
746746
; signature check.
jmp .tryToBoot
.Pass2:
.Pass2:
cmp BYTE [si + part.type], kPartTypeHFS; In pass 2 we're going to find a HFS+ partition
; equipped with boot1h in its boot record
; regardless if it's active or not.
popad
ret
print_nibble:
and al, 0x0f
add al, '0'
trunk/i386/boot1/boot1h.s
11
22
33
4
4
55
66
77
......
99
1010
1111
12
12
1313
1414
1515
......
1717
1818
1919
20
20
2121
2222
2323
......
335335
336336
337337
338
338
339339
340340
341341
......
352352
353353
354354
355
355
356356
357357
358358
......
388388
389389
390390
391
391
392392
393393
394394
......
406406
407407
408408
409
409
410410
411411
412412
......
500500
501501
502502
503
503
504504
505505
506506
......
10581058
10591059
10601060
1061
1061
10621062
10631063
10641064
1065
1065
10661066
10671067
10681068
......
10881088
10891089
10901090
1091
1091
10921092
10931093
10941094
......
10991099
11001100
11011101
1102
1102
11031103
11041104
11051105
......
11151115
11161116
11171117
1118
1118
11191119
11201120
11211121
......
11831183
11841184
11851185
1186
1186
11871187
11881188
11891189
......
11991199
12001200
12011201
1202
1202
12031203
12041204
12051205
12061206
12071207
12081208
1209
1210
1209
1210
12111211
12121212
12131213
......
12301230
12311231
12321232
1233
1233
12341234
12351235
12361236
......
13001300
13011301
13021302
1303
1303
13041304
13051305
13061306
......
13281328
13291329
13301330
1331
1331
13321332
13331333
13341334
13351335
13361336
1337
1337
13381338
13391339
13401340
13411341
13421342
13431343
1344
1344
13451345
13461346
13471347
; Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
;
; @APPLE_LICENSE_HEADER_START@
;
;
; Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
; Reserved. This file contains Original Code and/or Modifications of
; Original Code as defined in and that are subject to the Apple Public
; except in compliance with the License. Please obtain a copy of the
; License at http://www.apple.com/publicsource and read it before using
; this file.
;
;
; The Original Code and all software distributed under the License are
; distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
; EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
; FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
; License for the specific language governing rights and limitations
; under the License.
;
;
; @APPLE_LICENSE_HEADER_END@
;
; Partition Boot Loader: boot1h
movsi, %1
callprint_string
%endmacro
%macro LogString 1
movdi, %1
calllog_string
%define PutChar(x)
%define PrintHex(x)
%endif
;--------------------------------------------------------------------------
; Start of text segment.
movcx, kSectorBytes; copy 256 words
repmovsb; repeat string move (word) operation
popsi
;
; Code relocated, jump to startReloc in relocated location.
;
; Initializing global variables.
;
mov eax, [si + part.lba]
mov [gPartLBA], eax; save the current partition LBA offset
mov [gPartLBA], eax; save the current partition LBA offset
mov [gBIOSDriveNumber], dl; save BIOS drive number
movWORD [gMallocPtr], mallocStart; set free space pointer
%if VERBOSE
LogString(error_str)
%endif
hang:
hlt
jmp hang
movbx, [bp + BTree.nodeBuffer + BTNodeDescriptor.numRecords]
xchgbh, bl
decbx
.bsearch:
cmpax, bx
ja.checkResult; jump if lowerBound > upperBound
movcx, ax
addcx, bx
shrcx, 1; test index = (lowerBound + upperBound / 2)
je.checkResult
jl.searchLessThanTrial
jg.searchGreaterThanTrial
jmp.bsearch
jmp.bsearch
.searchLessThanTrial:
movbx, cx
movax, cx
incax; lowerBound = index + 1
jmp.bsearch
.checkResult:
cmpBYTE [bp + BTree.searchResult], 0
jge.foundKey
movbx, [bx]
movedx, [bx]
jmp.readNode
.exit:
cmpBYTE [bp + BTree.searchResult], 0
ret
.exit:
popdi; restore address of trialKey
%if UNUSED
%if UNUSED
;
; Print catalog trial key
;
.printLoop:
lodsw
callprint_char
loop.printLoop
loop.printLoop
.printExit:
popad
;
;
;
%endif ; UNUSED
%if UNUSED
%if UNUSED
;
; Print extent trial key
;
popsi; restore SI
callbx; call key compare proc
popad
ret
ret
;--------------------------------------------------------------------------
; readExtent - read extents from a HFS+ file (multiple extent support)
popebx
jmp.beginExtentBlock
.continue:
movedx, [di + HFSPlusExtentDescriptor.blockCount]
callblockToSector; ECX = converted current extent's blockCount to sectors
movedx, [di + HFSPlusExtentDescriptor.startBlock]
callblockToSector; ECX = converted to sectors
addecx, eax; file offset converted to sectors
pushsi
movax, si
movedx, [bp + BTree.readBufferPtr]
callreadSectors
popsi
addebx, esi
movax, si
cwde
shlax, 9; convert SI (read sector count) to byte unit
add[bp + BTree.readBufferPtr], eax
sub[bp + BTree.readSize], esi
jz.exit
.nextExtent:
trunk/i386/boot1/boot1hp.s
269269
270270
271271
272
272
273273
274274
275275
mov al, 1; read HFS+ Volume Header
mov edx, kHFSPlusBuffer
call readLBA
jcNEAR bios_read_error
jc NEAR bios_read_error
;
; Looking for HFSPlus ('H+') or HFSPlus case-sensitive ('HX') signature.
trunk/i386/boot2/picopng.c
2323
2424
2525
26
26
27
2728
2829
2930
......
3233
3334
3435
36
37
3538
3639
3740
41
3842
43
3944
45
4046
47
48
49
4150
4251
4352
53
54
55
4456
4557
4658
59
4760
61
4862
49
63
64
65
5066
5167
5268
5369
5470
71
5572
73
5674
75
76
5777
78
5879
80
5981
6082
83
84
6185
6286
6387
/*************************************************************************************************/
typedef struct png_alloc_node {
typedef struct png_alloc_node
{
struct png_alloc_node *prev, *next;
void *addr;
size_t size;
png_alloc_node_t *png_alloc_head = NULL;
png_alloc_node_t *png_alloc_tail = NULL;
//==============================================================================
png_alloc_node_t *png_alloc_find_node(void *addr)
{
png_alloc_node_t *node;
for (node = png_alloc_head; node; node = node->next)
{
if (node->addr == addr)
{
break;
}
}
return node;
}
//==============================================================================
void png_alloc_add_node(void *addr, size_t size)
{
png_alloc_node_t *node;
if (png_alloc_find_node(addr))
{
return;
node = malloc(sizeof (png_alloc_node_t));
}
node = malloc(sizeof(png_alloc_node_t));
node->addr = addr;
node->size = size;
node->prev = png_alloc_tail;
node->next = NULL;
png_alloc_tail = node;
if (node->prev)
{
node->prev->next = node;
}
if (!png_alloc_head)
{
png_alloc_head = node;
}
}
//==============================================================================
void png_alloc_remove_node(png_alloc_node_t *node)
{
if (!node) {
trunk/i386/boot2/graphics.c
2020
2121
2222
23
24
25
2326
24
25
26
27
2827
2928
3029
......
5049
5150
5251
53
52
5453
5554
5655
5756
5857
59
58
6059
6160
62
61
6362
64
63
6564
6665
6766
......
7978
8079
8180
82
81
8382
8483
85
84
8685
8786
8887
8988
89
9090
91
91
9292
93
94
95
96
97
98
93
94
95
96
97
98
9999
100100
101101
......
163163
164164
165165
166
166
167167
168168
169169
170170
171171
172172
173
174
173175
174176
175177
......
184186
185187
186188
187
189
190
188191
189192
190193
......
208211
209212
210213
211
214
212215
213216
214217
......
219222
220223
221224
222
223
224
225
226
227
228
225
226
227
228
229
230
231
232
229233
230
231
232
233
234
235
234
235
236
237
238
239
236240
237
241
238242
239
243
240244
241
245
242246
243
244
245
246
247
248
249
247
248
249
250
251
252
253
250254
251
255
252256
253
257
258
259
260
254261
255
262
256263
257
258
259
260
264
265
266
267
261268
262
263
264
265
266
267
269
270
271
272
273
274
268275
269276
270
277
271278
272279
273280
274281
275282
276
283
277284
278
285
279286
280
281
282
287
288
289
283290
284
291
285292
286
293
287294
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
317324
318
325
319326
320
321
322
323
324
327
328
329
330
331
325332
326
333
327334
328
329
330
331
332
333
334
335
335
336
337
338
339
340
341
342
336343
337
344
338345
339
340
341
342
343
344
345
346
347
348
349
350
346
347
348
349
350
351
351352
352
353
354
353
354
355
356
357
358
355359
356
360
361
362
363
364
357365
358366
359367
......
506514
507515
508516
509
510
511
512
513
517
518
519
514520
515521
516522
......
525531
526532
527533
528
534
529535
530536
531537
......
533539
534540
535541
536
542
537543
538544
539545
......
543549
544550
545551
552
553
546554
547555
548556
......
595603
596604
597605
606
607
598608
599609
600610
......
623633
624634
625635
636
637
626638
627639
628640
......
640652
641653
642654
643
655
644656
645657
646658
......
669681
670682
671683
672
684
673685
674686
675687
......
677689
678690
679691
680
692
681693
682694
683695
......
687699
688700
689701
690
702
691703
692704
693705
......
704716
705717
706718
707
719
708720
709721
710722
......
725737
726738
727739
728
729
740
741
730742
731743
732744
......
735747
736748
737749
750
751
738752
739753
740754
......
752766
753767
754768
755
756
769
757770
758771
759772
......
787800
788801
789802
790
791
792
793
803
804
805
806
794807
795
808
796809
797810
811
812
798813
799814
800815
......
844859
845860
846861
847
848
862
863
864
849865
850866
851867
......
862878
863879
864880
865
881
866882
867883
868884
......
872888
873889
874890
875
891
876892
877893
878894
......
889905
890906
891907
908
909
892910
893911
894912
......
902920
903921
904922
905
923
906924
907925
908926
......
921939
922940
923941
924
925
942
943
926944
927945
928
946
929947
930948
931949
932
950
933951
934952
935953
......
969987
970988
971989
990
991
972992
973993
974994
......
978998
979999
9801000
981
1001
9821002
9831003
9841004
9851005
986
1006
9871007
9881008
9891009
990
1010
9911011
992
1012
9931013
994
1014
9951015
9961016
9971017
......
10281048
10291049
10301050
1031
1032
1033
1034
1051
10351052
10361053
10371054
......
10681085
10691086
10701087
1071
1072
1088
10731089
10741090
10751091
......
11001116
11011117
11021118
1119
1120
11031121
11041122
11051123
11061124
1107
1125
11081126
11091127
11101128
......
11221140
11231141
11241142
1125
1143
11261144
1127
1145
11281146
11291147
11301148
1131
1149
11321150
11331151
11341152
......
11371155
11381156
11391157
1140
1141
1158
11421159
11431160
11441161
......
11651182
11661183
11671184
1168
1185
11691186
11701187
11711188
11721189
11731190
11741191
1192
11751193
11761194
11771195
......
11801198
11811199
11821200
1183
1201
11841202
11851203
11861204
......
11901208
11911209
11921210
1193
1211
11941212
11951213
11961214
......
12131231
12141232
12151233
1216
1217
1234
1235
1236
12181237
12191238
1220
1239
12211240
12221241
12231242
......
12271246
12281247
12291248
1249
12301250
1251
12311252
12321253
1233
1254
12341255
12351256
12361257
......
12401261
12411262
12421263
1243
1264
12441265
12451266
12461267
......
12521273
12531274
12541275
1255
1256
1276
1277
1278
12571279
1258
1259
1280
1281
12601282
12611283
1262
1284
12631285
12641286
1287
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*
* Copyright 1993 NeXT, Inc. All rights reserved.
*
*/
/*
* Copyright 1993 NeXT, Inc.
* All rights reserved.
*/
#include "boot.h"
#include "vbe.h"
{
VBEInfoBlock vbeInfo;
int err, small;
bzero( &vbeInfo, sizeof(vbeInfo) );
strcpy( (char*)&vbeInfo, "VBE2" );
err = getVBEInfo( &vbeInfo );
if (err != errSuccess)
return 0;
if ( strncmp( (char *)vbeInfo.VESASignature, "VESA", 4 ) )
return 0;
small = (vbeInfo.TotalMemory < 16);
return vbeInfo.TotalMemory * 64 * 1024;
}
err = getVBEInfo( &vbeInfo );
if (err != errSuccess)
return 0;
if ( strncmp( (char *)vbeInfo.VESASignature, "VESA", 4 ) )
return 0;
buff = malloc(sizeof(char) * 256);
if (!buff) {
return 0;
}
small = (vbeInfo.TotalMemory < 16);
snprintf(buff, 256,
"VESA v%d.%d %d%s (%s)\n",
vbeInfo.VESAVersion >> 8,
vbeInfo.VESAVersion & 0xf,
small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16),
small ? "KB" : "MB",
VBEDecodeFP(const char *, vbeInfo.OEMStringPtr) );
"VESA v%d.%d %d%s (%s)\n",
vbeInfo.VESAVersion >> 8,
vbeInfo.VESAVersion & 0xf,
small ? (vbeInfo.TotalMemory * 64) : (vbeInfo.TotalMemory / 16),
small ? "KB" : "MB",
VBEDecodeFP(const char *, vbeInfo.OEMStringPtr) );
return buff;
}
clearScreenRows(0, 24);
setCursorPosition( 0, 0, 1 );
}
}
}
if (line != 0) {
pause();
}
setActiveDisplayPage(0);
}
//==============================================================================
char *getVBEModeInfoString()
{
VBEInfoBlock vbeInfo;
return 0;
}
char *buff=malloc(sizeof(char)*3072);
if(!buff) {
if(!buff)
{
return 0;
}
*modePtr, modeInfo.XResolution, modeInfo.YResolution,
modeInfo.BitsPerPixel, modeInfo.MemoryModel,
modeInfo.ModeAttributes);
}
}
return buff;
}
// If a mode is not found, then return the "best" available mode.
static unsigned short
getVESAModeWithProperties( unsigned short width,
unsigned short height,
unsigned char bitsPerPixel,
unsigned short attributesSet,
unsigned short attributesClear,
VBEModeInfoBlock * outModeInfo,
unsigned short * vesaVersion )
getVESAModeWithProperties( unsigned shortwidth,
unsigned shortheight,
unsigned charbitsPerPixel,
unsigned shortattributesSet,
unsigned shortattributesClear,
VBEModeInfoBlock*outModeInfo,
unsigned short*vesaVersion
)
{
VBEInfoBlock vbeInfo;
unsigned short * modePtr;
VBEModeInfoBlock modeInfo;
unsigned char modeBitsPerPixel;
unsigned short matchedMode = modeEndOfList;
int err;
VBEInfoBlock vbeInfo;
unsigned short * modePtr;
VBEModeInfoBlock modeInfo;
unsigned char modeBitsPerPixel;
unsigned short matchedMode = modeEndOfList;
int err;
// Clear output mode info.
// Clear output mode info.
bzero( outModeInfo, sizeof(*outModeInfo) );
bzero( outModeInfo, sizeof(*outModeInfo) );
// Get VBE controller info containing the list of supported modes.
// Get VBE controller info containing the list of supported modes.
bzero( &vbeInfo, sizeof(vbeInfo) );
strcpy( (char*)&vbeInfo, "VBE2" );
err = getVBEInfo( &vbeInfo );
if ( err != errSuccess )
{
return modeEndOfList;
}
bzero( &vbeInfo, sizeof(vbeInfo) );
strcpy( (char*)&vbeInfo, "VBE2" );
err = getVBEInfo( &vbeInfo );
if ( err != errSuccess )
{
return modeEndOfList;
}
// Report the VESA major/minor version number.
// Report the VESA major/minor version number.
if (vesaVersion) *vesaVersion = vbeInfo.VESAVersion;
if (vesaVersion)
{
*vesaVersion = vbeInfo.VESAVersion;
}
// Loop through the mode list, and find the matching mode.
// Loop through the mode list, and find the matching mode.
for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr );
*modePtr != modeEndOfList; modePtr++ )
{
// Get mode information.
for ( modePtr = VBEDecodeFP( unsigned short *, vbeInfo.VideoModePtr );
*modePtr != modeEndOfList; modePtr++ )
{
// Get mode information.
bzero( &modeInfo, sizeof(modeInfo) );
err = getVBEModeInfo( *modePtr, &modeInfo );
if ( err != errSuccess )
{
continue;
}
bzero( &modeInfo, sizeof(modeInfo) );
err = getVBEModeInfo( *modePtr, &modeInfo );
if ( err != errSuccess )
{
continue;
}
#if DEBUG
printf("Mode %x: %dx%dx%d mm:%d attr:%x\n",
printf("Mode %x: %dx%dx%d mm:%d attr:%x\n",
*modePtr, modeInfo.XResolution, modeInfo.YResolution,
modeInfo.BitsPerPixel, modeInfo.MemoryModel,
modeInfo.ModeAttributes);
#endif
// Filter out unwanted modes based on mode attributes.
// Filter out unwanted modes based on mode attributes.
if ( ( ( modeInfo.ModeAttributes & attributesSet ) != attributesSet )
if ( ( ( modeInfo.ModeAttributes & attributesSet ) != attributesSet )
|| ( ( modeInfo.ModeAttributes & attributesClear ) != 0 ) )
{
continue;
}
{
continue;
}
// Pixel depth in bits.
// Pixel depth in bits.
modeBitsPerPixel = modeInfo.BitsPerPixel;
modeBitsPerPixel = modeInfo.BitsPerPixel;
if ( ( modeBitsPerPixel == 4 ) && ( modeInfo.MemoryModel == 0 ) )
{
// Text mode, 16 colors.
}
else if ( ( modeBitsPerPixel == 8 ) && ( modeInfo.MemoryModel == 4 ) )
{
// Packed pixel, 256 colors.
}
else if ( ( ( modeBitsPerPixel == 16 ) || ( modeBitsPerPixel == 15 ) )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 5 )
&& ( modeInfo.GreenMaskSize == 5 )
&& ( modeInfo.BlueMaskSize == 5 ) )
{
// Direct color, 16 bpp (1:5:5:5).
modeInfo.BitsPerPixel = modeBitsPerPixel = 16;
}
else if ( ( modeBitsPerPixel == 32 )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 8 )
&& ( modeInfo.GreenMaskSize == 8 )
&& ( modeInfo.BlueMaskSize == 8 ) )
{
// Direct color, 32 bpp (8:8:8:8).
}
else
{
continue; // Not a supported mode.
}
if ( ( modeBitsPerPixel == 4 ) && ( modeInfo.MemoryModel == 0 ) )
{
// Text mode, 16 colors.
}
else if ( ( modeBitsPerPixel == 8 ) && ( modeInfo.MemoryModel == 4 ) )
{
// Packed pixel, 256 colors.
}
else if ( ( ( modeBitsPerPixel == 16 ) || ( modeBitsPerPixel == 15 ) )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 5 )
&& ( modeInfo.GreenMaskSize == 5 )
&& ( modeInfo.BlueMaskSize == 5 ) )
{
// Direct color, 16 bpp (1:5:5:5).
modeInfo.BitsPerPixel = modeBitsPerPixel = 16;
}
else if ( ( modeBitsPerPixel == 32 )
&& ( modeInfo.MemoryModel == 6 )
&& ( modeInfo.RedMaskSize == 8 )
&& ( modeInfo.GreenMaskSize == 8 )
&& ( modeInfo.BlueMaskSize == 8 ) )
{
// Direct color, 32 bpp (8:8:8:8).
}
else
{
continue; // Not a supported mode.
}
// Modes larger than the specified dimensions are skipped.
// Modes larger than the specified dimensions are skipped.
if ( ( modeInfo.XResolution > width ) ||
( modeInfo.YResolution > height ) )
{
continue;
}
if ( ( modeInfo.XResolution > width ) ||
( modeInfo.YResolution > height ) )
{
continue;
}
// Perfect match, we're done looking.
// Perfect match, we're done looking.
if ( ( modeInfo.XResolution == width ) &&
( modeInfo.YResolution == height ) &&
( modeBitsPerPixel == bitsPerPixel ) )
{
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
break;
}
if ( ( modeInfo.XResolution == width ) &&
( modeInfo.YResolution == height ) &&
( modeBitsPerPixel == bitsPerPixel ) )
{
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
break;
}
// Save the next "best" mode in case a perfect match is not found.
// Save the next "best" mode in case a perfect match is not found.
if ( modeInfo.XResolution == outModeInfo->XResolution &&
modeInfo.YResolution == outModeInfo->YResolution &&
modeBitsPerPixel <= outModeInfo->BitsPerPixel )
{
continue; // Saved mode has more depth.
}
if ( modeInfo.XResolution < outModeInfo->XResolution ||
modeInfo.YResolution < outModeInfo->YResolution ||
modeBitsPerPixel < outModeInfo->BitsPerPixel )
{
continue; // Saved mode has more resolution.
}
if ( modeInfo.XResolution == outModeInfo->XResolution &&
modeInfo.YResolution == outModeInfo->YResolution &&
modeBitsPerPixel <= outModeInfo->BitsPerPixel )
{
continue; // Saved mode has more depth.
}
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
}
if ( modeInfo.XResolution < outModeInfo->XResolution ||
modeInfo.YResolution < outModeInfo->YResolution ||
modeBitsPerPixel < outModeInfo->BitsPerPixel )
{
continue; // Saved mode has more resolution.
}
return matchedMode;
matchedMode = *modePtr;
bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
}
return matchedMode;
}
//==========================================================================
return err;
}
int
convertImage( unsigned short width,
unsigned short height,
const unsigned char *imageData,
unsigned char **newImageData )
//==============================================================================
int convertImage( unsigned short width, unsigned short height, const unsigned char *imageData, unsigned char **newImageData )
{
int cnt;
unsigned char *img = 0;
img16[cnt] = lookUpCLUTIndex(imageData[cnt], 16);
img = (unsigned char *)img16;
break;
case 32 :
img32 = malloc(width * height * 4);
if ( !img32 ) break;
img32[cnt] = lookUpCLUTIndex(imageData[cnt], 32);
img = (unsigned char *)img32;
break;
default :
img = malloc(width * height);
bcopy(imageData, img, width * height);
return 0;
}
//==============================================================================
int loadPngImage(const char *filename, uint16_t *width, uint16_t *height,
uint8_t **imageData)
{
return error;
}
//==============================================================================
int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData) {
PNG_info_t *info;
int error = 0;
return error;
}
//==============================================================================
void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height,
uint8_t *data)
{
uint32_t a; // Alpha
uint32_t dstrb, dstg, srcrb, srcg, drb, dg, rb, g, tempB; // Intermediate variables
uint16_t pos;
for (pos = 0; pos < drawWidth * 4; pos += 4) {
// Fast pseudo-vector alpha blending, adapted from: http://www.stereopsis.com/doubleblend.html
s = *((uint32_t*) (data + pos));
}
}
break;
default: /*Universal version*/
{
uint32_t s;
uint32_t dr, dg, db, sr, sg, sb; // Intermediate variables
uint16_t pos;
int bpp = (VIDEO (depth) + 7)/8;
for (pos = 0; pos < drawWidth; pos ++) {
// Fast pseudo-vector alpha blending, adapted from: http://www.stereopsis.com/doubleblend.html
s = *((uint32_t*) (data + 4*pos));
sr = (s & 0xFF);
a = (s >> 24) + 1;
switch (VIDEO (depth))
{
case 24:
db = ((*(uint16_t *)(vram + bpp*pos))&0x1f)<<3;
dg = ((*(uint16_t *)(vram + bpp*pos))&0x03e0)>>2;
dr = ((*(uint16_t *)(vram + bpp*pos))&0x7c00)>>7;
break;
break;
default:
return;
}
*(uint16_t *)(vram + bpp*pos) = ((db&0xf8)>>3) | ((dg&0xf8)<<2) | ((dr&0xf8)<<7);
break;
}
}
}
}
break;
}
}
}
//==============================================================================
void drawCheckerBoard()
{
uint32_t *vram = (uint32_t *) VIDEO(baseAddr);
//==========================================================================
// LookUpCLUTIndex
unsigned long lookUpCLUTIndex( unsigned char index,
unsigned char depth )
unsigned long lookUpCLUTIndex( unsigned char index, unsigned char depth )
{
long result, red, green, blue;
void * stosl(void * dst, long val, long len)
{
asm volatile ( "rep; stosl"
: "=c" (len), "=D" (dst)
: "0" (len), "1" (dst), "a" (val)
: "memory" );
asm volatile ( "rep; stosl"
: "=c" (len), "=D" (dst)
: "0" (len), "1" (dst), "a" (val)
: "memory" );
return dst;
return dst;
}
//==============================================================================
void drawColorRectangle( unsigned short x,
unsigned short y,
unsigned short width,
}
}
void
loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or)
//==============================================================================
void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or)
{
int x,y, off;
int red=0x7f, green=0x7f, blue=0x7f;
red=(val>>7)&0xf8;
green=(val>>2)&0xf8;
blue=(val<<3)&0xf8;
break;
break;
}
case 32:
{
green=(val>>8)&0xff;
blue=(val)&0xff;
break;
}
}
}
char *ptr=(char *)output+x*(op/8)+y*or;
switch (op)
}
}
//==============================================================================
DECLARE_IOHIBERNATEPROGRESSALPHA
void drawPreview(void *src, uint8_t * saveunder)
void *uncomp;
int origwidth, origheight, origbpx;
uint32_t saveindex[kIOHibernateProgressCount] = { 0 };
if (src && (uncomp=DecompressData(src, &origwidth, &origheight, &origbpx)))
{
if (!setVESAGraphicsMode(origwidth, origheight, origbpx, 0))
// Set the screen to 75% grey.
drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01 /* color index */);
}
pixelShift = VIDEO (depth) >> 4;
if (pixelShift < 1) return;
screen += ((VIDEO (width)
- kIOHibernateProgressCount * (kIOHibernateProgressWidth + kIOHibernateProgressSpacing)) << (pixelShift - 1))
+ (VIDEO (height) - kIOHibernateProgressOriginY - kIOHibernateProgressHeight) * rowBytes;
for (y = 0; y < kIOHibernateProgressHeight; y++)
{
out = screen + y * rowBytes;
}
}
//==============================================================================
void updateProgressBar(uint8_t * saveunder, int32_t firstBlob, int32_t select)
{
uint8_t * screen;
uint32_t alpha, in, color, result;
uint8_t * out;
uint32_t saveindex[kIOHibernateProgressCount] = { 0 };
pixelShift = VIDEO(depth) >> 4;
if (pixelShift < 1) return;
screen = (uint8_t *) VIDEO (baseAddr);
rowBytes = VIDEO (rowBytes);
screen += ((VIDEO (width)
- kIOHibernateProgressCount * (kIOHibernateProgressWidth + kIOHibernateProgressSpacing)) << (pixelShift - 1))
+ (VIDEO (height) - kIOHibernateProgressOriginY - kIOHibernateProgressHeight) * rowBytes;
lastBlob = (select < kIOHibernateProgressCount) ? select : (kIOHibernateProgressCount - 1);
screen += (firstBlob * (kIOHibernateProgressWidth + kIOHibernateProgressSpacing)) << pixelShift;
for (y = 0; y < kIOHibernateProgressHeight; y++)
{
out = screen + y * rowBytes;
//==========================================================================
// setVESATextMode
static int
setVESATextMode( unsigned short cols,
unsigned short rows,
unsigned char bitsPerPixel )
static int setVESATextMode( unsigned short cols, unsigned short rows, unsigned char bitsPerPixel )
{
VBEModeInfoBlock minfo;
unsigned short mode = modeEndOfList;
//==========================================================================
// getNumberArrayFromProperty
static int
getNumberArrayFromProperty( const char * propKey,
static int getNumberArrayFromProperty( const char * propKey,
unsigned long numbers[],
unsigned long maxArrayCount )
{
return count;
}
//==============================================================================
int initGraphicsMode ()
{
unsigned long params[4];
int count;
params[3] = 0;
count = getNumberArrayFromProperty( kGraphicsModeKey, params, 4 );
params[1] = gui.screen.height;
params[2] = 32;
}
// Map from pixel format to bits per pixel.
if ( params[2] == 256 ) params[2] = 8;
if ( params[2] == 555 ) params[2] = 16;
if ( params[2] == 888 ) params[2] = 32;
return setVESAGraphicsMode( params[0], params[1], params[2], params[3] );
}
//
// Set the video mode to VGA_TEXT_MODE or GRAPHICS_MODE.
void
setVideoMode( int mode, int drawgraphics)
void setVideoMode( int mode, int drawgraphics)
{
unsigned long params[4];
int count;
params[1] = 25;
}
setVESATextMode( params[0], params[1], 4 );
setVESATextMode( params[0], params[1], 4 );
bootArgs->Video.v_display = VGA_TEXT_MODE;
}
currentIndicator = 0;
}
//==============================================================================
void getGraphicModeParams(unsigned long params[]) {
params[3] = 0;
unsigned short vesaVersion;
unsigned short mode = modeEndOfList;
getNumberArrayFromProperty( kGraphicsModeKey, params, 4);
mode = getVESAModeWithProperties( params[0], params[1], params[2],
maLinearFrameBufferAvailBit,
0,
&minfo, &vesaVersion );
params[0] = minfo.XResolution;
params[1] = minfo.YResolution;
params[2] = 32;
// ensure a minimum of 1/9 sec between animation frames.
#define MIN_TICKS 2
void
spinActivityIndicator(int sectors)
//==============================================================================
void spinActivityIndicator(int sectors)
{
static unsigned long lastTickTime = 0, currentTickTime;
if (previewTotalSectors && previewSaveunder)
{
int blob, lastBlob;
blob = (previewLoadedSectors * kIOHibernateProgressCount) / previewTotalSectors;
if (blob!=lastBlob)
{
updateProgressBar (previewSaveunder, lastBlob, blob);
}
return;
}
currentTickTime = time18(); // late binding
if (currentTickTime < lastTickTime + MIN_TICKS)
{
{
lastTickTime = currentTickTime;
}
if (getVideoMode() == VGA_TEXT_MODE)
{
if (currentIndicator >= sizeof(indicator))
}
}
void
clearActivityIndicator( void )
//==============================================================================
void clearActivityIndicator( void )
{
if ( getVideoMode() == VGA_TEXT_MODE )
{
if ( getVideoMode() == VGA_TEXT_MODE )
{
putchar(' ');
putchar('\b');
}
}
}
//==============================================================================
trunk/i386/boot2/graphics.h
11
22
3
43
4
55
66
77
......
2626
2727
2828
29
29
3030
3131
3232
3333
3434
35
36
37
3835
3936
4037
/*
* graphics.h
*
*
*
* Created by fassl on 22.12.08.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*
void drawDataRectangle( unsigned short x, unsigned short y, unsigned short width, unsigned short height, unsigned char * data );
int convertImage( unsigned short width, unsigned short height, const unsigned char *imageData, unsigned char **newImageData );
int initGraphicsMode ();
int initGraphicsMode();
void drawCheckerBoard();
void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data);
void drawCheckerBoard();
void blendImage(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint8_t *data);
int loadEmbeddedPngImage(uint8_t *pngData, int pngSize, uint16_t *width, uint16_t *height, uint8_t **imageData);
uint32_t getVBEVideoRam();
trunk/i386/boot2/drivers.c
846846
847847
848848
849
850
849
851850
852851
853852
char *gDarwinBuildVerStr = "Darwin Kernel Version"; // Bungo
long
DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize)
long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize)
{
long ret = 0;
compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary;
trunk/i386/boot2/modules.c
105105
106106
107107
108
109108
110109
111110
112111
113112
114
115113
116114
117115
long flags;
long time;
struct dirstuff* moduleDir = opendir("/Extra/modules/");
if(!moduleDir)
{
verbose("Warning: Unable to open modules folder at '/Extra/modules/'. Ingoring modules.\n");
return;
}
while (readdir(moduleDir, (const char**)&name, &flags, &time) >= 0) {
if(strcmp(&name[strlen(name) - sizeof("dylib")], ".dylib") == 0) {
char* tmp = malloc(strlen(name) + 1);
trunk/i386/boot2/modules_support.s
33
44
55
6
6
77
88
99
10
10
LABEL(dyld_stub_binder)
jmp_dyld_stub_binder
LABEL(dyld_void_start)
ret
#endif
#endif
trunk/i386/boot2/appleClut8.h
22
33
44
5
5
66
77
88
......
1010
1111
1212
13
13
1414
1515
1616
......
1818
1919
2020
21
21
2222
2323
2424
......
3131
3232
3333
34
3435
3536
3637
3738
39
3840
3941
4042
4143
44
4245
4346
4447
45
48
49
4650
4751
4852
4953
54
5055
5156
5257
5358
59
5460
5561
5662
5763
64
5865
5966
6067
6168
69
6270
6371
6472
6573
74
6675
6776
6877
6978
79
7080
7181
7282
7383
84
7485
7586
7687
7788
89
7890
7991
8092
8193
94
8295
8396
84
97
8598
99
86100
87101
88102
89103
104
90105
91106
92107
* Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
*
* Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
*
*
* The Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
*
* @APPLE_LICENSE_HEADER_END@
*/
0xbc,0xbc,0xbc, 0xff,0xff,0x00, 0xba,0xba,0xba, 0xb9,0xb9,0xb9,
0xb8,0xb8,0xb8, 0xb7,0xb7,0xb7, 0xb6,0xb6,0xb6, 0xb5,0xb5,0xb5,
0xb4,0xb4,0xb4, 0xb3,0xb3,0xb3, 0xb2,0xb2,0xb2, 0x00,0x00,0x00,
0xb1,0xb1,0xb1, 0xb0,0xb0,0xb0, 0xaf,0xaf,0xaf, 0xae,0xae,0xae,
0xad,0xad,0xad, 0xac,0xac,0xac, 0xab,0xab,0xab, 0xaa,0xaa,0xaa,
0xff,0x00,0xff, 0xa9,0xa9,0xa9, 0xa8,0xa8,0xa8, 0xa7,0xa7,0xa7,
0xa6,0xa6,0xa6, 0xa5,0xa5,0xa5, 0xa4,0xa4,0xa4, 0xa3,0xa3,0xa3,
0xa2,0xa2,0xa2, 0xa1,0xa1,0xa1, 0xa0,0xa0,0xa0, 0xff,0x00,0x00,
0x9f,0x9f,0x9f, 0x9e,0x9e,0x9e, 0x9d,0x9d,0x9d, 0x9c,0x9c,0x9c,
0x9b,0x9b,0x9b, 0x9a,0x9a,0x9a, 0xcc,0xcc,0xff, 0xcc,0xcc,0xcc,
0x99,0x99,0x99, 0x98,0x98,0x98, 0x97,0x97,0x97, 0x96,0x96,0x96,
0x95,0x95,0x95, 0x94,0x94,0x94, 0x93,0x93,0x93, 0x92,0x92,0x92,
0x91,0x91,0x91, 0x90,0x90,0x90, 0x8f,0x8f,0x8f, 0x8e,0x8e,0x8e,
0x8d,0x8d,0x8d, 0x8c,0x8c,0x8c, 0x8b,0x8b,0x8b, 0x8a,0x8a,0x8a,
0x89,0x89,0x89, 0x87,0x87,0x87, 0x86,0x86,0x86, 0x85,0x85,0x85,
0x89,0x89,0x89, 0x88,0x88,0x88, 0x86,0x86,0x86, 0x85,0x85,0x85,
0x84,0x84,0x84, 0x83,0x83,0x83, 0x82,0x82,0x82, 0x81,0x81,0x81,
0x80,0x80,0x80, 0x7f,0x7f,0x7f, 0x7e,0x7e,0x7e, 0x7d,0x7d,0x7d,
0x7c,0x7c,0x7c, 0x7b,0x7b,0x7b, 0x7a,0x7a,0x7a, 0x79,0x79,0x79,
0x78,0x78,0x78, 0x76,0x76,0x76, 0x75,0x75,0x75, 0x74,0x74,0x74,
0x73,0x73,0x73, 0x72,0x72,0x72, 0x71,0x71,0x71, 0x70,0x70,0x70,
0x6f,0x6f,0x6f, 0x6e,0x6e,0x6e, 0x6d,0x6d,0x6d, 0x6c,0x6c,0x6c,
0x6b,0x6b,0x6b, 0x6a,0x6a,0x6a, 0x69,0x69,0x69, 0x68,0x68,0x68,
0x67,0x67,0x67, 0x66,0x66,0x66, 0x64,0x64,0x64, 0x63,0x63,0x63,
0x62,0x62,0x62, 0x61,0x61,0x61, 0x60,0x60,0x60, 0x5f,0x5f,0x5f,
0x5e,0x5e,0x5e, 0x5d,0x5d,0x5d, 0x5c,0x5c,0x5c, 0x5b,0x5b,0x5b,
0x5a,0x5a,0x5a, 0x59,0x59,0x59, 0x58,0x58,0x58, 0x57,0x57,0x57,
0x56,0x56,0x56, 0x54,0x54,0x54, 0x53,0x53,0x53, 0x52,0x52,0x52,
0x51,0x51,0x51, 0x50,0x50,0x50, 0x4f,0x4f,0x4f, 0x4e,0x4e,0x4e,
0x4d,0x4d,0x4d, 0x4c,0x4c,0x4c, 0x4b,0x4b,0x4b, 0x4a,0x4a,0x4a,
0x49,0x49,0x49, 0x48,0x48,0x48, 0x47,0x47,0x47, 0x46,0x46,0x46,
0x45,0x45,0x45, 0x43,0x43,0x43, 0x42,0x42,0x42, 0x41,0x41,0x41,
0x40,0x40,0x40, 0x3f,0x3f,0x3f, 0x3e,0x3e,0x3e, 0x3d,0x3d,0x3d,
0x3c,0x3c,0x3c, 0x3b,0x3b,0x3b, 0x3a,0x3a,0x3a, 0x39,0x39,0x39,
0x38,0x38,0x38, 0x37,0x37,0x37, 0x36,0x36,0x36, 0x35,0x35,0x35,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x00,0xff,0xff, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x00,0xff,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x00,0x00,0xff, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0xdd,0x00,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0xd0,0x00,0x00, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x00,0xbb,0x00,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65,
0x65,0x65,0x65, 0x65,0x65,0x65, 0x65,0x65,0x65, 0xbb,0xbb,0xbb,
0x65,0x65,0x65, 0x88,0x88,0x88, 0x77,0x77,0x77, 0x55,0x55,0x55,
trunk/i386/boot2/options.c
10941094
10951095
10961096
1097
1098
1097
1098
10991099
11001100
11011101
......
11071107
11081108
11091109
1110
1111
1110
1111
1112
11121113
11131114
11141115
......
11181119
11191120
11201121
1122
11211123
1122
11231124
11241125
11251126
......
12251226
12261227
12271228
1228
1229
1230
1231
12291232
12301233
12311234
1232
1235
1236
1237
12331238
12341239
12351240
......
13001305
13011306
13021307
1303
1308
1309
1310
13041311
13051312
13061313
13071314
1308
1315
1316
1317
13091318
13101319
13111320
......
13801389
13811390
13821391
1383
1392
1393
1394
13841395
13851396
13861397
......
14701481
14711482
14721483
1473
1484
1485
14741486
1475
1487
1488
1489
14761490
14771491
14781492
......
14841498
14851499
14861500
1487
1501
1502
14881503
14891504
14901505
14911506
14921507
14931508
1494
1509
1510
14951511
14961512
14971513
......
15181534
15191535
15201536
1521
1537
1538
15221539
1523
1540
1541
15241542
15251543
15261544
......
15291547
15301548
15311549
1532
1550
1551
1552
15331553
15341554
15351555
......
15371557
15381558
15391559
1540
1560
1561
15411562
15421563
15431564
......
15521573
15531574
15541575
1555
1576
1577
15561578
15571579
1558
1580
1581
1582
15591583
15601584
15611585
......
15681592
15691593
15701594
1571
1595
1596
15721597
1573
1598
1599
1600
15741601
15751602
15761603
bool copyArgument(const char *argName, const char *val, int cnt, char **argP, int *cntRemainingP)
{
int argLen = argName ? strlen(argName) : 0;
int len = argLen + cnt + 1; // +1 to account for space
int argLen = argName ? strlen(argName) : 0;
int len = argLen + cnt + 1; // + 1 to account for space.
if (argName)
{
return false;
}
if (argName) {
strncpy( *argP, argName, argLen );
if (argName)
{
strncpy(*argP, argName, argLen);
*argP += argLen;
*argP[0] = '=';
(*argP)++;
*argP += cnt;
*argP[0] = ' ';
(*argP)++;
*cntRemainingP -= len;
*cntRemainingP -= len;
return true;
}
if (( kernel = extractKernelName((char **)&cp) ))
{
strlcpy( bootInfo->bootFile, kernel, sizeof(bootInfo->bootFile) );
} else {
}
else
{
if ( getValueForKey( kKernelNameKey, &val, &cnt, &bootInfo->bootConfig ) )
{
strlcpy( bootInfo->bootFile, val, cnt+1 );
} else {
}
else
{
strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
}
}
cnt++;
strlcpy(valueBuffer + 1, val, cnt);
val = valueBuffer;
} else { /*
}
else
{ /*
if (strlen(gBootUUIDString))
{
val = "*uuid";
cnt = 5;
} else { */
}
else
{ */
// Don't set "rd=.." if there is no boot device key
// and no UUID.
val = "";
if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) )
{
strlcpy(gMKextName, val, cnt + 1);
} else {
}
else
{
gMKextName[0]=0;
}
void showHelp(void)
{
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE)
{
showInfoBox("Help. Press q to quit.\n", (char *)BootHelp_txt);
} else {
}
else
{
showTextBuffer((char *)BootHelp_txt, BootHelp_txt_len);
}
}
intfd;
intsize;
if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0) {
if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0)
{
printf("\nFile not found: %s\n", filename);
sleep(2);
return;
}
size = file_size(fd);
if (size > MAX_TEXT_FILE_SIZE) {
if (size > MAX_TEXT_FILE_SIZE)
{
size = MAX_TEXT_FILE_SIZE;
}
buf = malloc(size);
printf("Enter two-digit hexadecimal boot device [%02x]: ", bootdevice);
do {
key = getchar();
switch (ASCII_KEY(key)) {
switch (ASCII_KEY(key))
{
case KEY_BKSP:
if (digitsI > 0) {
if (digitsI > 0)
{
int x, y, t;
getCursorPositionAndType(&x, &y, &t);
// Assume x is not 0;
// Overwrite with space without moving cursor position
putca(' ', 0x07, 1);
digitsI--;
} else {
}
else
{
// TODO: Beep or something
}
break;
case KEY_ENTER:
digits[digitsI] = '\0';
newbootdevice = strtol(digits, &end, 16);
if (end == digits && *end == '\0') {
if (end == digits && *end == '\0')
{
// User entered empty string
printf("\nUsing default boot device %x\n", bootdevice);
key = 0;
break;
default:
if (isxdigit(ASCII_KEY(key)) && digitsI < 2) {
if (isxdigit(ASCII_KEY(key)) && digitsI < 2)
{
putchar(ASCII_KEY(key));
digits[digitsI++] = ASCII_KEY(key);
} else {
}
else
{
// TODO: Beep or something
}
break;
bool promptForRescanOption(void)
{
printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n");
if (getchar() == KEY_ENTER) {
if (getchar() == KEY_ENTER)
{
return true;
} else {
}
else
{
return false;
}
}
trunk/i386/libsa/zalloc.c
5757
5858
5959
60
60
6161
6262
6363
......
7878
7979
8080
81
81
82
8283
8384
8485
......
108109
109110
110111
111
112
112
113
114
115
113116
114117
115118
......
155158
156159
157160
158
161
162
159163
160164
161165
162166
163
167
168
164169
165170
166171
......
186191
187192
188193
189
194
195
190196
191197
192198
......
207213
208214
209215
210
211
216
217
218
219
212220
213221
214222
......
218226
219227
220228
221
229
230
222231
223232
224233
......
227236
228237
229238
230
239
240
231241
232242
233243
234244
235245
236
237
238
246
247
248
249
250
251
239252
240253
241254
......
246259
247260
248261
249
250
262
263
264
265
251266
252267
253268
......
270285
271286
272287
273
274
288
289
290
291
275292
276293
277294
......
287304
288305
289306
290
307
308
291309
292310
293311
......
301319
302320
303321
304
322
323
305324
306325
307326
......
311330
312331
313332
314
315
333
334
335
336
316337
317338
318339
static void zcoalesce(void);
#if ZDEBUG
size_t zalloced_size;
size_t zalloced_size;
#endif
#define ZALLOC_NODES32767 /* was 16384 */
zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes;
zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes;
if (size == 0) {
if (size == 0)
{
size = ZALLOC_LEN;
}
size = ((size + 0xf) & ~0xf);
if (size == 0) {
if (zerror) {
if (size == 0)
{
if (zerror)
{
(*zerror)((char *)0xdeadbeef, 0, file, line);
}
}
done:
if ((ret == 0) || (ret + size >= zalloc_end)) {
if (zerror) {
if (zerror)
{
(*zerror)(ret, size, file, line);
}
}
if (ret != 0) {
if (ret != 0)
{
bzero(ret, size);
}
#if ZDEBUG
rp = 0;
#endif
if (!start) {
if (!start)
{
return;
}
break;
}
}
if (!found) {
if (zerror) {
if (!found)
{
if (zerror)
{
(*zerror)(pointer, rp, "free", 0);
} else {
return;
zalloced_size -= tsize;
#endif
for (i = 0; i < availableNodes; i++) {
for (i = 0; i < availableNodes; i++)
{
if ((start + tsize) == zavailable[i].start) // merge it in
{
zavailable[i].start = start;
return;
}
if ((i > 0) && (zavailable[i-1].start + zavailable[i-1].size == start)) {
if ((i > 0) && (zavailable[i-1].start + zavailable[i-1].size == start))
{
zavailable[i-1].size += tsize;
zcoalesce();
return;
}
if ((start + tsize) < zavailable[i].start) {
if (++availableNodes > totalNodes) {
if (zerror) {
if ((start + tsize) < zavailable[i].start)
{
if (++availableNodes > totalNodes)
{
if (zerror)
{
(*zerror)((char *)0xf000f000, 0, "free", 0);
}
}
}
}
if (++availableNodes > totalNodes) {
if (zerror) {
if (++availableNodes > totalNodes)
{
if (zerror)
{
(*zerror)((char *)0xf000f000, 1, "free", 0);
}
}
zalloced[allocedNodes].start = start;
zalloced[allocedNodes].size = size;
if (++allocedNodes > totalNodes) {
if (zerror) {
if (++allocedNodes > totalNodes)
{
if (zerror)
{
(*zerror)((char *)0xf000f000, 2, "zallocate", 0);
}
};
z1 = zp + i;
z2 = z1 + 1;
for (; i >= ndx; i--, z1--, z2--) {
for (; i >= ndx; i--, z1--, z2--)
{
*z2 = *z1;
}
}
z1 = zp + ndx;
z2 = z1 + 1;
for (i = ndx; i < totalNodes - 1; i++, z1++, z2++) {
for (i = ndx; i < totalNodes - 1; i++, z1++, z2++)
{
*z1 = *z2;
}
}
{
int i;
for (i = 0; i < availableNodes-1; i++) {
if ( zavailable[i].start + zavailable[i].size == zavailable[i + 1].start ) {
for (i = 0; i < availableNodes-1; i++)
{
if ( zavailable[i].start + zavailable[i].size == zavailable[i + 1].start )
{
zavailable[i].size += zavailable[i + 1].size;
zdelete(zavailable, i + 1); availableNodes--;
return;
trunk/CHANGES
1
12
23
34
- Typo
- Make compile on gcc w/ errors enabled.
- Remove the '-x' option from the offending 'ld' command
- Makefile dependency missing for boot0 and boot1h

Archive Download the corresponding diff file

Revision: 2412