Chameleon

Chameleon Commit Details

Date:2011-05-31 21:16:11 (12 years 10 months ago)
Author:Azimutz
Commit:930
Parents: 929
Message:Merge trunk (r923 --> 929).
Changes:
D/branches/azimutz/Cleancut/i386/MakeInc.dir
D/branches/azimutz/Cleancut/i386/modules/include/types.h
C/trunk/i386/util/openUp.c → /branches/azimutz/Cleancut/i386/util/openUp.c
M/branches/azimutz/Cleancut/i386/libsa/string.c
M/branches/azimutz/Cleancut/i386/boot2/modules.h
M/branches/azimutz/Cleancut/i386/util/Cconfig
M/branches/azimutz/Cleancut/i386/boot2/mboot.c
M/branches/azimutz/Cleancut/i386/modules/NVIDIAGraphicsEnabler/nvidia.c
M/branches/azimutz/Cleancut/i386/util/Makefile
M/branches/azimutz/Cleancut/i386/boot2/gui.c
M/branches/azimutz/Cleancut/i386/modules/ATiGraphicsEnabler/ati.c
M/branches/azimutz/Cleancut/i386/boot2/gui.h
M/branches/azimutz/Cleancut/i386/libsaio/saio_internal.h
M/branches/azimutz/Cleancut/i386/boot2/ramdisk.c
M/branches/azimutz/Cleancut/i386/boot2/options.c
M/branches/azimutz/Cleancut/i386/boot2/Makefile
M/branches/azimutz/Cleancut/i386/libsaio/xml.c
M/branches/azimutz/Cleancut/i386/boot2/resume.c
M/branches/azimutz/Cleancut
M/branches/azimutz/Cleancut/i386/boot2/boot.c
M/branches/azimutz/Cleancut/i386/libsa/libsa.h
M/branches/azimutz/Cleancut/Make.rules
M/branches/azimutz/Cleancut/i386/boot2/modules.c

File differences

branches/azimutz/Cleancut/i386/MakeInc.dir
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
#
# Common makefile targets.
#
# Define these variables (if desired) in directory makefiles:
#DIRS_NEEDED
#INSTALLDIR
#SRCROOT
#
ifneq "" "$(wildcard /bin/mkdirs)"
MKDIRS = /bin/mkdirs
else
MKDIRS = /bin/mkdir -p
endif
CPP = g++ -fno-exceptions -fno-rtti
# Toggle this as to whether you want a frame pointer (%ebp) to be used. It is
# invaluable for debugging the booter. For example using GDB attached to VMware.
# In fact, it's so invaluable that it's now the default. Not only that but the
# compiler seems to generate slightly smaller code and the real<->prot code
# clearly handles it appropriately so I have no idea why Apple omitted it.
#OMIT_FRAME_POINTER_CFLAG=-fomit-frame-pointer
OMIT_FRAME_POINTER_CFLAG=
installsrc:: $(SRCROOT)
cp $(ALLSRC) $(SRCROOT)
cd $(SRCROOT); chmod a-w $(ALLSRC)
install:: installhdrs
@if [ -z "$(RC_ARCHS)" -o -n "$(RC_i386)" ]; then \
$(MAKE) install_i386 OBJROOT=${OBJROOT}\
SYMROOT=${SYMROOT} DSTROOT=${DSTROOT}\
SRCROOT=${SRCROOT}; \
else\
echo i386 not selected - null build.;\
fi
install_i386:: all
installhdrs::
.SUFFIXES: .s .i .c .o .o32 .o64
.c.o32:
@echo "\t[CC32] $<"
@$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $(OBJROOT)/$*.o32 \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
.c.o64:
@echo "\t[CC64] $<"
@$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $(OBJROOT)/$*.o64 \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
.c.o .m.o:
@echo "\t[CC] $<"
@$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.o: %.c
@echo "\t[CC] $<"
@$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.o32: %.c
@echo "\t[CC32] $<"
@$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $(OBJROOT)/$*.o32 \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.o64: %.c
@echo "\t[CC64] $<"
@$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $(OBJROOT)/$*.o64 \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.o: %.m
@echo "\t[CC] $<"
@$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $(OBJROOT)/$*.o \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
#.s.o:
#cc $(INC) -E $< > $(OBJROOT)/$*.o2
#$(AS) -o $(OBJROOT)/$@ $(OBJROOT)/$*.o2
.s.o:
@echo "\t[AS] $<"
@cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $<
boot2.o:
@echo "\t[AS] boot2.s"
@cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s
$(OBJROOT)/%.o: %.s
@echo "\t[CC] $<"
@cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $<
$(DIRS_NEEDED) $(INSTALLDIR) $(SRCROOT):
@echo "\t[MKDIR] $@"
@$(MKDIRS) $@
branches/azimutz/Cleancut/i386/libsaio/xml.c
356356
357357
358358
359
359
360360
361361
362362
......
381381
382382
383383
384
384
385385
386386
387387
......
424424
425425
426426
427
427
428428
429429
430430
......
449449
450450
451451
452
452
453453
454454
455455
......
670670
671671
672672
673
673
674674
675675
676676
......
711711
712712
713713
714
714
715715
716716
717717
......
732732
733733
734734
735
735
736736
737737
738738
......
772772
773773
774774
775
775
776776
777777
778778
......
804804
805805
806806
807
807
808808
809809
810810
else
{
printf("ParseStringID error (0x%x)\n", *val);
getc();
getchar();
return -1;
}
}
else
{
printf("ParseStringIDREF error (0x%x)\n", *val);
getc();
getchar();
return -1;
}
}
else
{
printf("ParseIntegerID error (0x%x)\n", *val);
getc();
getchar();
return -1;
}
}
else
{
printf("ParseStringIDREF error (0x%x)\n", *val);
getc();
getchar();
return -1;
}
}
if(buffer[0] == '<')
{
printf("Warning integer is non existant\n");
getc();
getchar();
tmpTag = NewTag();
tmpTag->type = kTagTypeInteger;
tmpTag->string = 0;
else
{
printf("ParseTagInteger hex error (0x%x) in buffer %s\n", *val, buffer);
getc();
getchar();
return -1;
}
}
if (*val < '0' || *val > '9')
{
printf("ParseTagInteger decimal error (0x%x) in buffer %s\n", *val, buffer);
getc();
getchar();
return -1;
}
//printf("ParseTagData unimplimented\n");
//printf("Data: %s\n", buffer);
//getc();
//getchar();
// TODO: base64 decode
if (tmpTag == 0) return -1;
printf("ParseTagDate unimplimented\n");
getc();
getchar();
tmpTag->type = kTagTypeDate;
tmpTag->string = 0;
branches/azimutz/Cleancut/i386/libsaio/saio_internal.h
4949
5050
5151
52
5352
5453
5554
extern int ebiosEjectMedia(int biosdev);
extern void bios_putchar(int ch);
extern void putca(int ch, int attr, int repeat);
extern int getc(void);
extern void pause();
extern int readKeyboardStatus(void);
extern int readKeyboardShiftFlags(void);
branches/azimutz/Cleancut/i386/boot2/mboot.c
345345
346346
347347
348
349
350
351
352
353
354
355348
356349
357350
return bootdevice;
}
enum {
kReturnKey = 0x0d,
kEscapeKey = 0x1b,
kBackspaceKey = 0x08,
kASCIIKeyMask = 0x7f
};
// This is the meat of our implementation. It grabs the boot device from
// the multiboot_info and returns it as is. If it fails it returns
// BAD_BOOT_DEVICE. We can call an awful lot of libsa and libsaio but
branches/azimutz/Cleancut/i386/boot2/Makefile
110110
111111
112112
113
114
115
113116
114117
115118
-Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) `find $(OBJROOT)/../boot2_modules/ -name \*.o` $(LIBS) -lcc_kext
@${RM} $(SYMROOT)/${SYMBOLS_MODULE}
@$(LD) -arch i386 \
-undefined dynamic_lookup \
-dylib -read_only_relocs suppress \
branches/azimutz/Cleancut/i386/boot2/resume.c
119119
120120
121121
122
122
123123
124124
125125
......
143143
144144
145145
146
146
147147
148148
149149
printf ("Resuming from Encrypted image is unsupported.\n"
"Uncheck \"Use secure virtual memory\" in \"Security\" pane on system preferences.\n"
"Press any key to proceed with normal boot.\n");
getc ();
getchar ();
return;
}
// depends on NVRAM
if (!((long long)mem_base+allocSize<1024*bootInfo->extmem+0x100000))
{
printf ("Not enough space to restore image. Press any key to proceed with normal boot.\n");
getc ();
getchar ();
return;
}
branches/azimutz/Cleancut/i386/boot2/boot.c
186186
187187
188188
189
189
190190
191191
192192
......
351351
352352
353353
354
354
355355
356356
357357
bool dummyVal;
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
printf("Press any key to continue...");
getc();
getchar();
}
usb_loop();
#if DEBUG
printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
printf(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
getc();
getchar();
#endif
useGUI = true;
branches/azimutz/Cleancut/i386/boot2/modules.c
1515
1616
1717
18
18
1919
2020
2121
2222
2323
2424
25
26
25
26
2727
2828
2929
......
5353
5454
5555
56
56
5757
5858
5959
......
6969
7070
7171
72
72
7373
7474
7575
......
8585
8686
8787
88
88
8989
9090
9191
......
166166
167167
168168
169
169
170170
171171
172172
......
179179
180180
181181
182
182
183183
184184
185185
......
286286
287287
288288
289
290
289
290
291291
292292
293293
......
308308
309309
310310
311
311
312
313
314
315
312316
313317
314318
......
349353
350354
351355
352
356
353357
354358
355359
......
358362
359363
360364
361
365
362366
363367
364368
......
377381
378382
379383
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
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
407411
408412
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
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
436438
437439
438440
......
493495
494496
495497
496
497
498
498
499
500
499501
500502
501503
......
738740
739741
740742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
741765
742766
743767
744768
745
769
746770
747771
748772
......
762786
763787
764788
765
766789
767790
768791
......
792815
793816
794817
795
796
797
798
799
800
801
802
818
803819
804820
805821
......
819835
820836
821837
822
823
824
825
826
827
828
829
830
838
831839
832840
833841
......
848856
849857
850858
851
852
853
854
855
856
857
858
859
860
861
862
859
860
863861
864862
865863
866
867
868
869
870
871
872
873
874
875
876
864
877865
878866
879867
......
886874
887875
888876
889
877
890878
891879
892880
......
894882
895883
896884
897
898
899
900
901
902
903
904
885
905886
906887
907888
......
912893
913894
914895
915
896
916897
917898
918899
......
930911
931912
932913
933
914
934915
935916
936917
......
938919
939920
940921
941
942
943
944
945
946
947
948
922
949923
924
950925
951
952
953
954
955
956
957
958
959
960
961926
962927
963928
......
971936
972937
973938
974
939
975940
976941
977942
978943
979944
980945
946
981947
982948
983949
......
11021068
11031069
11041070
1105
1071
11061072
11071073
11081074
......
11401106
11411107
11421108
1109
11431110
11441111
11451112
1146
1113
11471114
11481115
11491116
11501117
11511118
1152
1119
11531120
11541121
11551122
#if CONFIG_MODULE_DEBUG
#define DBG(x...)printf(x);
#define DBGPAUSE()getc()
#define DBGPAUSE()getchar()
#else
#define DBG(x...)
#define DBGPAUSE()
#endif
// NOTE: Global so that modules can link with this
unsigned long long textAddress = 0;
unsigned long long textSection = 0;
UInt64 textAddress = 0;
UInt64 textSection = 0;
void* symbols_module_start = (void*)0xFFFFFFFF;// Global, value is populated by the makefile with actual address
if(symbols_module_start != (void*)0xFFFFFFFF)
{
// Module system was compiled in (Symbols.dylib addr known)
module_start = parse_mach(module_data, &load_module, &add_symbol);
module_start = parse_mach(module_data, &load_module, &add_symbol, NULL);
if(module_start && module_start != (void*)0xFFFFFFFF)
{
else
{
module_data -= 0x10; // XCODE 4 HACK
module_start = parse_mach(module_data, &load_module, &add_symbol);
module_start = parse_mach(module_data, &load_module, &add_symbol, NULL);
if(module_start && module_start != (void*)0xFFFFFFFF)
{
else
{
// The module does not have a valid start function
printf("Unable to start %s\n", SYMBOLS_MODULE); getc();
printf("Unable to start %s\n", SYMBOLS_MODULE); getchar();
}
}
}
if (moduleSize && read(fh, module_base, moduleSize) == moduleSize)
{
// Module loaded into memory, parse it
module_start = parse_mach(module_base, &load_module, &add_symbol);
module_start = parse_mach(module_base, &load_module, &add_symbol, NULL);
if(module_start && module_start != (void*)0xFFFFFFFF)
{
else // The module does not have a valid start function. This may be a library.
{
printf("WARNING: Unable to start %s\n", module);
getc();
getchar();
}
#else
else msglog("WARNING: Unable to start %s\n", module);
}
#if CONFIG_MODULE_DEBUG
verbose("Unable to locate symbol %s\n", name);
getc();
printf("Unable to locate symbol %s\n", name);
getchar();
#endif
if(strcmp(name, VOID_SYMBOL) == 0) return 0xFFFFFFFF;
* NOTE: If the module is unable to load ot completeion, the modules
* symbols will still be available.
*/
void* parse_mach(void* binary, int(*dylib_loader)(char*), long long(*symbol_handler)(char*, long long, char))
void* parse_mach(void* binary,
int(*dylib_loader)(char*),
long long(*symbol_handler)(char*, long long, char),
void (*section_handler)(char* section, char* segment, long long offset, long long address)
)
{
char is64 = false;
void (*module_start)(void) = NULL;
else
{
verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic);
//getc();
//getchar();
return NULL;
}
/*if(((struct mach_header*)binary)->filetype != MH_DYLIB)
{
printf("Module is not a dylib. Unable to load.\n");
getc();
getchar();
return NULL; // Module is in the incorrect format
}*/
break;
case LC_SEGMENT: // 32bit macho
segCommand = binary + binaryIndex;
if(strcmp("__TEXT", segCommand->segname) == 0)
{
UInt32 sectionIndex;
sectionIndex = sizeof(struct segment_command);
struct section *sect;
while(sectionIndex < segCommand->cmdsize)
{
sect = binary + binaryIndex + sectionIndex;
sectionIndex += sizeof(struct section);
if(strcmp("__text", sect->sectname) == 0)
{
// __TEXT,__text found, save the offset and address for when looking for the calls.
textSection = sect->offset;
textAddress = sect->addr;
break;
}
}
}
{
segCommand = binary + binaryIndex;
UInt32 sectionIndex;
sectionIndex = sizeof(struct segment_command);
struct section *sect;
while(sectionIndex < segCommand->cmdsize)
{
sect = binary + binaryIndex + sectionIndex;
sectionIndex += sizeof(struct section);
if(section_handler) section_handler(sect->sectname, segCommand->segname, sect->offset, sect->addr);
if((strcmp("__TEXT", segCommand->segname) == 0) && (strcmp("__text", sect->sectname) == 0))
{
// __TEXT,__text found, save the offset and address for when looking for the calls.
textSection = sect->offset;
textAddress = sect->addr;
}
}
}
break;
case LC_SEGMENT_64:// 64bit macho's
segCommand64 = binary + binaryIndex;
if(strcmp("__TEXT", segCommand64->segname) == 0)
{
UInt32 sectionIndex;
sectionIndex = sizeof(struct segment_command_64);
struct section_64 *sect;
while(sectionIndex < segCommand64->cmdsize)
{
sect = binary + binaryIndex + sectionIndex;
sectionIndex += sizeof(struct section_64);
if(strcmp("__text", sect->sectname) == 0)
{
// __TEXT,__text found, save the offset and address for when looking for the calls.
textSection = sect->offset;
textAddress = sect->addr;
break;
}
}
}
{
segCommand64 = binary + binaryIndex;
UInt32 sectionIndex;
sectionIndex = sizeof(struct segment_command_64);
struct section_64 *sect;
while(sectionIndex < segCommand64->cmdsize)
{
sect = binary + binaryIndex + sectionIndex;
sectionIndex += sizeof(struct section_64);
if(section_handler) section_handler(sect->sectname, segCommand->segname, sect->offset, sect->addr);
if((strcmp("__TEXT", segCommand->segname) == 0) && (strcmp("__text", sect->sectname) == 0))
{
// __TEXT,__text found, save the offset and address for when looking for the calls.
textSection = sect->offset;
textAddress = sect->addr;
}
}
}
break;
// Rebase the module before binding it.
if(dyldInfoCommand->rebase_off)rebase_macho(binary, (char*)dyldInfoCommand->rebase_off,dyldInfoCommand->rebase_size);
// Bind all symbols.
if(dyldInfoCommand->bind_off)bind_macho(binary, (char*)dyldInfoCommand->bind_off,dyldInfoCommand->bind_size);
if(dyldInfoCommand->weak_bind_off)bind_macho(binary, (char*)dyldInfoCommand->weak_bind_off,dyldInfoCommand->weak_bind_size);
if(dyldInfoCommand->lazy_bind_off)bind_macho(binary, (char*)dyldInfoCommand->lazy_bind_off,dyldInfoCommand->lazy_bind_size);
if(dyldInfoCommand->bind_off)bind_macho(binary, (UInt8*)dyldInfoCommand->bind_off,dyldInfoCommand->bind_size);
if(dyldInfoCommand->weak_bind_off)bind_macho(binary, (UInt8*)dyldInfoCommand->weak_bind_off,dyldInfoCommand->weak_bind_size);
if(dyldInfoCommand->lazy_bind_off)bind_macho(binary, (UInt8*)dyldInfoCommand->lazy_bind_off,dyldInfoCommand->lazy_bind_size);
}
return module_start;
}
UInt32 read_uleb(UInt8* bind_stream, unsigned int* i)
{
// Read in offset
UInt32 tmp = 0;
UInt8 bits = 0;
do
{
if(bits < sizeof(UInt32)*8) // hack
{
tmp |= (bind_stream[++(*i)] & 0x7f) << bits;
bits += 7;
}
else
{
++(*i);
}
}
while(bind_stream[*i] & 0x80);
return tmp;
}
// Based on code from dylibinfo.cpp and ImageLoaderMachOCompressed.cpp
// NOTE: this uses 32bit values, and not 64bit values.
// There is a possibility that this could cause issues,
// however the modules are 32 bits, so it shouldn't matter too much
void bind_macho(void* base, char* bind_stream, UInt32 size)
void bind_macho(void* base, UInt8* bind_stream, UInt32 size)
{
bind_stream += (UInt32)base;
UInt32 symbolAddr = 0xFFFFFFFF;
// Temperary variables
UInt8 bits = 0;
UInt32 tmp = 0;
UInt32 tmp2 = 0;
UInt32 index = 0;
break;
case BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB:
libraryOrdinal = 0;
bits = 0;
do
{
libraryOrdinal |= (bind_stream[++i] & 0x7f) << bits;
bits += 7;
}
while(bind_stream[i] & 0x80);
libraryOrdinal = read_uleb(bind_stream, &i);
break;
case BIND_OPCODE_SET_DYLIB_SPECIAL_IMM:
break;
case BIND_OPCODE_SET_ADDEND_SLEB:
addend = 0;
bits = 0;
do
{
addend |= (bind_stream[++i] & 0x7f) << bits;
bits += 7;
}
while(bind_stream[i] & 0x80);
addend = read_uleb(bind_stream, &i);
if(!(bind_stream[i-1] & 0x40)) addend *= -1;
break;
while(index <= immediate);
segmentAddress = segCommand->fileoff;
// Read in offset
tmp = 0;
bits = 0;
do
{
tmp |= (bind_stream[++i] & 0x7f) << bits;
bits += 7;
}
while(bind_stream[i] & 0x80);
segmentAddress += tmp;
segmentAddress += read_uleb(bind_stream, &i);
break;
case BIND_OPCODE_ADD_ADDR_ULEB:
// Read in offset
tmp = 0;
bits = 0;
do
{
tmp |= (bind_stream[++i] & 0x7f) << bits;
bits += 7;
}
while(bind_stream[i] & 0x80);
segmentAddress += tmp;
segmentAddress += read_uleb(bind_stream, &i);
break;
case BIND_OPCODE_DO_BIND:
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc();
getchar();
}
segmentAddress += sizeof(void*);
case BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB:
// Read in offset
tmp = 0;
bits = 0;
do
{
tmp |= (bind_stream[++i] & 0x7f) << bits;
bits += 7;
}
while(bind_stream[i] & 0x80);
tmp = read_uleb(bind_stream, &i);
if(symbolAddr != 0xFFFFFFFF)
{
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc();
getchar();
}
segmentAddress += tmp + sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc();
getchar();
}
segmentAddress += (immediate * sizeof(void*)) + sizeof(void*);
break;
case BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB:
tmp = 0;
bits = 0;
do
{
tmp |= (bind_stream[++i] & 0x7f) << bits;
bits += 7;
}
while(bind_stream[i] & 0x80);
tmp = read_uleb(bind_stream, &i);
tmp2 = read_uleb(bind_stream, &i);
tmp2 = 0;
bits = 0;
do
{
tmp2 |= (bind_stream[++i] & 0x7f) << bits;
bits += 7;
}
while(bind_stream[i] & 0x80);
if(symbolAddr != 0xFFFFFFFF)
{
for(index = 0; index < tmp; index++)
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc();
getchar();
}
break;
}
i++;
}
}
inline void bind_location(UInt32* location, char* value, UInt32 addend, int type)
{
#if CONFIG_MODULE_DEBUG
//print_hook_list();
//getc();
//getchar();
#endif
}
hooks = hooks->next;
}
}
#endif
/********************************************************************************/
/*dyld / Linker Interface*/
/*dyld / Linker Interface*/
/********************************************************************************/
void dyld_stub_binder()
{
printf("ERROR: dyld_stub_binder was called, should have been take care of by the linker.\n");
getc();
getchar();
}
#else /* CONFIG_MODULES */
branches/azimutz/Cleancut/i386/boot2/modules.h
1515
1616
1717
18
19
18
19
2020
2121
2222
2323
2424
2525
26
26
2727
2828
2929
......
7777
7878
7979
80
80
81
82
8183
8284
8385
8486
8587
8688
87
89
8890
8991
9092
#define MODULE_PATH"/Extra/modules/"
#define SYMBOLS_MODULE "Symbols.dylib"
#define VOID_SYMBOL"dyld_void_start"
extern unsigned long long textAddress;
extern unsigned long long textSection;
extern UInt64 textAddress;
extern UInt64 textSection;
typedef struct symbolList_t
{
char* symbol;
unsigned int addr;
UInt64 addr;
struct symbolList_t* next;
} symbolList_t;
/********************************************************************************/
void*parse_mach(void* binary,
int(*dylib_loader)(char*),
long long(*symbol_handler)(char*, long long, char));
long long(*symbol_handler)(char*, long long, char),
void (*section_handler)(char* section, char* segment, long long offset, long long address)
);
unsigned inthandle_symtable(UInt32 base,
struct symtab_command* symtabCommand,
long long(*symbol_handler)(char*, long long, char),
char is64);
voidrebase_macho(void* base, char* rebase_stream, UInt32 size);
inline voidrebase_location(UInt32* location, char* base, int type);
voidbind_macho(void* base, char* bind_stream, UInt32 size);
voidbind_macho(void* base, UInt8* bind_stream, UInt32 size);
inline voidbind_location(UInt32* location, char* value, UInt32 addend, int type);
branches/azimutz/Cleancut/i386/boot2/gui.c
15791579
15801580
15811581
1582
1582
15831583
15841584
15851585
updateVRAM();
key = getc();
key = getchar();
if( key == kUpArrowkey )
if( currentline > 0 )
branches/azimutz/Cleancut/i386/boot2/gui.h
4141
4242
4343
44
44
4545
4646
4747
enum {
kBackspaceKey= 0x08,
kTabKey= 0x09,
kReturnKey= 0x0d,
kReturnKey= '\n',
kEscapeKey= 0x1b,
kUpArrowkey= 0x4800,
kDownArrowkey= 0x5000,
branches/azimutz/Cleancut/i386/boot2/ramdisk.c
290290
291291
292292
293
293
294294
295295
296296
......
303303
304304
305305
306
306
307307
308308
309309
setCursorPosition(0, 0, 1);
showInfoRAMDisk();
printf("\n\nPress any key to continue.\n");
getc();
getchar();
setActiveDisplayPage(0);
}
else
printf("\n?rd m <filename> - mount ramdisk image\n?rd u - unmount ramdisk image");
printf("\n?rd e - enable bt(0,0) alias\n?rd d - disable bt(0,0) alias");
printf("\n\nPress any key to continue.\n");
getc();
getchar();
setActiveDisplayPage(0);
}
}
branches/azimutz/Cleancut/i386/boot2/options.c
911911
912912
913913
914
914
915915
916916
917917
......
13831383
13841384
13851385
1386
1386
13871387
13881388
13891389
......
14501450
14511451
14521452
1453
1453
14541454
14551455
14561456
......
15011501
15021502
15031503
1504
1504
15051505
15061506
15071507
// reset cursor co-ords
gui.debug.cursor = pos( gui.screen.width - 160 , 10 );
}
key = getc();
key = getchar();
updateMenu( key, (void **) &menuBVR );
newShowPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
printf("[Type %s%sq to quit viewer]", (line_offset > 0) ? "p for previous page, " : "", (*bp != '\1') ? "space for next page, " : "");
}
c = getc();
c = getchar();
if (c == 'q' || c == 'Q') {
break;
}
printf("Typical boot devices are 80 (First HD), 81 (Second HD)\n");
printf("Enter two-digit hexadecimal boot device [%02x]: ", bootdevice);
do {
key = getc();
key = getchar();
switch (key & kASCIIKeyMask) {
case kBackspaceKey:
if (digitsI > 0) {
bool promptForRescanOption(void)
{
printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n");
if (getc() == kReturnKey) {
if (getchar() == kReturnKey) {
return true;
} else {
return false;
branches/azimutz/Cleancut/i386/modules/include/types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef _TYPES_H_
#define _TYPES_H_
typedef unsigned char UInt8;
typedef signed char SInt8;
typedef unsigned short UInt16;
typedef signed short SInt16;
typedef unsigned int UInt32;
typedef signed int SInt32;
typedef unsigned long long UInt64;
typedef signed long long SInt64;
#endif /* _TYPES_H_ */
branches/azimutz/Cleancut/i386/modules/NVIDIAGraphicsEnabler/nvidia.c
245245
246246
247247
248
248
249249
250250
251251
......
402402
403403
404404
405
405
406406
407407
408408
{ 0x10DE0408, "GeForce 9650M GS" },
{ 0x10DE0409, "GeForce 8700M GT" },
{ 0x10DE040A, "Quadro FX 370" },
{ 0x10DE040B, "Quadro NVS 320M" },
{ 0x10DE040B, "Quadro NVS 320M" }, //Azi: 320M
{ 0x10DE040C, "Quadro FX 570M" },
{ 0x10DE040D, "Quadro FX 1600M" },
{ 0x10DE040E, "Quadro FX 570" },
{ 0x10DE0DE2, "GeForce GT 420" },
{ 0x10DE0DEB, "GeForce GT 555M" },
{ 0x10DE0DEE, "GeForce GT 415M" },
{ 0x10DE0DF0, "GeForce GT 425M" },
{ 0x10DE0DF0, "GeForce GT 425M" }, //Azi: ?? GT 450M
{ 0x10DE0DF1, "GeForce GT 420M" },
{ 0x10DE0DF2, "GeForce GT 435M" },
{ 0x10DE0DF3, "GeForce GT 420M" },
branches/azimutz/Cleancut/i386/modules/ATiGraphicsEnabler/ati.c
643643
644644
645645
646
646
647647
648648
649649
650650
651651
652652
653
654
653
654
655655
656656
657657
......
668668
669669
670670
671
672
671
672
673673
674674
675675
676676
677
677
678
678679
679
680
680681
681682
682683
683684
684
685
685686
686687
687688
......
690691
691692
692693
693
694
694
695
695696
696697
697698
698
699
700
699701
700702
701703
......
705707
706708
707709
708
710
709711
710712
711
713
712714
713715
714716
......
716718
717719
718720
721
719722
723
724
720725
721
726
722727
723728
724
725
729
730
731
732
733
726734
727
735
736
728737
729
730
731738
739
740
741
742
732743
733
734
735
736
744
745
746
747
748
749
750
751
752
737753
738
754
739755
740756
741
742
743
744757
745
758
759
760
761
762
763
764
765
746766
747767
748
749
768
769
770
771
750772
751773
752774
753
775
776
754777
755778
756779
757780
781
782
783
758784
759
785
786
760787
761788
762
763
789
790
791
792
764793
794
765795
766
796
797
798
799
767800
768801
802
769803
770804
771
805
806
807
808
772809
773810
774
775
776811
777
812
813
814
815
816
817
818
778819
779820
821
822
780823
781824
782825
devicepath = get_pci_dev_path(ati_dev);
cmd = pci_config_read8(ati_dev->dev.addr, 4);
verbose("old pci command - %x\n", cmd);
verbose("old pci command - %x\n", cmd); //Azi: 7
if (cmd == 0) {
pci_config_write8(ati_dev->dev.addr, 4, 6);
cmd = pci_config_read8(ati_dev->dev.addr, 4);
verbose("new pci command - %x\n", cmd);
}
model = get_ati_model((ati_dev->vendor_id << 16) | ati_dev->device_id);
framebuffer = get_ati_fb((ati_dev->vendor_id << 16) | ati_dev->device_id);
model = get_ati_model((ati_dev->vendor_id << 16) | ati_dev->device_id); //Azi: Unknown
framebuffer = get_ati_fb((ati_dev->vendor_id << 16) | ati_dev->device_id); //Azi: Megalodon
if (!string) {
string = devprop_create_string();
}
} else {
boot_display = 0;
}
verbose("boot display - %x\n", boot_display);
devprop_add_value(device, "@0,AAPL,boot-display", (uint8_t*)&boot_display, 4);
verbose("boot display - %x\n", boot_display); //Azi: 1... thus, POSTed!
devprop_add_value(device, "@0,AAPL,boot-display", (uint8_t*)&boot_display, 4); //Azi: Ok!
if ((framebuffer[0] == 'M' && framebuffer[1] == 'o' && framebuffer[2] == 't') ||
(framebuffer[0] == 'S' && framebuffer[1] == 'h' && framebuffer[2] == 'r') ||
(framebuffer[0] == 'P' && framebuffer[1] == 'e' && framebuffer[2] == 'r')) //faster than strcmp ;)
devprop_add_ati_template_4xxx(device);
//Azi: if framebuffer = Motmot or Shrike (none!) or Peregrine
devprop_add_ati_template_4xxx(device); //Azi: 4000 series (or 4800 ??)
else {
devprop_add_ati_template(device);
devprop_add_ati_template(device); //Azi: my scene!!!***
vram_size = getvramsizekb(ati_dev) * 1024;
if ((vram_size > 0x80000000) || (vram_size == 0)) {
vram_size = 0x10000000;//vram reported wrong, defaulting to 256 mb
}
devprop_add_value(device, "VRAM,totalsize", (uint8_t*)&vram_size, 4);
devprop_add_value(device, "VRAM,totalsize", (uint8_t*)&vram_size, 4); //Azi: 0x20000000
ati_vram_memsize_0.data[6] = (vram_size >> 16) & 0xFF; //4,5 are 0x00 anyway
ati_vram_memsize_0.data[7] = (vram_size >> 24) & 0xFF;
ati_vram_memsize_1.data[6] = (vram_size >> 16) & 0xFF; //4,5 are 0x00 anyway
DP_ADD_TEMP_VAL_DATA(device, ati_vram_memsize_1);
devprop_add_iopciconfigspace(device, ati_dev);
}
devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1));
devprop_add_value(device, "ATY,DeviceID", (uint8_t*)&ati_dev->device_id, 2);
devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1)); //Azi: Unknown
devprop_add_value(device, "ATY,DeviceID", (uint8_t*)&ati_dev->device_id, 2); //Azi: Ok! 8171 = (7181)
//fb setup
sprintf(tmp, "Slot-%x",devices_number);
devprop_add_value(device, "AAPL,slot-name", (uint8_t*)tmp, strlen(tmp) + 1);
devprop_add_value(device, "AAPL,slot-name", (uint8_t*)tmp, strlen(tmp) + 1); //Azi: OK! Slot-1
// don't think my card is on slot 1 ??... 0 ??
devices_number++;
sprintf(tmp, ati_compatible_0[1], framebuffer);
devprop_add_value(device, (char *) ati_compatible_1[0], (uint8_t *)tmp, strlen(tmp) + 1);
sprintf(tmp, ati_device_type[1], framebuffer);
devprop_add_value(device, (char *) ati_device_type[0], (uint8_t *)tmp, strlen(tmp) + 1);
devprop_add_value(device, (char *) ati_device_type[0], (uint8_t *)tmp, strlen(tmp) + 1); //Azi: OK!
sprintf(tmp, ati_name[1], framebuffer);
devprop_add_value(device, (char *) ati_name[0], (uint8_t *)tmp, strlen(tmp) + 1);
devprop_add_value(device, (char *) ati_name[0], (uint8_t *)tmp, strlen(tmp) + 1); //Azi: display ??
sprintf(tmp, ati_name_0[1], framebuffer);
devprop_add_value(device, (char *) ati_name_0[0], (uint8_t *)tmp, strlen(tmp) + 1);
sprintf(tmp, ati_name_1[1], framebuffer);
devprop_add_value(device, (char *) ati_name_1[0], (uint8_t *)tmp, strlen(tmp) + 1);
//Azi: Assemble default path for a custom rom...
sprintf(tmp, "bt(0,0)/Extra/%04x_%04x.rom", (uint16_t)ati_dev->vendor_id, (uint16_t)ati_dev->device_id);
//Azi: if user enabled use of custom rom...
if (getBoolForKey(kUseAtiROMKey, &doit, &bootInfo->bootConfig) && doit) {
verbose("looking for ati video bios file %s\n", tmp);
verbose("Looking for custom ATI rom %s...\n", tmp);
rom = malloc(0x20000);
rom_size = load_ati_bios_file(tmp, rom, 0x20000);
if (rom_size > 0) {
verbose("Using ATI Video BIOS File %s (%d Bytes)\n", tmp, rom_size);
//Azi: if rom exists
if (rom_size > 0)
{
verbose("Using custom rom %s (%d Bytes)\n", tmp, rom_size);
if (rom_size > 0x10000) {
rom_size = 0x10000; //we dont need rest anyway;
rom_size = 0x10000; // we dont need the rest anyway;
//Azi:verbose("Trimmed %s to %d Bytes\n", tmp, rom_size);
}
} else {
printf("ERROR: unable to open ATI Video BIOS File %s\n", tmp);
}
else
{
printf("ERROR: unable to open custom ATI rom %s.\n", tmp);
}
}
if (rom_size == 0) {
if (boot_display) {// no custom rom
bios = NULL;// try to dump from legacy space, otherwise can result in 100% fan speed
} else {
if (rom_size == 0) //Azi: rom_size is still 0, user didn't enabled use of custom rom...
{//Azi: if card posted...
if (boot_display) { // no custom rom
bios = NULL; // try to dump from legacy space, otherwise can result in 100% fan speed
//bios = readAtomBIOS(ati_dev); //Azi: Wrong BIOS signature... returns 0 = NULL :-//
}
else
{
// readAtomBios result in bug on some cards (100% fan speed and black screen),
// not using it for posted card, reading from legacy space instead
// not using it for posted card, reading from legacy space instead - Azi: reminder***
bios = readAtomBIOS(ati_dev);
}
} else {
bios = rom;//going custom rom way
verbose("Using rom %s\n", tmp);
}
if (bios == NULL) {
else //Azi: rom_size is diff from 0, user enabled use of custom rom...
{
bios = rom; //going custom rom way //Azi: shouldn't this be bios = rom_size??*****
verbose("Using rom %s\n", tmp); //Azi: print just the path
}
if (bios == NULL) //Azi: card was posted (boot_display = 1)
{
bios = (uint8_t *)0x000C0000;
toFree = false;
verbose("Not going to use bios image file\n");
} else {
verbose("Card posted, not going to use custom bios?? rom.\n"); //Azi: what file? custom rom??
}
else //Azi: anything but NULL, card wasn't posted (boot_display = 0), bios = readAtomBIOS(ati_dev), bios = rom_size... whatever :P ufff...
{
toFree = true;
}
if (bios[0] == 0x55 && bios[1] == 0xaa) {
if (bios[0] == 0x55 && bios[1] == 0xaa) //Azi: check bios for 0xAA55 sig
{
verbose("Found bios image\n");
bios_size = bios[2] * 512;
rom_pci_header = (option_rom_pci_header_t*)(bios + bios[24] + bios[25]*256);
//Azi: Wrong pci header signature 558a1275 but still works!**** check later...
// ‘rom_header’ is used uninitialized in this function...
//rom_pci_header = (option_rom_pci_header_t *)((uint8_t *)rom_header + rom_header->pci_header_offset);
if (rom_pci_header->signature == 0x52494350) {
if (rom_pci_header->signature == 0x52494350) //Azi: ati pci header sig
{
if (rom_pci_header->device_id != ati_dev->device_id) {
verbose("Bios image (%x) doesnt match card (%x), ignoring\n", rom_pci_header->device_id, ati_dev->device_id);
} else {
if (toFree)
}
else
{
if (toFree) //Azi: card wasn't posted (boot_display = 0)
{
//Azi: mmio, Memory-mapped I/O - Kabyl's smbios patcher stuff reminder.
verbose("Adding binimage to card %x from mmio space with size %x\n", ati_dev->device_id, bios_size);
} else {
}
else //Azi: card was posted (boot_display = 1)
{
//Azi: check "legacy space/mmio" stuff again!!!***
verbose("Adding binimage to card %x from legacy space with size %x\n", ati_dev->device_id, bios_size);
}
//Azi: not all Mac's have this..!!
devprop_add_value(device, "ATY,bin_image", bios, bios_size);
}
} else {
}
else
{
// ATY,bin_image is not added... not all Mac's have this..!!
verbose("Wrong pci header signature %x\n", rom_pci_header->signature);
}
} else {
verbose("Bios image not found at %x, content %x %x\n", bios, bios[0], bios[1]);
}
if (toFree) {
else
{
verbose("Bios image not found at %x, content %x %x\n", bios, bios[0], bios[1]);
}
if (toFree) //Azi: card wasn't posted (boot_display = 0)
{
free(bios);
}
//Azi: see ati.c AMDge; i have no problems here with xcode 4 compilation ???
stringdata = malloc(sizeof(uint8_t) * string->length);
memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length);
stringlength = string->length;
branches/azimutz/Cleancut/i386/libsa/libsa.h
9393
9494
9595
96
96
9797
9898
9999
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 size_t 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);
branches/azimutz/Cleancut/i386/libsa/string.c
165165
166166
167167
168
168
169169
170170
171
172171
173172
174173
175
174
176175
177176
178177
return ret;
}
char *
size_t
strlcpy(char * s1, const char * s2, size_t n)
{
register char *ret = s1;
while (n && (*s1++ = *s2++))
n--;
if (!n) *--s1=0;
return ret;
return strlen(s2);
}
char *
branches/azimutz/Cleancut/i386/util/openUp.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
/*
* Copyright (c) 2001 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
*
* This 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 OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* Shantonu Sen <<EMAIL REMOVED>>
* openUp.c - program to set the "first-open-window" field of a volume
*
* Get the directory ID for the first argument, and set it as word 2
* of the Finder Info fields for the volume it lives on
*
* cc -o openUp openUp.c
* Usage: openUp /Volumes/Foo/OpenMe/
*
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/attr.h>
#include <sys/stat.h>
#include <sys/mount.h>
#include <memory.h>
struct directoryinfo {
long unsigned length;
uintptr_t dirid; // changed from: u_int32_t dirid;
};
struct volumeinfo {
long unsigned length;
uintptr_t finderinfo[8]; // changed from: u_int32_t finderinfo[8];
};
int main(int argc, char *argv[]) {
char *path = NULL;
struct attrlist alist;
struct directoryinfo dirinfo;
struct volumeinfo volinfo;
struct statfs sfs;
path = argv[1];
bzero(&alist, sizeof(alist));
alist.bitmapcount = 5;
alist.commonattr = ATTR_CMN_OBJID;
getattrlist(path, &alist, &dirinfo, sizeof(dirinfo), 0);
printf("directory id: %lu\n", dirinfo.dirid);
statfs(path, &sfs);
printf("mountpoint: %s\n", sfs.f_mntonname);
alist.commonattr = ATTR_CMN_FNDRINFO;
alist.volattr = ATTR_VOL_INFO;
getattrlist(sfs.f_mntonname, &alist, &volinfo, sizeof(volinfo), 0);
volinfo.finderinfo[2] = dirinfo.dirid;
setattrlist(sfs.f_mntonname, &alist, volinfo.finderinfo, sizeof(volinfo.finderinfo), 0);
return EXIT_SUCCESS;
}
branches/azimutz/Cleancut/i386/util/Cconfig
88
99
1010
11
12
13
14
15
16
17
18
When in doubt, say "Y".
source "i386/util/fdisk/Cconfig"
config OPENUP
bool "openUp utility"
default n
help
Say Y here if you want to compile the openUp utility.
openUp is used to set the "first-open-window" field of a volume.
When in doubt, say "N".
branches/azimutz/Cleancut/i386/util/Makefile
1717
1818
1919
20
20
2121
2222
2323
......
2525
2626
2727
28
29
30
31
32
33
2834
2935
3036
include ${SRCROOT}/Make.rules
PROGRAMS = machOconv dyldsymboltool
OBJECTS = dyldsymboltool.o32 dyldsymboltool.o64 machOconv.o32 machOconv.o64
OBJECTS = dyldsymboltool.o32 dyldsymboltool.o64 machOconv.o32 machOconv.o64
ifeq (${CONFIG_BDMESG}, y)
OBJECTS += bdmesg.o32 bdmesg.o64
endif
ifeq (${CONFIG_OPENUP}, y)
PROGRAMS += openUp
OBJECTS += openUp.o64 openUp.o32
endif
LDFLAGS := $(LDFALGS) -framework IOKit -framework CoreFoundation -mmacosx-version-min=10.5
SYMPROG = $(addprefix $(SYMROOT)/, $(PROGRAMS))
branches/azimutz/Cleancut/Make.rules
1616
1717
1818
19
20
21
19
20
2221
2322
24
25
26
2723
28
29
30
3124
3225
3326
......
7669
7770
7871
79
80
81
82
83
84
8572
8673
8774
8875
8976
90
91
92
93
94
95
96
9777
9878
9979
NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
# CFLAGS= -O $(MORECPP) -arch i386 -g
CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) $(MORECPP) -g -Wmost -Werror
CPPFLAGS = -fno-exceptions -fno-rtti
CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror
CPPFLAGS = $(MORECPP) -g -Wmost -Werror -fno-exceptions -fno-rtti
DEFINES=
CONFIG = hd
#LIBDIR = libsa
#INC = -I. -I$(LIBDIR)
#
# Common makefile targets.
#
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
#$(OBJROOT)/.s.o:
#@echo "\t[AS] $<"
#@cc $(CPPFLAGS) -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $<
# This breaks make, must use make all (FIXME)
$(OBJROOT)/boot2.o:
@echo "\t[AS] boot2.s"
@cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s \
-MD -dependency-file $*.d
@md -u $(OBJROOT)/Makedep -f -d $*.d
#$(OBJROOT)/boot_modules.o:
#@echo "\t[AS] boot_modules.s"
#@cc $(CPPFLAGS) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) $(SYMROOT)/boot_modules.s \
# -MD -dependency-file $*.d
#@md -u $(OBJROOT)/Makedep -f -d $*.d
$(OBJROOT)/%.o: %.s
@echo "\t[AS] $<"

Archive Download the corresponding diff file

Revision: 930