Chameleon

Chameleon Commit Details

Date:2012-01-17 23:32:17 (12 years 3 months ago)
Author:armel cadet-petit
Commit:1804
Parents: 1803
Message:Please, see change log
Changes:
A/branches/cparm/i386/libsa/udivdi3.c
A/branches/cparm/i386/libsa/qdivrem.c
A/branches/cparm/i386/libsa/moddi3.c
A/branches/cparm/i386/libsaio/arc4random.c
A/branches/cparm/i386/libsa/bzero.s
A/branches/cparm/i386/libsa/umoddi3.c
A/branches/cparm/i386/libsa/divdi3.c
A/branches/cparm/i386/libsaio/cpu_intel_amd.c
A/branches/cparm/i386/libsa/bcopy.s
A/branches/cparm/i386/libsaio/stack_protector.c
A/branches/cparm/i386/libsa/quad.h
M/branches/cparm/i386/libsa/string.c
M/branches/cparm/i386/libsaio/stringTable.c
M/branches/cparm/i386/boot2/modules.h
M/branches/cparm/i386/util/Symbols.c
M/branches/cparm/Chameleon.xcodeproj/project.pbxproj
M/branches/cparm/i386/modules/SMBiosPatcher/Makefile
M/branches/cparm/i386/modules/CPUfreq/Makefile
M/branches/cparm/i386/util/Makefile
M/branches/cparm/i386/libsaio/disk.c
M/branches/cparm/i386/modules/Memory/Makefile
M/branches/cparm/i386/libsaio/Makefile
M/branches/cparm/i386/libsaio/saio_internal.h
M/branches/cparm/i386/boot2/options.c
M/branches/cparm/i386/modules/NetbookInstaller/Makefile
M/branches/cparm/i386/libsaio/console.c
M/branches/cparm/i386/boot2/graphics.c
M/branches/cparm/i386/modules/RamDiskLoader/Makefile
M/branches/cparm/i386/modules/YellowIconFixer/Makefile
M/branches/cparm/i386/modules/KextPatcher/Makefile
M/branches/cparm/i386/libsa/Makefile
M/branches/cparm/i386/modules/ACPIPatcher/Makefile
M/branches/cparm/i386/modules/Networking/Makefile
M/branches/cparm/i386/modules/ACPICodec/acpi_codec.c
M/branches/cparm/i386/modules/GraphicsEnabler/Makefile
M/branches/cparm/CHANGES
M/branches/cparm/i386/libsaio/sys.c
M/branches/cparm/i386/modules/Keymapper/Makefile
M/branches/cparm/i386/boot2/drivers.c
M/branches/cparm/i386/modules/USBFix/Makefile
M/branches/cparm/i386/modules/HPET/Makefile
M/branches/cparm/i386/libsaio/saio_types.h
M/branches/cparm/i386/modules/Resolution/Makefile
M/branches/cparm/i386/libsaio/fake_efi.c
M/branches/cparm/i386/modules/KextPatcher/kext_patcher.c
M/branches/cparm/i386/libsa/setjmp.s
M/branches/cparm/i386/libsaio/misc.c
M/branches/cparm/i386/libsa/zalloc.c
M/branches/cparm/i386/modules/ACPICodec/Makefile
M/branches/cparm/i386/modules/HelloWorld/Makefile
M/branches/cparm/i386/modules/GUI/gui.c
M/branches/cparm/i386/libsa/strtol.c
M/branches/cparm/i386/boot2/Makefile
M/branches/cparm/i386/libsa/prf.c
M/branches/cparm/i386/boot2/boot.c
M/branches/cparm/i386/modules/GUI/Makefile
M/branches/cparm/i386/libsa/libsa.h
M/branches/cparm/i386/libsaio/internal_modules.h
M/branches/cparm/i386/modules/KernelPatcher/Makefile
M/branches/cparm/i386/boot2/modules.c
M/branches/cparm/i386/libsaio/pci.c
M/branches/cparm/i386/modules/HibernateEnabler/Makefile
M/branches/cparm/i386/modules/SMBiosGetters/Makefile

File differences

branches/cparm/Chameleon.xcodeproj/project.pbxproj
77
88
99
10
11
12
13
14
15
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
16296
17297
18298
......
28308
29309
30310
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173311
174312
175313
......
298436
299437
300438
301
302
303439
304
305440
306441
307442
......
310445
311446
312447
313
448
314449
315450
316451
317452
318453
319
320454
321
322455
323456
324457
......
326459
327460
328461
329
462
330463
331464
332
465
466
467
468
469
470
471
472
473
474
475
476
333477
334
478
335479
336480
337
481
338482
339483
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
484
485
486
487
355488
356
489
357490
358491
359
492
360493
361494
362
363
364
365
366
367
368
369
370
371
372
495
496
497
498
499
500
373501
374
502
375503
376504
377
505
378506
379507
380
381
382
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
383528
384
529
385530
386531
387
532
388533
389534
390
391
392
393
394
395
396
535
536
537
397538
398
539
399540
400541
401
542
402543
403544
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
545
546
432547
433
548
434549
435550
436
551
437552
438553
439
440
441
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
442576
443
577
444578
445579
446
580
447581
448582
449
450
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
451673
452
674
453675
454676
455
677
456678
457679
458
459
460
461
462
463
464
465
466
467
468
469
470
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
471701
472
702
473703
474704
475
705
476706
477707
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
708
709
710
711
712
713
714
715
566716
567
717
568718
569719
570
720
571721
572722
573
574
723
724
725
726
727
728
575729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
576980
577981
578982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
5791025
5801026
5811027
objects = {
/* Begin PBXFileReference section */
0172D0DC11FB66820030222E /* dram_controllers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dram_controllers.h; sourceTree = "<group>"; };
0172D0DD11FB66820030222E /* dram_controllers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dram_controllers.c; sourceTree = "<group>"; };
019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = "<group>"; };
1D145307137073F40050C0CD /* bootargs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootargs.h; sourceTree = "<group>"; };
1D2A1AF513743A2600787720 /* bootargs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootargs.h; sourceTree = "<group>"; };
65ED53931204B83200B22507 /* disk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = "<group>"; };
AB0E930C14C6223500F798D7 /* cpu_intel_amd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu_intel_amd.c; sourceTree = "<group>"; };
AB43B2B714C37E520018D529 /* boot0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0.s; sourceTree = "<group>"; };
AB43B2B814C37E520018D529 /* boot0md.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0md.s; sourceTree = "<group>"; };
AB43B2B914C37E520018D529 /* chain0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = chain0.s; sourceTree = "<group>"; };
AB43B2BA14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B2BC14C37E520018D529 /* boot1f32-install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "boot1f32-install.sh"; sourceTree = "<group>"; };
AB43B2BD14C37E520018D529 /* boot1f32.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1f32.s; sourceTree = "<group>"; };
AB43B2BE14C37E520018D529 /* boot1h.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1h.s; sourceTree = "<group>"; };
AB43B2BF14C37E520018D529 /* boot1he.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1he.s; sourceTree = "<group>"; };
AB43B2C014C37E520018D529 /* boot1hp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1hp.s; sourceTree = "<group>"; };
AB43B2C114C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B2C314C37E520018D529 /* appleboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleboot.h; sourceTree = "<group>"; };
AB43B2C414C37E520018D529 /* appleClut8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleClut8.h; sourceTree = "<group>"; };
AB43B2C514C37E520018D529 /* boot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = boot.c; sourceTree = "<group>"; };
AB43B2C614C37E520018D529 /* boot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boot.h; sourceTree = "<group>"; };
AB43B2C714C37E520018D529 /* boot2.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot2.s; sourceTree = "<group>"; };
AB43B2C814C37E520018D529 /* drivers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = drivers.c; sourceTree = "<group>"; };
AB43B2C914C37E520018D529 /* drivers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = drivers.h; sourceTree = "<group>"; };
AB43B2CA14C37E520018D529 /* failedboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = failedboot.h; sourceTree = "<group>"; };
AB43B2CB14C37E520018D529 /* graphics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphics.c; sourceTree = "<group>"; };
AB43B2CC14C37E520018D529 /* graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphics.h; sourceTree = "<group>"; };
AB43B2CD14C37E520018D529 /* lzss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzss.c; sourceTree = "<group>"; };
AB43B2CE14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B2CF14C37E520018D529 /* mboot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mboot.c; sourceTree = "<group>"; };
AB43B2D014C37E520018D529 /* mboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mboot.h; sourceTree = "<group>"; };
AB43B2D114C37E520018D529 /* modules.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = modules.c; sourceTree = "<group>"; };
AB43B2D214C37E520018D529 /* modules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = modules.h; sourceTree = "<group>"; };
AB43B2D314C37E520018D529 /* multiboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multiboot.h; sourceTree = "<group>"; };
AB43B2D414C37E520018D529 /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = "<group>"; };
AB43B2D514C37E520018D529 /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options.h; sourceTree = "<group>"; };
AB43B2D614C37E520018D529 /* prompt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prompt.c; sourceTree = "<group>"; };
AB43B2D814C37E520018D529 /* cdboot.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboot.s; sourceTree = "<group>"; };
AB43B2D914C37E520018D529 /* cdboothdd.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboothdd.s; sourceTree = "<group>"; };
AB43B2DA14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B2DC14C37E520018D529 /* Limits */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Limits; sourceTree = "<group>"; };
AB43B2DD14C37E520018D529 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
AB43B2DF14C37E520018D529 /* efi_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = efi_tables.c; sourceTree = "<group>"; };
AB43B2E014C37E520018D529 /* efi_tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi_tables.h; sourceTree = "<group>"; };
AB43B2E114C37E520018D529 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = "<group>"; };
AB43B2E214C37E520018D529 /* libsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsa.h; sourceTree = "<group>"; };
AB43B2E314C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B2E414C37E520018D529 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
AB43B2E514C37E520018D529 /* prf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prf.c; sourceTree = "<group>"; };
AB43B2E614C37E520018D529 /* printf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printf.c; sourceTree = "<group>"; };
AB43B2E714C37E520018D529 /* qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qsort.c; sourceTree = "<group>"; };
AB43B2E814C37E520018D529 /* rand.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rand.c; sourceTree = "<group>"; };
AB43B2E914C37E520018D529 /* setjmp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = "<group>"; };
AB43B2EA14C37E520018D529 /* string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = string.c; sourceTree = "<group>"; };
AB43B2EB14C37E520018D529 /* strtol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strtol.c; sourceTree = "<group>"; };
AB43B2EC14C37E520018D529 /* zalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zalloc.c; sourceTree = "<group>"; };
AB43B2EE14C37E520018D529 /* acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = "<group>"; };
AB43B2EF14C37E520018D529 /* acpi_tools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_tools.c; sourceTree = "<group>"; };
AB43B2F014C37E520018D529 /* acpi_tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_tools.h; sourceTree = "<group>"; };
AB43B2F114C37E520018D529 /* allocate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = allocate.c; sourceTree = "<group>"; };
AB43B2F214C37E520018D529 /* apic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apic.h; sourceTree = "<group>"; };
AB43B2F314C37E520018D529 /* asm.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = asm.s; sourceTree = "<group>"; };
AB43B2F414C37E520018D529 /* befs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = befs.c; sourceTree = "<group>"; };
AB43B2F514C37E520018D529 /* befs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = befs.h; sourceTree = "<group>"; };
AB43B2F614C37E520018D529 /* bios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bios.h; sourceTree = "<group>"; };
AB43B2F714C37E520018D529 /* bios.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bios.s; sourceTree = "<group>"; };
AB43B2F814C37E520018D529 /* biosfn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = biosfn.c; sourceTree = "<group>"; };
AB43B2F914C37E520018D529 /* bootLion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootLion.h; sourceTree = "<group>"; };
AB43B2FA14C37E520018D529 /* bootstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bootstruct.c; sourceTree = "<group>"; };
AB43B2FB14C37E520018D529 /* bootstruct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootstruct.h; sourceTree = "<group>"; };
AB43B2FC14C37E520018D529 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
AB43B2FD14C37E520018D529 /* console.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = console.c; sourceTree = "<group>"; };
AB43B2FE14C37E520018D529 /* convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = convert.c; sourceTree = "<group>"; };
AB43B2FF14C37E520018D529 /* convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert.h; sourceTree = "<group>"; };
AB43B30014C37E520018D529 /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu.c; sourceTree = "<group>"; };
AB43B30114C37E520018D529 /* cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = "<group>"; };
AB43B30214C37E520018D529 /* cpu_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_data.h; sourceTree = "<group>"; };
AB43B30314C37E520018D529 /* cpuid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpuid.h; sourceTree = "<group>"; };
AB43B30414C37E520018D529 /* datatype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = datatype.h; sourceTree = "<group>"; };
AB43B30514C37E520018D529 /* device_inject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_inject.c; sourceTree = "<group>"; };
AB43B30614C37E520018D529 /* device_inject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_inject.h; sourceTree = "<group>"; };
AB43B30714C37E520018D529 /* device_tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_tree.c; sourceTree = "<group>"; };
AB43B30814C37E520018D529 /* device_tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_tree.h; sourceTree = "<group>"; };
AB43B30914C37E520018D529 /* disk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = disk.c; sourceTree = "<group>"; };
AB43B30A14C37E520018D529 /* disk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = disk.h; sourceTree = "<group>"; };
AB43B30B14C37E520018D529 /* efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi.h; sourceTree = "<group>"; };
AB43B30C14C37E520018D529 /* exfat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = exfat.c; sourceTree = "<group>"; };
AB43B30D14C37E520018D529 /* exfat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = exfat.h; sourceTree = "<group>"; };
AB43B30E14C37E520018D529 /* ext2fs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ext2fs.c; sourceTree = "<group>"; };
AB43B30F14C37E520018D529 /* ext2fs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ext2fs.h; sourceTree = "<group>"; };
AB43B31014C37E520018D529 /* fake_efi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fake_efi.c; sourceTree = "<group>"; };
AB43B31114C37E520018D529 /* fake_efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fake_efi.h; sourceTree = "<group>"; };
AB43B31214C37E520018D529 /* fdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fdisk.h; sourceTree = "<group>"; };
AB43B31314C37E520018D529 /* freebsd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = freebsd.c; sourceTree = "<group>"; };
AB43B31414C37E520018D529 /* freebsd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = freebsd.h; sourceTree = "<group>"; };
AB43B31514C37E520018D529 /* hfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hfs.c; sourceTree = "<group>"; };
AB43B31614C37E520018D529 /* hfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hfs.h; sourceTree = "<group>"; };
AB43B31714C37E520018D529 /* hfs_CaseTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hfs_CaseTables.h; sourceTree = "<group>"; };
AB43B31814C37E520018D529 /* hfs_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hfs_compare.c; sourceTree = "<group>"; };
AB43B31914C37E520018D529 /* intel_acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intel_acpi.h; sourceTree = "<group>"; };
AB43B31A14C37E520018D529 /* internal_modules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internal_modules.h; sourceTree = "<group>"; };
AB43B31B14C37E520018D529 /* io_inline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io_inline.h; sourceTree = "<group>"; };
AB43B31C14C37E520018D529 /* libsaio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsaio.h; sourceTree = "<group>"; };
AB43B31D14C37E520018D529 /* load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load.c; sourceTree = "<group>"; };
AB43B31E14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B31F14C37E520018D529 /* md5c.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5c.c; sourceTree = "<group>"; };
AB43B32014C37E520018D529 /* misc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = misc.c; sourceTree = "<group>"; };
AB43B32114C37E520018D529 /* msdos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msdos.c; sourceTree = "<group>"; };
AB43B32214C37E520018D529 /* msdos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msdos.h; sourceTree = "<group>"; };
AB43B32314C37E520018D529 /* msdos_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msdos_private.h; sourceTree = "<group>"; };
AB43B32414C37E520018D529 /* nbp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nbp.c; sourceTree = "<group>"; };
AB43B32514C37E520018D529 /* nbp_cmd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nbp_cmd.h; sourceTree = "<group>"; };
AB43B32614C37E520018D529 /* ntfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ntfs.c; sourceTree = "<group>"; };
AB43B32714C37E520018D529 /* ntfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntfs.h; sourceTree = "<group>"; };
AB43B32814C37E520018D529 /* ntfs_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntfs_private.h; sourceTree = "<group>"; };
AB43B32914C37E520018D529 /* openbsd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = openbsd.c; sourceTree = "<group>"; };
AB43B32A14C37E520018D529 /* openbsd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = openbsd.h; sourceTree = "<group>"; };
AB43B32B14C37E520018D529 /* pci.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci.c; sourceTree = "<group>"; };
AB43B32C14C37E520018D529 /* pci.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pci.h; sourceTree = "<group>"; };
AB43B32D14C37E520018D529 /* pci_root.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci_root.c; sourceTree = "<group>"; };
AB43B32E14C37E520018D529 /* pci_root.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pci_root.h; sourceTree = "<group>"; };
AB43B32F14C37E520018D529 /* platform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = platform.c; sourceTree = "<group>"; };
AB43B33014C37E520018D529 /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = "<group>"; };
AB43B33114C37E520018D529 /* ppm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppm.h; sourceTree = "<group>"; };
AB43B33214C37E520018D529 /* ppmsetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppmsetup.h; sourceTree = "<group>"; };
AB43B33314C37E520018D529 /* saio_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saio_internal.h; sourceTree = "<group>"; };
AB43B33414C37E520018D529 /* saio_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saio_types.h; sourceTree = "<group>"; };
AB43B33514C37E520018D529 /* sl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sl.h; sourceTree = "<group>"; };
AB43B33614C37E520018D529 /* smbios.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios.c; sourceTree = "<group>"; };
AB43B33714C37E520018D529 /* SMBIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SMBIOS.h; sourceTree = "<group>"; };
AB43B33814C37E520018D529 /* smp-imps.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "smp-imps.c"; sourceTree = "<group>"; };
AB43B33914C37E520018D529 /* smp-imps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "smp-imps.h"; sourceTree = "<group>"; };
AB43B33A14C37E520018D529 /* stringTable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stringTable.c; sourceTree = "<group>"; };
AB43B33B14C37E520018D529 /* sys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sys.c; sourceTree = "<group>"; };
AB43B33C14C37E520018D529 /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = "<group>"; };
AB43B33D14C37E520018D529 /* ufs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ufs.c; sourceTree = "<group>"; };
AB43B33E14C37E520018D529 /* ufs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ufs.h; sourceTree = "<group>"; };
AB43B33F14C37E520018D529 /* ufs_byteorder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ufs_byteorder.c; sourceTree = "<group>"; };
AB43B34014C37E520018D529 /* ufs_byteorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ufs_byteorder.h; sourceTree = "<group>"; };
AB43B34114C37E520018D529 /* vbe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vbe.c; sourceTree = "<group>"; };
AB43B34214C37E520018D529 /* vbe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vbe.h; sourceTree = "<group>"; };
AB43B34314C37E520018D529 /* xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = "<group>"; };
AB43B34414C37E520018D529 /* xml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = "<group>"; };
AB43B34514C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B34614C37E520018D529 /* MakeInc.dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MakeInc.dir; sourceTree = "<group>"; };
AB43B34714C37E520018D529 /* MakePaths.dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MakePaths.dir; sourceTree = "<group>"; };
AB43B34A14C37E520018D529 /* acpi_codec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_codec.c; sourceTree = "<group>"; };
AB43B34B14C37E520018D529 /* acpi_codec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_codec.h; sourceTree = "<group>"; };
AB43B34C14C37E520018D529 /* acpicode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpicode.c; sourceTree = "<group>"; };
AB43B34D14C37E520018D529 /* acpicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpicode.h; sourceTree = "<group>"; };
AB43B34E14C37E520018D529 /* ACPICodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ACPICodec.c; sourceTree = "<group>"; };
AB43B34F14C37E520018D529 /* acpidecode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpidecode.c; sourceTree = "<group>"; };
AB43B35014C37E520018D529 /* acpidecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpidecode.h; sourceTree = "<group>"; };
AB43B35114C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B35314C37E520018D529 /* acpi_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_patcher.c; sourceTree = "<group>"; };
AB43B35414C37E520018D529 /* acpi_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_patcher.h; sourceTree = "<group>"; };
AB43B35514C37E520018D529 /* AcpiPatcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = AcpiPatcher.c; sourceTree = "<group>"; };
AB43B35614C37E520018D529 /* aml_generator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aml_generator.c; sourceTree = "<group>"; };
AB43B35714C37E520018D529 /* aml_generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aml_generator.h; sourceTree = "<group>"; };
AB43B35814C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B35A14C37E520018D529 /* CPUfreq.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = CPUfreq.c; sourceTree = "<group>"; };
AB43B35B14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B35D14C37E520018D529 /* ati.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ati.c; sourceTree = "<group>"; };
AB43B35E14C37E520018D529 /* ati.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ati.h; sourceTree = "<group>"; };
AB43B35F14C37E520018D529 /* ati_reg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ati_reg.h; sourceTree = "<group>"; };
AB43B36014C37E520018D529 /* gma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gma.c; sourceTree = "<group>"; };
AB43B36114C37E520018D529 /* gma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gma.h; sourceTree = "<group>"; };
AB43B36214C37E520018D529 /* GraphicsEnabler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = GraphicsEnabler.c; sourceTree = "<group>"; };
AB43B36314C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B36414C37E520018D529 /* nvidia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nvidia.c; sourceTree = "<group>"; };
AB43B36514C37E520018D529 /* nvidia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nvidia.h; sourceTree = "<group>"; };
AB43B36714C37E520018D529 /* graphic_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphic_utils.c; sourceTree = "<group>"; };
AB43B36814C37E520018D529 /* graphic_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphic_utils.h; sourceTree = "<group>"; };
AB43B36914C37E520018D529 /* gui.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gui.c; sourceTree = "<group>"; };
AB43B36A14C37E520018D529 /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = "<group>"; };
AB43B36B14C37E520018D529 /* GUI_appleboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUI_appleboot.h; sourceTree = "<group>"; };
AB43B36C14C37E520018D529 /* GUI_module.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = GUI_module.c; sourceTree = "<group>"; };
AB43B36D14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B36E14C37E520018D529 /* picopng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = picopng.c; sourceTree = "<group>"; };
AB43B36F14C37E520018D529 /* picopng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picopng.h; sourceTree = "<group>"; };
AB43B37114C37E520018D529 /* HelloWorld.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = HelloWorld.c; sourceTree = "<group>"; };
AB43B37214C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B37414C37E520018D529 /* bmdecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bmdecompress.c; sourceTree = "<group>"; };
AB43B37514C37E520018D529 /* bmdecompress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bmdecompress.h; sourceTree = "<group>"; };
AB43B37614C37E520018D529 /* graphic_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphic_utils.c; sourceTree = "<group>"; };
AB43B37714C37E520018D529 /* graphic_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphic_utils.h; sourceTree = "<group>"; };
AB43B37814C37E520018D529 /* HibernateEnabler.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = HibernateEnabler.c; sourceTree = "<group>"; };
AB43B37914C37E520018D529 /* IOHibernatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOHibernatePrivate.h; sourceTree = "<group>"; };
AB43B37A14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B37B14C37E520018D529 /* resume.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resume.c; sourceTree = "<group>"; };
AB43B37C14C37E520018D529 /* resume.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resume.h; sourceTree = "<group>"; };
AB43B37E14C37E520018D529 /* HPET.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = HPET.c; sourceTree = "<group>"; };
AB43B37F14C37E520018D529 /* hpet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hpet.h; sourceTree = "<group>"; };
AB43B38014C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B38214C37E520018D529 /* kernel_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kernel_patcher.c; sourceTree = "<group>"; };
AB43B38314C37E520018D529 /* kernel_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_patcher.h; sourceTree = "<group>"; };
AB43B38414C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B38614C37E520018D529 /* adler32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = adler32.c; sourceTree = "<group>"; };
AB43B38714C37E520018D529 /* deflate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = deflate.c; sourceTree = "<group>"; };
AB43B38814C37E520018D529 /* deflate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deflate.h; sourceTree = "<group>"; };
AB43B38914C37E520018D529 /* hex_editor.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hex_editor.c; sourceTree = "<group>"; };
AB43B38A14C37E520018D529 /* hex_editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hex_editor.h; sourceTree = "<group>"; };
AB43B38B14C37E520018D529 /* inffast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inffast.c; sourceTree = "<group>"; };
AB43B38C14C37E520018D529 /* inffast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inffast.h; sourceTree = "<group>"; };
AB43B38D14C37E520018D529 /* inffixed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inffixed.h; sourceTree = "<group>"; };
AB43B38E14C37E520018D529 /* inflate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inflate.c; sourceTree = "<group>"; };
AB43B38F14C37E520018D529 /* inflate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inflate.h; sourceTree = "<group>"; };
AB43B39014C37E520018D529 /* inftrees.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inftrees.c; sourceTree = "<group>"; };
AB43B39114C37E520018D529 /* inftrees.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inftrees.h; sourceTree = "<group>"; };
AB43B39214C37E520018D529 /* kext_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kext_patcher.c; sourceTree = "<group>"; };
AB43B39314C37E520018D529 /* kext_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kext_patcher.h; sourceTree = "<group>"; };
AB43B39414C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B39514C37E520018D529 /* mkext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mkext.h; sourceTree = "<group>"; };
AB43B39614C37E520018D529 /* trees.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = trees.c; sourceTree = "<group>"; };
AB43B39714C37E520018D529 /* trees.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = trees.h; sourceTree = "<group>"; };
AB43B39814C37E520018D529 /* zconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zconf.h; sourceTree = "<group>"; };
AB43B39914C37E520018D529 /* zlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zlib.h; sourceTree = "<group>"; };
AB43B39A14C37E520018D529 /* zutil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zutil.c; sourceTree = "<group>"; };
AB43B39B14C37E520018D529 /* zutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zutil.h; sourceTree = "<group>"; };
AB43B39D14C37E520018D529 /* Keylayout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Keylayout.c; sourceTree = "<group>"; };
AB43B39E14C37E520018D529 /* Keylayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Keylayout.h; sourceTree = "<group>"; };
AB43B39F14C37E520018D529 /* Keymapper.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Keymapper.c; sourceTree = "<group>"; };
AB43B3A014C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3A114C37E520018D529 /* term.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = term.h; sourceTree = "<group>"; };
AB43B3A214C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3A414C37E520018D529 /* dram_controllers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dram_controllers.c; sourceTree = "<group>"; };
AB43B3A514C37E520018D529 /* dram_controllers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dram_controllers.h; sourceTree = "<group>"; };
AB43B3A614C37E520018D529 /* GPL_V2_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL_V2_LICENSE; sourceTree = "<group>"; };
AB43B3A714C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3A814C37E520018D529 /* mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mem.c; sourceTree = "<group>"; };
AB43B3A914C37E520018D529 /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = "<group>"; };
AB43B3AA14C37E520018D529 /* Memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Memory.c; sourceTree = "<group>"; };
AB43B3AB14C37E520018D529 /* MEMTEST86_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MEMTEST86_LICENSE; sourceTree = "<group>"; };
AB43B3AC14C37E520018D529 /* memvendors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memvendors.h; sourceTree = "<group>"; };
AB43B3AD14C37E520018D529 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
AB43B3AE14C37E520018D529 /* spd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spd.c; sourceTree = "<group>"; };
AB43B3AF14C37E520018D529 /* spd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spd.h; sourceTree = "<group>"; };
AB43B3B114C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3B214C37E520018D529 /* NBI.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = NBI.c; sourceTree = "<group>"; };
AB43B3B414C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3B514C37E520018D529 /* Networking.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Networking.c; sourceTree = "<group>"; };
AB43B3B714C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3B814C37E520018D529 /* ramdisk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ramdisk.c; sourceTree = "<group>"; };
AB43B3B914C37E520018D529 /* ramdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ramdisk.h; sourceTree = "<group>"; };
AB43B3BA14C37E520018D529 /* RamDiskLoader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = RamDiskLoader.c; sourceTree = "<group>"; };
AB43B3BC14C37E520018D529 /* 915resolution.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = 915resolution.c; sourceTree = "<group>"; };
AB43B3BD14C37E520018D529 /* 915resolution.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 915resolution.h; sourceTree = "<group>"; };
AB43B3BE14C37E520018D529 /* edid.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = edid.c; sourceTree = "<group>"; };
AB43B3BF14C37E520018D529 /* edid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = edid.h; sourceTree = "<group>"; };
AB43B3C014C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3C114C37E520018D529 /* Resolution.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Resolution.c; sourceTree = "<group>"; };
AB43B3C214C37E520018D529 /* shortatombios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shortatombios.h; sourceTree = "<group>"; };
AB43B3C414C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3C514C37E520018D529 /* mysmbios.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mysmbios.c; sourceTree = "<group>"; };
AB43B3C614C37E520018D529 /* mysmbios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mysmbios.h; sourceTree = "<group>"; };
AB43B3C714C37E520018D529 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
AB43B3C814C37E520018D529 /* smbios_decode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios_decode.c; sourceTree = "<group>"; };
AB43B3C914C37E520018D529 /* smbios_getters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios_getters.c; sourceTree = "<group>"; };
AB43B3CA14C37E520018D529 /* smbios_getters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smbios_getters.h; sourceTree = "<group>"; };
AB43B3CB14C37E520018D529 /* SMBiosGetters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SMBiosGetters.c; sourceTree = "<group>"; };
AB43B3CD14C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3CE14C37E520018D529 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
AB43B3CF14C37E520018D529 /* smbios_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios_patcher.c; sourceTree = "<group>"; };
AB43B3D014C37E520018D529 /* smbios_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smbios_patcher.h; sourceTree = "<group>"; };
AB43B3D114C37E520018D529 /* SMBiosPatcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SMBiosPatcher.c; sourceTree = "<group>"; };
AB43B3D314C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3D414C37E520018D529 /* usb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = usb.c; sourceTree = "<group>"; };
AB43B3D514C37E520018D529 /* USBFix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = USBFix.c; sourceTree = "<group>"; };
AB43B3D714C37E520018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3D814C37E520018D529 /* YellowIconFixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = YellowIconFixer.c; sourceTree = "<group>"; };
AB43B3DA14C37E520018D529 /* amlsgn.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = amlsgn.m; sourceTree = "<group>"; };
AB43B3DB14C37E520018D529 /* bdmesg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bdmesg.c; sourceTree = "<group>"; };
AB43B3DD14C37E530018D529 /* acpidecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpidecode.h; sourceTree = "<group>"; };
AB43B3DE14C37E530018D529 /* datatype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = datatype.h; sourceTree = "<group>"; };
AB43B3DF14C37E530018D529 /* intel_acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intel_acpi.h; sourceTree = "<group>"; };
AB43B3E014C37E530018D529 /* ppm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppm.h; sourceTree = "<group>"; };
AB43B3E114C37E530018D529 /* ppmsetup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ppmsetup.h; sourceTree = "<group>"; };
AB43B3E214C37E530018D529 /* machOconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = machOconv.c; sourceTree = "<group>"; };
AB43B3E314C37E530018D529 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
AB43B3E414C37E530018D529 /* Symbols.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Symbols.c; sourceTree = "<group>"; };
AB43B3E514C37E530018D529 /* WKdm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKdm.h; sourceTree = "<group>"; };
AB43B3E614C37E530018D529 /* WKdmDecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = WKdmDecompress.c; sourceTree = "<group>"; };
AB43B3EC14C383120018D529 /* bcopy.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bcopy.s; sourceTree = "<group>"; };
AB43B3ED14C383120018D529 /* bzero.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bzero.s; sourceTree = "<group>"; };
AB43B3EE14C383120018D529 /* divdi3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = divdi3.c; sourceTree = "<group>"; };
AB43B3EF14C383120018D529 /* moddi3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = moddi3.c; sourceTree = "<group>"; };
AB43B3F014C383120018D529 /* qdivrem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qdivrem.c; sourceTree = "<group>"; };
AB43B3F114C383120018D529 /* quad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quad.h; sourceTree = "<group>"; };
AB43B3F214C383120018D529 /* udivdi3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = udivdi3.c; sourceTree = "<group>"; };
AB43B3F314C383120018D529 /* umoddi3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = umoddi3.c; sourceTree = "<group>"; };
AB43B3F814C384040018D529 /* stack_protector.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stack_protector.c; sourceTree = "<group>"; };
AB43B42A14C3A8080018D529 /* arc4random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arc4random.c; sourceTree = "<group>"; };
B0056CD611F3868000754B65 /* boot */ = {isa = PBXFileReference; lastKnownFileType = text; path = boot; sourceTree = "<group>"; };
B0056CD711F3868000754B65 /* boot.sys */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.preload"; path = boot.sys; sourceTree = "<group>"; };
B0056CD811F3868000754B65 /* boot0 */ = {isa = PBXFileReference; lastKnownFileType = text; path = boot0; sourceTree = "<group>"; };
B0056CE211F3868000754B65 /* libsaio.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libsaio.a; sourceTree = "<group>"; };
B0056CE311F3868000754B65 /* machOconv */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; path = machOconv; sourceTree = "<group>"; };
B0056CE411F3868000754B65 /* vers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vers.h; sourceTree = "<group>"; };
B0056CE711F3868000754B65 /* boot0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot0.s; sourceTree = "<group>"; };
B0056CE811F3868000754B65 /* chain0.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = chain0.s; sourceTree = "<group>"; };
B0056CE911F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056CEB11F3868000754B65 /* boot1.asm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm.asm; path = boot1.asm; sourceTree = "<group>"; };
B0056CEC11F3868000754B65 /* boot1.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1.s; sourceTree = "<group>"; };
B0056CED11F3868000754B65 /* boot1f32-install.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "boot1f32-install.sh"; sourceTree = "<group>"; };
B0056CEE11F3868000754B65 /* boot1f32.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1f32.s; sourceTree = "<group>"; };
B0056CEF11F3868000754B65 /* boot1he.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1he.s; sourceTree = "<group>"; };
B0056CF011F3868000754B65 /* boot1hp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot1hp.s; sourceTree = "<group>"; };
B0056CF111F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056CF311F3868000754B65 /* appleboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleboot.h; sourceTree = "<group>"; };
B0056CF411F3868000754B65 /* appleClut8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = appleClut8.h; sourceTree = "<group>"; };
B0056CF511F3868000754B65 /* bmdecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bmdecompress.c; sourceTree = "<group>"; };
B0056CF611F3868000754B65 /* boot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = boot.c; sourceTree = "<group>"; };
B0056CF711F3868000754B65 /* boot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = boot.h; sourceTree = "<group>"; };
B0056CF811F3868000754B65 /* boot2.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = boot2.s; sourceTree = "<group>"; };
B0056CF911F3868000754B65 /* drivers.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = drivers.c; sourceTree = "<group>"; };
B0056CFA11F3868000754B65 /* graphic_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphic_utils.c; sourceTree = "<group>"; };
B0056CFB11F3868000754B65 /* graphic_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphic_utils.h; sourceTree = "<group>"; };
B0056CFC11F3868000754B65 /* graphics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = graphics.c; sourceTree = "<group>"; };
B0056CFD11F3868000754B65 /* graphics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graphics.h; sourceTree = "<group>"; };
B0056CFE11F3868000754B65 /* gui.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gui.c; sourceTree = "<group>"; };
B0056CFF11F3868000754B65 /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = "<group>"; };
B0056D0011F3868000754B65 /* IOHibernatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOHibernatePrivate.h; sourceTree = "<group>"; };
B0056D0111F3868000754B65 /* lzss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lzss.c; sourceTree = "<group>"; };
B0056D0211F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056D0311F3868000754B65 /* mboot.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mboot.c; sourceTree = "<group>"; };
B0056D0411F3868000754B65 /* mboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mboot.h; sourceTree = "<group>"; };
B0056D0511F3868000754B65 /* multiboot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multiboot.h; sourceTree = "<group>"; };
B0056D0611F3868000754B65 /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = "<group>"; };
B0056D0711F3868000754B65 /* picopng.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = picopng.c; sourceTree = "<group>"; };
B0056D0811F3868000754B65 /* picopng.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = picopng.h; sourceTree = "<group>"; };
B0056D0911F3868000754B65 /* prompt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prompt.c; sourceTree = "<group>"; };
B0056D0A11F3868000754B65 /* ramdisk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ramdisk.c; sourceTree = "<group>"; };
B0056D0B11F3868000754B65 /* ramdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ramdisk.h; sourceTree = "<group>"; };
B0056D0C11F3868000754B65 /* resume.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = resume.c; sourceTree = "<group>"; };
B0056D0D11F3868000754B65 /* WKdm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKdm.h; sourceTree = "<group>"; };
B0056D0E11F3868000754B65 /* WKdmDecompress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = WKdmDecompress.c; sourceTree = "<group>"; };
B0056D1011F3868000754B65 /* cdboot.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboot.s; sourceTree = "<group>"; };
B0056D1111F3868000754B65 /* cdboothdd.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = cdboothdd.s; sourceTree = "<group>"; };
B0056D1211F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056D1411F3868000754B65 /* Limits */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Limits; sourceTree = "<group>"; };
B0056D1511F3868000754B65 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
B0056D1711F3868000754B65 /* efi_tables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = efi_tables.c; sourceTree = "<group>"; };
B0056D1811F3868000754B65 /* efi_tables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi_tables.h; sourceTree = "<group>"; };
B0056D1911F3868000754B65 /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = "<group>"; };
B0056D1A11F3868000754B65 /* libsa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsa.h; sourceTree = "<group>"; };
B0056D1B11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056D1C11F3868000754B65 /* memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = "<group>"; };
B0056D1D11F3868000754B65 /* prf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = prf.c; sourceTree = "<group>"; };
B0056D1E11F3868000754B65 /* printf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = printf.c; sourceTree = "<group>"; };
B0056D1F11F3868000754B65 /* qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qsort.c; sourceTree = "<group>"; };
B0056D2011F3868000754B65 /* setjmp.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = "<group>"; };
B0056D2111F3868000754B65 /* string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = string.c; sourceTree = "<group>"; };
B0056D2211F3868000754B65 /* strtol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strtol.c; sourceTree = "<group>"; };
B0056D2311F3868000754B65 /* zalloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zalloc.c; sourceTree = "<group>"; };
B0056D2511F3868000754B65 /* acpi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi.h; sourceTree = "<group>"; };
B0056D2611F3868000754B65 /* acpi_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acpi_patcher.c; sourceTree = "<group>"; };
B0056D2711F3868000754B65 /* acpi_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acpi_patcher.h; sourceTree = "<group>"; };
B0056D2811F3868000754B65 /* allocate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = allocate.c; sourceTree = "<group>"; };
B0056D2911F3868000754B65 /* asm.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = asm.s; sourceTree = "<group>"; };
B0056D2A11F3868000754B65 /* ati.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ati.c; sourceTree = "<group>"; };
B0056D2B11F3868000754B65 /* ati.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ati.h; sourceTree = "<group>"; };
B0056D2C11F3868000754B65 /* bios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bios.h; sourceTree = "<group>"; };
B0056D2D11F3868000754B65 /* bios.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bios.s; sourceTree = "<group>"; };
B0056D2E11F3868000754B65 /* biosfn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = biosfn.c; sourceTree = "<group>"; };
B0056D2F11F3868000754B65 /* bootstruct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bootstruct.c; sourceTree = "<group>"; };
B0056D3011F3868000754B65 /* bootstruct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bootstruct.h; sourceTree = "<group>"; };
B0056D3111F3868000754B65 /* cache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = "<group>"; };
B0056D3211F3868000754B65 /* console.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = console.c; sourceTree = "<group>"; };
B0056D3311F3868000754B65 /* convert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = convert.c; sourceTree = "<group>"; };
B0056D3411F3868000754B65 /* convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert.h; sourceTree = "<group>"; };
B0056D3511F3868000754B65 /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu.c; sourceTree = "<group>"; };
B0056D3611F3868000754B65 /* cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = "<group>"; };
B0056D3711F3868000754B65 /* device_inject.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_inject.c; sourceTree = "<group>"; };
B0056D3811F3868000754B65 /* device_inject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_inject.h; sourceTree = "<group>"; };
B0056D3911F3868000754B65 /* device_tree.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = device_tree.c; sourceTree = "<group>"; };
B0056D3A11F3868000754B65 /* device_tree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_tree.h; sourceTree = "<group>"; };
B0056D3B11F3868000754B65 /* disk.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = disk.c; sourceTree = "<group>"; };
B0056D3C11F3868000754B65 /* efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = efi.h; sourceTree = "<group>"; };
B0056D3D11F3868000754B65 /* ext2fs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ext2fs.c; sourceTree = "<group>"; };
B0056D3E11F3868000754B65 /* ext2fs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ext2fs.h; sourceTree = "<group>"; };
B0056D3F11F3868000754B65 /* fake_efi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fake_efi.c; sourceTree = "<group>"; };
B0056D4011F3868000754B65 /* fake_efi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fake_efi.h; sourceTree = "<group>"; };
B0056D4111F3868000754B65 /* fdisk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fdisk.h; sourceTree = "<group>"; };
B0056D4211F3868000754B65 /* hfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hfs.c; sourceTree = "<group>"; };
B0056D4311F3868000754B65 /* hfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hfs.h; sourceTree = "<group>"; };
B0056D4411F3868000754B65 /* hfs_CaseTables.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hfs_CaseTables.h; sourceTree = "<group>"; };
B0056D4511F3868000754B65 /* hfs_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hfs_compare.c; sourceTree = "<group>"; };
B0056D4611F3868000754B65 /* hpet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hpet.c; sourceTree = "<group>"; };
B0056D4711F3868000754B65 /* hpet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hpet.h; sourceTree = "<group>"; };
B0056D4811F3868000754B65 /* io_inline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = io_inline.h; sourceTree = "<group>"; };
B0056D4911F3868000754B65 /* libsaio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libsaio.h; sourceTree = "<group>"; };
B0056D4A11F3868000754B65 /* load.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = load.c; sourceTree = "<group>"; };
B0056D4B11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056D4C11F3868000754B65 /* md5c.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5c.c; sourceTree = "<group>"; };
B0056D4D11F3868000754B65 /* mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mem.c; sourceTree = "<group>"; };
B0056D4E11F3868000754B65 /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = "<group>"; };
B0056D4F11F3868000754B65 /* memvendors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memvendors.h; sourceTree = "<group>"; };
B0056D5011F3868000754B65 /* misc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = misc.c; sourceTree = "<group>"; };
B0056D5111F3868000754B65 /* msdos.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msdos.c; sourceTree = "<group>"; };
B0056D5211F3868000754B65 /* msdos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msdos.h; sourceTree = "<group>"; };
B0056D5311F3868000754B65 /* msdos_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msdos_private.h; sourceTree = "<group>"; };
B0056D5411F3868000754B65 /* nbp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nbp.c; sourceTree = "<group>"; };
B0056D5511F3868000754B65 /* nbp_cmd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nbp_cmd.h; sourceTree = "<group>"; };
B0056D5611F3868000754B65 /* ntfs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ntfs.c; sourceTree = "<group>"; };
B0056D5711F3868000754B65 /* ntfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntfs.h; sourceTree = "<group>"; };
B0056D5811F3868000754B65 /* ntfs_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ntfs_private.h; sourceTree = "<group>"; };
B0056D5911F3868000754B65 /* nvidia.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nvidia.c; sourceTree = "<group>"; };
B0056D5A11F3868000754B65 /* nvidia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nvidia.h; sourceTree = "<group>"; };
B0056D5B11F3868000754B65 /* pci.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci.c; sourceTree = "<group>"; };
B0056D5C11F3868000754B65 /* pci.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pci.h; sourceTree = "<group>"; };
B0056D5D11F3868000754B65 /* pci_root.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci_root.c; sourceTree = "<group>"; };
B0056D5E11F3868000754B65 /* pci_root.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pci_root.h; sourceTree = "<group>"; };
B0056D5F11F3868000754B65 /* pci_setup.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pci_setup.c; sourceTree = "<group>"; };
B0056D6011F3868000754B65 /* platform.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = platform.c; sourceTree = "<group>"; };
B0056D6111F3868000754B65 /* platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform.h; sourceTree = "<group>"; };
B0056D6211F3868000754B65 /* saio_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saio_internal.h; sourceTree = "<group>"; };
B0056D6311F3868000754B65 /* saio_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = saio_types.h; sourceTree = "<group>"; };
B0056D6411F3868000754B65 /* sl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sl.h; sourceTree = "<group>"; };
B0056D6511F3868000754B65 /* SMBIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SMBIOS.h; sourceTree = "<group>"; };
B0056D6611F3868000754B65 /* smbios_patcher.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = smbios_patcher.c; sourceTree = "<group>"; };
B0056D6711F3868000754B65 /* smbios_patcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smbios_patcher.h; sourceTree = "<group>"; };
B0056D6811F3868000754B65 /* spd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spd.c; sourceTree = "<group>"; };
B0056D6911F3868000754B65 /* spd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spd.h; sourceTree = "<group>"; };
B0056D6A11F3868000754B65 /* stringTable.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stringTable.c; sourceTree = "<group>"; };
B0056D6B11F3868000754B65 /* sys.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sys.c; sourceTree = "<group>"; };
B0056D6C11F3868000754B65 /* table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = "<group>"; };
B0056D6D11F3868000754B65 /* ufs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ufs.c; sourceTree = "<group>"; };
B0056D6E11F3868000754B65 /* ufs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ufs.h; sourceTree = "<group>"; };
B0056D6F11F3868000754B65 /* ufs_byteorder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ufs_byteorder.c; sourceTree = "<group>"; };
B0056D7011F3868000754B65 /* ufs_byteorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ufs_byteorder.h; sourceTree = "<group>"; };
B0056D7111F3868000754B65 /* usb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = usb.c; sourceTree = "<group>"; };
B0056D7211F3868000754B65 /* vbe.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vbe.c; sourceTree = "<group>"; };
B0056D7311F3868000754B65 /* vbe.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vbe.h; sourceTree = "<group>"; };
B0056D7411F3868000754B65 /* xml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xml.c; sourceTree = "<group>"; };
B0056D7511F3868000754B65 /* xml.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xml.h; sourceTree = "<group>"; };
B0056D7611F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056D7711F3868000754B65 /* MakeInc.dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MakeInc.dir; sourceTree = "<group>"; };
B0056D7811F3868000754B65 /* MakePaths.dir */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MakePaths.dir; sourceTree = "<group>"; };
B0056D7A11F3868000754B65 /* machOconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = machOconv.c; sourceTree = "<group>"; };
B0056D7B11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056D7C11F3868000754B65 /* TODO */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TODO; sourceTree = "<group>"; };
B0056D7D11F3868000754B65 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
B0056D7F11F3868000754B65 /* CREDITS */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CREDITS; sourceTree = "<group>"; };
B0056E1811F3868000754B65 /* screen_format.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screen_format.png; sourceTree = "<group>"; };
B0056E1911F3868000754B65 /* xnulogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = xnulogo.png; sourceTree = "<group>"; };
B0056E1A11F3868000754B65 /* Users_Guide0.5.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = Users_Guide0.5.pdf; sourceTree = "<group>"; };
B00F494911F6089500B1D7C5 /* aml_generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aml_generator.h; sourceTree = "<group>"; };
B00F494A11F6089500B1D7C5 /* aml_generator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aml_generator.c; sourceTree = "<group>"; };
B0146EFF11FDEF550010765C /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
B0146F0011FDEFB90010765C /* GPL_V2_LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GPL_V2_LICENSE; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
children = (
B0056DBA11F3868000754B65 /* artwork */,
B0056E0611F3868000754B65 /* doc */,
B0056CE511F3868000754B65 /* i386 */,
AB43B2B514C37E520018D529 /* i386 */,
B0056D8311F3868000754B65 /* package */,
B0056CD411F3868000754B65 /* sym */,
B0056D8211F3868000754B65 /* APPLE_LICENSE */,
B0056D7F11F3868000754B65 /* CREDITS */,
B0056D8111F3868000754B65 /* CHANGES */,
B0146F0011FDEFB90010765C /* GPL_V2_LICENSE */,
B0146EFF11FDEF550010765C /* README */,
019DFBAF11FB94090013E8CC /* MEMTEST86_LICENSE */,
B0056D7C11F3868000754B65 /* TODO */,
B0056D7D11F3868000754B65 /* Makefile */,
B0056D8011F3868000754B65 /* coding_standards.txt */,
name = Chameleon;
sourceTree = "<group>";
};
B0056CD411F3868000754B65 /* sym */ = {
AB43B2B514C37E520018D529 /* i386 */ = {
isa = PBXGroup;
children = (
B0056CD511F3868000754B65 /* i386 */,
AB43B2B614C37E520018D529 /* boot0 */,
AB43B2BB14C37E520018D529 /* boot1 */,
AB43B2C214C37E520018D529 /* boot2 */,
AB43B2D714C37E520018D529 /* cdboot */,
AB43B2DB14C37E520018D529 /* doc */,
AB43B2DE14C37E520018D529 /* libsa */,
AB43B2ED14C37E520018D529 /* libsaio */,
AB43B34514C37E520018D529 /* Makefile */,
AB43B34614C37E520018D529 /* MakeInc.dir */,
AB43B34714C37E520018D529 /* MakePaths.dir */,
AB43B34814C37E520018D529 /* modules */,
AB43B3D914C37E520018D529 /* util */,
);
path = sym;
path = i386;
sourceTree = "<group>";
};
B0056CD511F3868000754B65 /* i386 */ = {
AB43B2B614C37E520018D529 /* boot0 */ = {
isa = PBXGroup;
children = (
B0056CD611F3868000754B65 /* boot */,
B0056CD711F3868000754B65 /* boot.sys */,
B0056CD811F3868000754B65 /* boot0 */,
B0056CD911F3868000754B65 /* boot0hfs */,
B0056CDA11F3868000754B65 /* boot1f32 */,
B0056CDB11F3868000754B65 /* boot1h */,
B0056CDC11F3868000754B65 /* boot1he */,
B0056CDD11F3868000754B65 /* boot1hp */,
B0056CDE11F3868000754B65 /* cdboot */,
B0056CDF11F3868000754B65 /* chain0 */,
B0056CE011F3868000754B65 /* embedded.h */,
B0056CE111F3868000754B65 /* libsa.a */,
B0056CE211F3868000754B65 /* libsaio.a */,
B0056CE311F3868000754B65 /* machOconv */,
B0056CE411F3868000754B65 /* vers.h */,
AB43B2B714C37E520018D529 /* boot0.s */,
AB43B2B814C37E520018D529 /* boot0md.s */,
AB43B2B914C37E520018D529 /* chain0.s */,
AB43B2BA14C37E520018D529 /* Makefile */,
);
path = i386;
path = boot0;
sourceTree = "<group>";
};
B0056CE511F3868000754B65 /* i386 */ = {
AB43B2BB14C37E520018D529 /* boot1 */ = {
isa = PBXGroup;
children = (
B0056CE611F3868000754B65 /* boot0 */,
B0056CEA11F3868000754B65 /* boot1 */,
B0056CF211F3868000754B65 /* boot2 */,
B0056D0F11F3868000754B65 /* cdboot */,
B0056D1311F3868000754B65 /* doc */,
B0056D1611F3868000754B65 /* libsa */,
B0056D2411F3868000754B65 /* libsaio */,
B0056D7911F3868000754B65 /* util */,
B0056D7611F3868000754B65 /* Makefile */,
B0056D7711F3868000754B65 /* MakeInc.dir */,
B0056D7811F3868000754B65 /* MakePaths.dir */,
AB43B2BC14C37E520018D529 /* boot1f32-install.sh */,
AB43B2BD14C37E520018D529 /* boot1f32.s */,
AB43B2BE14C37E520018D529 /* boot1h.s */,
AB43B2BF14C37E520018D529 /* boot1he.s */,
AB43B2C014C37E520018D529 /* boot1hp.s */,
AB43B2C114C37E520018D529 /* Makefile */,
);
path = i386;
path = boot1;
sourceTree = "<group>";
};
B0056CE611F3868000754B65 /* boot0 */ = {
AB43B2C214C37E520018D529 /* boot2 */ = {
isa = PBXGroup;
children = (
B0056CE711F3868000754B65 /* boot0.s */,
B0056CE811F3868000754B65 /* chain0.s */,
B0056CE911F3868000754B65 /* Makefile */,
AB43B2C314C37E520018D529 /* appleboot.h */,
AB43B2C414C37E520018D529 /* appleClut8.h */,
AB43B2C514C37E520018D529 /* boot.c */,
AB43B2C614C37E520018D529 /* boot.h */,
AB43B2C714C37E520018D529 /* boot2.s */,
AB43B2C814C37E520018D529 /* drivers.c */,
AB43B2C914C37E520018D529 /* drivers.h */,
AB43B2CA14C37E520018D529 /* failedboot.h */,
AB43B2CB14C37E520018D529 /* graphics.c */,
AB43B2CC14C37E520018D529 /* graphics.h */,
AB43B2CD14C37E520018D529 /* lzss.c */,
AB43B2CE14C37E520018D529 /* Makefile */,
AB43B2CF14C37E520018D529 /* mboot.c */,
AB43B2D014C37E520018D529 /* mboot.h */,
AB43B2D114C37E520018D529 /* modules.c */,
AB43B2D214C37E520018D529 /* modules.h */,
AB43B2D314C37E520018D529 /* multiboot.h */,
AB43B2D414C37E520018D529 /* options.c */,
AB43B2D514C37E520018D529 /* options.h */,
AB43B2D614C37E520018D529 /* prompt.c */,
);
path = boot0;
path = boot2;
sourceTree = "<group>";
};
B0056CEA11F3868000754B65 /* boot1 */ = {
AB43B2D714C37E520018D529 /* cdboot */ = {
isa = PBXGroup;
children = (
B0056CEB11F3868000754B65 /* boot1.asm */,
B0056CEC11F3868000754B65 /* boot1.s */,
B0056CED11F3868000754B65 /* boot1f32-install.sh */,
B0056CEE11F3868000754B65 /* boot1f32.s */,
B0056CEF11F3868000754B65 /* boot1he.s */,
B0056CF011F3868000754B65 /* boot1hp.s */,
B0056CF111F3868000754B65 /* Makefile */,
AB43B2D814C37E520018D529 /* cdboot.s */,
AB43B2D914C37E520018D529 /* cdboothdd.s */,
AB43B2DA14C37E520018D529 /* Makefile */,
);
path = boot1;
path = cdboot;
sourceTree = "<group>";
};
B0056CF211F3868000754B65 /* boot2 */ = {
AB43B2DB14C37E520018D529 /* doc */ = {
isa = PBXGroup;
children = (
B0056CF311F3868000754B65 /* appleboot.h */,
B0056CF411F3868000754B65 /* appleClut8.h */,
B0056CF511F3868000754B65 /* bmdecompress.c */,
B0056CF611F3868000754B65 /* boot.c */,
B0056CF711F3868000754B65 /* boot.h */,
B0056CF811F3868000754B65 /* boot2.s */,
B0056CF911F3868000754B65 /* drivers.c */,
B0056CFA11F3868000754B65 /* graphic_utils.c */,
B0056CFB11F3868000754B65 /* graphic_utils.h */,
B0056CFC11F3868000754B65 /* graphics.c */,
B0056CFD11F3868000754B65 /* graphics.h */,
B0056CFE11F3868000754B65 /* gui.c */,
B0056CFF11F3868000754B65 /* gui.h */,
B0056D0011F3868000754B65 /* IOHibernatePrivate.h */,
B0056D0111F3868000754B65 /* lzss.c */,
B0056D0211F3868000754B65 /* Makefile */,
B0056D0311F3868000754B65 /* mboot.c */,
B0056D0411F3868000754B65 /* mboot.h */,
B0056D0511F3868000754B65 /* multiboot.h */,
B0056D0611F3868000754B65 /* options.c */,
B0056D0711F3868000754B65 /* picopng.c */,
B0056D0811F3868000754B65 /* picopng.h */,
B0056D0911F3868000754B65 /* prompt.c */,
B0056D0A11F3868000754B65 /* ramdisk.c */,
B0056D0B11F3868000754B65 /* ramdisk.h */,
B0056D0C11F3868000754B65 /* resume.c */,
B0056D0D11F3868000754B65 /* WKdm.h */,
B0056D0E11F3868000754B65 /* WKdmDecompress.c */,
AB43B2DC14C37E520018D529 /* Limits */,
AB43B2DD14C37E520018D529 /* README */,
);
path = boot2;
path = doc;
sourceTree = "<group>";
};
B0056D0F11F3868000754B65 /* cdboot */ = {
AB43B2DE14C37E520018D529 /* libsa */ = {
isa = PBXGroup;
children = (
B0056D1011F3868000754B65 /* cdboot.s */,
B0056D1111F3868000754B65 /* cdboothdd.s */,
B0056D1211F3868000754B65 /* Makefile */,
AB43B3EC14C383120018D529 /* bcopy.s */,
AB43B3ED14C383120018D529 /* bzero.s */,
AB43B3EE14C383120018D529 /* divdi3.c */,
AB43B3EF14C383120018D529 /* moddi3.c */,
AB43B3F014C383120018D529 /* qdivrem.c */,
AB43B3F114C383120018D529 /* quad.h */,
AB43B3F214C383120018D529 /* udivdi3.c */,
AB43B3F314C383120018D529 /* umoddi3.c */,
AB43B2DF14C37E520018D529 /* efi_tables.c */,
AB43B2E014C37E520018D529 /* efi_tables.h */,
AB43B2E114C37E520018D529 /* error.c */,
AB43B2E214C37E520018D529 /* libsa.h */,
AB43B2E314C37E520018D529 /* Makefile */,
AB43B2E414C37E520018D529 /* memory.h */,
AB43B2E514C37E520018D529 /* prf.c */,
AB43B2E614C37E520018D529 /* printf.c */,
AB43B2E714C37E520018D529 /* qsort.c */,
AB43B2E814C37E520018D529 /* rand.c */,
AB43B2E914C37E520018D529 /* setjmp.s */,
AB43B2EA14C37E520018D529 /* string.c */,
AB43B2EB14C37E520018D529 /* strtol.c */,
AB43B2EC14C37E520018D529 /* zalloc.c */,
);
path = cdboot;
path = libsa;
sourceTree = "<group>";
};
B0056D1311F3868000754B65 /* doc */ = {
AB43B2ED14C37E520018D529 /* libsaio */ = {
isa = PBXGroup;
children = (
B0056D1411F3868000754B65 /* Limits */,
B0056D1511F3868000754B65 /* README */,
AB43B2EE14C37E520018D529 /* acpi.h */,
AB43B2EF14C37E520018D529 /* acpi_tools.c */,
AB43B2F014C37E520018D529 /* acpi_tools.h */,
AB43B2F114C37E520018D529 /* allocate.c */,
AB43B2F214C37E520018D529 /* apic.h */,
AB43B42A14C3A8080018D529 /* arc4random.c */,
AB43B2F314C37E520018D529 /* asm.s */,
AB43B2F414C37E520018D529 /* befs.c */,
AB43B2F514C37E520018D529 /* befs.h */,
AB43B2F614C37E520018D529 /* bios.h */,
AB43B2F714C37E520018D529 /* bios.s */,
AB43B2F814C37E520018D529 /* biosfn.c */,
AB43B2F914C37E520018D529 /* bootLion.h */,
AB43B2FA14C37E520018D529 /* bootstruct.c */,
AB43B2FB14C37E520018D529 /* bootstruct.h */,
AB43B2FC14C37E520018D529 /* cache.c */,
AB43B2FD14C37E520018D529 /* console.c */,
AB43B2FE14C37E520018D529 /* convert.c */,
AB43B2FF14C37E520018D529 /* convert.h */,
AB43B30014C37E520018D529 /* cpu.c */,
AB43B30114C37E520018D529 /* cpu.h */,
AB0E930C14C6223500F798D7 /* cpu_intel_amd.c */,
AB43B30214C37E520018D529 /* cpu_data.h */,
AB43B30314C37E520018D529 /* cpuid.h */,
AB43B30414C37E520018D529 /* datatype.h */,
AB43B30514C37E520018D529 /* device_inject.c */,
AB43B30614C37E520018D529 /* device_inject.h */,
AB43B30714C37E520018D529 /* device_tree.c */,
AB43B30814C37E520018D529 /* device_tree.h */,
AB43B30914C37E520018D529 /* disk.c */,
AB43B30A14C37E520018D529 /* disk.h */,
AB43B30B14C37E520018D529 /* efi.h */,
AB43B30C14C37E520018D529 /* exfat.c */,
AB43B30D14C37E520018D529 /* exfat.h */,
AB43B30E14C37E520018D529 /* ext2fs.c */,
AB43B30F14C37E520018D529 /* ext2fs.h */,
AB43B31014C37E520018D529 /* fake_efi.c */,
AB43B31114C37E520018D529 /* fake_efi.h */,
AB43B31214C37E520018D529 /* fdisk.h */,
AB43B31314C37E520018D529 /* freebsd.c */,
AB43B31414C37E520018D529 /* freebsd.h */,
AB43B31514C37E520018D529 /* hfs.c */,
AB43B31614C37E520018D529 /* hfs.h */,
AB43B31714C37E520018D529 /* hfs_CaseTables.h */,
AB43B31814C37E520018D529 /* hfs_compare.c */,
AB43B31914C37E520018D529 /* intel_acpi.h */,
AB43B31A14C37E520018D529 /* internal_modules.h */,
AB43B31B14C37E520018D529 /* io_inline.h */,
AB43B31C14C37E520018D529 /* libsaio.h */,
AB43B31D14C37E520018D529 /* load.c */,
AB43B31E14C37E520018D529 /* Makefile */,
AB43B31F14C37E520018D529 /* md5c.c */,
AB43B32014C37E520018D529 /* misc.c */,
AB43B32114C37E520018D529 /* msdos.c */,
AB43B32214C37E520018D529 /* msdos.h */,
AB43B32314C37E520018D529 /* msdos_private.h */,
AB43B32414C37E520018D529 /* nbp.c */,
AB43B32514C37E520018D529 /* nbp_cmd.h */,
AB43B32614C37E520018D529 /* ntfs.c */,
AB43B32714C37E520018D529 /* ntfs.h */,
AB43B32814C37E520018D529 /* ntfs_private.h */,
AB43B32914C37E520018D529 /* openbsd.c */,
AB43B32A14C37E520018D529 /* openbsd.h */,
AB43B32B14C37E520018D529 /* pci.c */,
AB43B32C14C37E520018D529 /* pci.h */,
AB43B32D14C37E520018D529 /* pci_root.c */,
AB43B32E14C37E520018D529 /* pci_root.h */,
AB43B32F14C37E520018D529 /* platform.c */,
AB43B33014C37E520018D529 /* platform.h */,
AB43B33114C37E520018D529 /* ppm.h */,
AB43B33214C37E520018D529 /* ppmsetup.h */,
AB43B33314C37E520018D529 /* saio_internal.h */,
AB43B33414C37E520018D529 /* saio_types.h */,
AB43B33514C37E520018D529 /* sl.h */,
AB43B33614C37E520018D529 /* smbios.c */,
AB43B33714C37E520018D529 /* SMBIOS.h */,
AB43B3F814C384040018D529 /* stack_protector.c */,
AB43B33814C37E520018D529 /* smp-imps.c */,
AB43B33914C37E520018D529 /* smp-imps.h */,
AB43B33A14C37E520018D529 /* stringTable.c */,
AB43B33B14C37E520018D529 /* sys.c */,
AB43B33C14C37E520018D529 /* table.c */,
AB43B33D14C37E520018D529 /* ufs.c */,
AB43B33E14C37E520018D529 /* ufs.h */,
AB43B33F14C37E520018D529 /* ufs_byteorder.c */,
AB43B34014C37E520018D529 /* ufs_byteorder.h */,
AB43B34114C37E520018D529 /* vbe.c */,
AB43B34214C37E520018D529 /* vbe.h */,
AB43B34314C37E520018D529 /* xml.c */,
AB43B34414C37E520018D529 /* xml.h */,
);
path = doc;
path = libsaio;
sourceTree = "<group>";
};
B0056D1611F3868000754B65 /* libsa */ = {
AB43B34814C37E520018D529 /* modules */ = {
isa = PBXGroup;
children = (
B0056D1711F3868000754B65 /* efi_tables.c */,
B0056D1811F3868000754B65 /* efi_tables.h */,
B0056D1911F3868000754B65 /* error.c */,
B0056D1A11F3868000754B65 /* libsa.h */,
B0056D1B11F3868000754B65 /* Makefile */,
B0056D1C11F3868000754B65 /* memory.h */,
B0056D1D11F3868000754B65 /* prf.c */,
B0056D1E11F3868000754B65 /* printf.c */,
B0056D1F11F3868000754B65 /* qsort.c */,
B0056D2011F3868000754B65 /* setjmp.s */,
B0056D2111F3868000754B65 /* string.c */,
B0056D2211F3868000754B65 /* strtol.c */,
B0056D2311F3868000754B65 /* zalloc.c */,
AB43B34914C37E520018D529 /* ACPICodec */,
AB43B35214C37E520018D529 /* ACPIPatcher */,
AB43B35914C37E520018D529 /* CPUfreq */,
AB43B35C14C37E520018D529 /* GraphicsEnabler */,
AB43B36614C37E520018D529 /* GUI */,
AB43B37014C37E520018D529 /* HelloWorld */,
AB43B37314C37E520018D529 /* HibernateEnabler */,
AB43B37D14C37E520018D529 /* HPET */,
AB43B38114C37E520018D529 /* KernelPatcher */,
AB43B38514C37E520018D529 /* KextPatcher */,
AB43B39C14C37E520018D529 /* Keymapper */,
AB43B3A214C37E520018D529 /* Makefile */,
AB43B3A314C37E520018D529 /* Memory */,
AB43B3B014C37E520018D529 /* NetbookInstaller */,
AB43B3B314C37E520018D529 /* Networking */,
AB43B3B614C37E520018D529 /* RamDiskLoader */,
AB43B3BB14C37E520018D529 /* Resolution */,
AB43B3C314C37E520018D529 /* SMBiosGetters */,
AB43B3CC14C37E520018D529 /* SMBiosPatcher */,
AB43B3D214C37E520018D529 /* USBFix */,
AB43B3D614C37E520018D529 /* YellowIconFixer */,
);
path = libsa;
path = modules;
sourceTree = "<group>";
};
B0056D2411F3868000754B65 /* libsaio */ = {
AB43B34914C37E520018D529 /* ACPICodec */ = {
isa = PBXGroup;
children = (
B0056D2511F3868000754B65 /* acpi.h */,
B0056D2611F3868000754B65 /* acpi_patcher.c */,
B0056D2711F3868000754B65 /* acpi_patcher.h */,
B0056D2811F3868000754B65 /* allocate.c */,
B00F494A11F6089500B1D7C5 /* aml_generator.c */,
B00F494911F6089500B1D7C5 /* aml_generator.h */,
B0056D2911F3868000754B65 /* asm.s */,
B0056D2A11F3868000754B65 /* ati.c */,
B0056D2B11F3868000754B65 /* ati.h */,
B0056D2C11F3868000754B65 /* bios.h */,
B0056D2D11F3868000754B65 /* bios.s */,
B0056D2E11F3868000754B65 /* biosfn.c */,
1D145307137073F40050C0CD /* bootargs.h */,
B0056D2F11F3868000754B65 /* bootstruct.c */,
B0056D3011F3868000754B65 /* bootstruct.h */,
B0056D3111F3868000754B65 /* cache.c */,
B0056D3211F3868000754B65 /* console.c */,
B0056D3311F3868000754B65 /* convert.c */,
B0056D3411F3868000754B65 /* convert.h */,
B0056D3511F3868000754B65 /* cpu.c */,
B0056D3611F3868000754B65 /* cpu.h */,
B0056D3711F3868000754B65 /* device_inject.c */,
B0056D3811F3868000754B65 /* device_inject.h */,
B0056D3911F3868000754B65 /* device_tree.c */,
B0056D3A11F3868000754B65 /* device_tree.h */,
B0056D3B11F3868000754B65 /* disk.c */,
65ED53931204B83200B22507 /* disk.h */,
0172D0DC11FB66820030222E /* dram_controllers.h */,
0172D0DD11FB66820030222E /* dram_controllers.c */,
B0056D3C11F3868000754B65 /* efi.h */,
B0056D3D11F3868000754B65 /* ext2fs.c */,
B0056D3E11F3868000754B65 /* ext2fs.h */,
B0056D3F11F3868000754B65 /* fake_efi.c */,
B0056D4011F3868000754B65 /* fake_efi.h */,
B0056D4111F3868000754B65 /* fdisk.h */,
B0056D4211F3868000754B65 /* hfs.c */,
B0056D4311F3868000754B65 /* hfs.h */,
B0056D4411F3868000754B65 /* hfs_CaseTables.h */,
B0056D4511F3868000754B65 /* hfs_compare.c */,
B0056D4611F3868000754B65 /* hpet.c */,
B0056D4711F3868000754B65 /* hpet.h */,
B0056D4811F3868000754B65 /* io_inline.h */,
B0056D4911F3868000754B65 /* libsaio.h */,
B0056D4A11F3868000754B65 /* load.c */,
B0056D4B11F3868000754B65 /* Makefile */,
B0056D4C11F3868000754B65 /* md5c.c */,
B0056D4D11F3868000754B65 /* mem.c */,
B0056D4E11F3868000754B65 /* mem.h */,
B0056D4F11F3868000754B65 /* memvendors.h */,
B0056D5011F3868000754B65 /* misc.c */,
B0056D5111F3868000754B65 /* msdos.c */,
B0056D5211F3868000754B65 /* msdos.h */,
B0056D5311F3868000754B65 /* msdos_private.h */,
B0056D5411F3868000754B65 /* nbp.c */,
B0056D5511F3868000754B65 /* nbp_cmd.h */,
B0056D5611F3868000754B65 /* ntfs.c */,
B0056D5711F3868000754B65 /* ntfs.h */,
B0056D5811F3868000754B65 /* ntfs_private.h */,
B0056D5911F3868000754B65 /* nvidia.c */,
B0056D5A11F3868000754B65 /* nvidia.h */,
B0056D5B11F3868000754B65 /* pci.c */,
B0056D5C11F3868000754B65 /* pci.h */,
B0056D5D11F3868000754B65 /* pci_root.c */,
B0056D5E11F3868000754B65 /* pci_root.h */,
B0056D5F11F3868000754B65 /* pci_setup.c */,
B0056D6011F3868000754B65 /* platform.c */,
B0056D6111F3868000754B65 /* platform.h */,
B0056D6211F3868000754B65 /* saio_internal.h */,
B0056D6311F3868000754B65 /* saio_types.h */,
B0056D6411F3868000754B65 /* sl.h */,
B0056D6511F3868000754B65 /* SMBIOS.h */,
B0056D6611F3868000754B65 /* smbios_patcher.c */,
B0056D6711F3868000754B65 /* smbios_patcher.h */,
B0056D6811F3868000754B65 /* spd.c */,
B0056D6911F3868000754B65 /* spd.h */,
B0056D6A11F3868000754B65 /* stringTable.c */,
B0056D6B11F3868000754B65 /* sys.c */,
B0056D6C11F3868000754B65 /* table.c */,
B0056D6D11F3868000754B65 /* ufs.c */,
B0056D6E11F3868000754B65 /* ufs.h */,
B0056D6F11F3868000754B65 /* ufs_byteorder.c */,
B0056D7011F3868000754B65 /* ufs_byteorder.h */,
B0056D7111F3868000754B65 /* usb.c */,
B0056D7211F3868000754B65 /* vbe.c */,
B0056D7311F3868000754B65 /* vbe.h */,
B0056D7411F3868000754B65 /* xml.c */,
B0056D7511F3868000754B65 /* xml.h */,
1D2A1AF513743A2600787720 /* bootargs.h */,
AB43B34A14C37E520018D529 /* acpi_codec.c */,
AB43B34B14C37E520018D529 /* acpi_codec.h */,
AB43B34C14C37E520018D529 /* acpicode.c */,
AB43B34D14C37E520018D529 /* acpicode.h */,
AB43B34E14C37E520018D529 /* ACPICodec.c */,
AB43B34F14C37E520018D529 /* acpidecode.c */,
AB43B35014C37E520018D529 /* acpidecode.h */,
AB43B35114C37E520018D529 /* Makefile */,
);
path = libsaio;
path = ACPICodec;
sourceTree = "<group>";
};
B0056D7911F3868000754B65 /* util */ = {
AB43B35214C37E520018D529 /* ACPIPatcher */ = {
isa = PBXGroup;
children = (
B0056D7A11F3868000754B65 /* machOconv.c */,
B0056D7B11F3868000754B65 /* Makefile */,
AB43B35314C37E520018D529 /* acpi_patcher.c */,
AB43B35414C37E520018D529 /* acpi_patcher.h */,
AB43B35514C37E520018D529 /* AcpiPatcher.c */,
AB43B35614C37E520018D529 /* aml_generator.c */,
AB43B35714C37E520018D529 /* aml_generator.h */,
AB43B35814C37E520018D529 /* Makefile */,
);
path = ACPIPatcher;
sourceTree = "<group>";
};
AB43B35914C37E520018D529 /* CPUfreq */ = {
isa = PBXGroup;
children = (
AB43B35A14C37E520018D529 /* CPUfreq.c */,
AB43B35B14C37E520018D529 /* Makefile */,
);
path = CPUfreq;
sourceTree = "<group>";
};
AB43B35C14C37E520018D529 /* GraphicsEnabler */ = {
isa = PBXGroup;
children = (
AB43B35D14C37E520018D529 /* ati.c */,
AB43B35E14C37E520018D529 /* ati.h */,
AB43B35F14C37E520018D529 /* ati_reg.h */,
AB43B36014C37E520018D529 /* gma.c */,
AB43B36114C37E520018D529 /* gma.h */,
AB43B36214C37E520018D529 /* GraphicsEnabler.c */,
AB43B36314C37E520018D529 /* Makefile */,
AB43B36414C37E520018D529 /* nvidia.c */,
AB43B36514C37E520018D529 /* nvidia.h */,
);
path = GraphicsEnabler;
sourceTree = "<group>";
};
AB43B36614C37E520018D529 /* GUI */ = {
isa = PBXGroup;
children = (
AB43B36714C37E520018D529 /* graphic_utils.c */,
AB43B36814C37E520018D529 /* graphic_utils.h */,
AB43B36914C37E520018D529 /* gui.c */,
AB43B36A14C37E520018D529 /* gui.h */,
AB43B36B14C37E520018D529 /* GUI_appleboot.h */,
AB43B36C14C37E520018D529 /* GUI_module.c */,
AB43B36D14C37E520018D529 /* Makefile */,
AB43B36E14C37E520018D529 /* picopng.c */,
AB43B36F14C37E520018D529 /* picopng.h */,
);
path = GUI;
sourceTree = "<group>";
};
AB43B37014C37E520018D529 /* HelloWorld */ = {
isa = PBXGroup;
children = (
AB43B37114C37E520018D529 /* HelloWorld.c */,
AB43B37214C37E520018D529 /* Makefile */,
);
path = HelloWorld;
sourceTree = "<group>";
};
AB43B37314C37E520018D529 /* HibernateEnabler */ = {
isa = PBXGroup;
children = (
AB43B37414C37E520018D529 /* bmdecompress.c */,
AB43B37514C37E520018D529 /* bmdecompress.h */,
AB43B37614C37E520018D529 /* graphic_utils.c */,
AB43B37714C37E520018D529 /* graphic_utils.h */,
AB43B37814C37E520018D529 /* HibernateEnabler.c */,
AB43B37914C37E520018D529 /* IOHibernatePrivate.h */,
AB43B37A14C37E520018D529 /* Makefile */,
AB43B37B14C37E520018D529 /* resume.c */,
AB43B37C14C37E520018D529 /* resume.h */,
);
path = HibernateEnabler;
sourceTree = "<group>";
};
AB43B37D14C37E520018D529 /* HPET */ = {
isa = PBXGroup;
children = (
AB43B37E14C37E520018D529 /* HPET.c */,
AB43B37F14C37E520018D529 /* hpet.h */,
AB43B38014C37E520018D529 /* Makefile */,
);
path = HPET;
sourceTree = "<group>";
};
AB43B38114C37E520018D529 /* KernelPatcher */ = {
isa = PBXGroup;
children = (
AB43B38214C37E520018D529 /* kernel_patcher.c */,
AB43B38314C37E520018D529 /* kernel_patcher.h */,
AB43B38414C37E520018D529 /* Makefile */,
);
path = KernelPatcher;
sourceTree = "<group>";
};
AB43B38514C37E520018D529 /* KextPatcher */ = {
isa = PBXGroup;
children = (
AB43B38614C37E520018D529 /* adler32.c */,
AB43B38714C37E520018D529 /* deflate.c */,
AB43B38814C37E520018D529 /* deflate.h */,
AB43B38914C37E520018D529 /* hex_editor.c */,
AB43B38A14C37E520018D529 /* hex_editor.h */,
AB43B38B14C37E520018D529 /* inffast.c */,
AB43B38C14C37E520018D529 /* inffast.h */,
AB43B38D14C37E520018D529 /* inffixed.h */,
AB43B38E14C37E520018D529 /* inflate.c */,
AB43B38F14C37E520018D529 /* inflate.h */,
AB43B39014C37E520018D529 /* inftrees.c */,
AB43B39114C37E520018D529 /* inftrees.h */,
AB43B39214C37E520018D529 /* kext_patcher.c */,
AB43B39314C37E520018D529 /* kext_patcher.h */,
AB43B39414C37E520018D529 /* Makefile */,
AB43B39514C37E520018D529 /* mkext.h */,
AB43B39614C37E520018D529 /* trees.c */,
AB43B39714C37E520018D529 /* trees.h */,
AB43B39814C37E520018D529 /* zconf.h */,
AB43B39914C37E520018D529 /* zlib.h */,
AB43B39A14C37E520018D529 /* zutil.c */,
AB43B39B14C37E520018D529 /* zutil.h */,
);
path = KextPatcher;
sourceTree = "<group>";
};
AB43B39C14C37E520018D529 /* Keymapper */ = {
isa = PBXGroup;
children = (
AB43B39D14C37E520018D529 /* Keylayout.c */,
AB43B39E14C37E520018D529 /* Keylayout.h */,
AB43B39F14C37E520018D529 /* Keymapper.c */,
AB43B3A014C37E520018D529 /* Makefile */,
AB43B3A114C37E520018D529 /* term.h */,
);
path = Keymapper;
sourceTree = "<group>";
};
AB43B3A314C37E520018D529 /* Memory */ = {
isa = PBXGroup;
children = (
AB43B3A414C37E520018D529 /* dram_controllers.c */,
AB43B3A514C37E520018D529 /* dram_controllers.h */,
AB43B3A614C37E520018D529 /* GPL_V2_LICENSE */,
AB43B3A714C37E520018D529 /* Makefile */,
AB43B3A814C37E520018D529 /* mem.c */,
AB43B3A914C37E520018D529 /* mem.h */,
AB43B3AA14C37E520018D529 /* Memory.c */,
AB43B3AB14C37E520018D529 /* MEMTEST86_LICENSE */,
AB43B3AC14C37E520018D529 /* memvendors.h */,
AB43B3AD14C37E520018D529 /* README */,
AB43B3AE14C37E520018D529 /* spd.c */,
AB43B3AF14C37E520018D529 /* spd.h */,
);
path = Memory;
sourceTree = "<group>";
};
AB43B3B014C37E520018D529 /* NetbookInstaller */ = {
isa = PBXGroup;
children = (
AB43B3B114C37E520018D529 /* Makefile */,
AB43B3B214C37E520018D529 /* NBI.c */,
);
path = NetbookInstaller;
sourceTree = "<group>";
};
AB43B3B314C37E520018D529 /* Networking */ = {
isa = PBXGroup;
children = (
AB43B3B414C37E520018D529 /* Makefile */,
AB43B3B514C37E520018D529 /* Networking.c */,
);
path = Networking;
sourceTree = "<group>";
};
AB43B3B614C37E520018D529 /* RamDiskLoader */ = {
isa = PBXGroup;
children = (
AB43B3B714C37E520018D529 /* Makefile */,
AB43B3B814C37E520018D529 /* ramdisk.c */,
AB43B3B914C37E520018D529 /* ramdisk.h */,
AB43B3BA14C37E520018D529 /* RamDiskLoader.c */,
);
path = RamDiskLoader;
sourceTree = "<group>";
};
AB43B3BB14C37E520018D529 /* Resolution */ = {
isa = PBXGroup;
children = (
AB43B3BC14C37E520018D529 /* 915resolution.c */,
AB43B3BD14C37E520018D529 /* 915resolution.h */,
AB43B3BE14C37E520018D529 /* edid.c */,
AB43B3BF14C37E520018D529 /* edid.h */,
AB43B3C014C37E520018D529 /* Makefile */,
AB43B3C114C37E520018D529 /* Resolution.c */,
AB43B3C214C37E520018D529 /* shortatombios.h */,
);
path = Resolution;
sourceTree = "<group>";
};
AB43B3C314C37E520018D529 /* SMBiosGetters */ = {
isa = PBXGroup;
children = (
AB43B3C414C37E520018D529 /* Makefile */,
AB43B3C514C37E520018D529 /* mysmbios.c */,
AB43B3C614C37E520018D529 /* mysmbios.h */,
AB43B3C714C37E520018D529 /* README */,
AB43B3C814C37E520018D529 /* smbios_decode.c */,
AB43B3C914C37E520018D529 /* smbios_getters.c */,
AB43B3CA14C37E520018D529 /* smbios_getters.h */,
AB43B3CB14C37E520018D529 /* SMBiosGetters.c */,
);
path = SMBiosGetters;
sourceTree = "<group>";
};
AB43B3CC14C37E520018D529 /* SMBiosPatcher */ = {
isa = PBXGroup;
children = (
AB43B3CD14C37E520018D529 /* Makefile */,
AB43B3CE14C37E520018D529 /* README */,
AB43B3CF14C37E520018D529 /* smbios_patcher.c */,
AB43B3D014C37E520018D529 /* smbios_patcher.h */,
AB43B3D114C37E520018D529 /* SMBiosPatcher.c */,
);
path = SMBiosPatcher;
sourceTree = "<group>";
};
AB43B3D214C37E520018D529 /* USBFix */ = {
isa = PBXGroup;
children = (
AB43B3D314C37E520018D529 /* Makefile */,
AB43B3D414C37E520018D529 /* usb.c */,
AB43B3D514C37E520018D529 /* USBFix.c */,
);
path = USBFix;
sourceTree = "<group>";
};
AB43B3D614C37E520018D529 /* YellowIconFixer */ = {
isa = PBXGroup;
children = (
AB43B3D714C37E520018D529 /* Makefile */,
AB43B3D814C37E520018D529 /* YellowIconFixer.c */,
);
path = YellowIconFixer;
sourceTree = "<group>";
};
AB43B3D914C37E520018D529 /* util */ = {
isa = PBXGroup;
children = (
AB43B3DA14C37E520018D529 /* amlsgn.m */,
AB43B3DB14C37E520018D529 /* bdmesg.c */,
AB43B3DC14C37E530018D529 /* Intel_Acpi */,
AB43B3E214C37E530018D529 /* machOconv.c */,
AB43B3E314C37E530018D529 /* Makefile */,
AB43B3E414C37E530018D529 /* Symbols.c */,
AB43B3E514C37E530018D529 /* WKdm.h */,
AB43B3E614C37E530018D529 /* WKdmDecompress.c */,
);
path = util;
sourceTree = "<group>";
};
AB43B3DC14C37E530018D529 /* Intel_Acpi */ = {
isa = PBXGroup;
children = (
AB43B3DD14C37E530018D529 /* acpidecode.h */,
AB43B3DE14C37E530018D529 /* datatype.h */,
AB43B3DF14C37E530018D529 /* intel_acpi.h */,
AB43B3E014C37E530018D529 /* ppm.h */,
AB43B3E114C37E530018D529 /* ppmsetup.h */,
);
path = Intel_Acpi;
sourceTree = "<group>";
};
B0056CD411F3868000754B65 /* sym */ = {
isa = PBXGroup;
children = (
B0056CD511F3868000754B65 /* i386 */,
);
path = sym;
sourceTree = "<group>";
};
B0056CD511F3868000754B65 /* i386 */ = {
isa = PBXGroup;
children = (
B0056CD611F3868000754B65 /* boot */,
B0056CD711F3868000754B65 /* boot.sys */,
B0056CD811F3868000754B65 /* boot0 */,
B0056CD911F3868000754B65 /* boot0hfs */,
B0056CDA11F3868000754B65 /* boot1f32 */,
B0056CDB11F3868000754B65 /* boot1h */,
B0056CDC11F3868000754B65 /* boot1he */,
B0056CDD11F3868000754B65 /* boot1hp */,
B0056CDE11F3868000754B65 /* cdboot */,
B0056CDF11F3868000754B65 /* chain0 */,
B0056CE011F3868000754B65 /* embedded.h */,
B0056CE111F3868000754B65 /* libsa.a */,
B0056CE211F3868000754B65 /* libsaio.a */,
B0056CE311F3868000754B65 /* machOconv */,
B0056CE411F3868000754B65 /* vers.h */,
);
path = i386;
sourceTree = "<group>";
};
B0056D8311F3868000754B65 /* package */ = {
isa = PBXGroup;
children = (
branches/cparm/CHANGES
1
2
3
4
5
6
17
28
39
- Added cpu_intel_amd.c (not by default, you need to edit the makefile in the libsaio directory to compile it)
- Implemented a stack_protector (seems to work)
- Sync'd libsa with Xnu
- Removed lcc_kext dependency from the make file
- Fixed some bugs
- Updated the default theme to v 1.1 (credit to blackosx)
- Updated LogintoLion with he haiku device logo (credit to blackosx)
- Updated for the gui
branches/cparm/i386/libsaio/console.c
6868
6969
7070
71
72
73
74
75
71
72
73
74
75
7676
7777
7878
......
8787
8888
8989
90
90
9191
9292
93
93
9494
9595
96
96
9797
9898
9999
......
106106
107107
108108
109
109
110110
111111
112112
......
124124
125125
126126
127
127
128128
129129
130130
131131
132
132
133133
134134
135135
136136
137137
138
138
139139
140
141
142140
143141
144142
......
151149
152150
153151
154
152
155153
156
154
157155
158156
159157
......
163161
164162
165163
166
164
167165
168166
169167
170
168
171169
172
170
173171
174172
175
173
176174
177175
178176
......
180178
181179
182180
183
181
184182
185183
186184
......
194192
195193
196194
197
195
198196
199
197
200198
201
199
202200
203201
204
202
205203
206204
207205
......
209207
210208
211209
212
210
213211
214212
215213
......
219217
220218
221219
222
220
223221
224222
225223
......
229227
230228
231229
232
230
233231
234232
235
233
236234
237235
238236
......
247245
248246
249247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
void sputc(int c, struct putc_info * pi)
{
if (pi->last_str)
if (pi->str == pi->last_str)
{
*(pi->str) = '\0';
return;
}
if (pi->str == pi->last_str)
{
*(pi->str) = '\0';
return;
}
*(pi->str)++ = c;
}
{
va_list ap;
struct putc_info pi;
if (!msgbuf)
return;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return;
va_start(ap, fmt);
pi.str = cursor;
pi.last_str = 0;
{
if (!msgbuf)
return;
Node *node = DT__FindNode("/", false);
if (node)
DT__AddProperty(node, "boot-log", strlen((char *)msgbuf) + 1, msgbuf);
for (c = 0; c < 8; c++) putc(' ');
return;
}
if ( c == '\n' )
{
putc('\r');
}
putc(c);
}
int getc()
{
int c = bgetc();
int c = bgetc();
//execute_hook("Keymapper", &c, NULL, NULL, NULL, NULL, NULL);
if ((c & 0xff) == 0)
return c;
else
int getchar()
{
register int c = getc();
if ( c == '\r' ) c = '\n';
if ( c >= ' ' && c < 0x7f) putchar(c);
return (c);
{
va_list ap;
va_start(ap, fmt);
prf(fmt, ap, putchar, 0);
{
/* Kabyl: BooterLog */
/* Kabyl: BooterLog */
struct putc_info pi;
if (!msgbuf)
return 0;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return 0;
pi.str = cursor;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
}
va_end(ap);
return 0;
}
{
prf(fmt, ap, putchar, 0);
}
{
/* Kabyl: BooterLog */
/* Kabyl: BooterLog */
struct putc_info pi;
if (!msgbuf)
return 0;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return 0;
pi.str = cursor;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
}
va_end(ap);
return(0);
}
va_list ap;
gErrors = true;
va_start(ap, fmt);
prf(fmt, ap, putchar, 0);
va_end(ap);
void stop(const char * fmt, ...)
{
va_list ap;
printf("\n");
va_start(ap, fmt);
prf(fmt, ap, putchar, 0);
va_end(ap);
printf("Press a key to continue...");
getc();
}
char * newStringWithFormat(const char * fmt, ...)
{
va_list ap;
struct putc_info pi;
int len;
char *str = NULL;
va_start(ap, fmt);
pi.last_str = 0;
len = prf_fmt_str_len(fmt, ap);
if (len > 0)
{
str = malloc(len+1);
if (!str) return NULL;
}
pi.str = str;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
va_end(ap);
return str;
}
branches/cparm/i386/libsaio/arc4random.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#include "libsaio.h"
/*
* License for L15_Swap, L15_InitState, L_SCHEDULE, L15_KSA, L15_Discard, L15, L15_Byte
*
* Copyright (c) 2004, 2005, 2006 Robin J Carey. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification, immediately at the beginning of the file.
* 2. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $DragonFly: src/sys/kern/kern_nrandom.c,v 1.7 2008/08/01 04:42:30 dillon Exp $
*/
/*
* IMPORTANT NOTE: LByteType must be exactly 8-bits in size or this software
* will not function correctly.
*/
typedef unsigned char LByteType;
#define L15_STATE_SIZE 256
static LByteType L15_x, L15_y;
static LByteType L15_start_x;
static LByteType L15_state[L15_STATE_SIZE];
/*
* PRIVATE FUNCS:
*/
static void L15(const LByteType * const key, const size_t keyLen);
static void L15_Swap(const LByteType pos1, const LByteType pos2);
static void L15_InitState(void);
static void L15_KSA(const LByteType * const key,
const size_t keyLen);
static void L15_Discard(const LByteType numCalls);
/*
* PUBLIC INTERFACE:
*/
static LByteType L15_Byte(void);
static __inline void
L15_Swap(const LByteType pos1, const LByteType pos2)
{
const LByteType save1 = L15_state[pos1];
L15_state[pos1] = L15_state[pos2];
L15_state[pos2] = save1;
}
static void
L15_InitState (void)
{
size_t i;
for (i = 0; i < L15_STATE_SIZE; ++i)
L15_state[i] = i;
}
#define L_SCHEDULE(xx) \
\
for (i = 0; i < L15_STATE_SIZE; ++i) { \
L15_Swap(i, (stateIndex += (L15_state[i] + (xx)))); \
}
static void
L15_KSA (const LByteType * const key, const size_t keyLen)
{
size_t i, keyIndex;
LByteType stateIndex = 0;
L_SCHEDULE(keyLen);
for (keyIndex = 0; keyIndex < keyLen; ++keyIndex) {
L_SCHEDULE(key[keyIndex]);
}
}
static void
L15_Discard(const LByteType numCalls)
{
LByteType i;
for (i = 0; i < numCalls; ++i) {
(void)L15_Byte();
}
}
/*
* PUBLIC INTERFACE:
*/
static void
L15(const LByteType * const key, const size_t keyLen)
{
L15_x = L15_start_x = 0;
L15_y = L15_STATE_SIZE - 1;
L15_InitState();
L15_KSA(key, keyLen);
L15_Discard(L15_Byte());
}
static LByteType
L15_Byte(void)
{
LByteType z;
L15_Swap(L15_state[L15_x], L15_y);
z = (L15_state [L15_x++] + L15_state[L15_y--]);
if (L15_x == L15_start_x) {
--L15_y;
}
return (L15_state[z]);
}
/*-
* THE BEER-WARE LICENSE
*
* <dan@FreeBSD.ORG> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you
* think this stuff is worth it, you can buy me a beer in return.
*
* Dan Moschuk
*
* $FreeBSD: src/sys/libkern/arc4random.c,v 1.3.2.2 2001/09/17 07:06:50 silby Exp $
*/
#defineARC4_MAXRUNS 16384
#defineARC4_RESEED_SECONDS 300 * 18
#defineARC4_KEYBYTES 32 /* 256 bit key */
static u_int8_t arc4_i, arc4_j;
static int arc4_initialized = 0;
static int arc4_numruns = 0;
static u_int8_t arc4_sbox[256];
static u_int32_t arc4_tv_nextreseed;
static u_int8_t arc4_randbyte(void);
static __inline void
arc4_swap(u_int8_t *a, u_int8_t *b)
{
u_int8_t c;
c = *a;
*a = *b;
*b = c;
}
/*
* Stir our S-box.
*/
static void
arc4_randomstir (void)
{
u_int8_t key[256];
int r, n;
/*
* XXX read_random() returns unsafe numbers if the entropy
* device is not loaded -- MarkM.
*/
{
for (r = 0; r < ARC4_KEYBYTES; ++r)
((u_char *)key)[r] = L15_Byte();
}
/* If r == 0 || -1, just use what was on the stack. */
if (r > 0)
{
for (n = r; n < sizeof(key); n++)
key[n] = key[n % r];
}
for (n = 0; n < 256; n++)
{
arc4_j = (arc4_j + arc4_sbox[n] + key[n]) % 256;
arc4_swap(&arc4_sbox[n], &arc4_sbox[arc4_j]);
}
arc4_i = arc4_j = 0;
/* Reset for next reseed cycle. */
arc4_tv_nextreseed = time18();
arc4_tv_nextreseed += ARC4_RESEED_SECONDS;
arc4_numruns = 0;
}
/*
* Initialize our S-box to its beginning defaults.
*/
static void
arc4_init(void)
{
int n;
u_int32_t now = time18();
L15((const LByteType *)&now, sizeof(u_int32_t));
arc4_i = arc4_j = 0;
for (n = 0; n < 256; n++)
arc4_sbox[n] = (u_int8_t) n;
arc4_randomstir();
arc4_initialized = 1;
/*
* Throw away the first N words of output, as suggested in the
* paper "Weaknesses in the Key Scheduling Algorithm of RC4"
* by Fluher, Mantin, and Shamir. (N = 256 in our case.)
*/
for (n = 0; n < 256*4; n++)
arc4_randbyte();
}
/*
* Generate a random byte.
*/
static u_int8_t
arc4_randbyte(void)
{
u_int8_t arc4_t;
arc4_i = (arc4_i + 1) % 256;
arc4_j = (arc4_j + arc4_sbox[arc4_i]) % 256;
arc4_swap(&arc4_sbox[arc4_i], &arc4_sbox[arc4_j]);
arc4_t = (arc4_sbox[arc4_i] + arc4_sbox[arc4_j]) % 256;
return arc4_sbox[arc4_t];
}
void
arc4rand(void *ptr, u_int len, int reseed)
{
u_char *p;
u_int32_t tv_now;
/* Initialize array if needed. */
if (!arc4_initialized)
arc4_init();
tv_now = time18();
if (reseed ||
(arc4_numruns > ARC4_MAXRUNS) ||
(tv_now > arc4_tv_nextreseed))
arc4_randomstir();
arc4_numruns += len;
p = ptr;
while (len--)
*p++ = arc4_randbyte();
}
uint32_t
arc4random(void)
{
uint32_t ret;
arc4rand(&ret, sizeof ret, 0);
return ret;
}
branches/cparm/i386/libsaio/Makefile
1111
1212
1313
14
14
1515
1616
1717
18
18
1919
2020
2121
......
3333
3434
3535
36
36
3737
3838
3939
OPTIM = -Os -Oz
DEBUG = -DNOTHING
#DEBUG = -DDEBUG_CPU=1 -DDEBUG_MEM=1 -DDEBUG_SPD=1 -DDEBUG_PCI=1 -DDEBUG_SMBIOS=1
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float
DEFINES=
VPATH = $(OBJROOT):$(SYMROOT)
SAIO_OBJS = table.o asm.o bios.o biosfn.o \
SAIO_OBJS = table.o asm.o bios.o biosfn.o arc4random.o stack_protector.o \
disk.o sys.o cache.o bootstruct.o \
stringTable.o load.o pci.o allocate.o misc.o \
vbe.o hfs.o hfs_compare.o \
branches/cparm/i386/libsaio/cpu_intel_amd.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
/*
* Copyright 2008 Islam Ahmed Zaid. All rights reserved. <azismed@gmail.com>
* AsereBLN: 2009: cleanup and bugfix
*/
#include "libsaio.h"
#include "platform.h"
#include "cpu.h"
#ifndef DEBUG_CPU
#define DEBUG_CPU 0
#endif
#if DEBUG_CPU
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#endif
//#define LEGACY_CPU
// DFE: enable_PIT2 and disable_PIT2 come from older xnu
/*
* Enable or disable timer 2.
* Port 0x61 controls timer 2:
* bit 0 gates the clock,
* bit 1 gates output to speaker.
*/
static inline void enable_PIT2(void)
{
/* Enable gate, disable speaker */
__asm__ volatile(
" inb $0x61,%%al \n\t"
" and $0xFC,%%al \n\t" /* & ~0x03 */
" or $1,%%al \n\t"
" outb %%al,$0x61 \n\t"
: : : "%al" );
}
static inline void disable_PIT2(void)
{
/* Disable gate and output to speaker */
__asm__ volatile(
" inb $0x61,%%al \n\t"
" and $0xFC,%%al \n\t"/* & ~0x03 */
" outb %%al,$0x61 \n\t"
: : : "%al" );
}
// DFE: set_PIT2_mode0, poll_PIT2_gate, and measure_tsc_frequency are
// roughly based on Linux code
/* Set the 8254 channel 2 to mode 0 with the specified value.
In mode 0, the counter will initially set its gate low when the
timer expires. For this to be useful, you ought to set it high
before calling this function. The enable_PIT2 function does this.
*/
static inline void set_PIT2_mode0(uint16_t value)
{
__asm__ volatile(
" movb $0xB0,%%al \n\t"
" outb%%al,$0x43\n\t"
" movb%%dl,%%al\n\t"
" outb%%al,$0x42\n\t"
" movb%%dh,%%al\n\t"
" outb%%al,$0x42"
: : "d"(value) /*: no clobber */ );
}
/* Returns the number of times the loop ran before the PIT2 signaled */
static inline unsigned long poll_PIT2_gate(void)
{
unsigned long count = 0;
unsigned char nmi_sc_val;
do {
++count;
__asm__ volatile(
"inb$0x61,%0"
: "=q"(nmi_sc_val) /*:*/ /* no input */ /*:*/ /* no clobber */);
} while( (nmi_sc_val & 0x20) == 0);
return count;
}
#ifdef LEGACY_CPU
static uint64_t measure_tsc_frequency(void);
/*
* DFE: Measures the TSC frequency in Hz (64-bit) using the ACPI PM timer
*/
static uint64_t measure_tsc_frequency(void)
{
uint64_t tscStart;
uint64_t tscEnd;
uint64_t tscDelta = 0xffffffffffffffffULL;
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.
* That is to say that we're biased towards measuring the minimum
* number of TSC ticks that occur while waiting for the timer to
* expire. That theoretically helps avoid inconsistencies when
* running under a VM if the TSC is not virtualized and the host
* steals time. The TSC is normally virtualized for VMware.
*/
for(i = 0; i < 10; ++i)
{
enable_PIT2();
set_PIT2_mode0(CALIBRATE_LATCH);
tscStart = rdtsc64();
pollCount = poll_PIT2_gate();
tscEnd = rdtsc64();
/* The poll loop must have run at least a few times for accuracy */
if(pollCount <= 1)
continue;
/* The TSC must increment at LEAST once every millisecond. We
* should have waited exactly 30 msec so the TSC delta should
* be >= 30. Anything less and the processor is way too slow.
*/
if((tscEnd - tscStart) <= CALIBRATE_TIME_MSEC)
continue;
// tscDelta = min(tscDelta, (tscEnd - tscStart))
if( (tscEnd - tscStart) < tscDelta )
tscDelta = tscEnd - tscStart;
}
/* tscDelta is now the least number of TSC ticks the processor made in
* a timespan of 0.03 s (e.g. 30 milliseconds)
* Linux thus divides by 30 which gives the answer in kiloHertz because
* 1 / ms = kHz. But we're xnu and most of the rest of the code uses
* Hz so we need to convert our milliseconds to seconds. Since we're
* dividing by the milliseconds, we simply multiply by 1000.
*/
/* Unlike linux, we're not limited to 32-bit, but we do need to take care
* that we're going to multiply by 1000 first so we do need at least some
* arithmetic headroom. For now, 32-bit should be enough.
* Also unlike Linux, our compiler can do 64-bit integer arithmetic.
*/
if(tscDelta > (1ULL<<32))
retval = 0;
else
{
retval = tscDelta * 1000 / 30;
}
disable_PIT2();
return retval;
}
#endif
#define MSR_AMD_APERF 0x000000E8
/*
* Original comment/code:
* "DFE: Measures the Max Performance Frequency in Hz (64-bit)"
*
* Measures the Actual Performance Frequency in Hz (64-bit)
* (just a naming change, mperf --> aperf )
*/
static uint64_t measure_aperf_frequency(void)
{
uint64_t aperfStart;
uint64_t aperfEnd;
uint64_t aperfDelta = 0xffffffffffffffffULL;
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.
* That is to say that we're biased towards measuring the minimum
* number of APERF ticks that occur while waiting for the timer to
* expire.
*/
for(i = 0; i < 10; ++i)
{
enable_PIT2();
set_PIT2_mode0(CALIBRATE_LATCH);
aperfStart = rdmsr64(MSR_AMD_APERF);
pollCount = poll_PIT2_gate();
aperfEnd = rdmsr64(MSR_AMD_APERF);
/* The poll loop must have run at least a few times for accuracy */
if (pollCount <= 1)
continue;
/* The TSC must increment at LEAST once every millisecond.
* We should have waited exactly 30 msec so the APERF delta should
* be >= 30. Anything less and the processor is way too slow.
*/
if ((aperfEnd - aperfStart) <= CALIBRATE_TIME_MSEC)
continue;
// tscDelta = MIN(tscDelta, (tscEnd - tscStart))
if ( (aperfEnd - aperfStart) < aperfDelta )
aperfDelta = aperfEnd - aperfStart;
}
/* 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
{
retval = aperfDelta * 1000 / 30;
}
disable_PIT2();
return retval;
}
/*
License for x2apic_enabled, get_apicbase, compute_bclk.
Copyright (c) 2010, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
static inline __attribute__((always_inline)) void rdmsr32(uint32_t msr, uint32_t * lo_data_addr, uint32_t * hi_data_addr);
static inline __attribute__((always_inline)) void wrmsr32(uint32_t msr, uint32_t lo_data, uint32_t hi_data);
static uint32_t x2apic_enabled(void);
static uint32_t get_apicbase(void);
static uint32_t compute_bclk(void);
static inline __attribute__((always_inline)) void rdmsr32(uint32_t msr, uint32_t * lo_data_addr, uint32_t * hi_data_addr)
{
__asm__ volatile(
"rdmsr"
: "=a" (*lo_data_addr), "=d" (*hi_data_addr)
: "c" (msr)
);
}
static inline __attribute__((always_inline)) void wrmsr32(uint32_t msr, uint32_t lo_data, uint32_t hi_data)
{
__asm__ __volatile__ (
"wrmsr"
: /* No outputs */
: "c" (msr), "a" (lo_data), "d" (hi_data)
);
}
#define MSR_APIC_BASE 0x1B
#define APIC_TMR_INITIAL_CNT 0x380
#define APIC_TMR_CURRENT_CNT 0x390
#define APIC_TMR_DIVIDE_CFG 0x3E0
#define MSR_APIC_TMR_INITIAL_CNT 0x838
#define MSR_APIC_TMR_CURRENT_CNT 0x839
#define MSR_APIC_TMR_DIVIDE_CFG 0x83E
static uint32_t x2apic_enabled(void)
{
uint64_t temp64;
temp64 = rdmsr64(MSR_APIC_BASE);
return (uint32_t) (temp64 & (1 << 10)) ? 1 : 0;
}
static uint32_t get_apicbase(void)
{
uint64_t temp64;
temp64 = rdmsr64(MSR_APIC_BASE);
return (uint32_t) (temp64 & 0xfffff000);
}
static uint32_t compute_bclk(void)
{
uint32_t dummy;
uint32_t start, stop;
uint8_t temp8;
uint16_t delay_count;
uint32_t bclk;
#define DELAY_IN_US 1000
// Compute fixed delay as time
// delay count = desired time * PIT frequency
// PIT frequency = 1.193182 MHz
delay_count = 1193182 / DELAY_IN_US;
// PIT channel 2 gate is controlled by IO port 0x61, bit 0
#define PIT_CH2_LATCH_REG 0x61
#define CH2_SPEAKER (1 << 1) // bit 1 -- 1 = speaker enabled 0 = speaker disabled
#define CH2_GATE_IN (1 << 0) // bit 0 -- 1 = gate enabled, 0 = gate disabled
#define CH2_GATE_OUT (1 << 5) // bit 5 -- 1 = gate latched, 0 = gate not latched
// PIT Command register
#define PIT_MODE_COMMAND_REG 0x43
#define SELECT_CH2 (2 << 6)
#define ACCESS_MODE_LOBYTE_HIBYTE (3 << 4)
#define MODE0_INTERRUPT_ON_TERMINAL_COUNT 0 // Despite name, no interrupts on CH2
// PIT Channel 2 data port
#define PIT_CH2_DATA 0x42
// Disable the PIT channel 2 speaker and gate
temp8 = inb(PIT_CH2_LATCH_REG);
temp8 &= ~(CH2_SPEAKER | CH2_GATE_IN);
outb(PIT_CH2_LATCH_REG, temp8);
// Setup command and mode
outb(PIT_MODE_COMMAND_REG, SELECT_CH2 | ACCESS_MODE_LOBYTE_HIBYTE | MODE0_INTERRUPT_ON_TERMINAL_COUNT);
// Set time for fixed delay
outb(PIT_CH2_DATA, (uint8_t) (delay_count));
outb(PIT_CH2_DATA, (uint8_t) (delay_count >> 8));
// Prepare to enable channel 2 gate but leave the speaker disabled
temp8 = inb(PIT_CH2_LATCH_REG);
temp8 &= ~CH2_SPEAKER;
temp8 |= CH2_GATE_IN;
if (x2apic_enabled())
{
// Set APIC Timer Divide Value as 2
wrmsr32(MSR_APIC_TMR_DIVIDE_CFG, 0, 0);
// start APIC timer with a known value
start = ~0UL;
wrmsr32(MSR_APIC_TMR_INITIAL_CNT, start, 0);
}
else
{
// Set APIC Timer Divide Value as 2
*(volatile uint32_t *)(uint32_t) (get_apicbase() + APIC_TMR_DIVIDE_CFG) = 0UL;
// start APIC timer with a known value
start = ~0UL;
*(volatile uint32_t *)(uint32_t) (get_apicbase() + APIC_TMR_INITIAL_CNT) = start;
}
// Actually start the PIT channel 2
outb(PIT_CH2_LATCH_REG, temp8);
// Wait for the fixed delay
while (!(inb(PIT_CH2_LATCH_REG) & CH2_GATE_OUT));
if (x2apic_enabled())
{
// read the APIC timer to determine the change that occurred over this fixed delay
rdmsr32(MSR_APIC_TMR_CURRENT_CNT, &stop, &dummy);
// stop APIC timer
wrmsr32(MSR_APIC_TMR_INITIAL_CNT, 0, 0);
}
else
{
// read the APIC timer to determine the change that occurred over this fixed delay
stop = *(volatile uint32_t *)(uint32_t) (get_apicbase() + APIC_TMR_CURRENT_CNT);
// stop APIC timer
*(volatile uint32_t *)(uint32_t) (get_apicbase() + APIC_TMR_INITIAL_CNT) = 0UL;
}
// Disable channel 2 speaker and gate input
temp8 = inb(PIT_CH2_LATCH_REG);
temp8 &= ~(CH2_SPEAKER | CH2_GATE_IN);
outb(PIT_CH2_LATCH_REG, temp8);
bclk = (start - stop) * 2 / DELAY_IN_US;
// Round bclk to the nearest 100/12 integer value
bclk = ((((bclk * 24) + 100) / 200) * 200) / 24;
return bclk;
}
/*
* Calculates the FSB and CPU frequencies using specific MSRs for each CPU
* - multi. is read from a specific MSR. In the case of Intel, there is:
* a max multi. (used to calculate the FSB freq.),
* and a current multi. (used to calculate the CPU freq.)
* - fsbFrequency = tscFrequency / multi
* - cpuFrequency = fsbFrequency * multi
*/
void scan_cpu(PlatformInfo_t *p)
{
uint64_ttscFrequency = 0, fsbFrequency = 0, cpuFrequency = 0;
uint64_tmsr;
uint8_tmaxcoef = 0, maxdiv = 0, currcoef = 0, currdiv = 0;
uint32_treg[4];
uint32_t cores_per_package = 0;
uint32_t logical_per_package = 0;
do_cpuid(0, reg);
p->CPU.Vendor= reg[ebx];
p->CPU.cpuid_max_basic = reg[eax];
if (p->CPU.Vendor == 0x756E6547 /* Intel */)
{
do_cpuid2(0x00000004, 0, reg);
cores_per_package= bitfield(reg[eax], 31, 26) + 1;
}
else if (p->CPU.Vendor != 0x68747541 /* AMD */)
{
stop("Error: CPU unsupported\n");
halt();
}
/* get extended cpuid results */
do_cpuid(0x80000000, reg);
p->CPU.cpuid_max_ext = reg[eax];
/* Begin of Copyright: from Apple's XNU cpuid.c */
/* get brand string (if supported) */
if (p->CPU.cpuid_max_ext > 0x80000004)
{
char str[128], *s;
/*
* The brand string 48 bytes (max), guaranteed to
* be NUL terminated.
*/
do_cpuid(0x80000002, reg);
bcopy((char *)reg, &str[0], 16);
do_cpuid(0x80000003, reg);
bcopy((char *)reg, &str[16], 16);
do_cpuid(0x80000004, reg);
bcopy((char *)reg, &str[32], 16);
for (s = str; *s != '\0'; s++)
{
if (*s != ' ') break;
}
strlcpy(p->CPU.BrandString,s, sizeof(p->CPU.BrandString));
if (!strncmp(p->CPU.BrandString, CPUID_STRING_UNKNOWN, min(sizeof(p->CPU.BrandString), (unsigned)strlen(CPUID_STRING_UNKNOWN) + 1)))
{
/*
* This string means we have a firmware-programmable brand string,
* and the firmware couldn't figure out what sort of CPU we have.
*/
p->CPU.BrandString[0] = '\0';
}
}
/*
* Get processor signature and decode
* and bracket this with the approved procedure for reading the
* the microcode version number a.k.a. signature a.k.a. BIOS ID
*/
if (p->CPU.Vendor == 0x756E6547 /* Intel */)
{
wrmsr64(MSR_IA32_BIOS_SIGN_ID, 0);
do_cpuid(1, reg);
p->CPU.MicrocodeVersion =
(uint32_t) (rdmsr64(MSR_IA32_BIOS_SIGN_ID) >> 32);
}
else if (p->CPU.Vendor != 0x68747541 /* AMD */)
do_cpuid(1, reg);
p->CPU.Signature = reg[eax];
p->CPU.Stepping = bitfield(reg[eax], 3, 0);
p->CPU.Model = bitfield(reg[eax], 7, 4);
p->CPU.Family = bitfield(reg[eax], 11, 8);
p->CPU.ExtModel = bitfield(reg[eax], 19, 16);
p->CPU.ExtFamily = bitfield(reg[eax], 27, 20);
p->CPU.Brand = bitfield(reg[ebx], 7, 0);
p->CPU.Features = quad(reg[ecx], reg[edx]);
/* Fold extensions into family/model */
if (p->CPU.Family == 0x0f)
p->CPU.Family += p->CPU.ExtFamily;
if (p->CPU.Family == 0x0f || p->CPU.Family == 0x06)
p->CPU.Model += (p->CPU.ExtModel << 4);
if (p->CPU.Features & CPUID_FEATURE_HTT)
logical_per_package =
bitfield(reg[ebx], 23, 16);
else
logical_per_package = 1;
if (p->CPU.cpuid_max_ext >= 0x80000001)
{
do_cpuid(0x80000001, reg);
p->CPU.ExtFeatures =
quad(reg[ecx], reg[edx]);
}
if (p->CPU.cpuid_max_ext >= 0x80000007)
{
do_cpuid(0x80000007, reg);
/* Fold in the Invariant TSC feature bit, if present */
p->CPU.ExtFeatures |=
reg[edx] & (uint32_t)CPUID_EXTFEATURE_TSCI;
if (p->CPU.Vendor == 0x68747541 /* AMD */)
{
/* Fold in the Hardware P-State control feature bit, if present */
p->CPU.ExtFeatures |=
reg[edx] & (uint32_t)_Bit(7);
/* Fold in the read-only effective frequency interface feature bit, if present */
p->CPU.ExtFeatures |=
reg[edx] & (uint32_t)_Bit(10);
}
}
if (p->CPU.Vendor == 0x68747541 /* AMD */)
{
if (p->CPU.cpuid_max_ext >= 0x80000008)
{
if (p->CPU.Features & CPUID_FEATURE_HTT)
{
do_cpuid(0x80000008, reg);
cores_per_package= bitfield(reg[ecx], 7 , 0) + 1; // NC + 1
}
}
}
if (p->CPU.cpuid_max_basic >= 0x5) {
/*
* Extract the Monitor/Mwait Leaf info:
*/
do_cpuid(5, reg);
if (p->CPU.Vendor == 0x756E6547 /* Intel */)
{
p->CPU.sub_Cstates = reg[edx];
}
p->CPU.extensions = reg[ecx];
}
if (p->CPU.Vendor == 0x756E6547 /* Intel */)
{
if (p->CPU.cpuid_max_basic >= 0x6)
{
/*
* The thermal and Power Leaf:
*/
do_cpuid(6, reg);
p->CPU.dynamic_acceleration = bitfield(reg[eax], 1, 1); // "Dynamic Acceleration Technology (Turbo Mode)"
p->CPU.invariant_APIC_timer = bitfield(reg[eax], 2, 2); // "Invariant APIC Timer"
p->CPU.fine_grain_clock_mod = bitfield(reg[eax], 4, 4);
}
if ((p->CPU.Vendor == 0x756E6547 /* Intel */) &&
(p->CPU.Family == 0x06))
{
/*
* Find the number of enabled cores and threads
* (which determines whether SMT/Hyperthreading is active).
*/
switch (p->CPU.Model)
{
case CPUID_MODEL_DALES_32NM:
case CPUID_MODEL_WESTMERE:
case CPUID_MODEL_WESTMERE_EX:
{
msr = rdmsr64(MSR_CORE_THREAD_COUNT);
p->CPU.NoThreads = bitfield((uint32_t)msr, 15, 0);
p->CPU.NoCores = bitfield((uint32_t)msr, 19, 16);
break;
}
case CPUID_MODEL_NEHALEM:
case CPUID_MODEL_FIELDS:
case CPUID_MODEL_DALES:
case CPUID_MODEL_NEHALEM_EX:
case CPUID_MODEL_SANDYBRIDGE:
case CPUID_MODEL_JAKETOWN:
{
msr = rdmsr64(MSR_CORE_THREAD_COUNT);
p->CPU.NoThreads = bitfield((uint32_t)msr, 15, 0);
p->CPU.NoCores = bitfield((uint32_t)msr, 31, 16);
break;
}
}
}
}
if (p->CPU.NoCores == 0)
{
if (p->CPU.Vendor == 0x68747541 /* AMD */)
{
if (!cores_per_package) {
//legacy method
if ((p->CPU.ExtFeatures & _HBit(1)/* CmpLegacy */) && ( p->CPU.Features & CPUID_FEATURE_HTT) )
cores_per_package = logical_per_package;
else
cores_per_package = 1;
}
}
p->CPU.NoThreads = logical_per_package;
p->CPU.NoCores = cores_per_package ? cores_per_package : 1 ;
}
/* End of Copyright: from Apple's XNU cpuid.c */
fsbFrequency = (uint64_t)(compute_bclk() * 1000000);
#ifdef LEGACY_CPU
tscFrequency = measure_tsc_frequency();
#endif
if (p->CPU.Vendor == 0x68747541 /* AMD */)
{
#define K8_FIDVID_STATUS0xC0010042
#define K10_COFVID_STATUS0xC0010071
if (p->CPU.ExtFeatures & _Bit(10))
{
cpuFrequency = measure_aperf_frequency();
}
if ((p->CPU.Vendor == 0x68747541 /* AMD */) && (p->CPU.Family == 0x0f))
{
switch(p->CPU.ExtFamily)
{
case 0x00: /* K8 */
msr = rdmsr64(K8_FIDVID_STATUS);
maxcoef = bitfield(msr, 21, 16) / 2 + 4;
currcoef = bitfield(msr, 5, 0) / 2 + 4;
break;
case 0x01: /* K10 */
{
//uint32_t reg[4];
msr = rdmsr64(K10_COFVID_STATUS);
/*
do_cpuid2(0x00000006, 0, reg);
EffFreq: effective frequency interface
if (bitfield(reg[ecx], 0, 0) == 1)
{
uint64_t aperf = measure_aperf_frequency();
cpuFrequency = aperf;
}
*/
// NOTE: tsc runs at the maccoeff (non turbo)
//*not* at the turbo frequency.
maxcoef = bitfield(msr, 54, 49) / 2 + 4;
currcoef = bitfield(msr, 5, 0) + 0x10;
currdiv = 2 << bitfield(msr, 8, 6);
break;
}
case 0x05: /* K14 */
msr = rdmsr64(K10_COFVID_STATUS);
currcoef = (bitfield(msr, 54, 49) + 0x10) << 2;
currdiv = (bitfield(msr, 8, 4) + 1) << 2;
currdiv += bitfield(msr, 3, 0);
break;
case 0x02: /* K11 */
DBG("K11 detected, but not supported !!!\n");
// not implimented
break;
}
if (!fsbFrequency)
{
if (maxcoef)
{
if (currdiv)
{
if (!currcoef) currcoef = maxcoef;
if (!cpuFrequency)
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
else
fsbFrequency = ((cpuFrequency * currdiv) / currcoef);
DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
if (!cpuFrequency)
fsbFrequency = (tscFrequency / maxcoef);
else
fsbFrequency = (cpuFrequency / maxcoef);
DBG("%d\n", currcoef);
}
}
else if (currcoef)
{
if (currdiv)
{
fsbFrequency = ((tscFrequency * currdiv) / currcoef);
DBG("%d.%d\n", currcoef / currdiv, ((currcoef % currdiv) * 100) / currdiv);
} else {
fsbFrequency = (tscFrequency / currcoef);
DBG("%d\n", currcoef);
}
}
}
}
// NOTE: This is not the approved method,
// the method provided by AMD is:
// if ((PowerNow == enabled (p->CPU.cpuid_max_ext >= 0x80000007)) && (StartupFID(??) != MaxFID(??))) then "mobile processor present"
if (strstr(p->CPU.BrandString, "obile"))
p->CPU.isMobile = true;
else
p->CPU.isMobile = false;
DBG("%s platform detected.\n", p->CPU.isMobile?"Mobile":"Desktop");
}
else if ((p->CPU.Vendor == 0x756E6547 /* Intel */) &&
((p->CPU.Family == 0x06) ||
(p->CPU.Family == 0x0f)))
{
if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0c) ||
(p->CPU.Family == 0x0f && p->CPU.Model >= 0x03))
{
/* Nehalem CPU model */
if (p->CPU.Family == 0x06 && (p->CPU.Model == CPUID_MODEL_NEHALEM ||
p->CPU.Model == CPUID_MODEL_FIELDS ||
p->CPU.Model == CPUID_MODEL_DALES ||
p->CPU.Model == CPUID_MODEL_DALES_32NM ||
p->CPU.Model == CPUID_MODEL_WESTMERE ||
p->CPU.Model == CPUID_MODEL_NEHALEM_EX ||
p->CPU.Model == CPUID_MODEL_WESTMERE_EX ||
p->CPU.Model == CPUID_MODEL_SANDYBRIDGE ||
p->CPU.Model == CPUID_MODEL_JAKETOWN))
{
uint8_tbus_ratio_max = 0, bus_ratio_min = 0;
uint32_tmax_ratio = 0;
uint64_tflex_ratio = 0;
msr = rdmsr64(MSR_PLATFORM_INFO);
#if DEBUG_CPU
DBG("msr(%d): platform_info %08x\n", __LINE__, msr & 0xffffffff);
#endif
bus_ratio_max = (msr >> 8) & 0xff;
bus_ratio_min = (msr >> 40) & 0xff;
msr = rdmsr64(MSR_FLEX_RATIO);
#if DEBUG_CPU
DBG("msr(%d): flex_ratio %08x\n", __LINE__, msr & 0xffffffff);
#endif
if ((msr >> 16) & 0x01)
{
flex_ratio = (msr >> 8) & 0xff;
/* bcc9: at least on the gigabyte h67ma-ud2h,
where the cpu multipler can't be changed to
allow overclocking, the flex_ratio msr has unexpected (to OSX)
contents. These contents cause mach_kernel to
fail to compute the bus ratio correctly, instead
causing the system to crash since tscGranularity
is inadvertently set to 0.
*/
if (flex_ratio == 0)
{
/* Clear bit 16 (evidently the
presence bit) */
wrmsr64(MSR_FLEX_RATIO, (msr & 0xFFFFFFFFFFFEFFFFULL));
msr = rdmsr64(MSR_FLEX_RATIO);
#if DEBUG_CPU
DBG("Unusable flex ratio detected. MSR Patched to %08x\n", msr & 0xffffffff);
#endif
}
else
{
if (bus_ratio_max > flex_ratio)
{
bus_ratio_max = flex_ratio;
}
}
}
#ifdef LEGACY_CPU
if (bus_ratio_max)
{
fsbFrequency = (tscFrequency / bus_ratio_max);
}
#endif
//valv: Turbo Ratio Limit
if ((p->CPU.Model != 0x2e) && (p->CPU.Model != 0x2f))
{
//msr = rdmsr64(MSR_TURBO_RATIO_LIMIT);
cpuFrequency = bus_ratio_max * fsbFrequency;
max_ratio = bus_ratio_max * 10;
}
else
{
#ifdef LEGACY_CPU
cpuFrequency = tscFrequency;
#else
cpuFrequency = bus_ratio_max * fsbFrequency;
#endif
}
#if DEBUG_CPU
DBG("Sticking with [BCLK: %dMhz, Bus-Ratio: %d]\n", fsbFrequency / 1000000, max_ratio);
#endif
currcoef = bus_ratio_max;
tscFrequency = cpuFrequency;
}
else
{
msr = rdmsr64(MSR_IA32_PERF_STATUS);
#if DEBUG_CPU
DBG("msr(%d): ia32_perf_stat 0x%08x\n", __LINE__, msr & 0xffffffff);
#endif
currcoef = (msr >> 8) & 0x1f;
/* Non-integer bus ratio for the max-multi*/
maxdiv = (msr >> 46) & 0x01;
/* Non-integer bus ratio for the current-multi (undocumented)*/
currdiv = (msr >> 14) & 0x01;
if ((p->CPU.Family == 0x06 && p->CPU.Model >= 0x0e) ||
(p->CPU.Family == 0x0f)) // This will always be model >= 3
{
/* On these models, maxcoef defines TSC freq */
maxcoef = (msr >> 40) & 0x1f;
}
else
{
/* On lower models, currcoef defines TSC freq */
/* XXX */
maxcoef = currcoef;
}
if (!currcoef) currcoef = maxcoef;
#ifdef LEGACY_CPU
if (maxcoef)
{
if (maxdiv)
{
fsbFrequency = ((tscFrequency * 2) / ((maxcoef * 2) + 1));
}
else
{
fsbFrequency = (tscFrequency / maxcoef);
}
if (currdiv)
{
cpuFrequency = (fsbFrequency * ((currcoef * 2) + 1) / 2);
}
else
{
cpuFrequency = (fsbFrequency * currcoef);
}
#if DEBUG_CPU
DBG("max: %d%s current: %d%s\n", maxcoef, maxdiv ? ".5" : "",currcoef, currdiv ? ".5" : "");
#endif
}
#else
if (currdiv)
{
cpuFrequency = (fsbFrequency * ((currcoef * 2) + 1) / 2);
}
else
{
cpuFrequency = (fsbFrequency * currcoef);
}
if (maxcoef)
{
if (maxdiv)
{
tscFrequency = (fsbFrequency * ((maxcoef * 2) + 1)) / 2;
}
else
{
tscFrequency = fsbFrequency * maxcoef;
}
}
#if DEBUG_CPU
DBG("max: %d%s current: %d%s\n", maxcoef, maxdiv ? ".5" : "",currcoef, currdiv ? ".5" : "");
#endif
#endif // LEGACY_CPU
}
}
/* Mobile CPU ? */
//Slice
p->CPU.isMobile = false;
switch (p->CPU.Model)
{
case 0x0D:
p->CPU.isMobile = true;
break;
case 0x02:
case 0x03:
case 0x04:
case 0x06:
p->CPU.isMobile = (rdmsr64(0x2C) & (1 << 21));
break;
default:
p->CPU.isMobile = (rdmsr64(0x17) & (1 << 28));
break;
}
DBG("%s platform detected.\n", p->CPU.isMobile?"Mobile":"Desktop");
}
if (!cpuFrequency) cpuFrequency = tscFrequency;
if (!tscFrequency) tscFrequency = cpuFrequency;
p->CPU.MaxCoef = maxcoef;
p->CPU.MaxDiv = maxdiv;
p->CPU.CurrCoef = currcoef;
p->CPU.CurrDiv = currdiv;
p->CPU.TSCFrequency = tscFrequency ;
p->CPU.FSBFrequency = fsbFrequency ;
p->CPU.CPUFrequency = cpuFrequency ;
DBG("CPU: Vendor/Model/ExtModel: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Model, p->CPU.ExtModel);
DBG("CPU: Family/ExtFamily: 0x%x/0x%x\n", p->CPU.Family, p->CPU.ExtFamily);
if (p->CPU.Vendor == 0x68747541 /* AMD */)
{
DBG("CPU (AMD): TSCFreq: %dMHz\n", p->CPU.TSCFrequency / 1000000);
DBG("CPU (AMD): FSBFreq: %dMHz\n", p->CPU.FSBFrequency / 1000000);
DBG("CPU (AMD): CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000);
DBG("CPU (AMD): MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef);
DBG("CPU (AMD): MaxDiv/CurrDiv: 0x%x/0x%x\n", p->CPU.MaxDiv, p->CPU.CurrDiv);
}
else
{
DBG("CPU: TSCFreq: %dMHz\n", p->CPU.TSCFrequency / 1000000);
DBG("CPU: FSBFreq: %dMHz\n", p->CPU.FSBFrequency / 1000000);
DBG("CPU: CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000);
DBG("CPU: MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef);
DBG("CPU: MaxDiv/CurrDiv: 0x%x/0x%x\n", p->CPU.MaxDiv, p->CPU.CurrDiv);
}
DBG("CPU: NoCores/NoThreads: %d/%d\n", p->CPU.NoCores, p->CPU.NoThreads);
DBG("CPU: Features: 0x%08x\n", p->CPU.Features);
DBG("CPU: ExtFeatures: 0x%08x\n", p->CPU.ExtFeatures);
if (p->CPU.Vendor == 0x756E6547 /* Intel */)
DBG("CPU: MicrocodeVersion: %d\n", p->CPU.MicrocodeVersion);
#if DEBUG_CPU
pause();
#endif
}
branches/cparm/i386/libsaio/internal_modules.h
2626
2727
2828
29
3029
3130
3231
// Done !!!
// ps: i swear the next version will be more simple
}
#endif /* __INTERNAL_MODULES_H */
branches/cparm/i386/libsaio/sys.c
4545
4646
4747
48
48
4949
5050
5151
......
5555
5656
5757
58
58
5959
6060
6161
......
138138
139139
140140
141
141
142142
143143
144
144
145145
146
146
147147
148
148
149149
150
150
151151
152152
153153
......
160160
161161
162162
163
163
164164
165
165
166166
167167
168
168
169169
170170
171171
......
173173
174174
175175
176
176
177177
178178
179
179
180180
181181
182
182
183183
184184
185185
......
192192
193193
194194
195
195
196196
197197
198
198
199199
200
200
201201
202202
203
203
204204
205
205
206206
207
207
208208
209209
210210
......
221221
222222
223223
224
224
225225
226226
227227
......
231231
232232
233233
234
234
235235
236236
237237
......
243243
244244
245245
246
246
247247
248
248
249249
250250
251251
252252
253253
254
254
255255
256256
257257
258258
259
260
259
260
261261
262262
263263
264264
265265
266266
267
267
268268
269269
270270
271271
272
272
273273
274274
275275
276276
277
277
278278
279279
280280
......
282282
283283
284284
285
285
286286
287287
288288
......
296296
297297
298298
299
299
300300
301
301
302302
303303
304
304
305305
306
306
307307
308
309
310
308
309
310
311311
312312
313313
......
321321
322322
323323
324
324
325325
326326
327
327
328328
329329
330
330
331331
332
332
333333
334334
335335
......
341341
342342
343343
344
344
345345
346346
347347
......
356356
357357
358358
359
359
360360
361361
362362
363363
364
364
365365
366366
367367
......
377377
378378
379379
380
380
381381
382382
383383
......
396396
397397
398398
399
399
400400
401401
402402
403
403
404404
405405
406406
407
407
408408
409409
410
410
411411
412412
413413
......
416416
417417
418418
419
419
420420
421421
422422
......
435435
436436
437437
438
438
439439
440440
441441
......
453453
454454
455455
456
456
457457
458458
459459
460460
461461
462462
463
463
464464
465465
466466
467
467
468468
469469
470470
471
471
472472
473473
474474
......
496496
497497
498498
499
499
500500
501501
502502
......
506506
507507
508508
509
509
510510
511511
512
512
513513
514
514
515515
516516
517517
......
525525
526526
527527
528
528
529529
530530
531
531
532532
533533
534
534
535535
536
536
537537
538
538
539539
540540
541541
......
546546
547547
548548
549
549
550550
551551
552
552
553553
554554
555555
......
560560
561561
562562
563
563
564564
565565
566
566
567567
568568
569569
570
570
571571
572572
573573
574
574
575575
576
576
577577
578
578
579579
580580
581581
......
598598
599599
600600
601
602
603
604
601
602
603
604
605605
606606
607607
......
768768
769769
770770
771
771
772772
773773
774
775
776
777
778
774
775
776
777
778
779779
780780
781781
782782
783783
784784
785
785
786786
787787
788788
......
794794
795795
796796
797
798
799
800
801
797
798
799
800
801
802802
803
804
805
806
807
803
804
805
806
807
808808
809
810
811
812
813
809
810
811
812
813
814814
815815
816816
......
820820
821821
822822
823
824
825
826
827
823
824
825
826
827
828828
829829
830
831
832
830
831
832
833833
834
835
834
835
836836
837837
838
839
838
839
840840
841841
842842
......
922922
923923
924924
925
926
927
925
926
927
928928
929929
930930
......
939939
940940
941941
942
943
944
945
946
947
948
942
943
944
945
946
947
948
949949
950950
951951
952
953
954
955
956
957
952
953
954
955
956
957
958958
959959
960960
961961
962962
963963
964
964
965965
966
966
967967
968968
969969
970
970
971971
972972
973973
......
983983
984984
985985
986
986
987987
988
988
989989
990
990
991991
992992
993993
......
10011001
10021002
10031003
1004
1004
10051005
10061006
10071007
10081008
10091009
10101010
1011
1011
10121012
10131013
10141014
......
10161016
10171017
10181018
1019
1019
10201020
1021
1021
10221022
10231023
1024
1024
10251025
10261026
10271027
1028
1028
10291029
1030
1030
10311031
10321032
10331033
10341034
10351035
1036
1036
10371037
10381038
10391039
10401040
10411041
10421042
1043
1043
10441044
10451045
10461046
10471047
10481048
1049
1049
10501050
10511051
1052
1052
10531053
1054
1054
10551055
10561056
10571057
......
10611061
10621062
10631063
1064
1064
10651065
1066
1066
10671067
10681068
10691069
......
10771077
10781078
10791079
1080
1080
10811081
10821082
1083
1083
10841084
1085
1085
10861086
10871087
10881088
1089
1089
10901090
10911091
10921092
10931093
1094
1094
10951095
10961096
10971097
......
11051105
11061106
11071107
1108
1108
11091109
11101110
11111111
* Add routine, ptol(), to parse partition letters.
*
*/
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
*/
/* Copyright 2007 VMware Inc.
"Preboot" ramdisk support added by David Elliott
"Preboot" ramdisk support added by David Elliott
*/
#include <AvailabilityMacros.h>
long LoadVolumeFile(BVRef bvr, const char *filePath)
{
long fileSize;
// Read file into load buffer. The data in the load buffer will be
// overwritten by the next LoadFile() call.
gFSLoadAddress = (void *) LOAD_ADDR;
fileSize = bvr->fs_loadfile(bvr, (char *)filePath);
// Return the size of the file, or -1 if load failed.
return fileSize;
}
{
const char * filePath;
BVRef bvr;
// Resolve the boot volume from the file spec.
if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL)
return -1;
return LoadVolumeFile(bvr, filePath);
}
{
const char *filePath;
BVRef bvr;
if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL)
return -1;
if (bvr->fs_readfile == NULL)
return -1;
return bvr->fs_readfile(bvr, (char *)filePath, buffer, offset, length);
}
long length2;
// Resolve the boot volume from the file spec.
if ((bvr = getBootVolumeRef(fileSpec, &filePath)) == NULL)
return -1;
*binary = (void *)kLoadAddr;
// Read file into load buffer. The data in the load buffer will be
// overwritten by the next LoadFile() call.
gFSLoadAddress = (void *) LOAD_ADDR;
readFile = bvr->fs_readfile;
if (readFile != NULL) {
// Read the first 4096 bytes (fat header)
length = readFile(bvr, (char *)filePath, *binary, 0, 0x1000);
length2 = readFile(bvr, (char *)filePath, (void *)(kLoadAddr + length), length, 0);
//if (length2 == -1) return -1;
if (length2 < 0) return -1;
length += (unsigned long)length2;
}
}
ThinFatFile(binary, &length);
}
}
return length;
}
char *p = uuidStr;
MD5_CTX md5c;
uint8_t mdresult[16];
bzero(mdresult, sizeof(mdresult));
// just like AppleFileSystemDriver
MD5Init(&md5c);
MD5Update(&md5c, kFSUUIDNamespaceSHA1, sizeof(kFSUUIDNamespaceSHA1));
MD5Update(&md5c, uubytes, nbytes);
MD5Final(mdresult, &md5c);
// this UUID has been made version 3 style (i.e. via namespace)
// see "-uuid-urn-" IETF draft (which otherwise copies byte for byte)
mdresult[6] = 0x30 | ( mdresult[6] & 0x0F );
mdresult[8] = 0x80 | ( mdresult[8] & 0x3F );
// generate the text: e.g. 5EB1869F-C4FA-3502-BDEB-3B8ED5D87292
i = 0; fmtbase = 0;
for(fmtidx = 0; fmtidx < sizeof(uuidfmt); fmtidx++) {
for(i=0; i < uuidfmt[fmtidx]; i++) {
uint8_t byte = mdresult[fmtbase+i];
char nib;
nib = byte >> 4;
*p = nib + '0'; // 0x4 -> '4'
if(*p > '9') *p = (nib - 9 + ('A'-1)); // 0xB -> 'B'
p++;
nib = byte & 0xf;
*p = nib + '0'; // 0x4 -> '4'
if(*p > '9') *p = (nib - 9 + ('A'-1)); // 0xB -> 'B'
p++;
}
fmtbase += i;
if(fmtidx < sizeof(uuidfmt)-1)
else
*p = '\0';
}
return 0;
}
{
const char * dirPath;
BVRef bvr;
// Resolve the boot volume from the dir spec.
if ((bvr = getBootVolumeRef(dirSpec, &dirPath)) == NULL)
return -1;
// Return 0 on success, or -1 if there are no additional entries.
return bvr->fs_getdirentry( bvr,
/* dirPath */ (char *)dirPath,
/* dirIndex */ dirIndex,
/* dirEntry */ (char **)name, flags, time, 0, 0 );
/* dirPath */ (char *)dirPath,
/* dirIndex */ dirIndex,
/* dirEntry */ (char **)name, flags, time, 0, 0 );
}
//==========================================================================
{
long long index = 0;
const char * entryName;
if (gMakeDirSpec == 0)
gMakeDirSpec = (char *)malloc(1024);
if (!dirSpec) {
long idx, len;
len = strlen(name);
for (idx = len; idx && (name[idx] != '/' && name[idx] != '\\'); idx--) {}
if (idx == 0) {
gMakeDirSpec[0] = '/';
}
dirSpec = gMakeDirSpec;
}
while (GetDirEntry(dirSpec, &index, &entryName, flags, time) == 0)
{
if (strcmp(entryName, name) == 0)
static int GetFreeFd(void)
{
intfd;
// Locate a free descriptor slot.
for (fd = 0; fd < NFILES; fd++) {
if (iob[fd].i_flgs == 0) {
return fd;
}
}
}
stop("Out of file descriptors");
// not reached
static struct iob * iob_from_fdesc(int fdesc)
{
register struct iob * io;
if (fdesc < 0 || fdesc >= NFILES ||
((io = &iob[fdesc])->i_flgs & F_ALLOC) == 0)
return NULL;
struct iob*io;
intfdesc;
inti;
if (bvr == NULL) {
return -1;
}
fdesc = GetFreeFd();
io = &iob[fdesc];
bzero(io, sizeof(*io));
// Mark the descriptor as taken.
io->i_flgs = F_ALLOC;
// Find the next available memory block in the download buffer.
io->i_buf = (char *) LOAD_ADDR;
for (i = 0; i < NFILES; i++) {
}
io->i_buf = max(iob[i].i_filesize + iob[i].i_buf, io->i_buf);
}
// Load entire file into memory. Unnecessary open() calls must be avoided.
gFSLoadAddress = io->i_buf;
io->i_filesize = bvr->fs_loadfile(bvr, (char *)filePath);
{
const char*filepath;
BVRefbvr;
// Resolve the boot volume from the file spec.
if ((bvr = getBootVolumeRef(path, &filepath)) != NULL) {
#if UNUSED
int open_bvdev(const char *bvd, const char *path)
#endif
{
const struct devsw*dp;
const struct devsw*dp;
const char*cp;
BVRefbvr;
inti;
intlen;
intunit;
intpartition;
if ((i = open(path)) >= 0) {
return i;
}
if (bvd == NULL || (len = strlen(bvd)) < 2) {
return -1;
}
for (dp=devsw; dp->name; dp++) {
if (bvd[0] == dp->name[0] && bvd[1] == dp->name[1]) {
unit = 0;
return open_bvr(bvr, path);
#endif
}
}
}
return -1;
}
int close(int fdesc)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
io->i_flgs = 0;
return 0;
}
if ((io = iob_from_fdesc(fdesc)) == NULL)
return (-1);
if ((io->i_offset + count) > (unsigned int)io->i_filesize)
count = io->i_filesize - io->i_offset;
if (count <= 0)
return 0; // end of file
bcopy(io->i_buf + io->i_offset, buf, count);
io->i_offset += count;
return count;
}
int file_size(int fdesc)
{
struct iob * io;
if ((io = iob_from_fdesc(fdesc)) == 0)
return 0;
return io->i_filesize;
}
struct dirstuff * dirp = 0;
const char * dirPath;
BVRef bvr;
if ((bvr = getBootVolumeRef(path, &dirPath)) == NULL)
goto error;
dirp = (struct dirstuff *) malloc(sizeof(struct dirstuff));
if (dirp == NULL)
goto error;
dirp->dir_path = newString(dirPath);
if (dirp->dir_path == NULL)
goto error;
dirp->dir_bvr = bvr;
return dirp;
error:
closedir(dirp);
return NULL;
long * time)
{
return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr,
/* dirPath */ dirp->dir_path,
/* dirIndex */ &dirp->dir_index,
/* dirEntry */ (char **)name, flags, time,
0, 0);
/* dirPath */ dirp->dir_path,
/* dirIndex */ &dirp->dir_index,
/* dirEntry */ (char **)name, flags, time,
0, 0);
}
#if UNUSED
//==========================================================================
int readdir_ext(struct dirstuff * dirp, const char ** name, long * flags,
long * time, FinderInfo *finderInfo, long *infoValid)
long * time, FinderInfo *finderInfo, long *infoValid)
{
return dirp->dir_bvr->fs_getdirentry( dirp->dir_bvr,
/* dirPath */ dirp->dir_path,
/* dirIndex */ &dirp->dir_index,
/* dirEntry */ (char **)name,
flags, time,
finderInfo, infoValid);
/* dirPath */ dirp->dir_path,
/* dirIndex */ &dirp->dir_index,
/* dirEntry */ (char **)name,
flags, time,
finderInfo, infoValid);
}
//==========================================================================
const char * systemConfigDir()
{
if (gBootFileType == kNetworkDeviceType)
return "";
return "";
return "/Library/Preferences/SystemConfiguration";
}
void scanBootVolumes( int biosdev, int * count )
{
BVRef bvr = 0;
bvr = diskScanBootVolumes(biosdev, count);
if (bvr == NULL)
{
BVRef bvr = 0;
bvr = diskScanBootVolumes(biosdev, count);
if (bvr == NULL)
{
#ifdef NBP_SUPPORT
bvr = nbpScanBootVolumes(biosdev, count);
if (bvr != NULL)
{
gBootFileType = kNetworkDeviceType;
}
bvr = nbpScanBootVolumes(biosdev, count);
if (bvr != NULL)
{
gBootFileType = kNetworkDeviceType;
}
#endif
}
else
{
gBootFileType = kBlockDeviceType;
}
}
else
{
gBootFileType = kBlockDeviceType;
}
}
//==========================================================================
void scanDisks(void)
#endif
{
#define MAX_HDD_COUNT 32
int bvCount;
int hd = 0;
// Testing up to MAX_HDD_COUNT hard drives.
#define MAX_HDD_COUNT 32
int bvCount;
int hd = 0;
// Testing up to MAX_HDD_COUNT hard drives.
while(!testBiosread(0x80 + hd, 0) && hd < MAX_HDD_COUNT)
{
bvCount = 0;
scanBootVolumes(0x80 + hd, &bvCount);
hd++;
bvCount = 0;
scanBootVolumes(0x80 + hd, &bvCount);
hd++;
}
// Also scanning CD/DVD drive.
// Also scanning CD/DVD drive.
if (biosDevIsCDROM(gBIOSDev))
{
bvCount = 0;
scanBootVolumes(gBIOSDev, &bvCount);
bvCount = 0;
scanBootVolumes(gBIOSDev, &bvCount);
}
}
int gBIOSDev;
/*!
This is like boot2's gBootVolume except it is for the internal use of
libsaio to track which volume an unqualified path should be relative to.
This replaces bootInfo->kernDev as the carrier of this information.
This is like boot2's gBootVolume except it is for the internal use of
libsaio to track which volume an unqualified path should be relative to.
This replaces bootInfo->kernDev as the carrier of this information.
*/
static BVRef gRootVolume;
void setBootGlobals(BVRef chain)
{
// Record default boot device.
gBootVolume = selectBootVolume(chain);
// turbo - Save the ORIGINAL boot volume too for loading our mkext
if (!gBIOSBootVolume) gBIOSBootVolume = gBootVolume;
setRootVolume(gBootVolume);
// Record default boot device.
gBootVolume = selectBootVolume(chain);
// turbo - Save the ORIGINAL boot volume too for loading our mkext
if (!gBIOSBootVolume) gBIOSBootVolume = gBootVolume;
setRootVolume(gBootVolume);
}
/*!
Extracts the volume selector from the pathname, returns the selected
BVRef, and sets *outPath to the remainder of the path.
If the path did not include a volume selector then the current volume
is used. When called with a volume selector the current volume
is changed to the selected volume unless the volume selector is
that of a ramdisk.
Extracts the volume selector from the pathname, returns the selected
BVRef, and sets *outPath to the remainder of the path.
If the path did not include a volume selector then the current volume
is used. When called with a volume selector the current volume
is changed to the selected volume unless the volume selector is
that of a ramdisk.
*/
BVRef getBootVolumeRef( const char * path, const char ** outPath )
{
const char * cp;
BVRef bvr = gRootVolume;
int biosdev = gBIOSDev;
// Search for left parenthesis in the path specification.
for (cp = path; *cp; cp++) {
if (*cp == LP || *cp == '/') break;
}
if (*cp != LP) // no left paren found
{
// Path is using the implicit current device so if there is
int i;
int unit = -1;
int part = -1;
cp++;
// Check the 2 character device name pointed by 'xp'.
for (dp = devsw; dp->name; dp++)
{
if ((xp[0] == dp->name[0]) && (xp[1] == dp->name[1]))
// Extract the optional unit number from the specification.
// hd(unit) or hd(unit, part).
i = 0;
while (*cp >= '0' && *cp <= '9')
{
i = i * 10 + *cp++ - '0';
unit = i;
}
// Unit is no longer optional and never really was.
// If the user failed to specify it then the unit number from the previous kernDev
// would have been used which makes little sense anyway.
// second hard disk (i.e. unit 1) then fd() would select the second floppy drive!
if(unit == -1)
return NULL;
// Extract the optional partition number from the specification.
if (*cp == ',')
part = atoi(++cp);
// If part is not specified part will be -1 whereas before it would have been
// whatever the last partition was which makes about zero sense if the device
// has been switched.
// Skip past the right paren.
for ( ; *cp && *cp != RP; cp++) /* LOOP */;
if (*cp == RP) cp++;
biosdev = dp->biosdev + unit;
bvr = newBootVolumeRef(biosdev, part);
if(bvr == NULL)
return NULL;
}
else
{
// Bad device specifier, skip past the right paren.
for ( cp++; *cp && *cp != RP; cp++) /* LOOP */;
if (*cp == RP) cp++;
// If gRootVolume was NULL, then bvr will be NULL as well which
// should be caught by the caller.
}
// Returns the file path following the device spec.
// e.g. 'hd(1,b)mach_kernel' is reduced to 'mach_kernel'.
*outPath = cp;
return bvr;
}
static BVRef newBootVolumeRef( int biosdev, int partno )
{
BVRef bvr, bvr1, bvrChain;
bvr = bvr1 = NULL;
// Try resolving "rd" and "bt" devices first.
execute_hook("newRamDisk_BVR", &biosdev, &bvr1, NULL, NULL, NULL, NULL);
else
{
// Fetch the volume list from the device.
scanBootVolumes( biosdev, NULL );
bvrChain = getBVChainForBIOSDev(biosdev);
// Look for a perfect match based on device and partition number.
for ( bvr1 = NULL, bvr = bvrChain; bvr; bvr = bvr->next )
{
if ( ( bvr->flags & kBVFlagNativeBoot ) == 0 ) continue;
bvr1 = bvr;
if ( bvr->part_no == partno ) break;
}
}
return bvr ? bvr : bvr1;
}
return 0;
*str = '\0';
if (bvr)
{
const struct devsw *dp = devsw;
branches/cparm/i386/libsaio/disk.c
196196
197197
198198
199
199200
200201
201202
......
333334
334335
335336
336
337
337
338
338339
339340
340341
......
375376
376377
377378
378
379
379
380
380381
381382
382383
......
417418
418419
419420
420
421
421422
422423
423424
......
10491050
10501051
10511052
1052
1053
1054
1055
1056
1053
1054
1055
1056
1057
10571058
1058
1059
10591060
10601061
1061
1062
1062
1063
1064
1065
10631066
10641067
10651068
......
15191522
15201523
15211524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
15221550
15231551
15241552
15251553
15261554
1527
15281555
15291556
15301557
......
15431570
15441571
15451572
1546
1573
1574
15471575
1548
1549
1550
1551
1552
1553
1554
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
15551599
15561600
15571601
......
21272171
21282172
21292173
2130
2174
21312175
21322176
21332177
......
21432187
21442188
21452189
2146
2147
2190
2191
21482192
21492193
21502194
......
21682212
21692213
21702214
2171
2215
21722216
21732217
21742218
......
21832227
21842228
21852229
2186
2187
2230
2231
21882232
21892233
21902234
#ifdef APPLE_PARTITION_MAP_SUPPORT
static BVRef diskScanAPMBootVolumes( int biosdev, int * countPtr );
#endif
static TagPtr XMLGetElementWithID( TagPtr dict, const char* id );
static bool getOSVersion(BVRef bvr, char *str);
//==========================================================================
rc = 0;
break;
}
error(" EBIOS read error: %s\n", bios_error(rc), rc);
error(" Block 0x%x Sectors %d\n", secno, xnsecs);
printf(" EBIOS read error: %s\n", bios_error(rc), rc);
printf(" Block 0x%x Sectors %d\n", secno, xnsecs);
sleep(1);
}
}
rc = 0;
break;
}
error(" BIOS read error: %s\n", bios_error(rc), rc);
error(" Block %d, Cyl %d Head %d Sector %d\n",
printf(" BIOS read error: %s\n", bios_error(rc), rc);
printf(" Block %d, Cyl %d Head %d Sector %d\n",
secno, cyl, head, sec);
sleep(1);
}
if(biosdev >= 0x100 && (execute_hook("isRamDiskRegistred", NULL, NULL, NULL, NULL, NULL, NULL) == EFI_SUCCESS)){
int ret = -1;
execute_hook("p_ramdiskReadBytes", &biosdev, &blkno, &byteoff, &byteCount, buffer, &ret);
execute_hook("p_ramdiskReadBytes", &biosdev, (void*)(unsigned long)&blkno, &byteoff, &byteCount, buffer, &ret);
return ret;
}
#endif
/* Let's try assuming we are on a hybrid HFS/ISO9660 CD. */
bvr = newFDiskBVRef(
biosdev, 0,
0,
&cdpart,
HFSInitPartition,
HFSLoadFile,
biosdev, 0,
0,
&cdpart,
HFSInitPartition,
HFSLoadFile,
HFSReadFile,
HFSGetDirEntry,
HFSGetDirEntry,
HFSGetFileBlock,
HFSGetUUID,
0,
kBIOSDevTypeHardDrive);
HFSGetDescription,
HFSFree,
0,
kBIOSDevTypeHardDrive, 0);
bvr->next = map->bvr;
map->bvr = bvr;
map->bvrcnt++;
}
}
static TagPtr XMLGetElementWithID( TagPtr dict, const char* id )
{
if(dict->type != kTagTypeArray) return 0;
int element = 0;
TagPtr tmp = dict->tag;
int entry_count = XMLTagCount(dict);
while(element < entry_count)
{
char *Identifier = NULL;
Identifier = XMLCastString(XMLGetProperty(tmp, (const char*)"Identifier"));
if (Identifier && (strcmp(Identifier, id) == 0))
{
return tmp;
}
element++;
tmp = tmp->tagNext;
}
return tmp;
}
static bool getOSVersion(BVRef bvr, char *str)
{
bool valid = false;
config_file_t systemVersion;
char dirSpec[512];
long flags, time;
sprintf(dirSpec, "hd(%d,%d)/System/Library/CoreServices/SystemVersion.plist", BIOS_DEV_UNIT(bvr), bvr->part_no);
}
else
{
sprintf(dirSpec, "hd(%d,%d)/", BIOS_DEV_UNIT(bvr), bvr->part_no);
/* Much clean */
sprintf(dirSpec, "hd(%d,%d)/Mac OS X Install Data/index.sproduct", BIOS_DEV_UNIT(bvr), bvr->part_no);
if (GetFileInfo(dirSpec, "Mac OS X Install Data", &flags, &time) == 0)
{
/*** DIRTY HACK (would be better to have a plist) ***/
*str = '\0';
strncat(str, "10.7", 4);
return true;
}
if (!loadConfigFile(dirSpec, &systemVersion))
{
TagPtr pkg_p = XMLCastArray(XMLGetProperty(systemVersion.dictionary, (const char*)"Packages"));
if (pkg_p)
{
char *version = NULL;
version = XMLCastString(XMLGetProperty(
XMLGetElementWithID(pkg_p,
"com.apple.mpkg.OSInstall"),
(const char*)"Version"));
if (version && strlen(version) >= 4)
{
*str = '\0';
strncat(str, version, 4);
return true;
}
}
}
}
}
int rc;
if ((len & (BPS-1)) != 0) {
error("raw disk read not sector aligned");
printf("raw disk read not sector aligned");
return -1;
}
secno += bvr->part_boff;
if ((rc = ebiosread(bvr->biosdev, secno, secs)) != 0) {
/* Ignore corrected ECC errors */
if (rc != ECC_CORRECTED_ERR) {
error(" EBIOS read error: %s\n", bios_error(rc), rc);
error(" Block %d Sectors %d\n", secno, secs);
printf(" EBIOS read error: %s\n", bios_error(rc), rc);
printf(" Block %d Sectors %d\n", secno, secs);
return rc;
}
}
int rc;
if ((len & (BPS-1)) != 0) {
error("raw disk write not sector aligned");
printf("raw disk write not sector aligned");
return -1;
}
secno += bvr->part_boff;
bcopy( cbuf, trackbuf, copy_len );
//printf("rdr: ebioswrite(%d, %d, %d)\n", bvr->biosdev, secno, secs);
if ((rc = ebioswrite(bvr->biosdev, secno, secs)) != 0) {
error(" EBIOS write error: %s\n", bios_error(rc), rc);
error(" Block %d Sectors %d\n", secno, secs);
printf(" EBIOS write error: %s\n", bios_error(rc), rc);
printf(" Block %d Sectors %d\n", secno, secs);
return rc;
}
len -= copy_len;
branches/cparm/i386/libsaio/stack_protector.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "libsaio.h"
#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
void __guard_setup(void) __attribute__ ((visibility ("hidden")));
void __stack_chk_fail(void);
void
__guard_setup(void)
{
if (__stack_chk_guard[0]!=0) return;
size_t i;
long guard[__arraycount(__stack_chk_guard)];
arc4rand(guard, sizeof(guard), 0);
for (i = 0; i < __arraycount(guard); i++)
__stack_chk_guard[i] = guard[i];
if (__stack_chk_guard[0]!=0 && *__stack_chk_guard != 0) return;
/* If a random generator can't be used, the protector switches the guard
to the "terminator canary" */
((char*)__stack_chk_guard)[0] = 0; ((char*)__stack_chk_guard)[1] = 0;
((char*)__stack_chk_guard)[2] = '\n'; ((char*)__stack_chk_guard)[3] = 255;
}
void
__stack_chk_fail()
{
#ifndef BOOT1
stop("stack overflow");
#endif
for(;;);
}
branches/cparm/i386/libsaio/pci.c
159159
160160
161161
162
162
163163
164164
165165
......
195195
196196
197197
198
198
199199
200200
201201
char *get_pci_dev_path(pci_dt_t *pci_dt)
{
char* buffer = malloc(sizeof(char) * 256);
pci_dt_t*current;
pci_dt_t*end;
chartmp[64];
while (current)
{
execute_hook("PCIDevice", current, NULL/* &ret*/, NULL, NULL, NULL, NULL);
execute_hook("PCIDevice", (void*)current, NULL, NULL, NULL, NULL, NULL);
setup_pci_devs(current->children);
current = current->next;
branches/cparm/i386/libsaio/stringTable.c
3030
3131
3232
33
34
33
34
3535
3636
3737
......
4343
4444
4545
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
6868
6969
7070
......
7373
7474
7575
76
76
7777
7878
7979
......
9494
9595
9696
97
97
9898
9999
100100
101
101
102102
103103
104
104
105105
106106
107107
108
108
109109
110110
111111
......
122122
123123
124124
125
125
126126
127
127
128128
129129
130130
131
131
132132
133133
134134
135135
136136
137
138
139
137
138
139
140140
141141
142142
......
144144
145145
146146
147
148
147
148
149149
150150
151151
152
153
152
153
154154
155155
156
156
157157
158158
159159
......
168168
169169
170170
171
171
172172
173173
174174
......
204204
205205
206206
207
207
208208
209
209
210210
211
211
212212
213213
214214
......
220220
221221
222222
223
224
225
226
223
224
225
226
227227
228228
229229
230230
231231
232232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
249252
250
251
252
253
254
253
254
255255
256
256
257257
258258
259259
......
267267
268268
269269
270
271
272
270
271
272
273273
274
274
275275
276276
277277
......
284284
285285
286286
287
288
289
290
287
288
289
290
291291
292
293
294
295
292
293
294
295
296296
297297
298298
......
304304
305305
306306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324324
325
325
326326
327327
328328
......
330330
331331
332332
333
334
335
336
333
334
335
336
337337
338338
339339
......
515515
516516
517517
518
518
519519
520
521
522
523
524
525
526
520
521
522
523
524
525
526
527527
528528
529529
......
543543
544544
545545
546
546
547547
548548
549
549
550550
551551
552552
553553
554
554
555555
556
556
557557
558558
559
559
560560
561561
562562
......
603603
604604
605605
606
606
607607
608608
609609
......
722722
723723
724724
725
725
726726
727727
728728
......
760760
761761
762762
763
763
764764
765765
766766
......
774774
775775
776776
777
777
778778
779779
780780
......
793793
794794
795795
796
796
797797
798798
799799
......
811811
812812
813813
814
814
815815
816
816
817817
818818
819819
820820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
821842
822
843
823844
824
825
826
845
846
847
848
849
850
851
852
853
827854
828855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
829874
830875
831876
832877
833878
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
882927
#include "libsaio.h"
#include "xml.h"
extern char *Language;
extern char *LoadableFamilies;
static char * AllocInitStringWithLength(const char * oldString, int len);
static char * AllocInitZeroEndedStringWithLength(const char * oldString, int len);
bool sysConfigValid;
#if UNUSED
{
int c;
while (n--) {
c = *key++;
if (c == '\\') {
switch(c = *key++) {
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
default:
break;
}
} else if (c == '\"') {
/* Premature end of key */
return 1;
}
if (c != *str++) {
return 1;
}
c = *key++;
if (c == '\\') {
switch(c = *key++) {
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
default:
break;
}
} else if (c == '\"') {
/* Premature end of key */
return 1;
}
if (c != *str++) {
return 1;
}
}
return 0;
}
{
register const char *table = *table_p;
register bool found = false;
while (*table && !found)
{
if (*table == '\\') table += 2;
register int len;
register char *tab;
char *buf;
len = strlen(key);
tab = (char *)table;
buf = (char *)malloc(len + 3);
sprintf(buf, "\"%s\"", key);
len = strlen(buf);
while(*tab) {
if(strncmp(buf, tab, len) == 0) {
char c;
while((c = *(tab + len)) != ';') {
if(c == 0) {
len = -1;
len = -1;
out:
free(buf);
if(len == -1) return false;
while((*tab = *(tab + len))) {
tab++;
}
return true;
}
char *
newStringFromList(
char **list,
int *size
)
char **list,
int *size
)
{
char *begin = *list, *end;
char *newstr;
int bufsize;
while (*begin && newsize && isspace(*begin)) {
begin++;
newsize--;
begin++;
newsize--;
}
end = begin;
while (*end && newsize && !isspace(*end)) {
end++;
newsize--;
end++;
newsize--;
}
if (begin == end)
return 0;
return 0;
bufsize = end - begin + 1;
newstr = malloc(bufsize);
strlcpy(newstr, begin, bufsize);
int stringLength(const char *table, int compress)
{
int ret = 0;
while (*table)
{
if (*table == '\\')
return true;
}
} else {
// Legacy plist-style table
}
return false;
}
* \n escapes in the string.
*/
char *newStringForStringTableKey(
char *table,
char *key,
config_file_t *config
)
char *table,
char *key,
config_file_t *config
)
{
const char *val;
char *newstr, *p;
int size;
if (getValueForConfigTableKey(config, key, &val, &size)) {
newstr = (char *)malloc(size+1);
for (p = newstr; size; size--, p++, val++) {
if ((*p = *val) == '\\') {
switch (*++val) {
case 'r':
*p = '\r';
break;
case 'n':
*p = '\n';
break;
case 't':
*p = '\t';
break;
default:
*p = *val;
break;
newstr = (char *)malloc(size+1);
for (p = newstr; size; size--, p++, val++) {
if ((*p = *val) == '\\') {
switch (*++val) {
case 'r':
*p = '\r';
break;
case 'n':
*p = '\n';
break;
case 't':
*p = '\t';
break;
default:
*p = *val;
break;
}
size--;
}
}
size--;
}
}
*p = '\0';
return newstr;
*p = '\0';
return newstr;
} else {
return 0;
return 0;
}
}
int size;
if (getValueForKey(key, &val, &size, config) && size) {
newstr = (char *)malloc(size + 1);
strlcpy(newstr, val, size + 1);
return newstr;
newstr = (char *)malloc(size + 1);
strlcpy(newstr, val, size + 1);
return newstr;
} else {
return 0;
return 0;
}
}
static const char *getToken(const char *line, const char **begin, int *len)
{
if (*line == '\"') {
*begin = ++line;
while (*line && *line != '\"')
line++;
*len = line++ - *begin;
*begin = ++line;
while (*line && *line != '\"')
line++;
*len = line++ - *begin;
} else {
*begin = line;
while (*line && !isspace(*line) && *line != '=')
line++;
*len = line - *begin;
*begin = line;
while (*line && !isspace(*line) && *line != '=')
line++;
*len = line - *begin;
}
return line;
}
bool retval = false;
while (*line) {
/* look for keyword or argument */
while (isspace(*line)) line++;
/* now look for '=' or whitespace */
line = getToken(line, &key, &key_len);
/* line now points to '=' or space */
if (*line && !isspace(*line)) {
line = getToken(++line, &value, &value_len);
} else {
value = line;
value_len = 0;
}
if ((strlen(match) == key_len)
&& strncmp(match, key, key_len) == 0) {
*matchval = value;
*len = value_len;
retval = true;
/* look for keyword or argument */
while (isspace(*line)) line++;
/* now look for '=' or whitespace */
line = getToken(line, &key, &key_len);
/* line now points to '=' or space */
if (*line && !isspace(*line)) {
line = getToken(++line, &value, &value_len);
} else {
value = line;
value_len = 0;
}
if ((strlen(match) == key_len)
&& strncmp(match, key, key_len) == 0) {
*matchval = value;
*len = value_len;
retval = true;
/* Continue to look for this key; last one wins. */
}
}
}
return retval;
}
/* Return NULL if no option has been successfully retrieved, or the string otherwise */
const char * getStringForKey(const char * key, config_file_t *config)
{
static const char* value =0;
int len=0;
if(!getValueForKey(key, &value, &len, config)) value = 0;
return value;
static const char* value =0;
int len=0;
if(!getValueForKey(key, &value, &len, config)) value = 0;
return value;
}
printSystemConfig(char *p1)
{
char *p2 = p1, tmp;
while (*p1 != '\0') {
while (*p2 != '\0' && *p2 != '\n') p2++;
tmp = *p2;
*p2 = '\0';
printf("%s\n", p1);
*p2 = tmp;
if (tmp == '\0') break;
p1 = ++p2;
while (*p2 != '\0' && *p2 != '\n') p2++;
tmp = *p2;
*p2 = '\0';
printf("%s\n", p1);
*p2 = tmp;
if (tmp == '\0') break;
p1 = ++p2;
}
}
#endif
TagPtr tag;
pos = 0;
char *configBuffer;
configBuffer = malloc(strlen(buffer)+1);
strcpy(configBuffer, buffer);
while (1)
{
length = XMLParseNextTag(configBuffer + pos, &tag);
if (length == -1) break;
pos += length;
if (tag == 0) continue;
if (tag->type == kTagTypeDict) break;
XMLFreeTag(tag);
}
free(configBuffer);
"rd(0,0)/Extra/org.chameleon.Boot.plist", // Add compatibility with the trunk
"/Extra/org.chameleon.Boot.plist", // Add compatibility with the trunk
"bt(0,0)/Extra/org.chameleon.Boot.plist" // Add compatibility with the trunk
};
int i,fd, count, ret=-1;
int loadHelperConfig(config_file_t *config)
{
int rfd, pfd, sfd, count, ret=-1;
char *dirspec[] = {
"/com.apple.boot.P/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
sysConfigValid = true;
ret=0;
}
}
else
{
count = read(pfd, config->plist, IO_CONFIG_DATA_SIZE);
close(pfd);
close(rfd);
// build xml dictionary
ParseXMLFile(config->plist, &config->dictionary);
sysConfigValid = true;
ret=0;
}
}
else
{
}
}
}
return ret;
}
#endif
static char * AllocInitStringWithLength(const char * oldString, int len)
{
char *Buf = NULL;
Buf = malloc(len);
if (Buf == NULL) return NULL;
if (oldString != NULL)
strlcpy(Buf, oldString,len);
return Buf;
}
static char * AllocInitZeroEndedStringWithLength(const char * oldString, int len)
{
if (len > 0)
{
return AllocInitStringWithLength( oldString, len + 1);
}
return NULL;
}
char * newString(const char * oldString)
{
{
if ( oldString )
return strcpy(malloc(strlen(oldString)+1), oldString);
else
return NULL;
{
int len = strlen(oldString);
if (len > 0)
{
return AllocInitZeroEndedStringWithLength(oldString, len);
}
}
return NULL;
}
char * newStringWithLength(const char * oldString, int len)
{
if (len > 0)
{
return AllocInitZeroEndedStringWithLength(oldString, len);
}
return NULL;
}
char * newEmptyStringWithLength(int len)
{
if (len > 0)
{
return AllocInitZeroEndedStringWithLength(NULL, len);
}
return NULL;
}
/*
* Extracts the next argument from the command line, double quotes are allowed here.
*/
char * getNextArg(char ** argPtr, char * val)
{
char * ptr = *argPtr;
const char * strStart;
int len = 0;
bool isQuoted = false;
*val = '\0';
// Scan for the next non-whitespace character.
while ( *ptr && (*ptr == ' ' || *ptr == '=') )
{
ptr++;
}
strStart = ptr;
// Skip the leading double quote character.
if (*ptr == '\"')
{
isQuoted = true;
ptr++;
strStart++;
}
// Scan for the argument terminator character.
// This can be either a NULL character - in case we reach the end of the string,
// a double quote in case of quoted argument,
// or a whitespace character (' ' or '=') for non-quoted argument.
while (*ptr && !( (isQuoted && (*ptr == '\"')) ||
(!isQuoted && (*ptr == ' ' || *ptr == '=')) )
)
{
ptr++;
}
len = ptr - strStart;
// Skip the closing double quote character and adjust
// the starting pointer for the next getNextArg call.
if (*ptr && isQuoted && *ptr == '\"')
ptr++;
// Copy the extracted argument to val.
strncat(val, strStart, len);
// Set command line pointer.
*argPtr = ptr;
return ptr;
char * ptr = *argPtr;
const char * strStart;
int len = 0;
bool isQuoted = false;
*val = '\0';
// Scan for the next non-whitespace character.
while ( *ptr && (*ptr == ' ' || *ptr == '=') )
{
ptr++;
}
strStart = ptr;
// Skip the leading double quote character.
if (*ptr == '\"')
{
isQuoted = true;
ptr++;
strStart++;
}
// Scan for the argument terminator character.
// This can be either a NULL character - in case we reach the end of the string,
// a double quote in case of quoted argument,
// or a whitespace character (' ' or '=') for non-quoted argument.
while (*ptr && !( (isQuoted && (*ptr == '\"')) ||
(!isQuoted && (*ptr == ' ' || *ptr == '=')) )
)
{
ptr++;
}
len = ptr - strStart;
// Skip the closing double quote character and adjust
// the starting pointer for the next getNextArg call.
if (*ptr && isQuoted && *ptr == '\"')
ptr++;
// Copy the extracted argument to val.
strncat(val, strStart, len);
// Set command line pointer.
*argPtr = ptr;
return ptr;
}
branches/cparm/i386/libsaio/saio_types.h
4545
4646
4747
48
48
4949
5050
5151
/*
* Max size fo config data array, in bytes.
*/
#define IO_CONFIG_DATA_SIZE4096 // was 163840
#define IO_CONFIG_DATA_SIZE40960 // was 4096 // was 163840
#define rand_tab_len 100
branches/cparm/i386/libsaio/fake_efi.c
186186
187187
188188
189
189
190190
191191
192192
......
253253
254254
255255
256
256
257257
258258
259259
......
286286
287287
288288
289
289
290290
291291
292292
......
308308
309309
310310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413413
414414
415415
......
713713
714714
715715
716
717
718
719
720
721
716
717
718
719
720
721
722722
723
724
725
726
727
728
723
724
725
726
727
728
729729
730730
731731
732732
733
733
734734
735735
736736
737737
738738
739
739
740740
741741
742742
......
788788
789789
790790
791
791
792792
793
793
794794
795795
796796
......
844844
845845
846846
847
847
848848
849849
850850
851851
852852
853
853
854854
855855
856856
......
869869
870870
871871
872
872
873873
874874
875875
......
907907
908908
909909
910
910
911911
912912
913913
......
933933
934934
935935
936
936
937937
938938
939939
......
954954
955955
956956
957
957
958958
959959
960960
......
968968
969969
970970
971
971
972972
973973
974974
......
993993
994994
995995
996
996
997997
998998
999999
gEfiConfigurationTable64[i].VendorTable = (EFI_PTR32)table;
gNumTables64++ ;
}
Node *tableNode = DT__AddChild(gEfiConfigurationTableNode, mallocStringForGuid(pGuid));
// Use the pointer to the GUID we just stuffed into the system table
num = (EFI_UINTN)gST64->NumberOfTableEntries;
}
msglog("EFI Configuration table :\n");
msglog("EFI Configuration table :\n");
for (i=0; i<num; i++)
{
if (archCpuType == CPU_TYPE_I386)
{
sprintf(id, "%s", "_MP_");
}
msglog("table [%d]:%s , 32Bit addr : 0x%x\n",i,id,table);
}
#define setupEfiTables(mode) \
{ \
struct fake_efi_pages \
{\
/* We use the fake_efi_pages struct so that we only need to do one kernel
* memory allocation for all needed EFI data. Otherwise, small allocations
* like the FIRMWARE_VENDOR string would take up an entire page.
* NOTE WELL: Do NOT assume this struct has any particular layout within itself.
* It is absolutely not intended to be publicly exposed anywhere
* We say pages (plural) although right now we are well within the 1 page size
* and probably will stay that way.
*/\
EFI_SYSTEM_TABLE_##mode efiSystemTable;\
EFI_RUNTIME_SERVICES_##mode efiRuntimeServices;\
EFI_CONFIGURATION_TABLE_##mode efiConfigurationTable[MAX_CONFIGURATION_TABLE_ENTRIES];\
EFI_CHAR16 firmwareVendor[sizeof(FIRMWARE_VENDOR)/sizeof(EFI_CHAR16)];\
uint8_t voidret_instructions[sizeof(VOIDRET_INSTRUCTIONS)/sizeof(uint8_t)];\
uint8_t unsupportedret_instructions[sizeof(UNSUPPORTEDRET_INSTRUCTIONS)/sizeof(uint8_t)];\
};\
struct fake_efi_pages *fakeEfiPages = (struct fake_efi_pages*)AllocateKernelMemory(sizeof(struct fake_efi_pages));\
/* Zero out all the tables in case fields are added later*/\
bzero(fakeEfiPages, sizeof(struct fake_efi_pages));\
/*--------------------------------------------------------------------
* Initialize some machine code that will return EFI_UNSUPPORTED for
* functions returning int and simply return for void functions.*/\
memcpy(fakeEfiPages->voidret_instructions, VOIDRET_INSTRUCTIONS, sizeof(VOIDRET_INSTRUCTIONS));\
memcpy(fakeEfiPages->unsupportedret_instructions, UNSUPPORTEDRET_INSTRUCTIONS, sizeof(UNSUPPORTEDRET_INSTRUCTIONS));\
/*--------------------------------------------------------------------
* System table*/\
EFI_SYSTEM_TABLE_##mode *efiSystemTable = gST##mode = &fakeEfiPages->efiSystemTable;\
efiSystemTable->Hdr.Signature = EFI_SYSTEM_TABLE_SIGNATURE;\
efiSystemTable->Hdr.Revision = EFI_SYSTEM_TABLE_REVISION;\
efiSystemTable->Hdr.HeaderSize = sizeof(EFI_SYSTEM_TABLE_##mode);\
efiSystemTable->Hdr.CRC32 = 0;/*Initialize to zero and then do CRC32*/ \
efiSystemTable->Hdr.Reserved = 0;\
efiSystemTable->FirmwareVendor = pto(mode, &fakeEfiPages->firmwareVendor);\
memcpy(fakeEfiPages->firmwareVendor, FIRMWARE_VENDOR, sizeof(FIRMWARE_VENDOR));\
efiSystemTable->FirmwareRevision = FIRMWARE_REVISION;\
/* XXX: We may need to have basic implementations of ConIn/ConOut/StdErr
* The EFI spec states that all handles are invalid after boot services have been
* exited so we can probably get by with leaving the handles as zero.
*/\
efiSystemTable->ConsoleInHandle = 0;\
efiSystemTable->ConIn = 0;\
efiSystemTable->ConsoleOutHandle = 0;\
efiSystemTable->ConOut = 0;\
efiSystemTable->StandardErrorHandle = 0;\
efiSystemTable->StdErr = 0;\
efiSystemTable->RuntimeServices = pto(mode,&fakeEfiPages->efiRuntimeServices) ;\
/* According to the EFI spec, BootServices aren't valid after the
* boot process is exited so we can probably do without it.
* Apple didn't provide a definition for it in pexpert/i386/efi.h
* so I'm guessing they don't use it.
*/\
efiSystemTable->BootServices = 0;\
efiSystemTable->NumberOfTableEntries = 0;\
efiSystemTable->ConfigurationTable = pto(mode,fakeEfiPages->efiConfigurationTable);\
/* We're done. Now CRC32 the thing so the kernel will accept it.
* Must be initialized to zero before CRC32, done above.
*/\
gST##mode->Hdr.CRC32 = crc32(0L, gST##mode, gST##mode->Hdr.HeaderSize);\
/*--------------------------------------------------------------------
* Runtime services*/\
EFI_RUNTIME_SERVICES_##mode *efiRuntimeServices = &fakeEfiPages->efiRuntimeServices;\
efiRuntimeServices->Hdr.Signature = EFI_RUNTIME_SERVICES_SIGNATURE;\
efiRuntimeServices->Hdr.Revision = EFI_RUNTIME_SERVICES_REVISION;\
efiRuntimeServices->Hdr.HeaderSize = sizeof(EFI_RUNTIME_SERVICES_##mode);\
efiRuntimeServices->Hdr.CRC32 = 0;\
efiRuntimeServices->Hdr.Reserved = 0;\
/* There are a number of function pointers in the efiRuntimeServices table.
* These are the Foundation (e.g. core) services and are expected to be present on
* all EFI-compliant machines.Some kernel extensions (notably AppleEFIRuntime)
* will call these without checking to see if they are null.
*
* We don't really feel like doing an EFI implementation in the bootloader
* but it is nice if we can at least prevent a complete crash by
* at least providing some sort of implementation until one can be provided
* nicely in a kext.
*/\
void (*voidret_fp)() = (void*)fakeEfiPages->voidret_instructions;\
void (*unsupportedret_fp)() = (void*)fakeEfiPages->unsupportedret_instructions;\
efiRuntimeServices->GetTime = pto(mode,unsupportedret_fp);\
efiRuntimeServices->SetTime = pto(mode,unsupportedret_fp);\
efiRuntimeServices->GetWakeupTime = pto(mode,unsupportedret_fp);\
efiRuntimeServices->SetWakeupTime = pto(mode,unsupportedret_fp);\
efiRuntimeServices->SetVirtualAddressMap = pto(mode,unsupportedret_fp);\
efiRuntimeServices->ConvertPointer = pto(mode,unsupportedret_fp);\
efiRuntimeServices->GetVariable = pto(mode,unsupportedret_fp);\
efiRuntimeServices->GetNextVariableName = pto(mode,unsupportedret_fp);\
efiRuntimeServices->SetVariable = pto(mode,unsupportedret_fp);\
efiRuntimeServices->GetNextHighMonotonicCount = pto(mode,unsupportedret_fp);\
efiRuntimeServices->ResetSystem = pto(mode,voidret_fp);\
/*We're done.Now CRC32 the thing so the kernel will accept it*/\
efiRuntimeServices->Hdr.CRC32 = crc32(0L, efiRuntimeServices, efiRuntimeServices->Hdr.HeaderSize);\
/*--------------------------------------------------------------------
* Finish filling in the rest of the boot args that we need.*/\
bootArgs->efiSystemTable = (uint32_t)efiSystemTable;\
bootArgs->efiMode = kBootArgsEfiMode##mode;\
/* The bootArgs structure as a whole is bzero'd so we don't need to fill in
* things like efiRuntimeServices* and what not.
*
* In fact, the only code that seems to use that is the hibernate code so it
* knows not to save the pages. It even checks to make sure its nonzero.
*/\
struct fake_efi_pages \
{\
/* We use the fake_efi_pages struct so that we only need to do one kernel
* memory allocation for all needed EFI data. Otherwise, small allocations
* like the FIRMWARE_VENDOR string would take up an entire page.
* NOTE WELL: Do NOT assume this struct has any particular layout within itself.
* It is absolutely not intended to be publicly exposed anywhere
* We say pages (plural) although right now we are well within the 1 page size
* and probably will stay that way.
*/\
EFI_SYSTEM_TABLE_##mode efiSystemTable;\
EFI_RUNTIME_SERVICES_##mode efiRuntimeServices;\
EFI_CONFIGURATION_TABLE_##mode efiConfigurationTable[MAX_CONFIGURATION_TABLE_ENTRIES];\
EFI_CHAR16 firmwareVendor[sizeof(FIRMWARE_VENDOR)/sizeof(EFI_CHAR16)];\
uint8_t voidret_instructions[sizeof(VOIDRET_INSTRUCTIONS)/sizeof(uint8_t)];\
uint8_t unsupportedret_instructions[sizeof(UNSUPPORTEDRET_INSTRUCTIONS)/sizeof(uint8_t)];\
};\
struct fake_efi_pages *fakeEfiPages = (struct fake_efi_pages*)AllocateKernelMemory(sizeof(struct fake_efi_pages));\
/* Zero out all the tables in case fields are added later*/\
bzero(fakeEfiPages, sizeof(struct fake_efi_pages));\
/*--------------------------------------------------------------------
* Initialize some machine code that will return EFI_UNSUPPORTED for
* functions returning int and simply return for void functions.*/\
memcpy(fakeEfiPages->voidret_instructions, VOIDRET_INSTRUCTIONS, sizeof(VOIDRET_INSTRUCTIONS));\
memcpy(fakeEfiPages->unsupportedret_instructions, UNSUPPORTEDRET_INSTRUCTIONS, sizeof(UNSUPPORTEDRET_INSTRUCTIONS));\
/*--------------------------------------------------------------------
* System table*/\
EFI_SYSTEM_TABLE_##mode *efiSystemTable = gST##mode = &fakeEfiPages->efiSystemTable;\
efiSystemTable->Hdr.Signature = EFI_SYSTEM_TABLE_SIGNATURE;\
efiSystemTable->Hdr.Revision = EFI_SYSTEM_TABLE_REVISION;\
efiSystemTable->Hdr.HeaderSize = sizeof(EFI_SYSTEM_TABLE_##mode);\
efiSystemTable->Hdr.CRC32 = 0;/*Initialize to zero and then do CRC32*/ \
efiSystemTable->Hdr.Reserved = 0;\
efiSystemTable->FirmwareVendor = pto(mode, &fakeEfiPages->firmwareVendor);\
memcpy(fakeEfiPages->firmwareVendor, FIRMWARE_VENDOR, sizeof(FIRMWARE_VENDOR));\
efiSystemTable->FirmwareRevision = FIRMWARE_REVISION;\
/* XXX: We may need to have basic implementations of ConIn/ConOut/StdErr
* The EFI spec states that all handles are invalid after boot services have been
* exited so we can probably get by with leaving the handles as zero.
*/\
efiSystemTable->ConsoleInHandle = 0;\
efiSystemTable->ConIn = 0;\
efiSystemTable->ConsoleOutHandle = 0;\
efiSystemTable->ConOut = 0;\
efiSystemTable->StandardErrorHandle = 0;\
efiSystemTable->StdErr = 0;\
efiSystemTable->RuntimeServices = pto(mode,&fakeEfiPages->efiRuntimeServices) ;\
/* According to the EFI spec, BootServices aren't valid after the
* boot process is exited so we can probably do without it.
* Apple didn't provide a definition for it in pexpert/i386/efi.h
* so I'm guessing they don't use it.
*/\
efiSystemTable->BootServices = 0;\
efiSystemTable->NumberOfTableEntries = 0;\
efiSystemTable->ConfigurationTable = pto(mode,fakeEfiPages->efiConfigurationTable);\
/* We're done. Now CRC32 the thing so the kernel will accept it.
* Must be initialized to zero before CRC32, done above.
*/\
gST##mode->Hdr.CRC32 = crc32(0L, gST##mode, gST##mode->Hdr.HeaderSize);\
/*--------------------------------------------------------------------
* Runtime services*/\
EFI_RUNTIME_SERVICES_##mode *efiRuntimeServices = &fakeEfiPages->efiRuntimeServices;\
efiRuntimeServices->Hdr.Signature = EFI_RUNTIME_SERVICES_SIGNATURE;\
efiRuntimeServices->Hdr.Revision = EFI_RUNTIME_SERVICES_REVISION;\
efiRuntimeServices->Hdr.HeaderSize = sizeof(EFI_RUNTIME_SERVICES_##mode);\
efiRuntimeServices->Hdr.CRC32 = 0;\
efiRuntimeServices->Hdr.Reserved = 0;\
/* There are a number of function pointers in the efiRuntimeServices table.
* These are the Foundation (e.g. core) services and are expected to be present on
* all EFI-compliant machines.Some kernel extensions (notably AppleEFIRuntime)
* will call these without checking to see if they are null.
*
* We don't really feel like doing an EFI implementation in the bootloader
* but it is nice if we can at least prevent a complete crash by
* at least providing some sort of implementation until one can be provided
* nicely in a kext.
*/\
void (*voidret_fp)() = (void*)fakeEfiPages->voidret_instructions;\
void (*unsupportedret_fp)() = (void*)fakeEfiPages->unsupportedret_instructions;\
efiRuntimeServices->GetTime = pto(mode,unsupportedret_fp);\
efiRuntimeServices->SetTime = pto(mode,unsupportedret_fp);\
efiRuntimeServices->GetWakeupTime = pto(mode,unsupportedret_fp);\
efiRuntimeServices->SetWakeupTime = pto(mode,unsupportedret_fp);\
efiRuntimeServices->SetVirtualAddressMap = pto(mode,unsupportedret_fp);\
efiRuntimeServices->ConvertPointer = pto(mode,unsupportedret_fp);\
efiRuntimeServices->GetVariable = pto(mode,unsupportedret_fp);\
efiRuntimeServices->GetNextVariableName = pto(mode,unsupportedret_fp);\
efiRuntimeServices->SetVariable = pto(mode,unsupportedret_fp);\
efiRuntimeServices->GetNextHighMonotonicCount = pto(mode,unsupportedret_fp);\
efiRuntimeServices->ResetSystem = pto(mode,voidret_fp);\
/*We're done.Now CRC32 the thing so the kernel will accept it*/\
efiRuntimeServices->Hdr.CRC32 = crc32(0L, efiRuntimeServices, efiRuntimeServices->Hdr.HeaderSize);\
/*--------------------------------------------------------------------
* Finish filling in the rest of the boot args that we need.*/\
bootArgs->efiSystemTable = (uint32_t)efiSystemTable;\
bootArgs->efiMode = kBootArgsEfiMode##mode;\
/* The bootArgs structure as a whole is bzero'd so we don't need to fill in
* things like efiRuntimeServices* and what not.
*
* In fact, the only code that seems to use that is the hibernate code so it
* knows not to save the pages. It even checks to make sure its nonzero.
*/\
}
/*
DT__AddProperty(chosenNode, kBootUUIDKey, strlen(bootInfo->uuidStr)+1, bootInfo->uuidStr);
#if 0
if (gRootPath[0])
{
DT__AddProperty(chosenNode, "rootpath" or try "root-matching", strlen(gRootPath)+1, gRootPath);
}
else
{
DT__AddProperty(chosenNode, "rootpath" or try "root-matching", strlen(gRootPath)+1, gRootPath);
}
else
#endif
if (gRootDevice)
{
DT__AddProperty(chosenNode, "boot-device-path", strlen(gRootDevice)+1, gRootDevice);
}
if (gRootDevice)
{
DT__AddProperty(chosenNode, "boot-device-path", strlen(gRootDevice)+1, gRootDevice);
}
// "boot-file" is not used by kextcache if there is no "boot-device-path" or if there is a valid "rootpath" ,
// but i let it by default since it may be used by another service
DT__AddProperty(chosenNode, "boot-file", strlen(bootInfo->bootFile)+1, (EFI_CHAR16*)bootInfo->bootFile);
if (bootInfo->adler32)
DT__AddProperty(chosenNode, "boot-kernelcache-adler32", sizeof(unsigned long), &bootInfo->adler32);
}
}
// We could also just do DT__FindNode("/efi/platform", true)
// But I think eventually we want to fill stuff in the efi node
// too so we might as well create it so we have a pointer for it too.
{
DT__AddProperty(efiNode, MOTHERBOARD_NAME_PROP, strlen(DefaultPlatform)+1, DefaultPlatform);
}
}
// Set up the /efi/configuration-table node which will eventually have several child nodes for
// all of the configuration tables needed by various kernel extensions.
gEfiConfigurationTableNode = DT__AddChild(efiNode, "configuration-table");
void setupSmbiosConfigFile(const char *filename)
{
static bool readSmbConfigFile = true;
if (readSmbConfigFile == true)
{
chardirSpecSMBIOS[128] = "";
const char *override_pathname = NULL;
intlen = 0, err = 0;
// Take in account user overriding
if (getValueForKey("SMBIOS", &override_pathname, &len, &bootInfo->bootConfig) && len > 0)
{
err = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
}
}
if (err)
{
verbose("No SMBIOS config file found.\n");
}
ACPI_TABLE_FACS *FacsPointer = (acpi_tables.FacsPointer64 != (void*)0ul) ? (ACPI_TABLE_FACS *)acpi_tables.FacsPointer64:(ACPI_TABLE_FACS *)acpi_tables.FacsPointer;
Platform->hardware_signature = FacsPointer->HardwareSignature;
} while (0);
{
if (smbios_p)
addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL);
if (Platform->CPU.Vendor == 0x756E6547 /* Intel */)
{
int num_cpus;
}
#endif
}
// PM_Model
if (Platform->CPU.isServer == true)
{
{
Platform->Type = Desktop;
}
// Invalidate the platform hardware signature (this needs to be verified with acpica, but i guess that 0xFFFFFFFF is an invalid signature)
Platform->hardware_signature = 0xFFFFFFFF;
{
// Collect PCI info &| Generate device prop string
setup_pci_devs(root_pci_dev);
// load smbios.plist file if any
setupSmbiosConfigFile("SMBIOS.plist");
setup_Smbios();
branches/cparm/i386/libsaio/misc.c
178178
179179
180180
181
182
183
184
181
185182
186183
187184
int random (struct ran_obj* self)
{
//struct ran_opt * ret = (struct ran_opt * )malloc(sizeof(struct ran_opt));
//ret = rt ;
struct ran_obj * ret = self ;
static int wheel = 0;
branches/cparm/i386/libsaio/saio_internal.h
2727
2828
2929
30
31
32
33
3034
3135
3236
......
101105
102106
103107
108
104109
105110
106111
......
122127
123128
124129
125
130
126131
127
132
128133
129
134
130135
131136
132137
......
184189
185190
186191
192
193
194
187195
188196
189197
#include "saio_types.h"
/* arc4random.c */
extern void arc4rand(void *ptr, u_int len, int reseed);
extern uint32_t arc4random(void);
/* asm.s */
extern void real_to_prot(void);
extern void prot_to_real(void);
extern int error(const char *format, ...);
extern int verbose(const char *format, ...);
extern void stop(const char *format, ...);
extern char * newStringWithFormat(const char * fmt, ...);
/* disk.c */
extern void rescanBIOSDevice(int biosdev);
/* hfs_compare.c */
extern int32_t FastUnicodeCompare(u_int16_t *uniStr1, u_int32_t len1,
u_int16_t *uniStr2, u_int32_t len2, int byte_order);
u_int16_t *uniStr2, u_int32_t len2, int byte_order);
extern void utf_encodestr( const u_int16_t * ucsp, int ucslen,
u_int8_t * utf8p, u_int32_t bufsize, int byte_order );
u_int8_t * utf8p, u_int32_t bufsize, int byte_order );
extern void utf_decodestr(const u_int8_t *utf8p, u_int16_t *ucsp,
u_int16_t *ucslen, u_int32_t bufsize, int byte_order );
u_int16_t *ucslen, u_int32_t bufsize, int byte_order );
/* load.c */
extern bool gHaveKernelCache;
#endif
extern int loadOverrideConfig(config_file_t *configBuff);
extern char * newString(const char *oldString);
extern char * newEmptyStringWithLength(int len);
extern char * newStringWithLength(const char * oldString, int len);
extern char * getNextArg(char ** ptr, char * val);
extern int ParseXMLFile( char * buffer, TagPtr * dict );
branches/cparm/i386/boot2/graphics.c
142142
143143
144144
145
145
146146
147147
148148
......
168168
169169
170170
171
171
172172
173173
174174
......
241241
242242
243243
244
244
245245
246246
247247
......
263263
264264
265265
266
266
267267
268268
269269
......
615615
616616
617617
618
618
619619
620620
621621
......
669669
670670
671671
672
672
673673
674674
675675
676
676
677677
678678
679679
//bzero( outModeInfo, sizeof(*outModeInfo) );
bzero( outModeInfo, sizeof(VBEModeInfoBlock) );
// Get VBE controller info containing the list of supported modes.
//bzero( &vbeInfo, sizeof(vbeInfo) );
//bzero( &modeInfo, sizeof(modeInfo) );
bzero( &modeInfo, sizeof(VBEModeInfoBlock) );
err = getVBEModeInfo( *modePtr, &modeInfo );
if ( err != errSuccess )
{
matchedMode = *modePtr;
//bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
bcopy( &modeInfo, outModeInfo, sizeof(VBEModeInfoBlock) );
break;
}
matchedMode = *modePtr;
//bcopy( &modeInfo, outModeInfo, sizeof(modeInfo) );
bcopy( &modeInfo, outModeInfo, sizeof(VBEModeInfoBlock) );
}
return matchedMode;
unsigned long params[4];
int count;
int err = errSuccess;
if ( mode == GRAPHICS_MODE )
{
if ( (err=initGraphicsMode ()) == errSuccess ) {
spinActivityIndicator(int sectors)
{
static unsigned long lastTickTime = 0, currentTickTime;
bool doreturn = false;
execute_hook("spinActivity_hook", &sectors, &doreturn, NULL, NULL, NULL, NULL);
if (doreturn == true) return;
currentTickTime = time18(); // late binding
if (currentTickTime < lastTickTime + MIN_TICKS)
{
branches/cparm/i386/boot2/boot.c
10301030
10311031
10321032
1033
1033
1034
10341035
10351036
10361037
10371038
10381039
1039
1040
1041
10401042
10411043
10421044
......
10551057
10561058
10571059
1060
1061
1062
1063
10581064
10591065
10601066
{
if (strcmp(name, name_compare) == 0)
{
DBG("found : %s\n", name);
DBG("found : %s\n", name);
closedir(moduleDir);
return true;
}
}
else
{
DBG("found : %s\n", name);
DBG("found : %s\n", name);
closedir(moduleDir);
return true;
}
}
#endif
}
if (moduleDir) {
closedir(moduleDir);
}
return false;
}
branches/cparm/i386/boot2/modules.c
2525
2626
2727
28
28
2929
3030
3131
......
7171
7272
7373
74
74
7575
7676
7777
......
9999
100100
101101
102
102
103103
104104
105105
106106
107107
108108
109
110
111
109
110
111
112
113
112114
113115
114116
......
129131
130132
131133
132
134
133135
136
137
138
139
140
141
142
134143
135144
136145
......
143152
144153
145154
146
147155
156
148157
149158
150159
......
152161
153162
154163
155
156164
157
165
166
167
168
169
170
158171
159172
160173
......
164177
165178
166179
167
180
181
168182
169183
170184
171185
172186
173
174
187
188
189
190
175191
192
193
194
195
196
176197
177198
178199
179200
180201
181202
182
203
183204
184205
185206
......
206227
207228
208229
230
209231
210232
211233
......
270292
271293
272294
273
295
274296
275297
276298
......
278300
279301
280302
303
304
305
306
281307
282308
283309
......
285311
286312
287313
288
314
315
316
317
318
289319
290320
321
322
323
324
325
291326
292327
293328
......
324359
325360
326361
327
328
329
362
363
364
330365
331366
332367
333368
334
369
335370
336371
337372
......
392427
393428
394429
395
430
396431
397432
398433
......
403438
404439
405440
441
442
406443
407444
445
446
408447
409448
410449
......
437476
438477
439478
440
441
479
442480
443481
444482
......
449487
450488
451489
490
491
452492
453493
494
454495
455496
456497
......
487528
488529
489530
490
491
492
531
532
533
534
535
536
537
538
493539
494540
495541
496542
497543
498
499544
500545
501546
547
502548
503549
504550
505551
506552
507553
554
555
508556
509557
510558
......
536584
537585
538586
539
587
540588
541589
542
590
543591
544592
545593
......
563611
564612
565613
566
614
567615
568616
569617
......
593641
594642
595643
596
597644
645
598646
599647
600648
......
673721
674722
675723
676
677724
725
678726
679727
680728
......
732780
733781
734782
735
783
736784
737785
738786
......
763811
764812
765813
766
814
767815
768816
769817
......
805853
806854
807855
808
856
809857
810858
811859
812860
813861
814862
815
863
816864
817865
818866
......
820868
821869
822870
823
871
824872
825
873
826874
827875
828876
829877
830878
831879
832
880
833881
834882
835883
......
902950
903951
904952
905
953
906954
907955
908956
......
933981
934982
935983
936
984
937985
938986
939987
......
941989
942990
943991
944
945992
993
946994
947995
948996
......
951999
9521000
9531001
954
1002
9551003
9561004
9571005
......
9591007
9601008
9611009
962
9631010
1011
9641012
9651013
9661014
967
1015
9681016
9691017
9701018
......
9731021
9741022
9751023
976
9771024
1025
9781026
9791027
9801028
......
9861034
9871035
9881036
989
9901037
1038
9911039
9921040
9931041
9941042
9951043
9961044
997
1045
9981046
9991047
10001048
......
10331081
10341082
10351083
1036
1084
10371085
10381086
10391087
10401088
1041
1089
10421090
10431091
1044
1092
10451093
10461094
10471095
10481096
10491097
10501098
1051
1099
10521100
10531101
10541102
......
10891137
10901138
10911139
1092
1140
10931141
1094
1142
10951143
10961144
10971145
......
11041152
11051153
11061154
1107
1108
1109
1155
1156
11101157
1158
11111159
11121160
11131161
......
11151163
11161164
11171165
1118
1166
11191167
11201168
1121
1169
11221170
11231171
11241172
......
11301178
11311179
11321180
1133
1181
11341182
11351183
11361184
......
11381186
11391187
11401188
1141
1189
11421190
11431191
11441192
......
11711219
11721220
11731221
1174
1222
11751223
11761224
11771225
......
11861234
11871235
11881236
1189
1237
11901238
1191
11921239
11931240
11941241
......
11961243
11971244
11981245
1199
1200
1246
12011247
12021248
1249
12031250
12041251
12051252
......
12141261
12151262
12161263
1264
1265
12171266
12181267
12191268
......
12271276
12281277
12291278
1230
1279
12311280
1232
12331281
12341282
12351283
......
12411289
12421290
12431291
1244
1292
12451293
12461294
12471295
......
12641312
12651313
12661314
1315
1316
1317
12671318
12681319
12691320
......
12751326
12761327
12771328
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
12911329
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
13161330
moduleHook_t* moduleCallbacks = NULL;
moduleList_t* loadedModules = NULL;
symbolList_t* moduleSymbols = NULL;
unsigned int (*lookup_symbol)(const char*) = NULL;
unsigned int (*lookup_symbol)(const char*, int(*strcmp_callback)(const char*, const char*)) = NULL;
#if DEBUG_MODULES
VOID print_hook_list()
if((UInt32)lookup_symbol != 0xFFFFFFFF)
{
return status;
return EFI_SUCCESS;
}
}
while(readdir(moduleDir, (const char**)&name, &flags, &time) >= 0)
{
if ((strcmp(SYMBOLS_MODULE,name)) == 0) continue; // if we found Symbols.dylib, just skip it
int len = strlen(name);
int ext_size = sizeof("dylib");
if (len >= ext_size)
{
if(strcmp(&name[len - ext_size], ".dylib") == 0)
{
char* tmp = malloc(len /*+ 1*/);
strlcpy(tmp, name, len + 1);
{
char *tmp = newString(name);
if (!tmp) {
continue;
}
msglog("* Attempting to load module: %s\n", tmp);
if(load_module(tmp) != EFI_SUCCESS)
{
DBG("Ignoring %s\n", name);
}
#endif
}
if (moduleDir)
{
closedir(moduleDir);
}
#if DEBUG_MODULES
print_symbol_list();
#endif
EFI_STATUS load_module(char* module)
{
void (*module_start)(void) = NULL;
// Check to see if the module has already been loaded
if(is_module_loaded(module) == EFI_SUCCESS)
{
return EFI_ALREADY_STARTED;
}
char modString[128];
int fh = -1;
sprintf(modString, "/Extra/modules/%s", module);
char *modString=NULL;
modString = newStringWithFormat( "/Extra/modules/%s", module);
if (!modString) {
printf("Unable to allocate module name : /Extra/modules/%s\n", module);
return EFI_OUT_OF_RESOURCES;
}
fh = open(modString);
if(fh < 0)
{
#else
msglog("Unable to locate module %s\n", modString);
#endif
return EFI_OUT_OF_RESOURCES;
free(modString);
return EFI_OUT_OF_RESOURCES;
}
EFI_STATUS ret = EFI_SUCCESS;
{
int moduleSize = file_size(fh);
char* module_base = (char*) malloc(moduleSize);
if (moduleSize && read(fh, module_base, moduleSize) == moduleSize)
char* module_base = NULL;
if (moduleSize > 0)
{
module_base = (char*) malloc(moduleSize);
}
if (module_base && read(fh, module_base, moduleSize) == moduleSize)
{
DBG("Module %s read in.\n", modString);
// Module loaded into memory, parse it
module_start = parse_mach(module_base, &load_module, &add_symbol);
if(module_start && module_start != (void*)0xFFFFFFFF)
if(module_start && (module_start != (void*)0xFFFFFFFF))
{
module_loaded(module/*moduleName, moduleVersion, moduleCompat*/);
// Notify the system that it was laoded
}
}
close(fh);
free(modString);
return ret;
}
*/
VOID register_hook_callback(const char* name, void(*callback)(void*, void*, void*, void*, void*, void*))
{
DBG("Adding callback for '%s' hook.\n", name);
DBG("Adding callback for hook '%s'.\n", name);
moduleHook_t* hook = get_callback(name);
{
// append
callbackList_t* newCallback = malloc(sizeof(callbackList_t));
if (!newCallback) {
DBG("Unable to allocate memory for callback \n");
return;
}
newCallback->next = hook->callbacks;
hook->callbacks = newCallback;
newCallback->callback = callback;
else
{
// create new hook
moduleHook_t* newHook = malloc(sizeof(moduleHook_t));
moduleHook_t* newHook = malloc(sizeof(moduleHook_t));
if (!newHook) {
DBG("Unable to allocate memory for hook '%s'.\n", name);
return;
}
newHook->name = name;
newHook->callbacks = malloc(sizeof(callbackList_t));
if (!newHook->callbacks) {
DBG("Unable to allocate memory for callback \n");
free(newHook);
return;
}
newHook->callbacks->callback = callback;
newHook->callbacks->next = NULL;
// Module info
/*char* moduleName = NULL;
UInt32 moduleVersion = 0;
UInt32 moduleCompat = 0;
*/
UInt32 moduleVersion = 0;
UInt32 moduleCompat = 0;
*/
// TODO convert all of the structs to a union
struct dyld_info_command* dyldInfoCommand = NULL;
struct symtab_command* symtabCommand = NULL;
{
struct segment_command *segCommand = NULL;
struct segment_command_64 *segCommand64 = NULL;
{
UInt32 sectionIndex;
#if HARD_DEBUG_MODULES
#if DEBUG_MODULES
unsigned long fileaddr;
long filesize;
vmaddr = (segCommand->vmaddr & 0x3fffffff);
printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
segCommand->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
(unsigned) segCommand->nsects, (unsigned)segCommand->flags);
#if DEBUG_MODULES==2
getc();
#endif
#endif
sectionIndex = sizeof(struct segment_command);
struct section *sect;
{
UInt32 sectionIndex;
#if HARD_DEBUG_MODULES
#if DEBUG_MODULES
unsigned long fileaddr;
long filesize;
vmaddr = (segCommand64->vmaddr & 0x3fffffff);
printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
segCommand64->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
(unsigned) segCommand64->nsects, (unsigned)segCommand64->flags);
#if DEBUG_MODULES==2
getc();
#endif
#endif
sectionIndex = sizeof(struct segment_command_64);
// TODO: verify version
// =dylibCommand->dylib.current_version;
// =dylibCommand->dylib.compatibility_version;
char* name = malloc(strlen(module) + strlen(".dylib") + 1);
sprintf(name, "%s.dylib", module);
if(dylib_loader == EFI_SUCCESS)
char *name=NULL;
name = newStringWithFormat( "%s.dylib", module);
if (!name) {
printf("Unable to allocate module name : %s\n", module);
return NULL;
}
if(dylib_loader)
{
EFI_STATUS statue = dylib_loader(name);
if( statue != EFI_SUCCESS)
{
free(name);
if (statue != EFI_ALREADY_STARTED)
{
// Unable to load dependancy
free(name);
return NULL;
}
}
}
free(name);
break;
}
case LC_ID_DYLIB:
}
//if(!moduleName) return NULL;
}
// bind_macho uses the symbols.
module_start = (void*)handle_symtable((UInt32)binary, symtabCommand, symbol_handler, is64);
// Rebase the module before binding it.
if(dyldInfoCommand && dyldInfoCommand->rebase_off)
{
// This should be changed to bind when a symbol is referened at runtime instead.
bind_macho(binary, (char*)dyldInfoCommand->lazy_bind_off, dyldInfoCommand->lazy_bind_size);
}
return module_start;
}
{
immediate = rebase_stream[i] & REBASE_IMMEDIATE_MASK;
opcode = rebase_stream[i] & REBASE_OPCODE_MASK;
switch(opcode)
{
case REBASE_OPCODE_DONE:
segmentAddress += sizeof(void*);
}
break;
case REBASE_OPCODE_DO_REBASE_ULEB_TIMES:
tmp = 0;
bits = 0;
index = 0;
for (index = 0; index < tmp; ++index)
{
rebase_location(base + segmentAddress, (char*)base, type);
segmentAddress += tmp2 + sizeof(void*);
SInt32 addend = 0;// TODO: handle this
SInt32 libraryOrdinal = 0;
const char* symbolName = NULL;
UInt8 symboFlags = 0;
UInt32 symbolAddr = 0xFFFFFFFF;
while(bind_stream[i] & 0x80);
//DBG("BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB: %d\n", libraryOrdinal);
break;
case BIND_OPCODE_SET_DYLIB_SPECIAL_IMM:
// NOTE: this is wrong, fortunately we don't use it
libraryOrdinal = -immediate;
//DBG("BIND_OPCODE_SET_DYLIB_SPECIAL_IMM: %d\n", libraryOrdinal);
break;
case BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM:
symbolName = (char*)&bind_stream[++i];
i += strlen((char*)&bind_stream[i]);
//DBG("BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM: %s, 0x%X\n", symbolName, symboFlags);
symbolAddr = lookup_all_symbols(symbolName);
break;
case BIND_OPCODE_SET_TYPE_IMM:
// Set bind type (pointer, absolute32, pcrel32)
type = immediate;
//DBG("BIND_OPCODE_SET_TYPE_IMM: %d\n", type);
break;
case BIND_OPCODE_SET_ADDEND_SLEB:
if(symbolAddr != 0xFFFFFFFF)
{
address = segmentAddress + (UInt32)base;
bind_location((UInt32*)address, (char*)symbolAddr, addend, BIND_TYPE_POINTER);
}
else if(strcmp(symbolName, SYMBOL_DYLD_STUB_BINDER) != 0)
if(symbolAddr != 0xFFFFFFFF)
{
address = segmentAddress + (UInt32)base;
bind_location((UInt32*)address, (char*)symbolAddr, addend, BIND_TYPE_POINTER);
}
else if(strcmp(symbolName, SYMBOL_DYLD_STUB_BINDER) != 0)
printf("Unable to bind symbol %s\n", symbolName);
}
segmentAddress += tmp + sizeof(void*);
break;
case BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED:
if(symbolAddr != 0xFFFFFFFF)
{
address = segmentAddress + (UInt32)base;
bind_location((UInt32*)address, (char*)symbolAddr, addend, BIND_TYPE_POINTER);
}
else if(strcmp(symbolName, SYMBOL_DYLD_STUB_BINDER) != 0)
printf("Unable to bind symbol %s\n", symbolName);
}
segmentAddress += (immediate * sizeof(void*)) + sizeof(void*);
break;
case BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB:
tmp = 0;
bits = 0;
do
bits += 7;
}
while(bind_stream[i] & 0x80);
tmp2 = 0;
bits = 0;
do
//DBG("BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB 0x%X 0x%X\n", tmp, tmp2);
if(symbolAddr != 0xFFFFFFFF)
{
for(index = 0; index < tmp; index++)
{
address = segmentAddress + (UInt32)base;
bind_location((UInt32*)address, (char*)symbolAddr, addend, BIND_TYPE_POINTER);
segmentAddress += tmp2 + sizeof(void*);
{
// do actual update
char* newValue = value + addend;
switch (type) {
case BIND_TYPE_POINTER:
case BIND_TYPE_TEXT_ABSOLUTE32:
break;
case BIND_TYPE_TEXT_PCREL32:
newValue -= ((UInt32)location + 4);
break;
default:
return;
}
*location = (UInt32)newValue;
}
/*
if (new_entry)
{
new_entry->next = loadedModules;
loadedModules = new_entry;
new_entry->module = (char*)name;
//new_entry->version = version;
//new_entry->compat = compat;
while(entry)
{
DBG("Comparing %s with %s\n", name, entry->module);
char fullname[128];
sprintf(fullname, "%s.dylib",name);
if((strcmp(entry->module, name) == 0) || (strcmp(entry->module, fullname) == 0))
char *fullname = newStringWithFormat("%s.dylib",name);
if(fullname && ((strcmp(entry->module, name) == 0) || (strcmp(entry->module, fullname) == 0)))
{
free(fullname);
DBG("Located module %s\n", name);
return EFI_SUCCESS;
}
{
entry = entry->next;
}
}
DBG("Module %s not found\n", name);
return EFI_NOT_FOUND;
}
unsigned int addr = 0xFFFFFFFF;
if(lookup_symbol && (UInt32)lookup_symbol != 0xFFFFFFFF)
{
addr = lookup_symbol(name);
addr = lookup_symbol(name, &strcmp);
if(addr != 0xFFFFFFFF)
{
DBG("Internal symbol %s located at 0x%X\n", name, addr);
}
}
}
{
symbolList_t* entry = moduleSymbols;
while(entry)
* parse the symbol table
* Lookup any undefined symbols
*/
unsigned int handle_symtable(UInt32 base, struct symtab_command* symtabCommand, long long(*symbol_handler)(char*, long long, char), char is64)
{
unsigned int module_start = 0xFFFFFFFF;
{
if(symbolEntry->n_value)
{
if(strcmp(symbolString + symbolEntry->n_un.n_strx, "start") == 0)
if(strstr(symbolString + symbolEntry->n_un.n_strx, "module_start") || (strcmp(symbolString + symbolEntry->n_un.n_strx, "start") == 0))
{
// Module start located. 'start' is an alias so don't register it
module_start = base + symbolEntry->n_value;
DBG("n_value %x module_start %x\n", (unsigned)symbolEntry->n_value, (unsigned)module_start);
}
{
symbol_handler(symbolString + symbolEntry->n_un.n_strx, (long long)base + symbolEntry->n_value, is64);
}
#if HARD_DEBUG_MODULES
#if DEBUG_MODULES
bool isTexT = (((unsigned)symbolEntry->n_value > (unsigned)vmaddr) && ((unsigned)(vmaddr + vmsize) > (unsigned)symbolEntry->n_value ));
printf("%s %s\n", isTexT ? "__TEXT :" : "__DATA(OR ANY) :", symbolString + symbolEntry->n_un.n_strx);
#if DEBUG_MODULES==2
if(strcmp(symbolString + symbolEntry->n_un.n_strx, "_BootHelp_txt") == 0)
{
printf("method 2: __DATA : BootHelp_txt[0] %x\n", BootHelp2[0]);
}
#endif
#endif
}
symbolEntry++;
while(symbolIndex < symtabCommand->nsyms)
{
if(strcmp(symbolString + symbolEntry->n_un.n_strx, "start") == 0)
if(strstr(symbolString + symbolEntry->n_un.n_strx, "module_start") || (strcmp(symbolString + symbolEntry->n_un.n_strx, "start") == 0))
{
// Module start located. 'start' is an alias so don't register it
module_start = base + symbolEntry->n_value;
}
else
symbolIndex++;// TODO remove
}
}
return module_start;
}
if(addr != 0xFFFFFFFF)
{
UInt32* jumpPointer = malloc(sizeof(UInt32*));
if (!jumpPointer) {
return EFI_OUT_OF_RESOURCES;
}
*binary++ = 0xFF;// Jump
*binary++ = 0x25;// Long Jump
}
return EFI_NOT_FOUND;
}
/* Nedded to divide 64bit numbers correctly. TODO: look into why modules need this
* And why it isn't needed when compiled into boot2
*
* In the next versions, this will be surely replaced by the Apple's libcc_kext or the meklort's klibc
*/
uint64_t __udivdi3(uint64_t numerator, uint64_t denominator)
{
uint64_t quotient = 0, qbit = 1;
if (denominator)
{
while ((int64_t) denominator >= 0)
{
denominator <<= 1;
qbit <<= 1;
}
while (denominator)
{
if (denominator <= numerator)
{
numerator -= denominator;
quotient += qbit;
}
denominator >>= 1;
qbit >>= 1;
}
return quotient;
}
stop("Divide by 0");
return 0;
}
branches/cparm/i386/boot2/modules.h
9191
9292
9393
94
94
9595
9696
9797
9898
99
99
100100
101101
struct symtab_command* symtabCommand,
long long(*symbol_handler)(char*, long long, char),
char is64);
unsigned int lookup_all_symbols(const char* name);
EFI_STATUS replace_function(const char* symbol, void* newAddress);
extern unsigned int (*lookup_symbol)(const char*);
extern unsigned int (*lookup_symbol)(const char*, int(*strcmp_callback)(const char*, const char*));
#endif /* __BOOT_MODULES_H */
branches/cparm/i386/boot2/drivers.c
9898
9999
100100
101
101
102102
103103
104104
......
121121
122122
123123
124
124
125125
126126
127127
......
341341
342342
343343
344
344
345345
346346
347347
......
723723
724724
725725
726
726
727727
728728
729729
......
733733
734734
735735
736
736
737737
738738
739739
......
743743
744744
745745
746
747746
748747
749
748
749
750
751
752
750753
751754
752755
return 0;
// Load extra drivers if a hook has been installed.
int step = 0;
step = 1;
execute_hook("ramDiskLoadDrivers", &step, NULL, NULL, NULL, NULL, NULL);
#endif
// First try a specfic OS version folder ie 10.5
if (!length || (unsigned)length < sizeof (DriversPackage)) return -1;
// call hook to notify modules that the mkext has been loaded
execute_hook("LoadDriverMKext", (void*)fileSpec, (void*)package, (void*) length, NULL, NULL, NULL);
execute_hook("LoadDriverMKext", (void*)fileSpec, (void*)package, &length, NULL, NULL, NULL);
// Verify the MKext.
{
long ret;
compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary;
#if 0
printf("kernel header:\n");
printf("signature: 0x%x\n", kernel_header->signature);
printf("compressed_size: 0x%x\n", kernel_header->compressed_size);
getc();
#endif
if (kernel_header->signature == OSSwapBigToHostConstInt32('comp'))
{
if (kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss'))
}
u_int32_t uncompressed_size, size;
void *buffer;
uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size);
binary = buffer = malloc(uncompressed_size);
binary = malloc(uncompressed_size);
if (!binary) {
printf("Unable to allocate memory for uncompressed kernel\n");
return -1;
}
size = decompress_lzss((u_int8_t *) binary, &kernel_header->data[0],
OSSwapBigToHostInt32(kernel_header->compressed_size));
branches/cparm/i386/boot2/options.c
111111
112112
113113
114
114
115115
116116
117117
......
142142
143143
144144
145
146
147
148
149
145
146
147
148
149
150150
151151
152152
......
237237
238238
239239
240
240
241241
242
243
244
245
246
247
242
243
244
245
246
247
248248
249
250
249
250
251251
252252
253253
......
564564
565565
566566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
581582
582
583583
584584
585585
......
773773
774774
775775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
776
796777
797
798
778
799779
800
801
802
803
804
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805805
806806
807807
......
900900
901901
902902
903
903
904904
905905
906906
......
983983
984984
985985
986
987
986
988987
989
990
991
992
993
994
995
988
989
990
991
992
993
994
995
996
997
998
999
1000
9961001
997
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
9981016
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
10091017
10101018
1011
1019
10121020
10131021
10141022
......
10321040
10331041
10341042
1035
1043
1044
1045
1046
10361047
10371048
10381049
......
11141125
11151126
11161127
1117
1118
1128
1129
1130
1131
1132
1133
11191134
11201135
1121
1122
1123
1124
1125
1126
1127
1128
1136
1137
1138
11291139
1140
11301141
11311142
11321143
......
11381149
11391150
11401151
1141
1152
11421153
11431154
11441155
moveCursor( 0, row );
printf(msg);
for ( time = time18(), timeout++; timeout > 0; )
{
if ((ch = readKeyboardStatus()))
//==========================================================================
char gBootArgs[BOOT_STRING_LEN];
char * gBootArgsPtr = gBootArgs;
char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1;
char booterCommand[BOOT_STRING_LEN];
char booterParam[BOOT_STRING_LEN];
char gBootArgs[BOOT_STRING_LEN];
char * gBootArgsPtr = gBootArgs;
char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1;
char booterCommand[BOOT_STRING_LEN];
char booterParam[BOOT_STRING_LEN];
void clearBootArgs(void)
{
//==========================================================================
const MenuItem * gMenuItems = NULL;
const MenuItem * gMenuItems = NULL;
int gMenuItemCount;
int gMenuRow;
int gMenuHeight;
int gMenuTop;
int gMenuBottom;
int gMenuSelection;
int gMenuItemCount;
int gMenuRow;
int gMenuHeight;
int gMenuTop;
int gMenuBottom;
int gMenuSelection;
int gMenuStart;
int gMenuEnd;
int gMenuStart;
int gMenuEnd;
void printMenuItem( const MenuItem * item, int highlight )
{
timeout = multiboot_timeout;
} else
#endif
if (!getIntForKey(kTimeoutKey, &timeout, &bootInfo->bootConfig)) {
/* If there is no timeout key in the file use the default timeout
which is different for CDs vs. hard disks. However, if not booting
a CD and no config file could be loaded set the timeout
to zero which causes the menu to display immediately.
This way, if no partitions can be found, that is the disk is unpartitioned
or simply cannot be read) then an empty menu is displayed.
If some partitions are found, for example a Windows partition, then
these will be displayed in the menu as foreign partitions.
*/
if (isCDROM) {
timeout = kCDBootTimeout;
} else {
timeout = sysConfigValid ? kBootTimeout : 0;
if (!getIntForKey(kTimeoutKey, &timeout, &bootInfo->bootConfig)) {
/* If there is no timeout key in the file use the default timeout
which is different for CDs vs. hard disks. However, if not booting
a CD and no config file could be loaded set the timeout
to zero which causes the menu to display immediately.
This way, if no partitions can be found, that is the disk is unpartitioned
or simply cannot be read) then an empty menu is displayed.
If some partitions are found, for example a Windows partition, then
these will be displayed in the menu as foreign partitions.
*/
if (isCDROM) {
timeout = kCDBootTimeout;
} else {
timeout = sysConfigValid ? kBootTimeout : 0;
}
}
}
if (timeout < 0) {
gBootMode |= kBootModeQuiet;
}
else
#endif
if ( strcmp( booterCommand, "memory" ) == 0)
{
printMemoryInfo();
}
else if (strcmp(booterCommand, "lspci") == 0)
{
lspci();
}
else if (strcmp(booterCommand, "more") == 0)
{
showTextFile(booterParam);
}
else if (strcmp(booterCommand, "rd") == 0)
{
if (execute_hook("processRAMDiskCommand", (void*)argPtr, &booterParam, NULL, NULL, NULL, NULL) != EFI_SUCCESS)
showMessage("ramdisk module not found, please install RamdiskLoader.dylib in /Extra/modules/");
}
else if (strcmp(booterCommand, "norescan") == 0)
{
if (gEnableCDROMRescan)
if ( strcmp( booterCommand, "memory" ) == 0)
{
gEnableCDROMRescan = false;
break;
printMemoryInfo();
}
}
else
{
showHelp();
}
else if (strcmp(booterCommand, "lspci") == 0)
{
lspci();
}
else if (strcmp(booterCommand, "more") == 0)
{
showTextFile(booterParam);
}
else if (strcmp(booterCommand, "rd") == 0)
{
if (execute_hook("processRAMDiskCommand", (void*)argPtr, &booterParam, NULL, NULL, NULL, NULL) != EFI_SUCCESS)
showMessage("ramdisk module not found, please install RamdiskLoader.dylib in /Extra/modules/");
}
else if (strcmp(booterCommand, "norescan") == 0)
{
if (gEnableCDROMRescan)
{
gEnableCDROMRescan = false;
break;
}
}
else
{
showHelp();
}
#endif
key = 0;
showBootPrompt(nextRow, showPrompt);
int userCnt;
char * argP;
char * configKernelFlags;
skipblanks( &cp );
// Update the unit and partition number.
cnt = 0;
}
configKernelFlags = malloc(cnt + 1);
strlcpy(configKernelFlags, val, cnt + 1);
configKernelFlags = newString(val);
if (!getValueForBootKey(cp, kSafeModeFlag, &val, &cnt) &&
!getValueForBootKey(configKernelFlags, kSafeModeFlag, &val, &cnt)) {
if (gBootMode & kBootModeSafe) {
copyArgument(0, kSafeModeFlag, strlen(kSafeModeFlag), &argP, &ArgCntRemaining);
}
}
{
bool isSafeMode = false;
if (configKernelFlags) {
isSafeMode = getValueForBootKey(configKernelFlags, kSafeModeFlag, &val, &cnt);
}
if (!getValueForBootKey(cp, kSafeModeFlag, &val, &cnt) &&
(isSafeMode == false)) {
if (gBootMode & kBootModeSafe) {
copyArgument(0, kSafeModeFlag, strlen(kSafeModeFlag), &argP, &ArgCntRemaining);
}
}
}
// Store the merged kernel flags and boot args.
if (configKernelFlags) {
// Store the merged kernel flags and boot args.
cnt = strlen(configKernelFlags);
if (cnt) {
if (cnt > ArgCntRemaining) {
printf("Warning: boot arguments too long, truncating\n");
cnt = ArgCntRemaining;
}
strncpy(argP, configKernelFlags, cnt);
argP[cnt++] = ' ';
ArgCntRemaining -= cnt;
}
}
cnt = strlen(configKernelFlags);
if (cnt) {
if (cnt > ArgCntRemaining) {
error("Warning: boot arguments too long, truncating\n");
cnt = ArgCntRemaining;
}
strncpy(argP, configKernelFlags, cnt);
argP[cnt++] = ' ';
ArgCntRemaining -= cnt;
}
userCnt = strlen(cp);
if (userCnt > ArgCntRemaining) {
error("Warning: boot arguments too long, truncating\n");
printf("Warning: boot arguments too long, truncating\n");
userCnt = ArgCntRemaining;
}
strncpy(&argP[cnt], cp, userCnt);
strlcpy(gMKextName, val, cnt + 1);
}
free(configKernelFlags);
if (configKernelFlags)
{
free(configKernelFlags);
}
return 0;
}
char filename[512];
sprintf(filename, "BootHelp.txt");
// Check Extra on booting partition
sprintf(dirspec,"/Extra/%s",filename);
// Check Extra on booting partition
sprintf(dirspec,"/Extra/%s",filename);
fd=open (dirspec);
if (fd<0)
{// Fall back to booter partition
sprintf(dirspec,"bt(0,0)/Extra/%s",filename);
fd=open (dirspec);
if (fd<0)
{// Fall back to booter partition
sprintf(dirspec,"bt(0,0)/Extra/%s",filename);
fd=open (dirspec);
if (fd<0)
{
printf("BootHelp not found: %s\n", filename);
return;
}
{
printf("BootHelp not found: %s\n", filename);
return;
}
}
int BootHelp_txt_len = file_size (fd);
void *BootHelp_txt=malloc(BootHelp_txt_len);
if (BootHelp_txt)
close (fd);
return;
}
close (fd);
}
#endif
branches/cparm/i386/boot2/Makefile
99
1010
1111
12
12
1313
14
14
1515
1616
1717
......
7777
7878
7979
80
80
8181
8282
8383
include ../MakePaths.dir
OPTIM = -Os -Oz
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror -fstack-protector-all \
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float
DEFINES=
@echo "\t[LD] boot.sys"
@$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
-nostdlib -arch i386 -Wl,-segalign,20 \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext
-o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS)
@echo "\t[MACHOCONV] boot"
@$(SYMROOT)/machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot &> /dev/null
branches/cparm/i386/modules/NetbookInstaller/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/RamDiskLoader/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/YellowIconFixer/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/KextPatcher/kext_patcher.c
130130
131131
132132
133
133
134134
135135
136136
void KextPatcher_start()
{
// Hooks into the following:
//execute_hook("LoadDriverMKext", (void*)package, (void*) length, NULL, NULL, NULL, NULL);
//execute_hook("LoadDriverMKext", (void*)package, &length, NULL, NULL, NULL, NULL);
// execute_hook("LoadMatchedModules", module, &length, executableAddr, NULL, NULL, NULL);
#if UNUSED
register_hook_callback("PCIDevice", &KextPatcher_hook);
branches/cparm/i386/modules/KextPatcher/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/ACPIPatcher/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/GUI/gui.c
368368
369369
370370
371
371
372372
373
373
374374
375375
376376
377377
378
378
379379
380380
381381
......
385385
386386
387387
388
388
389389
390
390
391391
392392
393393
......
421421
422422
423423
424
424
425425
426
426
427427
428428
429429
......
444444
445445
446446
447
447
448448
449449
450450
......
459459
460460
461461
462
462
463463
464
464
465465
466466
467467
......
532532
533533
534534
535
535
536536
537
537
538538
539539
540
540
541541
542542
543543
......
913913
914914
915915
916
916
917917
918918
919919
920920
921921
922922
923
923
924924
925925
926
927
926
927
928928
929929
930930
......
945945
946946
947947
948
948
949949
950950
951951
952952
953
953
954954
955
955
956956
957957
958958
......
981981
982982
983983
984
985984
985
986986
987
987
988988
989989
990990
......
995995
996996
997997
998
998
999999
10001000
10011001
......
10471047
10481048
10491049
1050
1050
10511051
10521052
10531053
......
10601060
10611061
10621062
1063
1063
10641064
10651065
10661066
......
10861086
10871087
10881088
1089
1089
10901090
10911091
10921092
10931093
10941094
1095
1095
10961096
1097
1097
10981098
1099
1099
11001100
1101
1102
1101
1102
1103
1104
1105
11031106
1104
1105
1106
1107
1108
1109
1110
1111
1107
1108
1109
1110
1111
11121112
1113
1113
11141114
1115
1115
11161116
1117
1117
11181118
11191119
11201120
......
11321132
11331133
11341134
1135
1135
11361136
11371137
11381138
......
14821482
14831483
14841484
1485
1485
14861486
14871487
14881488
......
18621862
18631863
18641864
1865
1865
18661866
18671867
18681868
......
25812581
25822582
25832583
2584
if (images[i].image == NULL) {
images[i].image = malloc(sizeof(pixmap_t));
if (images[i].image == NULL) {
DBG("Unable to allocate memory for %s.png\n", image);
return 1;
}
}
sprintf(dirspec, "%s/%s/%s.png", src, theme_name, image);
width = 0;
height = 0;
imagedata = NULL;
images[i].image->height = height;
images[i].image->pixels = (pixel_t *)imagedata;
flipRB(images[i].image);
DBG("[ %s ] succesfully loaded and registred !!\n", dirspec);
return 0;
}
#ifdef EMBED_THEME
images[i].image->pixels = images[alt_image].image->pixels;
} else {
DBG("Unable to load %s, this image not vital anyway, reseting and returning success !!\n", dirspec);
free(images[i].image);
images[i].image = NULL;
}
free(images[i].image);
images[i].image = NULL;
return 1;
}
}
static int loadGraphics(char *src)
{
DBG("Loading image into memory....\n",theme_name);
LOADPNG(src, background, IMG_REQUIRED);
LOADPNG(src, logo, IMG_REQUIRED);
LOADPNG(src, device_generic, IMG_REQUIRED);
LOADPNG(src, font_console, IMG_REQUIRED);
LOADPNG(src, font_small, IMG_REQUIRED);
DBG("Initializing font....\n",theme_name);
initFont( &font_console, &images[iFontConsole]);
initFont( &font_small, &images[iFontSmall]);
DBG("Graphic objects successfully loaded !!\n",theme_name);
return 0;
#define MAX_tHEME 255
static int randomTheme(char *dirspec, const char **theme) {
long ret, flags, time;
long long index;
const char * name;
index = 0;
uint8_t i=0;
char *list[MAX_tHEME];
#ifdef EMBED_THEME
list[i] = "";
i++;
list[i] = "";
i++;
#endif
while (i < MAX_tHEME) {
}
if (i) {
srand (time18());
*theme = list[(rand() % i)];
int ret = startGUI();
uint8_t l=0;
#ifdef EMBED_THEME
l++;
if (!dummybool) {
return 1;
}
getBoolForKey("RandomTheme", &theme_ran, &bootInfo->bootConfig);
{
long flags;
long time;
if (theme_ran)
{
retry:
retry:
ret = GetFileInfo("rd(0,0)/Extra/", "Themes", &flags, &time);
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)) {
sprintf(dirsrc, "rd(0,0)/Extra/Themes");
if (theme_ran)
{
ret = randomTheme(dirsrc, &theme_name);
if (ret) printf("randomTheme Failed !! \n");
ret = startGUI();
if (ret) printf("Failed to load Theme : %s !! \n", theme_name);
}
#ifdef EMBED_THEME
if (ret) {
int val;
char dirspec[256];
if ((unsigned)(strlen(theme_name) + strlen(dirsrc) + strlen("theme.plist") + 2 ) > sizeof(dirspec)) {
DBG("Path of %s/%s/theme.plist to long\n", dirsrc, theme_name);
return 1;
}
sprintf(dirspec, "%s/%s/theme.plist", dirsrc ,theme_name);
if (loadConfigFile(dirspec, &bootInfo->themeConfig) != 0) {
#ifdef EMBED_THEME
if (strlen(theme_name) == 0) {
config_file_t *config;
if (strlen(theme_name) == 0) {
config_file_t *config;
config = &bootInfo->themeConfig;
if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) {
config = &bootInfo->themeConfig;
if (ParseXMLFile((char *)__theme_plist, &config->dictionary) != 0) {
DBG("Unable to load embed theme plist datas.\n");
return 1;
}
}
DBG("Unable to load embed theme plist datas.\n");
return 1;
}
}
#else
DBG("Unable to load %s theme plist.\n",theme_name);
return 1;
#endif
}
else
{
printf("No getResolution function hook installed, using default resolution.\n",theme_name);
}
#endif
void vramwrite (void *data, int width, int height)
#else
static inline
void vramwrite (void *data, int width)
void vramwrite (void *data, int width)
#endif
{
if (VIDEO (depth) == 0x20 /*32*/ && VIDEO (rowBytes) == (unsigned long)gui.backbuffer->width * 4)
int width = 0;
int max_width = 0;
int height = font->height;
// calculate the width in pixels
for (i=0; i < strlen(text); i++) {
if (text[i] == '\n')
return ch;
}
branches/cparm/i386/modules/GUI/Makefile
2323
2424
2525
26
26
2727
2828
2929
3030
31
31
3232
3333
3434
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common -fno-stack-protector #-fstack-protector-all
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common #-fstack-protector-all
DEFINES=
CONFIG = hd
branches/cparm/i386/modules/KernelPatcher/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -O3
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/Networking/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/GraphicsEnabler/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/SMBiosGetters/Makefile
2323
2424
2525
26
26
2727
2828
2929
3030
31
31
3232
3333
3434
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common -fno-stack-protector #-fstack-protector-all
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common #-fstack-protector-all
DEFINES=
CONFIG = hd
branches/cparm/i386/modules/HibernateEnabler/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/Keymapper/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/USBFix/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/HPET/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/SMBiosPatcher/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/Resolution/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
CONFIG = hd
branches/cparm/i386/modules/CPUfreq/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/Memory/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/ACPICodec/acpi_codec.c
106106
107107
108108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140109
141
142
143110
144111
145112
......
154121
155122
156123
157
124
158125
159126
160127
......
190157
191158
192159
193
194
160
161
195162
196
197
198163
199164
200165
......
206171
207172
208173
209
210
211
212174
213
214175
215176
216177
......
802763
803764
804765
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484766
1485767
1486768
......
1495777
1496778
1497779
1498
780
1499781
1500782
1501783
......
1516798
1517799
1518800
1519
801
1520802
1521803
1522804
......
1557839
1558840
1559841
1560
842
1561843
1562844
1563845
......
1625907
1626908
1627909
1628
910
1629911
1630912
1631913
......
19361218
19371219
19381220
1939
1221
19401222
19411223
19421224
......
19901272
19911273
19921274
1993
1275
19941276
19951277
19961278
......
21401422
21411423
21421424
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
21761425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
21771459
21781460
21791461
......
21861468
21871469
21881470
2189
1471
21901472
21911473
21921474
......
24231705
24241706
24251707
2426
1708
24271709
24281710
24291711
......
28022084
28032085
28042086
2805
2087
28062088
28072089
28082090
......
40703352
40713353
40723354
4073
3355
40743356
40753357
40763358
......
42833565
42843566
42853567
4286
3568
42873569
42883570
42893571
......
46213903
46223904
46233905
4624
46253906
46263907
46273908
......
53304611
53314612
53324613
5333
53344614
53354615
5336
53374616
53384617
53394618
......
53584637
53594638
53604639
5361
53624640
5363
53644641
53654642
53664643
5367
53684644
5369
53704645
53714646
53724647
......
56684943
56694944
56704945
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
4946
57154947
57164948
57174949
......
57494981
57504982
57514983
5752
57534984
57544985
57554986
static U32 process_rsdt(ACPI_TABLE_RSDP *rsdp_mod , bool gen_xsdt, U32 *new_table_list);
static ACPI_TABLE_FADT * patch_fadt(ACPI_TABLE_FADT *fadt, ACPI_TABLE_DSDT *new_dsdt, bool UpdateFADT);
#if OLD_SSDT
#include "modules.h"
struct aml_chunk
{
unsigned charType;
unsigned intLength;
char*Buffer;
unsigned intSize;
struct aml_chunk*Next;
struct aml_chunk*First;
struct aml_chunk*Last;
};
static U32 get_needed_symbols (void);
static ACPI_TABLE_SSDT *generate_cst_ssdt(ACPI_TABLE_FADT* fadt);
static ACPI_TABLE_SSDT *generate_pss_ssdt(ACPI_TABLE_DSDT* dsdt);
struct aml_chunk* (*aml_create_node)(struct aml_chunk*) = NULL;
struct aml_chunk* (*aml_add_buffer)(struct aml_chunk*,const char*, unsigned int) = NULL;
struct aml_chunk* (*aml_add_byte)(struct aml_chunk*, unsigned char) = NULL;
struct aml_chunk* (*aml_add_word)(struct aml_chunk*, unsigned int) = NULL;
struct aml_chunk* (*aml_add_dword)(struct aml_chunk*, unsigned long) = NULL;
struct aml_chunk* (*aml_add_qword)(struct aml_chunk*, unsigned long long) = NULL;
struct aml_chunk* (*aml_add_scope)(struct aml_chunk*, const char*) = NULL;
struct aml_chunk* (*aml_add_name)(struct aml_chunk*, const char*) = NULL;
struct aml_chunk* (*aml_add_package)(struct aml_chunk*) = NULL;
struct aml_chunk* (*aml_add_alias)(struct aml_chunk*, const char*, const char*) = NULL;
void (*aml_destroy_node)(struct aml_chunk*) = NULL;
unsigned int (*aml_calculate_size)(struct aml_chunk*) = NULL;
unsigned int (*aml_write_node)(struct aml_chunk*, char*, unsigned int) = NULL;
bool (*aml_add_to_parent)(struct aml_chunk*, struct aml_chunk*) = NULL;
#else
#define IA32_MISC_ENABLES 0x01A0
#define MSR_TURBO_POWER_CURRENT_LIMIT 0x1AC
#define MSR_PKG_CST_CONFIG_CONTROL 0x00E2
static U32 encode_pstate(U32 ratio);
static void collect_cpu_info(CPU_DETAILS * cpu);
#ifndef BETA
static U32 BuildCoreIPstateInfo(CPU_DETAILS * cpu);
//static U32 BuildCoreIPstateInfo(CPU_DETAILS * cpu);
#endif
static U32 BuildCstateInfo(CPU_DETAILS * cpu, U32 pmbase);
static U32 BuildPstateInfo(CPU_DETAILS * cpu);
static bool is_sandybridge(void);
static bool is_jaketown(void);
static U32 get_bclk(void);
static U32 computePstateRatio(const U32 max, const U32 min, const U32 turboEnabled, const U32 numStates, const U32 pstate);
static U32 computeNumPstates(const U32 max, const U32 min, const U32 turboEnabled, const U32 pssLimit);
//static U32 computePstateRatio(const U32 max, const U32 min, const U32 turboEnabled, const U32 numStates, const U32 pstate);
//static U32 computeNumPstates(const U32 max, const U32 min, const U32 turboEnabled, const U32 pssLimit);
#endif // OLD_SSDT
#if UNUSED
static ACPI_TABLE_FACS* generate_facs(bool updatefacs );
#endif
// Security space for SSDT , FACP & MADT table generation,
// the size can be increased
// note: the table will not placed in the reserved space if the 'normal' space is not full
#if OLD_SSDT
#define RESERVED_AERA 4
#else
#define RESERVED_AERA 3
#endif
#define ACPI_TABLE_LIST_FULL MAX_ACPI_TABLE + RESERVED_AERA + 1
return (cpu_map_error = 0);
}
#if OLD_SSDT
static U32 get_needed_symbols (void)
{
/* aml_generator symbols */
aml_create_node = (void*)lookup_all_symbols("_aml_create_node");
if (aml_create_node == (void*)0xFFFFFFFF) goto Failed;
aml_add_buffer = (void*)lookup_all_symbols("_aml_add_buffer");
if (aml_add_buffer == (void*)0xFFFFFFFF) goto Failed;
aml_add_byte = (void*)lookup_all_symbols("_aml_add_byte");
if (aml_add_byte == (void*)0xFFFFFFFF) goto Failed;
aml_add_word = (void*)lookup_all_symbols("_aml_add_word");
if (aml_add_word == (void*)0xFFFFFFFF) goto Failed;
aml_add_dword = (void*)lookup_all_symbols("_aml_add_dword");
if (aml_add_dword == (void*)0xFFFFFFFF) goto Failed;
aml_add_qword = (void*)lookup_all_symbols("_aml_add_qword");
if (aml_add_qword == (void*)0xFFFFFFFF) goto Failed;
aml_add_scope = (void*)lookup_all_symbols("_aml_add_scope");
if (aml_add_scope == (void*)0xFFFFFFFF) goto Failed;
aml_add_name = (void*)lookup_all_symbols("_aml_add_name");
if (aml_add_name == (void*)0xFFFFFFFF) goto Failed;
aml_add_package = (void*)lookup_all_symbols("_aml_add_package");
if (aml_add_package == (void*)0xFFFFFFFF) goto Failed;
aml_add_alias = (void*)lookup_all_symbols("_aml_add_alias");
if (aml_add_alias == (void*)0xFFFFFFFF) goto Failed;
aml_destroy_node = (void*)lookup_all_symbols("_aml_destroy_node");
if (aml_destroy_node == (void*)0xFFFFFFFF) goto Failed;
aml_calculate_size = (void*)lookup_all_symbols("_aml_calculate_size");
if (aml_calculate_size == (void*)0xFFFFFFFF) goto Failed;
aml_write_node = (void*)lookup_all_symbols("_aml_write_node");
if (aml_write_node == (void*)0xFFFFFFFF) goto Failed;
aml_add_to_parent = (void*)lookup_all_symbols("_aml_add_to_parent");
if (aml_add_to_parent == (void*)0xFFFFFFFF) goto Failed;
DBG("struct aml_chunk* _aml_create_node: 0x%x\n",(UInt32)aml_create_node);
DBG("struct aml_chunk* _aml_add_buffer: 0x%x\n",(UInt32)aml_add_buffer);
DBG("struct aml_chunk* _aml_add_byte: 0x%x\n",(UInt32)aml_add_byte);
DBG("struct aml_chunk* _aml_add_word: 0x%x\n",(UInt32)aml_add_word);
DBG("struct aml_chunk* _aml_add_dword: 0x%x\n",(UInt32)aml_add_dword);
DBG("struct aml_chunk* _aml_add_qword: 0x%x\n",(UInt32)aml_add_qword);
DBG("struct aml_chunk* _aml_add_scope: 0x%x\n",(UInt32)aml_add_scope);
DBG("struct aml_chunk* _aml_add_name: 0x%x\n",(UInt32)aml_add_name);
DBG("struct aml_chunk* _aml_add_package: 0x%x\n",(UInt32)aml_add_package);
DBG("struct aml_chunk* _aml_add_alias: 0x%x\n",(UInt32)aml_add_alias);
DBG("void _aml_destroy_node: 0x%x\n",(UInt32)aml_destroy_node);
DBG("unsigned int _aml_calculate_size: 0x%x\n",(UInt32)aml_calculate_size);
DBG("unsigned int _aml_write_node: 0x%x\n",(UInt32)aml_write_node);
DBG("bool _aml_add_to_parent: 0x%x\n",(UInt32)aml_add_to_parent);
return (1);
Failed:
printf("Failed to find aml_generator symbols, SSDT will not be generated !!!");
return (0);
}
static ACPI_TABLE_SSDT *generate_cst_ssdt(ACPI_TABLE_FADT* fadt)
{
char ssdt_header[] =
{
0x53, 0x53, 0x44, 0x54, 0xE7, 0x00, 0x00, 0x00, /* SSDT.... */
0x01, 0x17, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x41, /* ..PmRefA */
0x43, 0x70, 0x75, 0x43, 0x73, 0x74, 0x00, 0x00, /* CpuCst.. */
0x00, 0x10, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, /* ....INTL */
0x31, 0x03, 0x10, 0x20 /* 1.._*/
};
char cstate_resource_template[] =
{
0x11, 0x14, 0x0A, 0x11, 0x82, 0x0C, 0x00, 0x7F,
0x01, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x79, 0x00
};
if (Platform->CPU.Vendor != 0x756E6547) {
verbose ("Not an Intel platform: C-States will not be generated !!!\n");
return (void *)0ul;
}
if (fadt == (void *)0ul) {
verbose ("FACP not exists: C-States will not be generated !!!\n");
return (void *)0ul;
}
ACPI_TABLE_DSDT* dsdt = ((fadt->Header.Revision >= 3) && (fadt->XDsdt != 0)) ? (ACPI_TABLE_DSDT*)((U32)fadt->XDsdt):(ACPI_TABLE_DSDT*)fadt->Dsdt;
if (dsdt == (void *)0ul) {
verbose ("DSDT not found: C-States will not be generated !!!\n");
return (void *)0ul;
}
if (generate_cpu_map_from_acpi(dsdt) == 0)
{
bool c2_enabled = fadt->C2Latency < 100;
bool c3_enabled = fadt->C3Latency < 1000;
bool c4_enabled = false;
getBoolForKey(kEnableC4State, &c4_enabled, &bootInfo->bootConfig);
unsigned char cstates_count = 1 + (c2_enabled ? 1 : 0) + ((c3_enabled || c4_enabled) ? 1 : 0);
char *Lat = NULL, *Pw = NULL, *tmpstr =NULL;
int base = 16;
TagPtr personality = XMLCastDict(XMLGetProperty(bootInfo->bootConfig.dictionary, (const char*)"C-States"));
if ((tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Base")))) {
int mybase = strtol(tmpstr, NULL, 10);
if (mybase == 8 || mybase == 10 || mybase == 16 )
base = mybase;
}
struct aml_chunk* root = aml_create_node(NULL);
aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header
struct aml_chunk* scop;
if (cpuNamespace == CPU_NAMESPACE_PR)
scop = aml_add_scope(root, "\\_PR_");
else if (cpuNamespace == CPU_NAMESPACE_SB)
scop = aml_add_scope(root, "\\_SB_");
else
{
aml_destroy_node(root);
goto out;
}
struct aml_chunk* name = aml_add_name(scop, "CST_");
struct aml_chunk* pack = aml_add_package(name);
aml_add_byte(pack, cstates_count);
struct aml_chunk* tmpl = aml_add_package(pack);
TagPtr match_Status = XMLGetProperty(personality, (const char*)"C1");
if (match_Status) {
Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power"));
Lat = XMLCastString(XMLGetProperty(match_Status, (const char*)"Latency"));
}
cstate_resource_template[11] = 0x00; // C1
aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template));
aml_add_byte(tmpl, 0x01); // C1
aml_add_byte(tmpl, (unsigned char)resolve_cst(0x01, Lat, base)); // Latency
aml_add_word(tmpl, resolve_cst(0x03e8, Pw, base)); // Power
// C2
if (c2_enabled)
{
tmpl = aml_add_package(pack);
Lat = NULL;
Pw = NULL;
match_Status = XMLGetProperty(personality, (const char*)"C2");
if (match_Status) {
Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power"));
Lat = XMLCastString(XMLGetProperty(match_Status, (const char*)"Latency"));
}
cstate_resource_template[11] = 0x10; // C2
aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template));
aml_add_byte(tmpl, 0x02); // C2
aml_add_word(tmpl, resolve_cst(fadt->C2Latency, Lat, base)); // Latency
aml_add_word(tmpl, resolve_cst(0x01f4, Pw, base)); // Power
}
// C4
if (c4_enabled)
{
tmpl = aml_add_package(pack);
Lat = NULL;
Pw = NULL;
match_Status = XMLGetProperty(personality, (const char*)"C4");
if (match_Status) {
Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power"));
Lat = XMLCastString(XMLGetProperty(match_Status, (const char*)"Latency"));
}
cstate_resource_template[11] = 0x30; // C4
aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template));
aml_add_byte(tmpl, 0x04); // C4
aml_add_word(tmpl, resolve_cst(fadt->C3Latency / 2, Lat, base)); // TODO: right latency for C4
aml_add_word(tmpl, resolve_cst(0xfa, Pw, base)); // Power
// you can check if the C4 state is correctly activated or not with the following command Lines (you will need the 'lspci for mac' package):
// according to the intel ich10 dataheet ( Power Management PCI Configuration Registers (PM—D31:F0) ):
// setpci -s 0:1f.0 0xa0.w (must return an hex where bit 12 is 0 and bit 7 is 1, usually 06a0h )
// setpci -s 0:1f.0 0xa6.b (must return an hex where bit 7 is 1, usually 80h )
}
// C3
else if (c3_enabled)
{
tmpl = aml_add_package(pack);
Lat = NULL;
Pw = NULL;
match_Status = XMLGetProperty(personality, (const char*)"C3");
if (match_Status) {
Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power"));
Lat = XMLCastString(XMLGetProperty(match_Status, (const char*)"Latency"));
}
cstate_resource_template[11] = 0x20; // C3
aml_add_buffer(tmpl, cstate_resource_template, sizeof(cstate_resource_template));
aml_add_byte(tmpl, 0x03); // C3
aml_add_word(tmpl, resolve_cst(fadt->C3Latency , Lat, base));
aml_add_word(tmpl, resolve_cst(0x015e, Pw, base)); // Power
}
// Aliaces
unsigned int i;
for (i = 0; i < cpu_map_count; i++)
{
char name[9];
U32 nseg = *(U32*)cpu_map[i].nameseg;
if (cpuNamespace == CPU_NAMESPACE_PR) {
sprintf(name, "_PR_%c%c%c%c",
(int)(nseg & 0x000000ff),
(int)((nseg & 0x0000ff00) >> 8),
(int)((nseg & 0x00ff0000) >> 16),
(int)(nseg >> 24));
} else if (cpuNamespace == CPU_NAMESPACE_SB) {
sprintf(name, "_SB_%c%c%c%c",
(int)(nseg & 0x000000ff),
(int)((nseg & 0x0000ff00) >> 8),
(int)((nseg & 0x00ff0000) >> 16),
(int)(nseg >> 24));
} else {
aml_destroy_node(root);
goto out;
}
scop = aml_add_scope(root, name);
aml_add_alias(scop, "CST_", "_CST");
}
aml_calculate_size(root);
ACPI_TABLE_SSDT *ssdt = (ACPI_TABLE_SSDT *)AllocateKernelMemory(root->Size);
aml_write_node(root, (void*)ssdt, 0);
ssdt->Header.Length = root->Size;
SetChecksum(&ssdt->Header);
aml_destroy_node(root);
verbose ("SSDT with CPU C-States generated successfully\n");
return ssdt;
}
else
{
out:
verbose ("ACPI CPUs not found: C-States will not be generated !!!\n");
}
return (void *)0ul;
}
static ACPI_TABLE_SSDT *generate_pss_ssdt(ACPI_TABLE_DSDT* dsdt)
{
char ssdt_header[] =
{
0x53, 0x53, 0x44, 0x54, 0x7E, 0x00, 0x00, 0x00, /* SSDT.... */
0x01, 0x6A, 0x50, 0x6D, 0x52, 0x65, 0x66, 0x00, /* ..PmRef. */
0x43, 0x70, 0x75, 0x50, 0x6D, 0x00, 0x00, 0x00, /* CpuPm... */
0x00, 0x30, 0x00, 0x00, 0x49, 0x4E, 0x54, 0x4C, /* .0..INTL */
0x31, 0x03, 0x10, 0x20,/* 1.._*/
};
if (Platform->CPU.Vendor != 0x756E6547) {
verbose ("Not an Intel platform: P-States will not be generated !!!\n");
return (void *)0ul;
}
if (!(Platform->CPU.Features & CPUID_FEATURE_MSR)) {
verbose ("Unsupported CPU: P-States will not be generated !!!\n");
return (void *)0ul;
}
if (dsdt == (void *)0ul) {
verbose ("DSDT not found: P-States will not be generated !!!\n");
return (void *)0ul;
}
if (generate_cpu_map_from_acpi(dsdt) == 0 )
{
struct p_state /*initial,*/ maximum, minimum, p_states[32];
U8 p_states_count = 0;
// Retrieving P-States, ported from code by superhai (c)
switch (Platform->CPU.Family) {
case 0x06:
{
switch (Platform->CPU.Model)
{
case CPUID_MODEL_DOTHAN:
case CPUID_MODEL_YONAH: // Yonah
case CPUID_MODEL_MEROM: // Merom
case CPUID_MODEL_PENRYN: // Penryn
case CPUID_MODEL_ATOM: // Intel Atom (45nm)
{
bool cpu_dynamic_fsb = false;
if (rdmsr64(MSR_IA32_EXT_CONFIG) & (1 << 27))
{
wrmsr64(MSR_IA32_EXT_CONFIG, (rdmsr64(MSR_IA32_EXT_CONFIG) | (1 << 28)));
delay(1);
cpu_dynamic_fsb = rdmsr64(MSR_IA32_EXT_CONFIG) & (1 << 28);
}
bool cpu_noninteger_bus_ratio = (rdmsr64(MSR_IA32_PERF_STATUS) & (1ULL << 46));
initial.Control = rdmsr64(MSR_IA32_PERF_STATUS);
maximum.Control = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 32) & 0x1F3F) | (0x4000 * cpu_noninteger_bus_ratio);
maximum.CID = ((maximum.FID & 0x1F) << 1) | cpu_noninteger_bus_ratio;
minimum.FID = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 24) & 0x1F) | (0x80 * cpu_dynamic_fsb);
minimum.VID = ((rdmsr64(MSR_IA32_PERF_STATUS) >> 48) & 0x3F);
if (minimum.FID == 0)
{
U64 msr;
U8 i;
// Probe for lowest fid
for (i = maximum.FID; i >= 0x6; i--)
{
msr = rdmsr64(MSR_IA32_PERF_CONTROL);
wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (i << 8) | minimum.VID);
intel_waitforsts();
minimum.FID = (rdmsr64(MSR_IA32_PERF_STATUS) >> 8) & 0x1F;
delay(1);
}
msr = rdmsr64(MSR_IA32_PERF_CONTROL);
wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (maximum.FID << 8) | maximum.VID);
intel_waitforsts();
}
if (minimum.VID == maximum.VID)
{
U64 msr;
U8 i;
// Probe for lowest vid
for (i = maximum.VID; i > 0xA; i--)
{
msr = rdmsr64(MSR_IA32_PERF_CONTROL);
wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (minimum.FID << 8) | i);
intel_waitforsts();
minimum.VID = rdmsr64(MSR_IA32_PERF_STATUS) & 0x3F;
delay(1);
}
msr = rdmsr64(MSR_IA32_PERF_CONTROL);
wrmsr64(MSR_IA32_PERF_CONTROL, (msr & 0xFFFFFFFFFFFF0000ULL) | (maximum.FID << 8) | maximum.VID);
intel_waitforsts();
}
minimum.CID = ((minimum.FID & 0x1F) << 1) >> cpu_dynamic_fsb;
// Sanity check
if (maximum.CID < minimum.CID)
{
DBG("Insane FID values!");
p_states_count = 0;
}
else
{
// Finalize P-States
// Find how many P-States machine supports
p_states_count = maximum.CID - minimum.CID + 1;
if (p_states_count > 32) // MAX_PSTATES ??
p_states_count = 32; // MAX_PSTATES ??
U8 vidstep;
U8 i = 0, u, invalid = 0;
vidstep = ((maximum.VID << 2) - (minimum.VID << 2)) / (p_states_count - 1);
for (u = 0; u < p_states_count; u++)
{
i = u - invalid;
p_states[i].CID = maximum.CID - u;
p_states[i].FID = (p_states[i].CID >> 1);
if (p_states[i].FID < 0x6)
{
if (cpu_dynamic_fsb)
p_states[i].FID = (p_states[i].FID << 1) | 0x80;
}
else if (cpu_noninteger_bus_ratio)
{
p_states[i].FID = p_states[i].FID | (0x40 * (p_states[i].CID & 0x1));
}
if (i && p_states[i].FID == p_states[i-1].FID)
invalid++;
p_states[i].VID = ((maximum.VID << 2) - (vidstep * u)) >> 2;
U32 multiplier = p_states[i].FID & 0x1f;// = 0x08
bool half = p_states[i].FID & 0x40;// = 0x01
bool dfsb = p_states[i].FID & 0x80;// = 0x00
U32 fsb = Platform->CPU.FSBFrequency / 1000000; // = 400
U32 halffsb = (fsb + 1) >> 1;// = 200
U32 frequency = (multiplier * fsb);// = 3200
p_states[i].Frequency = (frequency + (half * halffsb)) >> dfsb;// = 3200 + 200 = 3400
}
p_states_count -= invalid;
}
break;
}
case CPUID_MODEL_FIELDS:
case CPUID_MODEL_DALES:
case CPUID_MODEL_DALES_32NM:
case CPUID_MODEL_NEHALEM:
case CPUID_MODEL_NEHALEM_EX:
case CPUID_MODEL_WESTMERE:
case CPUID_MODEL_WESTMERE_EX:
case CPUID_MODEL_SANDYBRIDGE:
case CPUID_MODEL_JAKETOWN:
{
maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)...
minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff;
verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control);
// Sanity check
if (maximum.Control < minimum.Control)
{
DBG("Insane control values!");
p_states_count = 0;
}
else
{
U8 i;
p_states_count = 0;
for (i = maximum.Control; i >= minimum.Control; i--)
{
p_states[p_states_count].Control = i;
p_states[p_states_count].CID = p_states[p_states_count].Control << 1;
p_states[p_states_count].Frequency = (Platform->CPU.FSBFrequency / 1000000) * i;
p_states_count++;
if (p_states_count >= 32) {
if (p_states_count > 32) // MAX_PSTATES ??
p_states_count = 32; // MAX_PSTATES ??
break;
}
}
}
break;
}
default:
verbose ("Unsupported CPU: P-States will not be generated !!!\n");
break;
}
}
default:
break;
}
// Generating SSDT
if (p_states_count)
{
unsigned int i;
struct aml_chunk* root = aml_create_node(NULL);
aml_add_buffer(root, ssdt_header, sizeof(ssdt_header)); // SSDT header
struct aml_chunk* scop;
if (cpuNamespace == CPU_NAMESPACE_PR)
scop = aml_add_scope(root, "\\_PR_");
else if (cpuNamespace == CPU_NAMESPACE_SB)
scop = aml_add_scope(root, "\\_SB_");
else
{
aml_destroy_node(root);
goto out;
}
struct aml_chunk* name = aml_add_name(scop, "PSS_");
struct aml_chunk* pack = aml_add_package(name);
U8 minPSratio = (p_states[p_states_count-1].Frequency / (Platform->CPU.FSBFrequency / 10000000 ));
U8 maxPSratio = (p_states[0].Frequency / (Platform->CPU.FSBFrequency / 10000000 ));
U8 cpu_div = Platform->CPU.CurrDiv;
U8 cpu_ratio = 0;
if (cpu_div)
cpu_ratio = (Platform->CPU.CurrCoef * 10) + 5;
else
cpu_ratio = Platform->CPU.CurrCoef * 10;
int user_max_ratio = 0;
getIntForKey(kMaxRatio, &user_max_ratio, &bootInfo->bootConfig);
if (user_max_ratio >= minPSratio && maxPSratio >= user_max_ratio) {
U8 maxcurrdiv = 0, maxcurrcoef = (int)(user_max_ratio / 10);
U8 maxdiv = user_max_ratio - (maxcurrcoef * 10);
if (maxdiv > 0)
maxcurrdiv = 1;
if (maxcurrdiv)
cpu_ratio = (maxcurrcoef * 10) + 5;
else
cpu_ratio = maxcurrcoef * 10;
}
int user_min_ratio = 0;
getIntForKey(kMinRatio, &user_min_ratio, &bootInfo->bootConfig);
if (user_min_ratio >= minPSratio && cpu_ratio >= user_min_ratio) {
U8 mincurrdiv = 0, mincurrcoef = (int)(user_min_ratio / 10);
U8 mindiv = user_min_ratio - (mincurrcoef * 10);
if (mindiv > 0)
mincurrdiv = 1;
if (mincurrdiv)
minPSratio = (mincurrcoef * 10) + 5;
else
minPSratio = mincurrcoef * 10;
}
if (maxPSratio >= cpu_ratio && cpu_ratio >= minPSratio)maxPSratio = cpu_ratio;
TagPtr personality = XMLCastDict(XMLGetProperty(bootInfo->bootConfig.dictionary, (const char*)"P-States"));
char* MatchStat = 0;
int dropPSS = 0, Pstatus = 0, base = 16;
int expert = 0;/* Default: 0 , mean mixed mode | expert mode : 1 , mean add only p-states found in boot.plist*/
char *tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Mode"));
if (strcmp(tmpstr,"Expert") == 0) {
p_states_count = XMLTagCount(personality) - 1 ; // - 1 = - ("Mode" tag)
expert = 1;
}
if ((tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Base")))) {
if (expert) p_states_count--; // -= ("Base" tag)
int mybase = strtol(tmpstr, NULL, 10);
if (mybase == 8 || mybase == 10 || mybase == 16 )
base = mybase;
}
for (i = 0; i < p_states_count; i++)
{
sprintf(MatchStat, "%d",i);
TagPtr match_Status = XMLGetProperty(personality, (const char*)MatchStat);
char *Lat1 = NULL, *clk = NULL, *Pw = NULL, *Lat2 = NULL, *Ctrl = NULL ;
if (match_Status) {
clk = XMLCastString(XMLGetProperty(match_Status, (const char*)"CoreFreq"));
Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power"));
Lat1 = XMLCastString(XMLGetProperty(match_Status, (const char*)"Transition Latency"));
Lat2 = XMLCastString(XMLGetProperty(match_Status, (const char*)"Bus Master Latency"));
Ctrl = XMLCastString(XMLGetProperty(match_Status, (const char*)"Control"));
} else if (expert)
continue;
unsigned long Frequency = 0x00000000;
if (!expert) Frequency = p_states[i].Frequency;
if (clk)
Frequency = strtoul((const char *)clk, NULL,base);
if (!Frequency || Frequency > p_states[0].Frequency ) continue;
U8 curr_ratio = (Frequency / (Platform->CPU.FSBFrequency / 10000000 ));
if (curr_ratio > maxPSratio || minPSratio > curr_ratio)
goto dropPstate;
struct aml_chunk* pstt = aml_add_package(pack);
aml_add_dword(pstt, Frequency); // CoreFreq (in MHz).
aml_add_dword(pstt, resolve_pss(0x00000000, Pw, base)); // Power (in milliWatts)
aml_add_dword(pstt, resolve_pss(0x0000000A, Lat1, base)); // Transition Latency (in microseconds).
aml_add_dword(pstt, resolve_pss(0x0000000A, Lat2, base)); // Bus Master Latency (in microseconds).
unsigned long Control = 0x00000000;
if (!expert) Control = p_states[i].Control;
aml_add_dword(pstt, resolve_pss(Control, Ctrl, base)); // Control
Pstatus++;
aml_add_dword(pstt, Pstatus); // Status
continue;
dropPstate:
DBG("state with cpu frequency :%d and ratio :%d will be dropped\n",p_states[i].Frequency,curr_ratio);
dropPSS++;
}
// Add aliaces
for (i = 0; i < cpu_map_count; i++)
{
char name[9];
U32 nseg = *(U32*)cpu_map[i].nameseg;
if (cpuNamespace == CPU_NAMESPACE_PR) {
sprintf(name, "_PR_%c%c%c%c",
(int)(nseg & 0x000000ff),
(int)((nseg & 0x0000ff00) >> 8),
(int)((nseg & 0x00ff0000) >> 16),
(int)(nseg >> 24));
} else if (cpuNamespace == CPU_NAMESPACE_SB) {
sprintf(name, "_SB_%c%c%c%c",
(int)(nseg & 0x000000ff),
(int)((nseg & 0x0000ff00) >> 8),
(int)((nseg & 0x00ff0000) >> 16),
(int)(nseg >> 24));
} else {
aml_destroy_node(root);
goto out;
}
scop = aml_add_scope(root, name);
aml_add_alias(scop, "PSS_", "_PSS");
}
aml_calculate_size(root);
ACPI_TABLE_SSDT *ssdt = (ACPI_TABLE_SSDT *)AllocateKernelMemory(root->Size);
aml_write_node(root, (void*)ssdt, 0);
ssdt->Header.Length = root->Size;
SetChecksum(&ssdt->Header);
aml_destroy_node(root);
verbose ("SSDT with CPU P-States generated successfully");
if (dropPSS)
verbose(", %d P-state(s) dropped",dropPSS);
verbose("\n");
return ssdt;
}
}
else
{
out:
verbose("ACPI CPUs not found: P-States will not be generated !!!\n");
}
return (void *)0ul;
}
#else
static bool is_sandybridge(void)
{
return Platform->CPU.Model == CPUID_MODEL_SANDYBRIDGE;
{
return (is_jaketown() || is_sandybridge()) ? 100 : 133;
}
/*
//-----------------------------------------------------------------------------
static U32 computePstateRatio(const U32 max, const U32 min, const U32 turboEnabled, const U32 numStates, const U32 pstate)
{
numStates = (pssLimit < maxStates) ? pssLimit : maxStates;
return (numStates < 2) ? 0 : numStates;
}
*/
#if BUILD_ACPI_TSS || pstate_power_support
static U64 divU64byU64(U64 n, U64 d, U64 * rem)
{
}
}
#endif
#endif // BUILD_ACPI_TSS || pstate_power_support
#if pstate_power_support
static U64 mulU64byU64(U64 a, U64 b, U64 * high)
return ((ratio_factor * ratio_factor * ratio_factor * Core_TDP) / PRECISION_FACTOR_CUBED) + Uncore_TDP;
}
}
#endif
#endif // pstate_power_support
static U32 encode_pstate(U32 ratio)
{
return (1);
}
#else
/*
//-----------------------------------------------------------------------------
static U32 BuildCoreIPstateInfo(CPU_DETAILS * cpu)
{
return (1);
}
*/
//-----------------------------------------------------------------------------
static U32 BuildPstateInfo(CPU_DETAILS * cpu)
{
case CPUID_MODEL_SANDYBRIDGE:
case CPUID_MODEL_JAKETOWN:
{
/*
maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)...
minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff;
verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control);
// Sanity check
if (maximum.Control < minimum.Control)
{
DBG("Insane control values!");
p_states_count = 0;
}
else
{
U8 i;
p_states_count = 0;
for (i = maximum.Control; i >= minimum.Control; i--)
{
p_states[p_states_count].Control = i;
p_states[p_states_count].CID = p_states[p_states_count].Control << 1;
p_states[p_states_count].Frequency = (Platform->CPU.FSBFrequency / 1000000) * i;
p_states_count++;
if (p_states_count >= MAX_PSTATES) { // was 32
if (p_states_count > MAX_PSTATES) // was 32
p_states_count = MAX_PSTATES; // was 32
break;
}
}
}
*/
maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Seems it always contains maximum multiplier value (with turbo, that's we need)...
minimum.Control = (rdmsr64(MSR_PLATFORM_INFO) >> 40) & 0xff;
verbose("P-States: min 0x%x, max 0x%x\n", minimum.Control, maximum.Control);
// Sanity check
if (maximum.Control < minimum.Control)
{
DBG("Insane control values!");
p_states_count = 0;
}
else
{
U8 i;
p_states_count = 0;
for (i = maximum.Control; i >= minimum.Control; i--)
{
p_states[p_states_count].Control = i;
p_states[p_states_count].CID = p_states[p_states_count].Control << 1;
p_states[p_states_count].Frequency = (Platform->CPU.FSBFrequency / 1000000) * i;
p_states_count++;
if (p_states_count >= MAX_PSTATES) { // was 32
if (p_states_count > MAX_PSTATES) // was 32
p_states_count = MAX_PSTATES; // was 32
break;
}
}
}
/*
U32 sta = BuildCoreIPstateInfo(cpu);
if (sta)
{
verbose("CoreI _PSS Generation failed !!\n");
return (0);
}
*/
break;
}
default:
DBG("_PSS PGK generated successfully\n");
return (1);
}
#endif
#endif // BETA
//-----------------------------------------------------------------------------
static U32 BuildCstateInfo(CPU_DETAILS * cpu, U32 pmbase)
}
return (1);
}
#endif
#endif // BUILD_ACPI_TSS
//-----------------------------------------------------------------------------
U32 ProcessMadt(ACPI_TABLE_MADT * madt, MADT_INFO * madt_info, void * buffer, U32 bufferSize, U32 nb_cpu)
return(current);
}
#endif
#endif // BUILD_ACPI_CSD
#if BUILD_ACPI_TSS
//-----------------------------------------------------------------------------
return(current);
}
#endif
#endif // BUILD_ACPI_TSS
//-----------------------------------------------------------------------------
static U32 BuildSsdt(MADT_INFO * madt_info, ACPI_TABLE_DSDT *dsdt, void * buffer, U32 bufferSize, bool enable_cstates, bool enable_pstates, bool enable_tstates)
return(1);
}
#endif
#if UNUSED
static ACPI_TABLE_FACS* generate_facs(bool updatefacs )
bool update_acpi=false, gen_xsdt=false;
bool gen_csta=false, gen_psta=false, speed_step=false;
#if !OLD_SSDT
bool gen_ssdt=false; // will force to generate ssdt even if gen_csta and gen_psta = false
bool gen_tsta=false;
#endif
bool oem_dsdt=false, oem_fadt=false;
// Find original rsdp
gen_csta=getBoolForKey(kGenerateCStates, &tmpval, &bootInfo->bootConfig)&&tmpval;
gen_psta=getBoolForKey(kGeneratePStates, &tmpval, &bootInfo->bootConfig)&&tmpval;
#if !OLD_SSDT
gen_ssdt=getBoolForKey(KForceSSDT, &tmpval, &bootInfo->bootConfig)&&tmpval;
#endif
update_acpi=getBoolForKey(kUpdateACPI, &tmpval, &bootInfo->bootConfig)&&tmpval;
speed_step=getBoolForKey(kSpeedstep, &tmpval, &bootInfo->bootConfig)&&tmpval;
#if !OLD_SSDT
turbo_enabled=(U32)getBoolForKey(kCoreTurbo, &tmpval, &bootInfo->bootConfig)&&tmpval;
#endif
#if BUILD_ACPI_TSS
gen_tsta=(U32)getBoolForKey(kGenerateTStates, &tmpval, &bootInfo->bootConfig)&&tmpval;
#endif
DsdtPtr = ((fadt_mod->Header.Revision >= 3) && (fadt_mod->XDsdt != 0)) ? (ACPI_TABLE_DSDT*)((U32)fadt_mod->XDsdt)
:(ACPI_TABLE_DSDT*)fadt_mod->Dsdt;
}
#if OLD_SSDT
if (get_needed_symbols())
{
if (speed_step || gen_csta || gen_psta)
{
U8 empty = get_0ul_index_in_list(new_table_list, true);
// Generate _CST SSDT
if ( speed_step || gen_csta)
{
if (empty != ACPI_TABLE_LIST_FULL)
{
if (new_table_list[empty] =(U32)generate_cst_ssdt(fadt_mod))
{
if (speed_step || gen_psta)
empty = get_0ul_index_in_list(new_table_list,true);
}
}
else
{
printf("Error: not enought reserved space in the new acpi list for the _CST SSDT table,\n ");
printf(" please increase the RESERVED_AERA\n");
}
}
// Generating _PSS SSDT
if (speed_step || gen_psta)
{
if (empty != ACPI_TABLE_LIST_FULL)
{
new_table_list[empty] =(U32)generate_pss_ssdt(DsdtPtr);
}
else
{
printf("Error: not enought reserved space in the new acpi list for the _PSS SSDT table,\n ");
printf(" please increase the RESERVED_AERA\n");
}
}
}
}
#else
{
MADT_INFO madt_info;
bool strip_madt = true;
ProcessSsdt(new_table_list, DsdtPtr, &madt_info, gen_csta, gen_psta, gen_tsta );
}
}
#endif
if ((rsdp_mod != (void *)0ul) && (rsdp_mod->Length >= ACPI_RSDP_REV0_SIZE) )
{
branches/cparm/i386/modules/ACPICodec/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/modules/HelloWorld/Makefile
2323
2424
2525
26
26
2727
2828
2929
30
30
3131
3232
3333
OPTIM = -Os -Oz
DEBUG = -DNOTHING
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fstack-protector-all \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT $(DEBUG) \
-fno-builtin $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common
DEFINES=
branches/cparm/i386/libsa/libsa.h
3434
3535
3636
37
3738
39
40
41
42
43
44
45
46
47
3848
3949
4050
41
42
43
44
51
52
53
54
55
56
57
58
4559
46
47
48
49
60
61
62
5063
51
52
53
54
64
65
5566
56
57
58
59
67
68
6069
61
62
63
64
70
71
72
73
6574
66
67
68
69
75
76
7077
71
72
73
74
78
79
80
7581
76
77
78
79
80
82
83
8184
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
85
86
10687
107
10888
89
90
91
92
10993
110
94
95
11196
97
98
99
100
101
112102
113
114
115
116103
117
118104
119105
106
120107
121
122
123
124
125
126
127
128108
129109
130110
......
136116
137117
138118
119
139120
140121
141122
#if 0
#include "C_Exception.h"
#endif
#include "quad.h"
/*
* This macro casts away the qualifier from the variable
*
* Note: use at your own risk, removing qualifiers can result in
* catastrophic run-time failures.
*/
#ifndef __CAST_AWAY_QUALIFIER
#define __CAST_AWAY_QUALIFIER(variable, qualifier, type) (type) (long)(variable)
#endif
/*
* ctype stuff (aserebln)
*/
static inline int isupper(char c)
{
return (c >= 'A' && c <= 'Z');
}
#define isupper(c) (c >= 'A' && c <= 'Z')
#define islower(c) (c >= 'a' && c <= 'z')
#define isalpha(c) ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))
#define isascii(c) ((c >= 0x20) && (c < 0x7f))
#define isspace(c) (c == ' ' || c == '\t' || c == '\n' || c == '\12')
#define isdigit(c) (c >= '0' && c <= '9')
#define isxdigit(c) ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
#define ispunct(c) (c == '.' || c == '-') //Azi: TODO - add more ponctuation characters as needed; at least these two, i need for PartNo.
static inline int islower(char c)
{
return (c >= 'a' && c <= 'z');
}
/*
* string.c
*/
static inline int isalpha(char c)
{
return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
}
extern char * strbreak(const char *str, char **next, long *len);
extern int ptol(const char * str);
static inline int isascii(char c)
{
return ( (c >= 0x20) && (c < 0x7f) );
}
extern voidbcopy(const void *, void *, size_t);
extern voidbzero(void *, size_t);
static inline int isspace(char c)
{
return (c == ' ' || c == '\t' || c == '\n' || c == '\12');
}
extern void*memcpy(void *, const void *, size_t);
extern intmemcmp(const void *, const void *, size_t);
extern void*memmove(void *, const void *, size_t);
extern void*memset(void *, int, size_t);
static inline int isdigit(char c)
{
return (c >= '0' && c <= '9');
}
extern size_tstrlen(const char *);
extern size_tstrnlen(const char *, size_t);
static inline int isxdigit(char c)
{
return ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'));
}
/* strcpy() is being deprecated. Please use strlcpy() instead. */
extern char*strcpy(char *, const char *);
extern char*strncpy(char *, const char *, size_t);
//Azi: TODO - add more ponctuation characters as needed; at least these two, i need for PartNo.
static inline int ispunct(char c)
{
return (c == '.' || c == '-');
}
extern size_tstrlcat(char *, const char *, size_t);
extern size_tstrlcpy(char *, const char *, size_t);
/*
* string.c
*/
#ifndef bcopy
extern void bcopy(const void * src, void * dst, size_t len);
#endif
#ifndef bzero
extern void bzero(void * dst, size_t len);
#endif
extern void * memset(void * dst, int c, size_t n);
extern void * memcpy(void * dst, const void * src, size_t len);
extern int memcmp(const void * p1, const void * p2, int len);
extern int strcmp(const char * s1, const char * s2);
extern int strncmp(const char * s1, const char * s2, size_t n);
extern char * strcpy(char * s1, const char * s2);
extern char * strncpy(char * s1, const char * s2, size_t n);
extern char * strlcpy(char * s1, const char * s2, size_t n);
extern char * strstr(const char *in, const char *str);
extern int atoi(const char * str);
extern int ptol(const char * str);
extern int strlen(const char * str);
extern char * strcat(char * s1, const char * s2);
/* strcat() is being deprecated. Please use strlcat() instead. */
extern char*strcat(char *, const char *);
extern char * strncat(char * s1, const char * s2, size_t n);
extern char * strdup(const char *s1);
/* strcmp() is being deprecated. Please use strncmp() instead. */
extern intstrcmp(const char *, const char *);
extern intstrncmp(const char *,const char *, size_t);
#if STRNCASECMP
extern int strncasecmp(const char * s1, const char * s2, size_t n);
extern intstrcasecmp(const char *s1, const char *s2);
extern intstrncasecmp(const char *s1, const char *s2, size_t n);
#endif
extern char*strdup(const char *);
extern char*strchr(const char *s, int c);
extern int atoi(const char *);
extern char *itoa(int,char*);
extern const char *strstr(const char *, const char *);
extern char * strchr(const char *str, int c);
extern char * strbreak(const char *str, char **next, long *len);
extern uint8_t checksum8( void * start, unsigned int length );
extern unsigned long
adler32( unsigned char * buffer, long length );
/*
* error.c
*/
extern int errno;
#if UNUSED
extern char * strerror(int errnum);
#endif
/*
* strtol.c
*/
extern long strtol(const char * nptr, char ** endptr, int base);
*/
extern void prf(const char * fmt, va_list ap, void (*putfn_p)(),
void * putfn_arg);
extern int prf_fmt_str_len(const char * fmt, va_list ap);
/*
* printf.c
branches/cparm/i386/libsa/quad.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*-
* Copyright (c) 1992, 1993
*The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*This product includes software developed by the University of
*California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*@(#)quad.h8.1 (Berkeley) 6/4/93
* $FreeBSD: src/sys/libkern/quad.h,v 1.9 1999/08/28 00:46:36 peter Exp $
*/
/*
* Quad arithmetic.
*
* This library makes the following assumptions:
*
* - The type long long (aka quad_t) exists.
*
* - A quad variable is exactly twice as long as `long'.
*
* - The machine's arithmetic is two's complement.
*
* This library can provide 128-bit arithmetic on a machine with 128-bit
* quads and 64-bit longs, for instance, or 96-bit arithmetic on machines
* with 48-bit longs.
*/
#include <sys/cdefs.h>
#include <sys/types.h>
#include <limits.h>
/*
* Depending on the desired operation, we view a `long long' (aka quad_t) in
* one or more of the following formats.
*/
union uu {
quad_tq;/* as a (signed) quad */
quad_tuq;/* as an unsigned quad */
longsl[2];/* as two signed longs */
u_longul[2];/* as two unsigned longs */
};
/*
* Define high and low longwords.
*/
#defineHi_QUAD_HIGHWORD
#defineLo_QUAD_LOWWORD
/*
* Total number of bits in a quad_t and in the pieces that make it up.
* These are used for shifting, and also below for halfword extraction
* and assembly.
*/
#defineQUAD_BITS(sizeof(quad_t) * CHAR_BIT)
#defineLONG_BITS(sizeof(long) * CHAR_BIT)
#defineHALF_BITS(sizeof(long) * CHAR_BIT / 2)
/*
* Extract high and low shortwords from longword, and move low shortword of
* longword to upper half of long, i.e., produce the upper longword of
* ((quad_t)(x) << (number_of_bits_in_long/2)). (`x' must actually be u_long.)
*
* These are used in the multiply code, to split a longword into upper
* and lower halves, and to reassemble a product as a quad_t, shifted left
* (sizeof(long)*CHAR_BIT/2).
*/
#defineHHALF(x)((x) >> HALF_BITS)
#defineLHALF(x)((x) & ((1 << HALF_BITS) - 1))
#defineLHUP(x)((x) << HALF_BITS)
quad_t__divdi3 __P((quad_t a, quad_t b));
quad_t__moddi3 __P((quad_t a, quad_t b));
u_quad_t__qdivrem __P((u_quad_t u, u_quad_t v, u_quad_t *rem));
u_quad_t__udivdi3 __P((u_quad_t a, u_quad_t b));
u_quad_t__umoddi3 __P((u_quad_t a, u_quad_t b));
/*
* XXX
* Compensate for gcc 1 vs gcc 2. Gcc 1 defines ?sh?di3's second argument
* as u_quad_t, while gcc 2 correctly uses int. Unfortunately, we still use
* both compilers.
*/
#if __GNUC__ >= 2
typedef unsigned intqshift_t;
#else
typedef u_quad_tqshift_t;
#endif
branches/cparm/i386/libsa/bzero.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ 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,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
#include <architecture/i386/asm_help.h>
/*
* void *memset(void * addr, int pattern, size_t length)
*/
LABEL(_memset)
pushl%edi
movl4+ 4(%esp),%edi/* addr */
movb4+ 8(%esp),%al/* pattern */
movl4+ 12(%esp),%edx/* length */
movb%al,%ah
movw%ax,%cx
shll$16,%eax
movw%cx,%ax
cld
/* zero longs */
movl%edx,%ecx
shrl$2,%ecx
rep
stosl
/* zero bytes */
movl%edx,%ecx
andl$3,%ecx
rep
stosb
movl4+ 4(%esp),%eax/* returns its first argument */
popl%edi
ret
/*
* void bzero(char * addr, size_t length)
*/
LABEL(_bzero)
pushl%edi
movl4+ 4(%esp),%edi/* addr */
movl4+ 8(%esp),%edx/* length */
xorl%eax,%eax
cld
/* zero longs */
movl%edx,%ecx
shrl$2,%ecx
rep
stosl
/* zero bytes */
movl%edx,%ecx
andl$3,%ecx
rep
stosb
popl%edi
ret
branches/cparm/i386/libsa/umoddi3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*-
* Copyright (c) 1992, 1993
*The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*This product includes software developed by the University of
*California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/libkern/umoddi3.c,v 1.6 1999/08/28 00:46:39 peter Exp $
*/
#include "quad.h"
/*
* Return remainder after dividing two unsigned quads.
*/
u_quad_t
__umoddi3(a, b)
u_quad_t a, b;
{
u_quad_t r;
(void)__qdivrem(a, b, &r);
return (r);
}
branches/cparm/i386/libsa/string.c
2525
2626
2727
28
29
30
31
32
33
28
29
3430
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
5831
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
32
33
34
35
36
37
38
39
40
41
42
43
7744
78
79
80
81
45
46
47
48
8249
83
84
85
86
87
88
89
90
91
92
50
51
52
53
54
55
56
57
58
59
60
61
9362
9463
95
96
97
98
99
100
101
102
103
104
105
106
107
108
10964
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
65
66
67
68
69
12570
126
127
128
129
130
131
132
133
134
135
136
137
138
139
14071
141
72
73
74
75
14276
143
144
145
146
147
148
149
150
151
152
153
154
155
77
78
79
80
81
82
83
84
85
86
87
88
15689
157
90
91
15892
15993
160
161
162
163
164
165
166
167
16894
95
96
97
98
99
100
101
102
169103
170
104
105
106
171107
172
173
108
109
110
174111
112
175113
176114
177115
116
117
118
119
120
121
122
123
124
178125
179
126
127
128
129
180130
181
182
183
184
131
132
133
134
135
136
137
138
139
140
185141
186142
187
188
143
144
145
146
147
148
149
189150
190
191
192
193
194
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
195172
196173
197
174
175
176
177
178
179
198180
199181
200182
201183
202
184
203185
204186
205
206
187
188
207189
208190
209191
210
192
211193
212194
213195
214196
215197
216198
217
218
199
200
219201
220202
221203
222204
223205
224206
225
207
226208
227209
228210
......
231213
232214
233215
216
217
218
219
220
221
222
223
224
234225
235
226
236227
237
238
239
240
241
242
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
243257
244
258
259
260
261
262
263
264
265
266
267
268
269
270
245271
246272
247
273
274
275
276
277
278
279
280
281
248282
249
250
251
252
253
254
255
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
256306
257307
258
308
309
310
311
312
313
259314
260
315
316
317
318
319
320
321
322
323
324
325
326
327
261328
262329
263
330
331
264332
265
333
334
335
336
337
338
339
340
266341
267342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
268424
269425
270
271
426
427
428
429
430
431
432
433
434
435
436
272437
273
438
439
274440
275
276
277
278
279
441
442
443
444
445
446
447
280448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
281466
282467
283
468
469
470
471
472
284473
285
286
287
288
289
290
291
292
293
294
474
475
476
477
478
479
480
295481
296482
297483
......
335521
336522
337523
338
524
339525
340526
341
527
342528
343529
344530
......
383569
384570
385571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
386622
#include "libsa.h"
void * memset(void * dst, int val, size_t len)
{
asm volatile ( "rep; stosb"
: "=c" (len), "=D" (dst)
: "0" (len), "1" (dst), "a" (val)
: "memory" );
static int _mach_strlen(const char *str);
static char *STRDUP(const char *string);
return dst;
}
#if 0
void * memcpy(void * dst, const void * src, size_t len)
{
asm volatile ( "rep; movsb"
: "=c" (len), "=D" (dst), "=S" (src)
: "0" (len), "1" (dst), "2" (src)
: "memory" );
return dst;
}
void bcopy(const void * src, void * dst, size_t len)
{
memcpy(dst, src, len);
}
void bzero(void * dst, size_t len)
{
memset(dst, 0, len);
}
/*
void __bzero(void * dst, size_t len)
{
memset(dst, 0, len);
}
*/
#else
void * memcpy(void * dst, const void * src, size_t len)
{
asm volatile ( "cld \n\t"
"movl %%ecx, %%edx \n\t"
"shrl $2, %%ecx \n\t"
"rep; movsl \n\t"
"movl %%edx, %%ecx \n\t"
"andl $3, %%ecx \n\t"
"rep; movsb \n\t"
: "=D" (dst)
: "c" (len), "D" (dst), "S" (src)
: "memory", "%edx" );
* Abstract:
* strcmp (s1, s2) compares the strings "s1" and "s2".
* It returns 0 if the strings are identical. It returns
* > 0 if the first character that differs in the two strings
* is larger in s1 than in s2 or if s1 is longer than s2 and
* the contents are identical up to the length of s2.
* It returns < 0 if the first differing character is smaller
* in s1 than in s2 or if s1 is shorter than s2 and the
* contents are identical upto the length of s1.
* Deprecation Warning:
*strcmp() is being deprecated. Please use strncmp() instead.
*/
return dst;
}
void bcopy(const void * src, void * dst, size_t len)
int
strcmp(
const char *s1,
const char *s2)
{
asm volatile ( "cld \n\t"
"movl %%ecx, %%edx \n\t"
"shrl $2, %%ecx \n\t"
"rep; movsl \n\t"
"movl %%edx, %%ecx \n\t"
"andl $3, %%ecx \n\t"
"rep; movsb \n\t"
:
: "c" (len), "D" (dst), "S" (src)
: "memory", "%edx" );
unsigned int a, b;
do {
a = *s1++;
b = *s2++;
if (a != b)
return a-b; /* includes case when
'a' is zero and 'b' is not zero
or vice versa */
} while (a != '\0');
return 0; /* both are zero */
}
void bzero(void * dst, size_t len)
{
asm volatile ( "xorl %%eax, %%eax \n\t"
"cld \n\t"
"movl %%ecx, %%edx \n\t"
"shrl $2, %%ecx \n\t"
"rep; stosl \n\t"
"movl %%edx, %%ecx \n\t"
"andl $3, %%ecx \n\t"
"rep; stosb \n\t"
:
: "c" (len), "D" (dst)
: "memory", "%eax" );
}
/*
void __bzero(void * dst, size_t len)
{
asm volatile ( "xorl %%eax, %%eax \n\t"
"cld \n\t"
"movl %%ecx, %%edx \n\t"
"shrl $2, %%ecx \n\t"
"rep; stosl \n\t"
"movl %%edx, %%ecx \n\t"
"andl $3, %%ecx \n\t"
"rep; stosb \n\t"
:
: "c" (len), "D" (dst)
: "memory", "%eax" );
}*/
#endif
* Abstract:
* strncmp (s1, s2, n) compares the strings "s1" and "s2"
* in exactly the same way as strcmp does. Except the
* comparison runs for at most "n" characters.
*/
/* #if DONT_USE_GCC_BUILT_IN_STRLEN */
int strlen(const char * s)
{
int n = 0;
while (*s++) n++;
return(n);
}
/*#endif*/
/* NOTE: Moved from ntfs.c */
int
memcmp(const void *p1, const void *p2, int len)
strncmp(
const char *s1,
const char *s2,
size_t n)
{
while (len--) {
if (*(const char*)(p1++) != *(const char*)(p2++))
return -1;
}
return 0;
}
int
strcmp(const char * s1, const char * s2)
{
while (*s1 && (*s1 == *s2)) {
s1++;
s2++;
unsigned int a, b;
while (n != 0) {
a = *s1++;
b = *s2++;
if (a != b)
return a-b; /* includes case when
'a' is zero and 'b' is not zero
or vice versa */
if (a == '\0')
return 0; /* both are zero */
n--;
}
return (*s1 - *s2);
return 0;
}
int strncmp(const char * s1, const char * s2, size_t len)
{
register int n = len;
while (--n >= 0 && *s1 == *s2++)
if (*s1++ == '\0')
return(0);
return(n<0 ? 0 : *s1 - *--s2);
}
/*
* Abstract:
* strcpy copies the contents of the string "from" including
* the null terminator to the string "to". A pointer to "to"
* is returned.
* Deprecation Warning:
*strcpy() is being deprecated. Please use strlcpy() instead.
*/
char *
strcpy(char * s1, const char * s2)
strcpy(
char *to,
const char *from)
{
register char *ret = s1;
while ((*s1++ = *s2++))
char *ret = to;
while ((*to++ = *from++) != '\0')
continue;
return ret;
}
/*
* Abstract:
* strncpy copies "count" characters from the "from" string to
* the "to" string. If "from" contains less than "count" characters
* "to" will be padded with null characters until exactly "count"
* characters have been written. The return value is a pointer
* to the "to" string.
*/
char *
strncpy(char * s1, const char * s2, size_t n)
strncpy(
char *s1,
const char *s2,
size_t n)
{
register char *ret = s1;
while (n && (*s1++ = *s2++))
n--;
return ret;
char *os1 = s1;
unsigned long i;
for (i = 0; i < n;)
if ((*s1++ = *s2++) == '\0')
for (i++; i < n; i++)
*s1++ = '\0';
else
i++;
return (os1);
}
char *
strlcpy(char * s1, const char * s2, size_t n)
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
size_t
strlcpy(char *dst, const char *src, size_t siz)
{
register char *ret = s1;
while (n && (*s1++ = *s2++))
n--;
if (!n) *--s1=0;
return ret;
char *d = dst;
const char *s = src;
size_t n = siz;
/* Copy as many bytes as will fit */
if (n != 0 && --n != 0) {
do {
if ((*d++ = *s++) == 0)
break;
} while (--n != 0);
}
/* Not enough room in dst, add NUL and traverse rest of src */
if (n == 0) {
if (siz != 0)
*d = '\0';/* NUL-terminate dst */
while (*s++)
;
}
return(s - src - 1);/* count does not include NUL */
}
char *
/*
* History:
* 2002-01-24 gvdlInitial implementation of strstr
*/
const char *
strstr(const char *in, const char *str)
{
char c;
size_t len;
c = *str++;
if (!c)
return (char *) in;// Trivial empty string case
return (const char *) in;// Trivial empty string case
len = strlen(str);
do {
char sc;
do {
sc = *in++;
if (!sc)
return (char *) 0;
} while (sc != c);
} while (strncmp(in, str, len) != 0);
return (char *) (in - 1);
return (const char *) (in - 1);
}
int
ptol(const char *str)
{
register int c = *str;
if (c <= '7' && c >= '0')
c -= '0';
else if (c <= 'h' && c >= 'a')
return c;
}
/*
* atoi:
*
* This function converts an ascii string into an integer.
*
* input : string
* output : a number
*/
int
atoi(const char *str)
atoi(const char *cp)
{
register int sum = 0;
while (*str == ' ' || *str == '\t')
str++;
while (*str >= '0' && *str <= '9') {
sum *= 10;
sum += *str++ - '0';
int number;
for (number = 0; ('0' <= *cp) && (*cp <= '9'); cp++)
number = (number * 10) + (*cp - '0');
return( number );
}
/*
* convert an integer to an ASCII string.
* inputs:
*numinteger to be converted
*strstring pointer.
*
* outputs:
*pointer to string start.
*/
char *
itoa(
intnum,
char*str)
{
char digits[11];
char *dp;
char *cp = str;
if (num == 0) {
*cp++ = '0';
}
return sum;
else {
dp = digits;
while (num) {
*dp++ = '0' + num % 10;
num /= 10;
}
while (dp != digits) {
*cp++ = *--dp;
}
}
*cp++ = '\0';
return str;
}
char *strncat(char *s1, const char *s2, size_t n)
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
* full size of dst, not space left). At most siz-1 characters
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
* If retval >= siz, truncation occurred.
*/
size_t
strlcat(char *dst, const char *src, size_t siz)
{
register char *ret = s1;
while (*s1)
s1++;
while (n-- && *s2)
*s1++ = *s2++;
*s1 = '\0';
return ret;
char *d = dst;
const char *s = src;
size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + strlen(s));
while (*s != '\0') {
if (n != 1) {
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src)); /* count does not include NUL */
}
char *strcat(char *s1, const char *s2)
/*
*
*/
char *
strncat(char *s1, const char *s2, unsigned long n)
{
return(strncat(s1, s2, strlen(s2)));
char *os1;
int i = n;
os1 = s1;
while (*s1++)
;
--s1;
while ((*s1++ = *s2++))
if (--i < 0) {
*--s1 = '\0';
break;
}
return(os1);
}
char *strdup(const char *s1)
static int
_mach_strlen(const char *str)
{
return strcpy(malloc(strlen(s1) + 1), s1);
const char *p;
for (p = str; p; p++) {
if (*p == '\0') {
return (p - str);
}
}
/* NOTREACHED */
return 0;
}
size_t strlen(const char * str)
{
return (size_t)_mach_strlen(str);
}
/*
* Does the same thing as strlen, except only looks up
* to max chars inside the buffer.
* Taken from archive/kern-stuff/sbf_machine.c in
* seatbelt.
* inputs:
* sstring whose length is to be measured
*maxmaximum length of string to search for null
* outputs:
*length of s or max; whichever is smaller
*/
size_t
strnlen(const char *s, size_t max) {
const char *es = s + max, *p = s;
while(*p && p != es)
p++;
return p - s;
}
/*
* Deprecation Warning:
*strcat() is being deprecated. Please use strlcat() instead.
*/
char *
strcat(
char *dest,
const char *src)
{
char *old = dest;
while (*dest)
++dest;
while ((*dest++ = *src++))
;
return (old);
}
/*
* STRDUP
*
* Description: The STRDUP function allocates sufficient memory for a copy
* of the string "string", does the copy, and returns a pointer
* it. The pointer may subsequently be used as an argument to
* the macro FREE().
*
* Parameters: stringString to be duplicated
*
* Returns: char * A pointer to the newly allocated string with
* duplicated contents in it.
*
* NULLIf MALLOC() fails.
*
*/
static char *
STRDUP(const char *string)
{
size_t len;
char *copy;
len = strlen(string) + 1;
copy = malloc(len);
if (copy == NULL)
return (NULL);
bcopy(string, copy, len);
return (copy);
}
char *strdup(const char *string)
{
if (string) {
return STRDUP(string);
}
return (NULL);
}
#if STRNCASECMP
#define tolower(c) ((int)((c) & ~0x20))
#define toupper(c) ((int)((c) | 0x20))
//
// Lame implementation just for use by strcasecmp/strncasecmp
//
static int
tolower(unsigned char ch)
{
if (ch >= 'A' && ch <= 'Z')
ch = 'a' + (ch - 'A');
return ch;
}
int strncasecmp(const char *s1, const char *s2, size_t len)
int
strcasecmp(const char *s1, const char *s2)
{
register int n = len;
while (--n >= 0 && tolower(*s1) == tolower(*s2++))
if (*s1++ == '\0')
return(0);
return(n<0 ? 0 : tolower(*s1) - tolower(*--s2));
const unsigned char *us1 = (const u_char *)s1,
*us2 = (const u_char *)s2;
while (tolower(*us1) == tolower(*us2++))
if (*us1++ == '\0')
return (0);
return (tolower(*us1) - tolower(*--us2));
}
int
strncasecmp(const char *s1, const char *s2, size_t n)
{
if (n != 0) {
const unsigned char *us1 = (const u_char *)s1,
*us2 = (const u_char *)s2;
do {
if (tolower(*us1) != tolower(*us2++))
return (tolower(*us1) - tolower(*--us2));
if (*us1++ == '\0')
break;
} while (--n != 0);
}
return (0);
}
#endif
char* strchr(const char *str, int c)
/*
*
*/
char *strchr(const char *str, int ch)
{
do
{
if(*str == c)
return (char*)str;
}
while(*(str++));
return 0;
}
do {
if (*str == ch)
return(__CAST_AWAY_QUALIFIER(str, const, char *));
} while (*str++);
return ((char *) 0);
}
char* strbreak(const char *str, char **next, long *len)
{
char *start = (char*)str, *end;
uint8_t csum = 0;
uint8_t * cp = (uint8_t *) start;
unsigned int i;
for ( i = 0; i < length; i++)
csum += *cp++;
return csum;
}
{
holdrand = holdrand * 214013L + 2531011L;
return ((holdrand >> 16) & RAND_MAX);
}
/*-
* For memcmp.
* Copyright (c) 1990, 1993
*The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Compare memory regions.
*/
int
memcmp(const void *s1, const void *s2, size_t n)
{
if (n != 0) {
const unsigned char *p1 = s1, *p2 = s2;
do {
if (*p1++ != *p2++)
return (*--p1 - *--p2);
} while (--n != 0);
}
return (0);
}
branches/cparm/i386/libsa/udivdi3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*-
* Copyright (c) 1992, 1993
*The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*This product includes software developed by the University of
*California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/libkern/udivdi3.c,v 1.6 1999/08/28 00:46:38 peter Exp $
*/
#include "quad.h"
/*
* Divide two unsigned quads.
*/
u_quad_t
__udivdi3(a, b)
u_quad_t a, b;
{
return (__qdivrem(a, b, (u_quad_t *)0));
}
branches/cparm/i386/libsa/qdivrem.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/*-
* Copyright (c) 1992, 1993
*The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*This product includes software developed by the University of
*California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/libkern/qdivrem.c,v 1.8 1999/08/28 00:46:35 peter Exp $
*/
/*
* Multiprecision divide. This algorithm is from Knuth vol. 2 (2nd ed),
* section 4.3.1, pp. 257--259.
*/
#include "quad.h"
#defineB(1 << HALF_BITS)/* digit base */
/* Combine two `digits' to make a single two-digit number. */
#defineCOMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b))
/* select a type for digits in base B: use unsigned short if they fit */
#if ULONG_MAX == 0xffffffff && USHRT_MAX >= 0xffff
typedef unsigned short digit;
#else
typedef u_long digit;
#endif
/*
* Shift p[0]..p[len] left `sh' bits, ignoring any bits that
* `fall out' the left (there never will be any such anyway).
* We may assume len >= 0. NOTE THAT THIS WRITES len+1 DIGITS.
*/
static void
shl(register digit *p, register int len, register int sh)
{
register int i;
for (i = 0; i < len; i++)
p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
p[i] = LHALF(p[i] << sh);
}
/*
* __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
*
* We do this in base 2-sup-HALF_BITS, so that all intermediate products
* fit within u_long. As a consequence, the maximum length dividend and
* divisor are 4 `digits' in this base (they are shorter if they have
* leading zeros).
*/
u_quad_t
__qdivrem(uq, vq, arq)
u_quad_t uq, vq, *arq;
{
union uu tmp;
digit *u, *v, *q;
register digit v1, v2;
u_long qhat, rhat, t;
int m, n, d, j, i;
digit uspace[5], vspace[5], qspace[5];
/*
* Take care of special cases: divide by zero, and u < v.
*/
if (vq == 0) {
/* divide by zero. */
static volatile const unsigned int zero = 0;
tmp.ul[Hi] = tmp.ul[Lo] = 1 / zero;
if (arq)
*arq = uq;
return (tmp.q);
}
if (uq < vq) {
if (arq)
*arq = uq;
return (0);
}
u = &uspace[0];
v = &vspace[0];
q = &qspace[0];
/*
* Break dividend and divisor into digits in base B, then
* count leading zeros to determine m and n. When done, we
* will have:
*u = (u[1]u[2]...u[m+n]) sub B
*v = (v[1]v[2]...v[n]) sub B
*v[1] != 0
*1 < n <= 4 (if n = 1, we use a different division algorithm)
*m >= 0 (otherwise u < v, which we already checked)
*m + n = 4
* and thus
*m = 4 - n <= 2
*/
tmp.uq = uq;
u[0] = 0;
u[1] = HHALF(tmp.ul[Hi]);
u[2] = LHALF(tmp.ul[Hi]);
u[3] = HHALF(tmp.ul[Lo]);
u[4] = LHALF(tmp.ul[Lo]);
tmp.uq = vq;
v[1] = HHALF(tmp.ul[Hi]);
v[2] = LHALF(tmp.ul[Hi]);
v[3] = HHALF(tmp.ul[Lo]);
v[4] = LHALF(tmp.ul[Lo]);
for (n = 4; v[1] == 0; v++) {
if (--n == 1) {
u_long rbj;/* r*B+u[j] (not root boy jim) */
digit q1, q2, q3, q4;
/*
* Change of plan, per exercise 16.
*r = 0;
*for j = 1..4:
*q[j] = floor((r*B + u[j]) / v),
*r = (r*B + u[j]) % v;
* We unroll this completely here.
*/
t = v[2];/* nonzero, by definition */
q1 = u[1] / t;
rbj = COMBINE(u[1] % t, u[2]);
q2 = rbj / t;
rbj = COMBINE(rbj % t, u[3]);
q3 = rbj / t;
rbj = COMBINE(rbj % t, u[4]);
q4 = rbj / t;
if (arq)
*arq = rbj % t;
tmp.ul[Hi] = COMBINE(q1, q2);
tmp.ul[Lo] = COMBINE(q3, q4);
return (tmp.q);
}
}
/*
* By adjusting q once we determine m, we can guarantee that
* there is a complete four-digit quotient at &qspace[1] when
* we finally stop.
*/
for (m = 4 - n; u[1] == 0; u++)
m--;
for (i = 4 - m; --i >= 0;)
q[i] = 0;
q += 4 - m;
/*
* Here we run Program D, translated from MIX to C and acquiring
* a few minor changes.
*
* D1: choose multiplier 1 << d to ensure v[1] >= B/2.
*/
d = 0;
for (t = v[1]; t < B / 2; t <<= 1)
d++;
if (d > 0) {
shl(&u[0], m + n, d);/* u <<= d */
shl(&v[1], n - 1, d);/* v <<= d */
}
/*
* D2: j = 0.
*/
j = 0;
v1 = v[1];/* for D3 -- note that v[1..n] are constant */
v2 = v[2];/* for D3 */
do {
register digit uj0, uj1, uj2;
/*
* D3: Calculate qhat (\^q, in TeX notation).
* Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and
* let rhat = (u[j]*B + u[j+1]) mod v[1].
* While rhat < B and v[2]*qhat > rhat*B+u[j+2],
* decrement qhat and increase rhat correspondingly.
* Note that if rhat >= B, v[2]*qhat < rhat*B.
*/
uj0 = u[j + 0];/* for D3 only -- note that u[j+...] change */
uj1 = u[j + 1];/* for D3 only */
uj2 = u[j + 2];/* for D3 only */
if (uj0 == v1) {
qhat = B;
rhat = uj1;
goto qhat_too_big;
} else {
u_long nn = COMBINE(uj0, uj1);
qhat = nn / v1;
rhat = nn % v1;
}
while (v2 * qhat > COMBINE(rhat, uj2)) {
qhat_too_big:
qhat--;
if ((rhat += v1) >= B)
break;
}
/*
* D4: Multiply and subtract.
* The variable `t' holds any borrows across the loop.
* We split this up so that we do not require v[0] = 0,
* and to eliminate a final special case.
*/
for (t = 0, i = n; i > 0; i--) {
t = u[i + j] - v[i] * qhat - t;
u[i + j] = LHALF(t);
t = (B - HHALF(t)) & (B - 1);
}
t = u[j] - t;
u[j] = LHALF(t);
/*
* D5: test remainder.
* There is a borrow if and only if HHALF(t) is nonzero;
* in that (rare) case, qhat was too large (by exactly 1).
* Fix it by adding v[1..n] to u[j..j+n].
*/
if (HHALF(t)) {
qhat--;
for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
t += u[i + j] + v[i];
u[i + j] = LHALF(t);
t = HHALF(t);
}
u[j] = LHALF(u[j] + t);
}
q[j] = qhat;
} while (++j <= m);/* D7: loop on j. */
/*
* If caller wants the remainder, we have to calculate it as
* u[m..m+n] >> d (this is at most n digits and thus fits in
* u[m+1..m+n], but we may need more source digits).
*/
if (arq) {
if (d) {
for (i = m + n; i > m; --i)
u[i] = (u[i] >> d) |
LHALF(u[i - 1] << (HALF_BITS - d));
u[i] = 0;
}
tmp.ul[Hi] = COMBINE(uspace[1], uspace[2]);
tmp.ul[Lo] = COMBINE(uspace[3], uspace[4]);
*arq = tmp.q;
}
tmp.ul[Hi] = COMBINE(qspace[1], qspace[2]);
tmp.ul[Lo] = COMBINE(qspace[3], qspace[4]);
return (tmp.q);
}
branches/cparm/i386/libsa/moddi3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*-
* Copyright (c) 1992, 1993
*The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*This product includes software developed by the University of
*California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/libkern/moddi3.c,v 1.7 1999/08/28 00:46:34 peter Exp $
*/
#include "quad.h"
/*
* Return remainder after dividing two signed quads.
*
* XXX
* If -1/2 should produce -1 on this machine, this code is wrong.
*/
quad_t
__moddi3(a, b)
quad_t a, b;
{
u_quad_t ua, ub, ur;
int neg;
if (a < 0)
ua = -(u_quad_t)a, neg = 1;
else
ua = a, neg = 0;
if (b < 0)
ub = -(u_quad_t)b;
else
ub = b;
(void)__qdivrem(ua, ub, &ur);
return (neg ? -ur : ur);
}
branches/cparm/i386/libsa/setjmp.s
2424
2525
2626
27
28
29
30
31
32
27
28
29
30
31
32
33
34
35
36
37
3338
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
39
40
41
42
43
44
45
46
47
48
49
50
#include <architecture/i386/asm_help.h>
#defineO_EDI0
#defineO_ESI4
#defineO_EBX8
#defineO_EBP12
#defineO_ESP16
#define O_EIP20
LABEL(_setjmp)
movl4(%esp),%ecx# fetch buffer
movl%ebx,0(%ecx)
movl%esi,4(%ecx)
movl%edi,8(%ecx)
movl%ebp,12(%ecx)# save frame pointer of caller
popl%edx
movl%esp,16(%ecx)# save stack pointer of caller
movl%edx,20(%ecx)# save pc of caller
xorl%eax,%eax
jmp *%edx
LEAF(_setjmp, 0)
X_LEAF(_set_label, _setjmp)
movl4(%esp), %edx // address of save area
movl%edi, O_EDI(%edx)
movl%esi, O_ESI(%edx)
movl%ebx, O_EBX(%edx)
movl%ebp, O_EBP(%edx)
movl%esp, O_ESP(%edx)
movl(%esp), %ecx // %eip (return address)
movl%ecx, O_EIP(%edx)
subl%eax, %eax // retval <- 0
ret
LEAF(_longjmp, 0)
X_LEAF(_jump_label, _longjmp)
movl4(%esp), %edx // address of save area
movlO_EDI(%edx), %edi
movlO_ESI(%edx), %esi
movlO_EBX(%edx), %ebx
movlO_EBP(%edx), %ebp
movlO_ESP(%edx), %esp
movlO_EIP(%edx), %eax // %eip (return address)
movl%eax, 0(%esp)
popl%eax // ret addr != 0
jmp *%eax // indirect
LABEL(_longjmp)
movl8(%esp),%eax# return(v)
movl4(%esp),%ecx# fetch buffer
movl0(%ecx),%ebx
movl4(%ecx),%esi
movl8(%ecx),%edi
movl12(%ecx),%ebp
movl16(%ecx),%esp
orl%eax,%eax
jnz0f
incl%eax
0:jmp*20(%ecx)# done, return....
branches/cparm/i386/libsa/divdi3.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*-
* Copyright (c) 1992, 1993
*The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*This product includes software developed by the University of
*California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/libkern/divdi3.c,v 1.6 1999/08/28 00:46:31 peter Exp $
*/
#include "quad.h"
/*
* Divide two signed quads.
* ??? if -1/2 should produce -1 on this machine, this code is wrong
*/
quad_t
__divdi3(a, b)
quad_t a, b;
{
u_quad_t ua, ub, uq;
int neg;
if (a < 0)
ua = -(u_quad_t)a, neg = 1;
else
ua = a, neg = 0;
if (b < 0)
ub = -(u_quad_t)b, neg ^= 1;
else
ub = b;
uq = __qdivrem(ua, ub, (u_quad_t *)0);
return (neg ? -uq : uq);
}
branches/cparm/i386/libsa/zalloc.c
6969
7070
7171
72
7273
7374
7475
......
99100
100101
101102
102
103
103104
104
105
105106
106107
107
108
108109
109110
110111
......
117118
118119
119120
120
121
121
122
122123
123124
124
125
125126
126127
127128
128129
129130
130
131
131132
132
133
134
135
133
134
135
136
136137
137138
138139
139140
140
141
141142
142143
143144
144
145
145
146
146147
147
148
148149
149150
150151
151
152
152153
153154
154155
......
156157
157158
158159
159
160
161
162
163
164
165
166
167
168
169
160
161
162
163
164
165
166
167
168
169
170
170171
171172
172173
......
176177
177178
178179
179
180
180181
181
182
183
184
185
186
182
183
184
185
186
187
187188
188
189
189190
190191
191
192
192193
193194
194195
195196
196
197
197
198
198199
200
199201
200
202
201203
202
203
204
205
206
204
205
206
207
208
207209
208
210
209211
210
212
211213
212
213
214
214
215
216
215217
216
218
217219
218220
219221
222
223
224
225
226
227
228
229
230
231
220232
221233
222
234
223235
224
236
225237
226
238
227239
228
229
230
231
232
240
241
242
243
244
233245
234
246
235247
236
248
237249
238
250
239251
240252
241253
......
248260
249261
250262
251
263
252264
253265
254266
255267
256268
257
269
258270
259
271
260272
261
273
262274
263
264
275
276
265277
266
278
267279
268
280
269281
270282
271283
......
275287
276288
277289
278
290
279291
280
292
281293
282294
283295
284296
285297
286
298
287299
288300
289
290
301
302
291303
292
304
293305
294
306
295307
296
308
297309
298310
299311
300312
301313
302314
303
304
305
315
316
317
306318
307
319
308320
309
321
310322
311
323
312324
313325
314326
......
325337
326338
327339
328
340
329341
330
342
331343
332
344
333345
334
346
335347
336348
337349
......
339351
340352
341353
342
354
343355
344356
345357
346
358
347359
348360
349
361
350362
351363
352364
......
355367
356368
357369
358
370
359371
360372
361
373
362374
363375
364
376
365377
366378
367379
......
369381
370382
371383
372
384
373385
374386
375387
376
388
377389
378390
379391
#else
static void * Malloc(size_t size);
#endif
static void * __malloc (size_t size);
#if ZDEBUG
size_t zalloced_size;
zalloced = (zmem *) zalloc_base;
zavailable = (zmem *) zalloc_base + sizeof(zmem) * totalNodes;
zavailable[0].start = (char *)zavailable + sizeof(zmem) * totalNodes;
if (size == 0) size = ZALLOC_LEN;
if (size == 0) size = ZALLOC_LEN;
zavailable[0].size = size - (zavailable[0].start - zalloc_base);
zalloc_end = zalloc_base + size;
zalloc_end = zalloc_base + size;
availableNodes = 1;
allocedNodes = 0;
zerror = malloc_err_fn ? malloc_err_fn : malloc_error;
zerror = malloc_err_fn ? malloc_err_fn : malloc_error;
}
#define BEST_FIT 1
{
int i;
#if BEST_FIT
int bestFit;
size_t smallestSize;
int bestFit;
size_t smallestSize;
#endif
char * ret = 0;
if ( !zalloc_base )
{
// this used to follow the bss but some bios' corrupted it...
malloc_init((char *)ZALLOC_ADDR, ZALLOC_LEN, ZALLOC_NODES, malloc_error);
}
size = ((size + 0xf) & ~0xf);
/*if (size == 0) {
if (zerror) (*zerror)((char *)0xdeadbeef, 0, file, line);
}*/
/*if (size == 0) {
if (zerror) (*zerror)((char *)0xdeadbeef, 0, file, line);
}*/
if (size == 0 && zerror)
#ifdef SAFE_MALLOC
(*zerror)((char *)0xdeadbeef, 0, file, line);
#else
(*zerror)((char *)0xdeadbeef, 0);
(*zerror)((char *)0xdeadbeef, 0);
#endif
#if BEST_FIT
smallestSize = 0;
bestFit = -1;
smallestSize = 0;
bestFit = -1;
#endif
for (i = 0; i < availableNodes; i++)
{
// find node with equal size, or if not found,
// then smallest node that fits.
// then smallest node that fits.
if ( zavailable[i].size == size )
{
zallocate(ret = zavailable[i].start, size);
goto done;
}
#if BEST_FIT
else
{
if ((zavailable[i].size > size) &&
((smallestSize == 0) ||
(zavailable[i].size < smallestSize)))
{
bestFit = i;
smallestSize = zavailable[i].size;
}
}
else
{
if ((zavailable[i].size > size) &&
((smallestSize == 0) ||
(zavailable[i].size < smallestSize)))
{
bestFit = i;
smallestSize = zavailable[i].size;
}
}
#else
else if ( zavailable[i].size > size )
{
goto done;
}
#endif
}
}
#if BEST_FIT
if (bestFit != -1)
{
zallocate(ret = zavailable[bestFit].start, size);
zavailable[bestFit].start += size;
zavailable[bestFit].size -= size;
}
if (bestFit != -1)
{
zallocate(ret = zavailable[bestFit].start, size);
zavailable[bestFit].start += size;
zavailable[bestFit].size -= size;
}
#endif
done:
#if ZDEBUG
zalloced_size += size;
zalloced_size += size;
#endif
return (void *) ret;
}
void *
malloc (size_t size)
static void *
__malloc (size_t size)
{
#ifdef SAFE_MALLOC
register void *ret = Safe_Malloc( size, __FILE__, __LINE__);
register void *ret = Safe_Malloc( size, __FILE__, __LINE__);
#else
register void *ret = Malloc (size);
#endif
if (ret == 0 || ((char *)ret + size >= zalloc_end))
{
if (zerror)
register void *ret = Malloc (size);
#endif
if (ret == 0 || ((char *)ret + size >= zalloc_end))
{
if (zerror)
#ifdef SAFE_MALLOC
(*zerror)(ret, size, __FILE__, __LINE__);
(*zerror)(ret, size, __FILE__, __LINE__);
#else
(*zerror)(ret, size);
(*zerror)(ret, size);
#endif
}
if (ret != 0)
{
}
if (ret != 0)
{
bzero(ret, size);
}
}
return ret;
}
void *
malloc (size_t size)
{
if (size > 0)
{
return __malloc(size);
}
return (void *)0;
}
void free(void * pointer)
{
unsigned long rp;
unsigned long rp;
int i, found = 0;
size_t tsize = 0;
size_t tsize = 0;
char * start = pointer;
#if i386
// Get return address of our caller,
// in case we have to report an error below.
asm volatile ("movl %%esp, %%eax\n\t"
"subl $4, %%eax\n\t"
"movl 0(%%eax), %%eax" : "=a" (rp) );
// Get return address of our caller,
// in case we have to report an error below.
asm volatile ("movl %%esp, %%eax\n\t"
"subl $4, %%eax\n\t"
"movl 0(%%eax), %%eax" : "=a" (rp) );
#else
rp = 0;
rp = 0;
#endif
if ( !start ) return;
for (i = 0; i < allocedNodes; i++)
{
if ( zalloced[i].start == start )
zdelete(zalloced, i); allocedNodes--;
found = 1;
#if ZDEBUG
memset(pointer, 0x5A, tsize);
memset(pointer, 0x5A, tsize);
#endif
break;
}
}
if ( !found ) {
if (zerror)
if (zerror)
#ifdef SAFE_MALLOC
(*zerror)(pointer, rp, "free", 0);
(*zerror)(pointer, rp, "free", 0);
#else
(*zerror)(pointer, rp);
(*zerror)(pointer, rp);
#endif
else return;
}
else return;
}
#if ZDEBUG
zalloced_size -= tsize;
zalloced_size -= tsize;
#endif
for (i = 0; i < availableNodes; i++)
{
if ((start + tsize) == zavailable[i].start) // merge it in
zcoalesce();
return;
}
if ((i > 0) &&
(zavailable[i-1].start + zavailable[i-1].size == start))
(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 (++availableNodes > totalNodes) {
if (zerror)
#ifdef SAFE_MALLOC
(*zerror)((char *)0xf000f000, 0, "free", 0);
(*zerror)((char *)0xf000f000, 0, "free", 0);
#else
(*zerror)((char *)0xf000f000, 0);
(*zerror)((char *)0xf000f000, 0);
#endif
}
}
zinsert(zavailable, i);
zavailable[i].start = start;
zavailable[i].size = tsize;
return;
}
}
if (++availableNodes > totalNodes) {
if (zerror)
if (++availableNodes > totalNodes) {
if (zerror)
#ifdef SAFE_MALLOC
(*zerror)((char *)0xf000f000, 1, "free", 0);
(*zerror)((char *)0xf000f000, 1, "free", 0);
#else
(*zerror)((char *)0xf000f000, 1);
(*zerror)((char *)0xf000f000, 1);
#endif
}
}
zavailable[i].start = start;
zavailable[i].size = tsize;
zcoalesce();
zalloced[allocedNodes].start = start;
zalloced[allocedNodes].size = size;
if (++allocedNodes > totalNodes) {
if (zerror)
if (zerror)
#ifdef SAFE_MALLOC
(*zerror)((char *)0xf000f000, 2, "zallocate", 0);
(*zerror)((char *)0xf000f000, 2, "zallocate", 0);
#else
(*zerror)((char *)0xf000f000, 2);
(*zerror)((char *)0xf000f000, 2);
#endif
};
};
}
static void
{
int i;
zmem *z1, *z2;
i = totalNodes-2;
z1 = zp + i;
z2 = z1 + 1;
for (; i >= ndx; i--, z1--, z2--)
{
*z2 = *z1;
*z2 = *z1;
}
}
{
int i;
zmem *z1, *z2;
z1 = zp + ndx;
z2 = z1 + 1;
for (i = ndx; i < totalNodes-1; i++, z1++, z2++)
{
*z1 = *z2;
*z1 = *z2;
}
}
zcoalesce(void)
{
int i;
for (i = 0; i < availableNodes-1; i++)
{
if ( zavailable[i].start + zavailable[i].size ==
zavailable[i+1].start )
zavailable[i+1].start )
{
zavailable[i].size += zavailable[i+1].size;
zdelete(zavailable, i+1); availableNodes--;
branches/cparm/i386/libsa/prf.c
5858
5959
6060
61
62
63
64
61
62
63
64
6565
6666
6767
6868
69
69
7070
7171
7272
7373
7474
7575
76
76
7777
7878
7979
......
8484
8585
8686
87
87
8888
8989
9090
9191
9292
9393
94
95
96
97
98
94
95
96
97
98
9999
100100
101101
102102
103
104
103
104
105105
106106
107107
108108
109109
110110
111
111
112112
113113
114114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
139
140
141
142
143
144
145
146
147
148
149
150
165151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166166
167167
168168
169169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
*/
static void
printn(n, b, flag, minwidth, putfn_p, putfn_arg)
u_long n;
int b, flag, minwidth;
void (*putfn_p)();
void *putfn_arg;
u_long n;
int b, flag, minwidth;
void (*putfn_p)();
void *putfn_arg;
{
char prbuf[11];
register char *cp;
int width = 0, neg = 0;
if (b == 10 && (int)n < 0) {
neg = 1;
n = (unsigned)(-(int)n);
}
cp = prbuf;
do {
*cp++ = "0123456789abcdef0123456789ABCDEF"[(flag & UCASE) + n%b];
*cp++ = "0123456789abcdef0123456789ABCDEF"[(flag & UCASE) + n%b];
n /= b;
width++;
} while (n);
}
while (width++ < minwidth)
(*putfn_p)( (flag & ZERO) ? '0' : ' ', putfn_arg);
do
(*putfn_p)(*--cp, putfn_arg);
while (cp > prbuf);
}
void prf(
char *fmt,
unsigned int *adx,
void (*putfn_p)(),
void *putfn_arg
)
char *fmt,
unsigned int *adx,
void (*putfn_p)(),
void *putfn_arg
)
{
int b, c;
char *s;
int flag = 0, width = 0;
int minwidth;
int minwidth;
loop:
while ((c = *fmt++) != '%') {
if(c == '\0')
return;
(*putfn_p)(c, putfn_arg);
}
minwidth = 0;
minwidth = 0;
again:
c = *fmt++;
switch (c) {
case 'l':
goto again;
case ' ':
flag |= SPACE;
goto again;
case '0':
if (minwidth == 0) {
/* this is a flag */
flag |= ZERO;
goto again;
} /* fall through */
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
minwidth *= 10;
minwidth += c - '0';
goto again;
case 'l':
goto again;
case ' ':
flag |= SPACE;
goto again;
case '0':
if (minwidth == 0) {
/* this is a flag */
flag |= ZERO;
goto again;
} /* fall through */
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
minwidth *= 10;
minwidth += c - '0';
goto again;
case 'X':
flag |= UCASE;
/* fall through */
case 'x':
b = 16;
goto number;
case 'd':
b = 10;
goto number;
case 'o': case 'O':
b = 8;
number:
printn((u_long)*adx, b, flag, minwidth, putfn_p, putfn_arg);
break;
case 's':
s = (char *)*adx;
while ((c = *s++)) {
(*putfn_p)(c, putfn_arg);
width++;
}
while (width++ < minwidth)
(*putfn_p)(' ', putfn_arg);
break;
case 'c':
(*putfn_p)((char)*adx, putfn_arg);
break;
default:
flag |= UCASE;
/* fall through */
case 'x':
b = 16;
goto number;
case 'd':
b = 10;
goto number;
case 'o': case 'O':
b = 8;
number:
printn((u_long)*adx, b, flag, minwidth, putfn_p, putfn_arg);
break;
case 's':
s = (char *)*adx;
while ((c = *s++)) {
(*putfn_p)(c, putfn_arg);
width++;
}
while (width++ < minwidth)
(*putfn_p)(' ', putfn_arg);
break;
case 'c':
(*putfn_p)((char)*adx, putfn_arg);
break;
default:
break;
}
adx++;
goto loop;
}
int prf_fmt_str_len(
char *fmt,
unsigned int *adx
)
{
int b, c, len =0;
char *s;
int flag = 0, width = 0;
int minwidth;
loop:
while ((c = *fmt++) != '%') {
if(c == '\0')
return len;
len++;
}
minwidth = 0;
again:
c = *fmt++;
switch (c) {
case 'l':
goto again;
case ' ':
flag |= SPACE;
goto again;
case '0':
if (minwidth == 0) {
/* this is a flag */
flag |= ZERO;
goto again;
} /* fall through */
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
minwidth *= 10;
minwidth += c - '0';
goto again;
case 'X':
flag |= UCASE;
/* fall through */
case 'x':
b = 16;
goto number;
case 'd':
b = 10;
goto number;
case 'o': case 'O':
b = 8;
number:
len++;
break;
case 's':
s = (char *)*adx;
while ((c = *s++)) {
len++;
width++;
}
while (width++ < minwidth)
len++;
break;
case 'c':
len++;
break;
default:
break;
}
adx++;
goto loop;
}
branches/cparm/i386/libsa/strtol.c
6666
6767
6868
69
69
7070
7171
7272
......
8181
8282
8383
84
85
86
87
84
8885
8986
9087
9188
9289
9390
94
91
9592
9693
9794
......
111108
112109
113110
114
111
115112
116113
117114
118115
119116
120117
121
118
122119
123120
124121
......
148145
149146
150147
151
148
152149
153150
154151
......
158155
159156
160157
161
158
162159
163160
164161
165
162
163
164
165
166
167
168
169
170
171
166172
167173
168174
......
174180
175181
176182
177
178
179
180
183
181184
182185
183186
184187
185188
186189
187
190
188191
189192
190193
......
202205
203206
204207
205
208
206209
207210
208211
......
220223
221224
222225
223
226
224227
225228
226229
......
230233
231234
232235
233
236
234237
235238
236239
237
240
241
242
243
244
245
246
247
248
249
250
238251
239252
240253
......
245258
246259
247260
248
249
250
251
261
262
263
252264
253265
254266
255267
256268
257269
258
270
259271
260272
261273
......
301313
302314
303315
304
316
305317
306318
307319
308
320
321
322
323
324
325
326
327
328
329
330
309331
310332
* Added support for "0b101..." binary constants.
* Commented out references to errno.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)strtol.c5.4 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */
* alphabets and digits are each contiguous.
*/
long
strtol(nptr, endptr, base)
const char *nptr;
char **endptr;
register int base;
strtol(const char *nptr, char **endptr, int base)
{
register const char *s = nptr;
register unsigned long acc;
register int c;
register unsigned long cutoff;
register int neg = 0, any, cutlim;
/*
* Skip white space and pick up leading +/- sign if any.
* If base is 0, allow 0x for hex and 0 for octal, else
s += 2;
base = 16;
} else if ((base == 0 || base == 2) &&
c == '0' && (*s == 'b' || *s == 'B')) {
c == '0' && (*s == 'b' || *s == 'B')) {
c = s[1];
s += 2;
base = 2;
}
if (base == 0)
base = c == '0' ? 8 : 10;
/*
* Compute the cutoff value between legal numbers and illegal
* numbers. That is the largest legal value, divided by the
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim) )
any = -1;
else {
any = 1;
}
if (any < 0) {
acc = neg ? LONG_MIN : LONG_MAX;
//errno = ERANGE;
//errno = ERANGE;
} else if (neg)
acc = -acc;
if (endptr != 0)
*endptr = (char *)(any ? s - 1 : nptr);
{
if(any)
{
*endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *);
}
else
{
*endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *);
}
}
return (acc);
}
* alphabets and digits are each contiguous.
*/
unsigned long
strtoul(nptr, endptr, base)
const char *nptr;
char **endptr;
register int base;
strtoul(const char *nptr, char **endptr, int base)
{
register const char *s = nptr;
register unsigned long acc;
register int c;
register unsigned long cutoff;
register int neg = 0, any, cutlim;
/*
* See strtol for comments as to the logic used.
*/
s += 2;
base = 16;
} else if ((base == 0 || base == 2) &&
c == '0' && (*s == 'b' || *s == 'B')) {
c == '0' && (*s == 'b' || *s == 'B')) {
c = s[1];
s += 2;
base = 2;
break;
if (c >= base)
break;
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim) )
any = -1;
else {
any = 1;
}
if (any < 0) {
acc = ULONG_MAX;
//errno = ERANGE;
//errno = ERANGE;
} else if (neg)
acc = -acc;
if (endptr != 0)
*endptr = (char *)(any ? s - 1 : nptr);
{
if(any)
{
*endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *);
}
else
{
*endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *);
}
}
return (acc);
}
* alphabets and digits are each contiguous.
*/
unsigned long long
strtouq(nptr, endptr, base)
const char *nptr;
char **endptr;
register int base;
strtouq(const char *nptr,
char **endptr,
register int base)
{
register const char *s = nptr;
register unsigned long long acc;
register int c;
register unsigned long long qbase, cutoff;
register int neg, any, cutlim;
/*
* See strtoq for comments as to the logic used.
*/
}
if (any < 0) {
acc = UQUAD_MAX;
//errno = ERANGE;
//errno = ERANGE;
} else if (neg)
acc = -acc;
if (endptr != 0)
*endptr = (char *)(any ? s - 1 : nptr);
{
if(any)
{
*endptr = __CAST_AWAY_QUALIFIER(s - 1, const, char *);
}
else
{
*endptr = __CAST_AWAY_QUALIFIER(nptr, const, char *);
}
}
return (acc);
}
branches/cparm/i386/libsa/bcopy.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ 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,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
*/
#include <architecture/i386/asm_help.h>
/* void *memcpy((void *) to, (const void *) from, (size_t) bcount) */
LABEL(_memcpy)
pushl%edi
pushl%esi
movl8+ 4(%esp),%edi/* to */
movl%edi,%eax/* returns its first argument */
movl8+ 8(%esp),%esi/* from */
memcpy_common:
movl8+ 12(%esp),%edx/* number of bytes */
cld
/* move longs*/
movl%edx,%ecx
shrl$2,%ecx
rep
movsl
/* move bytes*/
movl%edx,%ecx
andl$3,%ecx
rep
movsb
popl%esi
popl%edi
ret
/* void bcopy((const char *) from, (char *) to, (unsigned int) count) */
LABEL(_bcopy_no_overwrite)
pushl%edi
pushl%esi
movl8+ 8(%esp),%edi/* to */
movl8+ 4(%esp),%esi/* from */
jmpmemcpy_common
/* bcopy16(from, to, bcount) using word moves */
LABEL(_bcopy16)
pushl%edi
pushl%esi
movl8+12(%esp),%edx/* 8 for the two pushes above */
movl8+ 8(%esp),%edi
movl8+ 4(%esp),%esi
/* move words */
0:cld
movl%edx,%ecx
shrl$1,%ecx
rep
movsw
/* move bytes */
movl%edx,%ecx
andl$1,%ecx
rep
movsb
popl%esi
popl%edi
ret
/*
* Based on NetBSD's bcopy.S from their libc.
* bcopy(src, dst, cnt)
* ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
*/
LABEL(_bcopy)
pushl %esi
pushl %edi
movl 12(%esp),%esi
movl 16(%esp),%edi
movl 20(%esp),%ecx
movl %edi,%edx
subl %esi,%edx
cmpl %ecx,%edx /* overlapping && src < dst? */
movl %ecx,%edx
jb 1f
shrl $2,%ecx /* copy by 32-bit words */
cld /* nope, copy forwards */
rep
movsl
movl %edx,%ecx
andl $3,%ecx /* any bytes left? */
rep
movsb
popl %edi
popl %esi
ret
1:
addl %ecx,%edi /* copy backwards */
addl %ecx,%esi
decl %edi
decl %esi
andl $3,%ecx /* any fractional bytes? */
std
rep
movsb
movl %edx,%ecx /* copy remainder by 32-bit words */
shrl $2,%ecx
subl $3,%esi
subl $3,%edi
rep
movsl
popl %edi
popl %esi
cld
ret
branches/cparm/i386/libsa/Makefile
88
99
1010
11
11
1212
13
13
1414
1515
1616
......
2626
2727
2828
29
30
29
30
3131
3232
33
34
35
33
34
3635
3736
3837
INSTALL_MD_DIR = $(DSTROOT)/System/Library/Frameworks/System.framework/Versions/B/PrivateHeaders/machdep/i386
OPTIM = -Os -Oz
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror -fstack-protector-all \
-fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float
INC = -I. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSAIODIR)
VPATH = $(OBJROOT):$(SYMROOT)
SA_OBJS = prf.o printf.o zalloc.o\
string.o strtol.o error.o \
SA_OBJS = qdivrem.o umoddi3.o udivdi3.o divdi3.o moddi3.o bzero.o bcopy.o prf.o printf.o zalloc.o\
string.o strtol.o \
setjmp.o qsort.o efi_tables.o
SFILES = setjmp.s
CFILES = prf.c printf.c zalloc.c \
SFILES = setjmp.s bzero.s bcopy.s
CFILES = qdivrem.c umoddi3.c udivdi3.c divdi3.c moddi3.c prf.c printf.c zalloc.c \
string.c strtol.c error.c \
qsort.c efi_tables.c
branches/cparm/i386/util/Symbols.c
1212
1313
1414
15
16
1715
1816
1917
2018
21
19
2220
2321
2422
......
5553
5654
5755
58
59
60
61
62
63
64
65
66
67
68
6956
57
7058
59
7160
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "Symbols.h"
static int strcmp(const char * s1, const char * s2);
void Symbols_start()
{
}
unsigned int lookup_symbol(const char* symbol)
unsigned int lookup_symbol(const char* symbol, int(*strcmp)(const char*, const char*))
{
int upperLimit = sizeof(symbolList) / sizeof(symbolList[0]) - 1;
int lowerLimit = 0;
return symbolList[compareIndex].addr;
}
/*
* strcmp - Copied from libsa/string.c due to symbols not able to be resolved at this point
*/
static int strcmp(const char * s1, const char * s2)
{
while (*s1 && (*s1 == *s2)) {
s1++;
s2++;
}
return (*s1 - *s2);
}
#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
static void __guard_setup(void) __attribute__((constructor));
void __stack_chk_fail(void);
static void
__guard_setup(void)
{
/* Here the protector switches the guard
to the "terminator canary", and cannot report failure */
((char*)__stack_chk_guard)[0] = 0; ((char*)__stack_chk_guard)[1] = 0;
((char*)__stack_chk_guard)[2] = '\n'; ((char*)__stack_chk_guard)[3] = 255;
}
void
__stack_chk_fail()
{
for(;;);
}
branches/cparm/i386/util/Makefile
1818
1919
2020
21
21
2222
2323
2424
CFILES = machOconv.c
ALLSRC = $(CFILES) $(MFILES) $(HFILES) $(EXPORT_HFILES)
PROGRAMS = machOconv bdmesg
PROGRAMS = machOconv bdmesg amlsgn
OUTFILES = $(PROGRAMS)

Archive Download the corresponding diff file

Revision: 1804