Chameleon

Chameleon Commit Details

Date:2013-12-05 02:05:01 (6 years 7 months ago)
Author:ErmaC
Commit:2281
Parents: 2280
Message:Add Karas workaround for SMBIOS table 17 http://forge.voodooprojects.org/p/chameleon/issues/361/
Changes:
M/trunk/doc/BootHelp.txt
M/trunk/i386/boot0/boot0.s
M/trunk/i386/boot2/boot.c
M/trunk/i386/boot2/boot.h
M/trunk/i386/libsaio/smbios.c
M/trunk/i386/boot1/boot1h.s

File differences

trunk/i386/libsaio/smbios.c
629629
630630
631631
632
633
634
635
636
637
638
639
640
641
642
643
632644
633645
634646
SMBWord structSize;
int i;
/* http://forge.voodooprojects.org/p/chameleon/issues/361/ */
bool forceFullMemInfo = false;
if (structPtr->orig->type == kSMBTypeMemoryDevice)
{
getBoolForKey(kMemFullInfo, &forceFullMemInfo, &bootInfo->chameleonConfig);
if (forceFullMemInfo)
{
structPtr->orig->length = 27;
}
}
stringIndex = 1;
stringsSize = 0;
trunk/i386/boot0/boot0.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
......
2626
2727
2828
29
29
3030
3131
3232
......
7979
8080
8181
82
82
8383
8484
8585
......
9292
9393
9494
95
95
9696
9797
9898
......
100100
101101
102102
103
103
104104
105105
106106
......
117117
118118
119119
120
120
121121
122122
123123
......
133133
134134
135135
136
136
137137
138138
139139
......
149149
150150
151151
152
152
153153
154154
155155
......
186186
187187
188188
189
189
190190
191191
192192
......
404404
405405
406406
407
407408
408409
409410
......
444445
445446
446447
447
448
448449
449450
450451
......
472473
473474
474475
475
476476
477477
478478
......
496496
497497
498498
499
499
500500
501501
502502
......
535535
536536
537537
538
539538
540
541539
542540
543541
......
648646
649647
650648
651
649
652650
653651
654652
......
660658
661659
662660
663
661
664662
665663
666664
......
669667
670668
671669
672
670
673671
674672
675
673
676674
677675
678676
......
757755
758756
759757
760
761758
759
762760
763761
764762
......
793791
794792
795793
796
797
794
795
798796
799797
800798
; 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@
;
; Boot Loader: boot0
; responsibility is to locate the active partition, load the
; partition booter into memory, and jump to the booter's entry point.
; It leaves the boot drive in DL and a pointer to the partition entry in SI.
;
;
; This boot loader must be placed in the Master Boot Record.
;
; In order to coexist with a fdisk partition table (64 bytes), and
kHFSPSignatureEQU 'H+'; HFS+ volume signature
kHFSPCaseSignatureEQU 'HX'; HFS+ volume case-sensitive signature
kFAT32BootCodeOffset EQU 0x5a; offset of boot code in FAT32 boot sector
kBoot1FAT32MagicEQU 'BO'; Magic string to detect our boot1f32 code
kBoot1FAT32MagicEQU 'BO'; Magic string to detect our boot1f32 code
kGPTSignatureLowEQU 'EFI '; GUID Partition Table Header Signature
; in LBA 0 (that is, the first block) precedes the
; GUID Partition Table Header to maintain compatibility
; with existing tools that do not understand GPT partition structures.
; The Protective MBR has the same format as a legacy MBR
; The Protective MBR has the same format as a legacy MBR
; and contains one partition entry with an OSType set to 0xEE
; reserving the entire space used on the disk by the GPT partitions,
; including all headers.
kPartActive EQU 0x80; active flag enabled
kPartInactive EQU 0x00; active flag disabled
kHFSGUID EQU 0x48465300; first 4 bytes of Apple HFS Partition Type GUID.
kAppleGUIDEQU 0xACEC4365; last 4 bytes of Apple type GUIDs.
kAppleGUIDEQU 0xACEC4365; last 4 bytes of Apple type GUIDs.
kEFISystemGUIDEQU 0x3BC93EC9; last 4 bytes of EFI System Partition Type GUID:
; C12A7328-F81F-11D2-BA4B-00A0C93EC93B
; giving the size of the structure.
;
struc part
.bootid resb 1 ; bootable or not
.bootid resb 1 ; bootable or not
.head resb 1 ; starting head, sector, cylinder
.sect resb 1 ;
.cyl resb 1 ;
; Format of GPT Partition Table Header
;
strucgpth
.Signature resb8
.Signature resb8
.Revision resb4
.HeaderSizeresb4
.HeaderCRC32resb4
.PartitionEntryArrayCRC32resb4
endstruc
;
;
; Format of GUID Partition Entry Array
;
strucgpta
SEGMENT .text
ORG kBoot0RelocAddr
;--------------------------------------------------------------------------
; Boot code is loaded at 0:7C00h.
;
mov [my_lba], eax; save starting LBA for read_lba function
mov cx, [si + gpth.NumberOfPartitionEntries]; number of GUID Partition Array entries
mov bx, [si + gpth.SizeOfPartitionEntry]; size of GUID Partition Array entry
push bx; push size of GUID Partition entry
;
.gpt_loop:
mov eax, [si + gpta.PartitionTypeGUID + kGUIDLastDwordOffs]
cmpeax, kAppleGUID; check current GUID Partition for Apple's GUID type
je.gpt_ok
jmp SHORT initBootLoader
.gpt_continue:
add si, bx; advance SI to next partition entry
loop .gpt_loop; loop through all partition entries
;
loadBootSector:
pusha
mov al, 3
mov bx, kBoot0LoadAddr
call load
cmp WORD [di + kSectorBytes - 2], kBootSignature
.exit:
popa
ret
popad
ret
;--------------------------------------------------------------------------
; Write a string with 'boot0: ' prefix to the console.
;
;
log_string:
pusha
pushdi
movsi, log_title_str
callprint_string
callprint_string
popa
ret
;--------------------------------------------------------------------------
; Write a string to the console.
;
popa
ret
%endif ;DEBUG
;--------------------------------------------------------------------------
; NULL terminated strings.
;
pad_table_and_sig:
times 510-($-$$) db 0
dw kBootSignature
ABSOLUTE 0xE400
;
trunk/i386/boot1/boot1h.s
2525
2626
2727
28
28
2929
3030
3131
......
256256
257257
258258
259
259
260260
261261
262262
......
368368
369369
370370
371
371372
372373
373374
......
510511
511512
512513
513
514
514515
515516
516517
......
546547
547548
548549
549
550
550551
551552
552553
......
656657
657658
658659
659
660
660661
661662
662663
......
714715
715716
716717
717
718
718719
719720
720721
......
773774
774775
775776
776
777
777778
778779
779780
......
842843
843844
844845
845
846
846847
847848
848849
849850
850
851
851852
852853
853
854
854855
855856
856857
......
913914
914915
915916
916
917
917918
918919
919
920
920921
921922
922923
; This program is designed to reside in sector 0+1 of an HFS+ partition.
; It expects that the MBR has left the drive number in DL
; and a pointer to the partition entry in SI.
;
;
; This version requires a BIOS with EBIOS (LBA) support.
;
; This code is written for the NASM assembler.
.fileModeresw1
.specialresd1
endstruc
;
; FileInfo
;
; Set up the stack to grow down from kBoot1StackSegment:kBoot1StackAddress.
; Interrupts should be off while the stack is being manipulated.
;
cli ; interrupts off
xorax, ax ; zero ax
movss, ax ; ss <- 0
; Arguments:
; AX = number of 512-byte sectors to read (valid from 1-1280).
; EDX = pointer to where the sectors should be stored.
; ECX = sector offset in partition
; ECX = sector offset in partition
;
; Returns:
; CF = 0 success
; Arguments:
; AL = number of 512-byte sectors to read (valid from 1-127).
; EDX = pointer to where the sectors should be stored.
; ECX = sector offset in partition
; ECX = sector offset in partition
; [bios_drive_number] = drive number (0x80 + unit number)
;
; Returns:
callprint_string
popad
ret
;-------------------------------------------------------------------------
popad
ret
print_nibble:
and al, 0x0f
add al, '0'
inccl; increment string length count
cmpal, NULL; check for string terminator
jne.loop
popdi; restore unicode string length pointer
deccl; ignoring terminator from length count
mov[di], cl; save string length
;
compareHFSPlusExtentKeys:
pushad
movdl, 0; DL = result of comparison, DH = bestGuess
moveax, [si + HFSPlusExtentKey.fileID]
cmpeax, [di + HFSPlusExtentKey.fileID]
jne.checkFlags
cmpBYTE [si + HFSPlusExtentKey.forkType], kForkTypeData
jne.checkFlags
moveax, [si + HFSPlusExtentKey.startBlock]
cmpeax, [di + HFSPlusExtentKey.startBlock]
jecompareHFSPlusCatalogKeys.exit
.trialKeyGreater:
decdl
jmp.exit
.searchKeyGreater:
incdl
.exit:
mov[bp + BTree.searchResult], dl
cmpdl, 0; set flags to check relation between keys
trunk/i386/boot2/boot.c
464464
465465
466466
467
467
468468
469469
470470
gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
getchar();
#endif
useGUI = true;
// Override useGUI default
getBoolForKey(kGUIKey, &useGUI, &bootInfo->chameleonConfig);
trunk/i386/boot2/boot.h
154154
155155
156156
157
158
159
157160
158161
159162
#define kHDEFLayoutID"HDEFLayoutID"/* hda.c */
#define kHDAULayoutID"HDAULayoutID"/* hda.c */
/* Karas: added these keys */
#define kMemFullInfo"ForceFullMemInfo"/* smbios.c */
/*
* Flags to the booter or kernel
*/
trunk/doc/BootHelp.txt
135135
136136
137137
138
138
139
140
139141
140142
141143
EnableC3State=Yes Enable specific Processor power state, C3.
EnableC4State=Yes Enable specific Processor power state, C4.
SMBIOS=<file> Use an alternate SMBIOS.plist file
ForceFullMemInfo=Yes Force SMBIOS Table 17 to be 27 bytes long (disabled by default).
SMBIOS=<file> Use an alternate SMBIOS.plist file
(default path: /smbios.plist /Extra/smbios.plist
bt(0,0)/Extra/smbios.plist).

Archive Download the corresponding diff file

Revision: 2281