Chameleon

Chameleon Commit Details

Date:2012-05-03 23:13:23 (11 years 11 months ago)
Author:armel cadet-petit
Commit:1931
Parents: 1930
Message:First version of bundle modules.
Changes:
M/branches/cparm/i386/modules/HibernateEnabler/graphic_utils.c
M/branches/cparm/i386/libsaio/stringTable.c
M/branches/cparm/i386/modules/HibernateEnabler/resume.c
M/branches/cparm/i386/modules/HibernateEnabler/graphic_utils.h
M/branches/cparm/i386/modules/CPUfreq/Makefile
M/branches/cparm/i386/modules/GraphicsEnabler/nvidia.c
M/branches/cparm/i386/libsaio/Makefile
M/branches/cparm/i386/modules/GraphicsEnabler/ati.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/libsa/Makefile
M/branches/cparm/i386/boot2/graphics.h
M/branches/cparm/i386/modules/GraphicsEnabler/GraphicsEnabler.c
M/branches/cparm/i386/modules/SMBiosGetters/SMBiosGetters.c
M/branches/cparm/CHANGES
M/branches/cparm/i386/modules/NetbookInstaller/NBI.c
M/branches/cparm/i386/modules/Keymapper/Makefile
M/branches/cparm/xcode3_sym.zip
M/branches/cparm/i386/modules/Memory/spd.c
M/branches/cparm/i386/modules/Resolution/Makefile
M/branches/cparm/i386/libsaio/fake_efi.c
M/branches/cparm/i386/modules/Memory/spd.h
M/branches/cparm/i386/modules/ACPICodec/Makefile
M/branches/cparm/i386/modules/SMBiosPatcher/SMBiosPatcher.c
M/branches/cparm/i386/modules/HelloWorld/Makefile
M/branches/cparm/i386/modules/RamDiskLoader/ramdisk.c
M/branches/cparm/i386/modules/Networking/Networking.c
M/branches/cparm/i386/boot2/boot.c
M/branches/cparm/i386/modules/Memory/Memory.c
M/branches/cparm/i386/libsaio/modules.c
M/branches/cparm/i386/modules/Keymapper/Keylayout.c
M/branches/cparm/i386/modules/HibernateEnabler/Makefile
M/branches/cparm/i386/modules/SMBiosGetters/Makefile
M/branches/cparm/i386/libsaio/modules.h
M/branches/cparm/i386/libsaio/allocate.c
M/branches/cparm/i386/modules/SMBiosPatcher/Makefile
M/branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c
M/branches/cparm/i386/modules/Memory/Makefile
M/branches/cparm/i386/modules/YellowIconFixer/YellowIconFixer.c
M/branches/cparm/i386/libsaio/saio_internal.h
M/branches/cparm/i386/modules/Resolution/Resolution.c
M/branches/cparm/i386/boot2/options.c
M/branches/cparm/i386/modules/NetbookInstaller/Makefile
M/branches/cparm/i386/modules/GUI/GUI_module.c
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/HibernateEnabler/HibernateEnabler.c
M/branches/cparm/i386/modules/GraphicsEnabler/Makefile
M/branches/cparm/i386/libsaio/sys.c
M/branches/cparm/i386/modules/Keymapper/Keymapper.c
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/modules/USBFix/USBFix.c
M/branches/cparm/i386/modules/HPET/HPET.c
M/branches/cparm/i386/modules/HPET/hpet.h
M/branches/cparm/i386/modules/ACPIPatcher/AcpiPatcher.c
M/branches/cparm/i386/modules/GUI/gui.c
M/branches/cparm/i386/boot2/Makefile
M/branches/cparm/i386/modules/CPUfreq/CPUfreq.c
M/branches/cparm/i386/modules/KernelPatcher/kernel_patcher.c
M/branches/cparm/i386/modules/GUI/Makefile
M/branches/cparm/i386/modules/GUI/graphic_utils.c
M/branches/cparm/TODO
M/branches/cparm/i386/modules/KernelPatcher/Makefile
M/branches/cparm/i386/modules/ACPICodec/ACPICodec.c
M/branches/cparm/i386/modules/GUI/graphic_utils.h

File differences

branches/cparm/TODO
22
33
44
5
6
7
8
5
6
97
108
9
1110
11
1212
1313
1414
1515
1616
17
1817
1918
2019
====================================
- update cpu_intel_amd
- update project with corehash
- Implement the bundles
- split nvidia, gma and ati code into separate modules
- implement cpu topology
- Backport cconfig from the trunk
- move winfs, bsdfs, ext2fs, befs and lspci into modules
- Implement a Host like in bits to avoid some return issues
- update project with corehash
- Implement a pool allocator, so each module will run and allocate memory in there own pool, de-alloc all allocated memory by the module,
will be done simply by destroying the pool
- Try to sync our prf() with the apple/mach __doprnt() (in Xnu/osfmk/kern/printf.c) to normalize the formating in our printf, sprintf, etc ..., and facilitate bug fixes
- Implement a Host like in bits to avoid some return issues
- Implement snprintf to avoid buffer overflow in some case
branches/cparm/CHANGES
1
2
3
4
15
26
37
- Implemented the Runtime Bundles Modules
- Updated nvidia and ati device id
- Small security fixes
- Stability fixes
- Added mountain lion auto_installer compatibility
- Changed md5c.c to the Xnu's md5.c
branches/cparm/i386/libsaio/allocate.c
3232
3333
3434
35
3635
37
38
39
4036
41
4237
4338
4439
......
6257
6358
6459
65
60
6661
6762
6863
69
64
7065
7166
7267
73
68
7469
7570
7671
7772
78
73
7974
80
75
8176
8277
#define kPageSize 4096
#define RoundPage(x) ((((unsigned)(x)) + kPageSize - 1) & ~(kPageSize - 1))
#if UNUSED
long
AllocateMemoryRange(char * rangeName, long start, long length, long type)
#else
long
AllocateMemoryRange(char * rangeName, long start, long length)
#endif
{
char *nameBuf;
uint32_t *buffer;
AllocateKernelMemory( long inSize )
{
long addr;
if (gImageLastKernelAddr == 0)
{
gImageLastKernelAddr = RoundPage( bootArgs->kaddr +
bootArgs->ksize );
bootArgs->ksize );
}
addr = gImageLastKernelAddr;
gImageLastKernelAddr += RoundPage(inSize);
if ( gImageLastKernelAddr >= (KERNEL_ADDR + KERNEL_LEN) )
{
stop ("AllocateKernelMemory error");
}
bootArgs->ksize = gImageLastKernelAddr - bootArgs->kaddr;
return addr;
}
branches/cparm/i386/libsaio/Makefile
1414
1515
1616
17
18
19
17
2018
2119
2220
......
4139
4240
4341
44
42
4543
4644
4745
......
7169
7270
7371
72
73
74
7475
7576
7677
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -fno-stack-protector \
-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 \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float
-fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) -march=pentium4 -msse2 -msoft-float -ffreestanding -mpreferred-stack-boundary=2 -fno-align-functions -mfpmath=sse
DEFINES=
CONFIG = hd
cpu.o platform.o \
fake_efi.o \
device_inject.o pci_root.o \
convert.o acpi_tools.o smbios.o smp-imps.o uterror.o lzss.o
convert.o acpi_tools.o smbios.o uterror.o lzss.o
# example for AcpiCodec
#SAIO_OBJS += acpi_codec.o acpicode.o ACPICodec.o acpidecode.o
#CFLAGS += -DNO_HAIKU_SUPPORT # -256 bytes
SAIO_OBJS += befs.o
#CFLAGS += -DNO_SMP_SUPPORT
SAIO_OBJS += smp-imps.o
# Options disabled by default:
#CFLAGS += -DUFS_SUPPORT # +3616 bytes
branches/cparm/i386/libsaio/modules.c
22
33
44
5
6
7
8
9
10
11
512
613
714
......
2128
2229
2330
24
2531
2632
2733
34
2835
2936
3037
......
5259
5360
5461
62
5563
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
5695
57
58
59
96
6097
61
98
6299
63
64
65
66
67
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
68115
69
70
71
116
117
118
72119
120
121
73122
74123
124
125
126
127
75128
76129
130
77131
78
132
79133
80134
135
136
137
138
139
140
141
142
81143
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
82170
83
84
85
86
87
88
89
171
90172
91173
92
174
93175
94176
95177
96178
179
180
181
97182
183
98184
99185
100
186
101187
102
188
189
190
103191
104192
105193
106194
107195
108196
109
197
110198
111199
112200
113
114
201
202
203
204
205
206
207
208
209
115210
116
117
211
212
118213
214
215
216
217
218
219
220
119221
120222
121223
......
144246
145247
146248
249
250
147251
148
149
252
150253
151
254
152255
153
256
257
154258
259
155260
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
261
171262
172263
173264
174
265
175266
176267
177
268
178269
179
180
270
181271
182
183272
184273
185274
......
194283
195284
196285
197
286
198287
199288
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
289
290
218291
219292
220293
......
222295
223296
224297
225
298
226299
227300
228301
229
230
302
231303
232304
233305
......
351423
352424
353425
354
426
355427
356428
357
429
358430
359
431
360432
361433
362434
......
384456
385457
386458
387
459
388460
389461
390462
......
515587
516588
517589
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
590
591
548592
549
550
551
552
553
554
555
556
593
594
557595
558596
559597
......
578616
579617
580618
581
619
582620
583621
584622
......
605643
606644
607645
608
646
609647
610648
611649
......
898936
899937
900938
901
939
902940
903941
904942
......
950988
951989
952990
953
991
954992
955993
956994
......
9901028
9911029
9921030
993
1031
9941032
9951033
9961034
......
10041042
10051043
10061044
1007
1045
10081046
10091047
10101048
......
11551193
11561194
11571195
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
11981196
11991197
12001198
12011199
12021200
12031201
1204
1202
12051203
12061204
1207
1205
12081206
12091207
12101208
......
12181216
12191217
12201218
1221
1222
1219
1220
12231221
12241222
12251223
......
12401238
12411239
12421240
1243
1241
12441242
12451243
12461244
......
12531251
12541252
12551253
1256
1254
12571255
12581256
12591257
......
13791377
13801378
13811379
1382
1380
13831381
13841382
13851383
......
13891387
13901388
13911389
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
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
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
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
* Copyright 2010 Evan Lojewski. All rights reserved.
*
*/
/*
* Copyright 2012 Cadet-petit Armel <armelcadetpetit@gmail.com>. All rights reserved.
*
* Cleaned, Added (runtime) bundles module support, based on a dylib environement.
*
*/
#include "libsaio.h"
#include "bootstruct.h"
#include "modules.h"
unsigned long long textSection = 0;
moduleHook_t* moduleCallbacks = NULL;
moduleList_t* loadedModules = NULL;
symbolList_t* moduleSymbols = NULL;
unsigned int (*lookup_symbol)(const char*, int(*strcmp_callback)(const char*, const char*)) = NULL;
moduleHook_t* get_callback(const char* name);
static unsigned int load_module(char * name, char* module);
#if DEBUG_MODULES
VOID print_hook_list()
}
#endif
#if DYLIB_SUPPORT
typedef struct dylbList_t
{
char* dylib_name;
struct dylbList_t* next;
} dylbList_t;
dylbList_t* loadedDylib = NULL;
static EFI_STATUS is_system_loaded(void)
{
msglog("* Attempting to load system module\n");
if((UInt32)lookup_symbol != 0xFFFFFFFF)
{
#ifDEBUG_MODULES == 2
printf("System successfully Loaded.\n");
getc();
#endif
return EFI_SUCCESS;
}
#ifDEBUG_MODULES == 2
printf("Failed to load system module\n");
getc();
#endif
return EFI_LOAD_ERROR;
}
/*
* Initialize the module system by loading the Symbols.dylib module.
* Once loaded, locate the _lookup_symbol function so that internal
* symbols can be resolved.
* print out the information about the loaded module
*/
EFI_STATUS init_module_system(void)
static VOID add_dylib(const char* name)
{
msglog("* Attempting to load system module\n");
// Intialize module system
EFI_STATUS status = load_module(SYMBOLS_MODULE);
if((status == EFI_SUCCESS) || (status == EFI_ALREADY_STARTED)/*should never happen*/ )
dylbList_t* new_entry = malloc(sizeof(dylbList_t));
if (new_entry)
{
new_entry->next = loadedDylib;
loadedDylib = new_entry;
new_entry->dylib_name = (char*)name;
}
}
static EFI_STATUS is_dylib_loaded(const char* name)
{
dylbList_t* entry = loadedDylib;
while(entry)
{
lookup_symbol = (void*)lookup_all_symbols(SYMBOLS_MODULE,SYMBOL_LOOKUP_SYMBOL);
if((UInt32)lookup_symbol != 0xFFFFFFFF)
DBG("Comparing %s with %s\n", name, entry->dylib_name);
char *fullname = newStringWithFormat("%s.dylib",name);
if(fullname && ((strcmp(entry->dylib_name, name) == 0) || (strcmp(entry->dylib_name, fullname) == 0)))
{
free(fullname);
DBG("Located module %s\n", name);
return EFI_SUCCESS;
}
else
{
entry = entry->next;
}
}
DBG("Module %s not found\n", name);
return EFI_LOAD_ERROR;
return EFI_NOT_FOUND;
}
/*
* Load a dylib
*
* ex: load_dylib("/Extra/modules/", "AcpiCodec.dylib");
*/
VOID load_dylib(const char * dylib_path, const char * name)
{
void (*module_start)(void);
char *tmp = newStringWithFormat("%s%s",dylib_path, name);
if (!tmp) {
return;
}
char *dylib_name = newString(name);
if (!dylib_name) {
free(tmp);
return;
}
msglog("* Attempting to load module: %s\n", tmp);
module_start = (void*)load_module(dylib_name,tmp);
if(module_start && ( module_start != (void*)0xFFFFFFFF))
{
add_dylib(name);
module_start();
}
else
{
// failed to load or already loaded
free(tmp);
free(dylib_name);
}
}
/*
* Load all modules in the /Extra/modules/ directory
* Module depencdies will be loaded first
* MOdules will only be loaded once. When loaded a module must
* setup apropriete function calls and hooks as required.
* NOTE: To ensure a module loads after another you may
* link one module with the other. For dyld to allow this, you must
* reference at least one symbol within the module.
* Load all dylib in the /Extra/modules/ directory
*/
VOID load_all_modules(void)
VOID load_all_dylib(void)
{
char* name;
long flags;
long time;
if (is_system_loaded() != EFI_SUCCESS) return;
struct dirstuff* moduleDir = opendir("/Extra/modules/");
void (*module_start)(void);
while(readdir(moduleDir, (const char**)&name, &flags, &time) >= 0)
{
if ((strcmp(SYMBOLS_MODULE,name)) == 0) continue; // if we found Symbols.dylib, just skip it
if ((strcmp("Symbols.dylib",name)) == 0) continue; // if we found Symbols.dylib, just skip it
int len = strlen(name);
if (is_dylib_loaded(name) == EFI_SUCCESS) continue;
int len = strlen(name);
int ext_size = sizeof("dylib");
if (len >= ext_size)
{
if(strcmp(&name[len - ext_size], ".dylib") == 0)
{
char *tmp = newString(name);
char *tmp = newStringWithFormat("/Extra/modules/%s",name);
if (!tmp) {
continue;
}
msglog("* Attempting to load module: %s\n", tmp);
if(load_module(tmp) != EFI_SUCCESS)
char *dylib_name = newString(name);
if (!dylib_name) {
free(tmp);
continue;
}
msglog("* Attempting to load module: %s\n", tmp);
module_start = (void*)load_module(dylib_name,tmp);
if(module_start && ( module_start != (void*)0xFFFFFFFF))
{
// failed to load or already loaded
//free(tmp);
add_dylib(name);
module_start();
}
else
{
// failed to load or already loaded
free(tmp);
free(dylib_name);
}
}
#if DEBUG_MODULES
else
#endif
}
#endif
/*
* Load a module file in /Extra/modules
* TODO: verify version number of module
* Load a module file
*/
EFI_STATUS load_module(char* module)
static unsigned int load_module(char * name, char* module)
{
void (*module_start)(void) = NULL;
unsigned int module_start = 0xFFFFFFFF;
int fh = -1;
// Check to see if the module has already been loaded
if(is_module_loaded(module) == EFI_SUCCESS)
{
msglog("Module %s already registred\n", module);
return EFI_ALREADY_STARTED;
}
int fh = -1;
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);
fh = open(module);
if(fh < 0)
{
#if DEBUG_MODULES
DBG("Unable to locate module %s\n", modString);
DBG("Unable to locate module %s\n", module);
getc();
#else
msglog("Unable to locate module %s\n", modString);
msglog("Unable to locate module %s\n", module);
#endif
free(modString);
return EFI_OUT_OF_RESOURCES;
return 0xFFFFFFFF;
}
EFI_STATUS ret = EFI_SUCCESS;
{
int moduleSize = file_size(fh);
if (module_base && read(fh, module_base, moduleSize) == moduleSize)
{
DBG("Module %s read in.\n", modString);
DBG("Module %s read in.\n", module);
// Module loaded into memory, parse it
module_start = parse_mach(module, module_base, &load_module, &add_symbol);
if(module_start && (module_start != (void*)0xFFFFFFFF))
{
module_loaded(module);
// Notify the system that it was laoded
(*module_start)();// Start the module
msglog("%s successfully Loaded.\n", module);
}
else
{
// The module does not have a valid start function
printf("Unable to start %s\n", module);
ret = EFI_NOT_STARTED;
#if DEBUG_MODULES
getc();
#endif
}
module_start = parse_mach(name, module_base, &add_symbol);
}
else
{
#if DEBUG_MODULES
getc();
#endif
ret = EFI_LOAD_ERROR;
module_start = 0xFFFFFFFF;
}
}
close(fh);
free(modString);
return ret;
return module_start;
}
moduleHook_t* get_callback(const char* name)
* symbols will still be available (TODO: fix this). This should not
* happen as all dependencies are verified before the sybols are read in.
*/
void* parse_mach(char *module, void* binary, EFI_STATUS(*dylib_loader)(char*), long long(*symbol_handler)(char*, char*, long long, char))// TODO: add param to specify valid archs
unsigned int parse_mach(char *module, void* binary, long long(*symbol_handler)(char*, char*, long long, char))// TODO: add param to specify valid archs
{
char is64 = false;
void (*module_start)(void) = NULL;
unsigned int module_start = 0xFFFFFFFF;
EFI_STATUS bind_status = EFI_SUCCESS;
// TODO convert all of the structs to a union
struct dyld_info_command* dyldInfoCommand = NULL;
struct symtab_command* symtabCommand = NULL;
{
printf("Modules: Invalid mach magic\n");
getc();
return NULL;
return 0xFFFFFFFF;
}
case LC_LOAD_DYLIB:
case LC_LOAD_WEAK_DYLIB ^ LC_REQ_DYLD:
{
struct dylib_command* dylibCommand = binary + binaryIndex;
char* weak_module = binary + binaryIndex + ((UInt32)*((UInt32*)&dylibCommand->dylib.name));
char *name=NULL;
name = newStringWithFormat( "%s.dylib", weak_module);
if (!name) {
printf("Unable to allocate module name : %s\n", weak_module);
return NULL;
}
if(dylib_loader)
{
EFI_STATUS statue = dylib_loader(weak_module);
if( statue != EFI_SUCCESS)
{
if (statue != EFI_ALREADY_STARTED)
{
// Unable to load dependancy
//free(weak_module);
return NULL;
}
}
}
//free(weak_module);
break;
}
break;
case LC_ID_DYLIB:
{
/*struct dylib_command* dylibCommand = binary + binaryIndex;
moduleName =binary + binaryIndex + ((UInt32)*((UInt32*)&dylibCommand->dylib.name));
moduleVersion =dylibCommand->dylib.current_version;
moduleCompat =dylibCommand->dylib.compatibility_version;
*/
}
break;
break;
case LC_DYLD_INFO:
// Bind and rebase info is stored here
}
// bind_macho uses the symbols.
module_start = (void*)handle_symtable(module, (UInt32)binary, symtabCommand, symbol_handler, is64);
module_start = handle_symtable(module, (UInt32)binary, symtabCommand, symbol_handler, is64);
// Rebase the module before binding it.
if(dyldInfoCommand && dyldInfoCommand->rebase_off)
}
if (bind_status != EFI_SUCCESS) {
module_start = (void*)0xFFFFFFFF;
module_start = 0xFFFFFFFF;
}
return module_start;
#if DEBUG_MODULES==2
DBG("BIND_OPCODE_SET_ADDEND_SLEB: %d\n", addend);
#endif
break;
case BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB:
#if DEBUG_MODULES==2
DBG("BIND_OPCODE_ADD_ADDR_ULEB: 0x%X\n", segmentAddress);
#endif
break;
case BIND_OPCODE_DO_BIND:
}
while(bind_stream[i] & 0x80);
if(symbolAddr != 0xFFFFFFFF)
{
address = segmentAddress + (UInt32)base;
goto error;
}
segmentAddress += tmp + sizeof(void*);
}
/*
* print out the information about the loaded module
*/
VOID module_loaded(const char* name)
{
moduleList_t* new_entry = malloc(sizeof(moduleList_t));
if (new_entry)
{
new_entry->next = loadedModules;
loadedModules = new_entry;
new_entry->module = (char*)name;
}
}
EFI_STATUS is_module_loaded(const char* name)
{
moduleList_t* entry = loadedModules;
while(entry)
{
DBG("Comparing %s with %s\n", name, entry->module);
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;
}
else
{
entry = entry->next;
}
}
DBG("Module %s not found\n", name);
return EFI_NOT_FOUND;
}
// Look for symbols using the Smbols moduel function.
// If non are found, look through the list of module symbols
unsigned int lookup_all_symbols(const char* module, const char* name)
{
unsigned int addr = 0xFFFFFFFF;
do {
if ((module != NULL) && (strcmp(module,SYMBOLS_MODULE) != 0))
if ((module != NULL) && (strcmp(module,SYMBOLS_BUNDLE) != 0))
break;
if(lookup_symbol && (UInt32)lookup_symbol != 0xFFFFFFFF)
}
} while (0);
{
symbolList_t* entry = moduleSymbols;
while(entry)
{
entry = entry->next;
}
}
}
#endif
out:
return addr;
}
EFI_STATUS replace_system_function(const char* symbol, void* newAddress)
{
return replace_function(SYMBOLS_MODULE,symbol,newAddress);
return replace_function(SYMBOLS_BUNDLE,symbol,newAddress);
}
return replace_function(NULL,symbol,newAddress);
}
/*
* Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* Source License Version 2.0 (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.
*
* 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 OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/*
* drivers.c - Driver Loading Functions.
*
* Copyright (c) 2000 Apple Computer, Inc.
*
* DRI: Josh de Cesare
*/
/*
* Copyright 2012 Cadet-petit Armel <armelcadetpetit@gmail.com>. All rights reserved.
*
* Cleaned, Added (runtime) bundles support.
*
*/
#include <mach-o/fat.h>
#include <libkern/OSByteOrder.h>
#include <mach/machine.h>
#include "sl.h"
#include "xml.h"
struct Module {
struct Module *nextModule;
long willLoad;
TagPtr dict;
TagPtr personalities;
char *plistAddr;
long plistLength;
char *executablePath;
char *bundlePath;
long bundlePathLength;
};
typedef struct Module Module, *ModulePtr;
enum {
kCFBundleType2,
kCFBundleType3
};
enum {
BundlePriorityNull = 0,
BundlePriorityInit = 1,
BundlePrioritySystem = 2,
BundlePrioritySystemLib = 3,
BundlePriorityNormalPriority = 4,
BundlePriorityLowestPriority = 99,
BundlePriorityEnd = 100 // can not be assigned
};
static ModulePtr gModuleHead;
static char * gModulesSpec;
static char * gDriverSpec;
static char * gFileSpec;
static char * gTempSpec;
static char * gFileName;
static int gLowestLoadPriority;
static long ParseXML(char *buffer, ModulePtr *module);
static ModulePtr FindBundle( char * bundle_id );
static void
FreeBundleSupport( void )
{
if ( gModulesSpec ) free(gModulesSpec);
if ( gDriverSpec) free(gDriverSpec);
if ( gFileSpec ) free(gFileSpec);
if ( gTempSpec ) free(gTempSpec);
if ( gFileName ) free(gFileName);
}
//==========================================================================
// InitBundleSupport
long
InitBundleSupport( void )
{
DBG("InitBundleSupport\n");
static bool BundleSet = false;
if (BundleSet == true) return 0;
gModulesSpec = malloc( 4096 );
gDriverSpec = malloc( 4096 );
gFileSpec = malloc( 4096 );
gTempSpec = malloc( 4096 );
gFileName = malloc( 4096 );
if ( !gModulesSpec || !gDriverSpec || !gFileSpec || !gTempSpec || !gFileName )
goto error;
BundleSet = true;
return 0;
error:
FreeBundleSupport();
return 1;
}
//==========================================================================
// LoadBundles
long LoadBundles( char * dirSpec )
{
DBG("LoadBundles\n");
if ( InitBundleSupport() != 0 )
return 1;
strlcpy(gModulesSpec, dirSpec, 4096);
strlcat(gModulesSpec, "Modules", 4096 - 1);
FileLoadBundles(gModulesSpec, 0);
MatchBundlesLibraries();
LoadMatchedBundles();
DBG("LoadBundles Finished\n");
return 0;
}
//==========================================================================
// FileLoadBundles
long
FileLoadBundles( char * dirSpec, long plugin )
{
long ret, length, flags, time, bundleType;
long long index;
long result = -1;
const char * name;
DBG("FileLoadBundles in %s\n",dirSpec);
index = 0;
while (1) {
ret = GetDirEntry(dirSpec, &index, &name, &flags, &time);
if (ret == -1) break;
// Make sure this is a directory.
if ((flags & kFileTypeMask) != kFileTypeDirectory) continue;
// Make sure this is a kext.
length = strlen(name);
if (strcmp(name + length - 7, ".bundle")) continue;
// Save the file name.
strlcpy(gFileName, name, 4096);
DBG("Load Bundles %s\n",gFileName);
// Determine the bundle type.
sprintf(gTempSpec, "%s/%s", dirSpec, gFileName);
ret = GetFileInfo(gTempSpec, "Contents", &flags, &time);
if (ret == 0) bundleType = kCFBundleType2;
else bundleType = kCFBundleType3;
DBG("Bundles type = %d\n",bundleType);
if (!plugin)
sprintf(gDriverSpec, "%s/%s/%sPlugIns", dirSpec, gFileName,
(bundleType == kCFBundleType2) ? "Contents/" : "");
ret = LoadBundlePList( dirSpec, gFileName, bundleType);
if (result != 0)
result = ret;
if (!plugin)
FileLoadBundles(gDriverSpec, 1);
}
return result;
}
static void add_bundle(ModulePtr module,char* name)
{
ModulePtr new_entry= malloc(sizeof(Module));
DBG("Adding bundle %s \n", name );
if (new_entry)
{
new_entry->nextModule = gModuleHead;
gModuleHead = new_entry;
new_entry->executablePath = module->executablePath;
new_entry->bundlePath = module->bundlePath;
new_entry->bundlePathLength = module->bundlePathLength;
new_entry->plistAddr = module->plistAddr;
new_entry->willLoad = module->willLoad;
new_entry->dict = module->dict;
new_entry->plistLength = module->plistLength;
new_entry->personalities = module->personalities;
}
}
//==========================================================================
// LoadBundlePList
long
LoadBundlePList( char * dirSpec, char * name, long bundleType )
{
long length, executablePathLength, bundlePathLength;
ModulePtr module = 0;
char * buffer = 0;
char * tmpExecutablePath = 0;
char * tmpBundlePath = 0;
long ret = -1;
DBG("LoadBundlePList\n");
do {
// Save the driver path.
sprintf(gFileSpec, "%s/%s/%s", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/MacOS/" : "");
executablePathLength = strlen(gFileSpec) + 1;
tmpExecutablePath = malloc(executablePathLength);
if (tmpExecutablePath == 0) break;
strlcpy(tmpExecutablePath, gFileSpec, executablePathLength);
sprintf(gFileSpec, "%s/%s", dirSpec, name);
bundlePathLength = strlen(gFileSpec) + 1;
tmpBundlePath = malloc(bundlePathLength);
if (tmpBundlePath == 0) break;
strlcpy(tmpBundlePath, gFileSpec, bundlePathLength);
// Construct the file spec to the plist, then load it.
sprintf(gFileSpec, "%s/%s/%sInfo.plist", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/" : "");
DBG("Loading Bundle PList %s\n",gFileSpec);
length = LoadFile(gFileSpec);
if (length == -1) break;
length = length + 1;
buffer = malloc(length);
if (buffer == 0) break;
strlcpy(buffer, (char *)kLoadAddr, length);
// Parse the plist.
ret = ParseXML(buffer, &module);
if (ret != 0 ) { printf("Unable to read plist of %s",name); break; }
if (!module) break; // Should never happen but it will make the compiler happy
// Allocate memory for the driver path and the plist.
module->executablePath = tmpExecutablePath;
module->bundlePath = tmpBundlePath;
module->bundlePathLength = bundlePathLength;
module->plistAddr = malloc(length);
if ((module->executablePath == 0) || (module->bundlePath == 0) || (module->plistAddr == 0))
{
if ( module->plistAddr ) free(module->plistAddr);
ret = -1;
break;
}
// Add the plist to the module.
strlcpy(module->plistAddr, (char *)kLoadAddr, length);
module->plistLength = length;
// Add the module to the module list.
add_bundle(module, name);
ret = 0;
}
while (0);
if ( buffer ) free( buffer );
if ( module ) free( module );
if (ret != 0) {
if ( tmpExecutablePath ) free( tmpExecutablePath );
if ( tmpBundlePath ) free( tmpBundlePath );
}
return ret;
}
#define WillLoadBundles \
module = gModuleHead; \
while (module != NULL) \
{ \
if (module->willLoad == willLoad) \
{ \
prop = XMLGetProperty(module->dict, kPropCFBundleExecutable); \
\
if (prop != 0) \
{ \
fileName = prop->string; \
sprintf(gFileSpec, "%s%s", module->executablePath, fileName); \
\
module_start = (void*)load_module((char*)fileName,gFileSpec); \
if(!module_start || (*module_start == (void*)0xFFFFFFFF)) \
{ \
if (module->willLoad > BundlePrioritySystemLib) \
{ \
module->willLoad = BundlePriorityNull ; \
printf("Unable to start %s\n", gFileSpec); \
} \
} else module_start(); \
if (module->willLoad == BundlePrioritySystem) \
{ \
lookup_symbol = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,SYMBOL_LOOKUP_SYMBOL); \
if((UInt32)lookup_symbol != 0xFFFFFFFF) \
{ \
msglog("%s successfully Loaded.\n", gFileSpec); \
} else return -1; \
} \
} \
} \
module = module->nextModule; \
}
//==========================================================================
// LoadMatchedBundles
long LoadMatchedBundles( void )
{
TagPtr prop;
ModulePtr module;
char *fileName;
void (*module_start)(void);
long willLoad;
DBG("LoadMatchedBundles\n");
int priority_end = MIN(gLowestLoadPriority+1, BundlePriorityEnd);
for (willLoad = BundlePrioritySystem; willLoad < priority_end ; willLoad++)
{
WillLoadBundles ;
}
return 0;
}
//==========================================================================
// MatchBundlesLibraries
long MatchBundlesLibraries( void )
{
TagPtr prop, prop2;
ModulePtr module, module2,dummy_module;
// Check for active modules with the same Bundle IDs or same principal class, only one must remain (except for type 3 aka system libs)
{
module = gModuleHead;
while (module != 0)
{
if (!(module->willLoad > BundlePriorityInit)) // if the module load priority is not higher than initialized, continue
{
module = module->nextModule;
continue;
}
prop = XMLGetProperty(module->dict, kPropNSPrincipalClass);
prop2 = XMLGetProperty(module->dict, kPropCFBundleIdentifier);
if (prop != 0 && prop2 != 0)
{
module2 = gModuleHead;
TagPtr prop3,prop4;
while (module2 != 0)
{
prop3 = XMLGetProperty(module2->dict, kPropNSPrincipalClass);
prop4 = XMLGetProperty(module2->dict, kPropCFBundleIdentifier);
if ((prop3 != 0) && (prop4 != 0) && (module != module2))
{
if ((module2->willLoad == BundlePrioritySystemLib) && ((strcmp(prop2->string, prop4->string)!= 0) /*&& (!strcmp(prop->string, prop3->string))*/)) {
continue;
}
if ((!strcmp(prop2->string, prop4->string)) || (!strcmp(prop->string, prop3->string))) {
if (module2->willLoad > BundlePriorityNull) module2->willLoad = BundlePriorityNull;
}
}
module2 = module2->nextModule;
}
}
module = module->nextModule;
}
}
// Check for dependencies (it works in most cases, still a little buggy but should be sufficient for what we have to do,
// clearly the Achilles' heel of this implementation, please use dependencies with caution !!!)
dummy_module = gModuleHead;
while (dummy_module != 0)
{
module = gModuleHead;
while (module != 0)
{
if (module->willLoad > BundlePrioritySystemLib)
{
prop = XMLGetProperty(module->dict, kPropOSBundleLibraries);
if (prop != 0)
{
prop = prop->tag;
while (prop != 0)
{
module2 = gModuleHead;
while (module2 != 0)
{
prop2 = XMLGetProperty(module2->dict, kPropCFBundleIdentifier);
if ((prop2 != 0) && (!strncmp(prop->string, prop2->string, strlen( prop->string))))
{
// found a parent
if (module2->willLoad > BundlePriorityInit)
{
// parent is active
if (module->willLoad == BundlePriorityNull) {
module->willLoad = BundlePriorityNormalPriority;
}
// Check if the version of the parent >= version of the child
if (strtol(XMLCastString ( XMLGetProperty(module2->dict,"CFBundleShortVersionString") ), NULL, 10) >= strtol(XMLCastString( prop->tag ), NULL, 10)) {
if ((module2->willLoad >= module->willLoad) && (module->willLoad > BundlePrioritySystemLib))
module->willLoad = MIN(MAX(module->willLoad, module2->willLoad+1), BundlePriorityLowestPriority); // child must be loaded after the parent, this allow the to find symbols of the parent while we bind the child.
} else {
module->willLoad = BundlePriorityNull;
goto nextmodule;
}
break;
}
}
if (module->willLoad != BundlePriorityNull) module->willLoad = BundlePriorityNull;
module2 = module2->nextModule;
}
if (module->willLoad == BundlePriorityNull) goto nextmodule;
prop = prop->tagNext;
}
}
}
nextmodule:
module = module->nextModule;
}
dummy_module = dummy_module->nextModule;
}
// Get the lowest load priority
{
gLowestLoadPriority = BundlePriorityNormalPriority;
module = gModuleHead;
while (module != 0)
{
if (module->willLoad > BundlePriorityInit)
{
gLowestLoadPriority = MIN(module->willLoad, BundlePriorityLowestPriority);
}
module = module->nextModule;
}
}
return 0;
}
//==========================================================================
// FindBundle
static ModulePtr
FindBundle( char * bundle_id )
{
ModulePtr module;
TagPtr prop;
DBG("FindBundle %s\n",bundle_id);
module = gModuleHead;
while (module != 0)
{
prop = XMLGetProperty(module->dict, kPropCFBundleIdentifier);
if ((prop != 0) && !strcmp(bundle_id, prop->string)) break;
module = module->nextModule;
}
return module;
}
//==========================================================================
// GetBundleDict
void *
GetBundleDict( char * bundle_id )
{
ModulePtr module;
DBG("GetBundleDict %s\n",bundle_id);
module = FindBundle( bundle_id );
if (module != 0)
{
return (void *)module->dict;
}
return 0;
}
//==========================================================================
// GetBundlePersonality
void *
GetBundlePersonality( char * bundle_id )
{
ModulePtr module;
DBG("GetBundlePersonalities %s\n",bundle_id);
module = FindBundle( bundle_id );
if (module != 0)
{
return (void *)module->personalities;
}
return 0;
}
//==========================================================================
// GetBundlePath
char *
GetBundlePath( char * bundle_id )
{
ModulePtr module;
DBG("GetBundlePath %s\n",bundle_id);
module = FindBundle( bundle_id );
if (module != 0)
{
return module->bundlePath;
}
return 0;
}
//==========================================================================
// ParseXML
static long
ParseXML( char * buffer, ModulePtr * module )
{
long length, pos;
TagPtr moduleDict, prop;
ModulePtr tmpModule;
pos = 0;
DBG("ParseXML\n");
if (!module) {
return -1;
}
while (1)
{
length = XMLParseNextTag(buffer + pos, &moduleDict);
if (length == -1) break;
pos += length;
if (moduleDict == 0) continue;
if (moduleDict->type == kTagTypeDict) break;
XMLFreeTag(moduleDict);
}
if (length == -1)
{
return -1;
}
tmpModule = malloc(sizeof(Module));
if (tmpModule == 0)
{
XMLFreeTag(moduleDict);
return -1;
}
tmpModule->dict = moduleDict;
do {
prop = XMLGetProperty(moduleDict, kPropOSBundleEnabled);
if ((prop != 0) && prop->string)
{
if ( (strlen(prop->string) >= 1) && (prop->string[0] == 'N' || prop->string[0] == 'n') )
{
tmpModule->willLoad = 0;
break;
}
}
prop = XMLGetProperty(moduleDict, kPropNSPrincipalClass);
if ((prop != 0) && prop->string)
{
if (!strcmp(prop->string,SYSLIB_CLASS))
{
tmpModule->willLoad = BundlePrioritySystemLib;
break;
}
if (!strcmp(prop->string,SYS_CLASS))
{
tmpModule->willLoad = BundlePrioritySystem;
break;
}
}
prop = XMLGetProperty(moduleDict, kPropOSBundlePriority);
if ((prop != 0) && prop->string)
{
int tmpwillLoad;
if ((tmpwillLoad = strtoul(prop->string, NULL, 10)) > BundlePrioritySystemLib )
{
tmpModule->willLoad = MIN(tmpwillLoad, BundlePriorityLowestPriority);
break;
}
}
tmpModule->willLoad = BundlePriorityNormalPriority;
} while (0);
// Get the personalities.
tmpModule->personalities = XMLGetProperty(moduleDict, kPropIOKitPersonalities);
*module = tmpModule;
return 0;
}
branches/cparm/i386/libsaio/modules.h
44
55
66
7
8
9
10
11
12
13
714
815
916
......
2734
2835
2936
30
31
32
33
34
35
36
3737
3838
3939
......
4747
4848
4949
50
50
5151
5252
5353
......
5656
5757
5858
59
60
59
60
6161
62
63
64
6265
6366
6467
......
7780
7881
7982
80
81
82
83
84
8583
8684
87
85
8886
8987
9088
......
107105
108106
109107
110
108
111109
112110
113111
*
*/
/*
* Copyright 2012 Cadet-petit Armel <armelcadetpetit@gmail.com>. All rights reserved.
*
* Cleaned, Added bundles support.
*
*/
// There is a bug with the module system / rebasing / binding
// that causes static variables to be incorrectly rebased or bound
// Disable static variables for the moment
struct symbolList_t* next;
} symbolList_t;
typedef struct moduleList_t
{
char* module;
//struct moduleHook_t* hook_list;
struct moduleList_t* next;
} moduleList_t;
typedef struct callbackList_t
{
void(*callback)(void*, void*, void*, void*, void*, void*);
struct moduleHook_t* next;
} moduleHook_t;
#define SYMBOLS_MODULE "Symbols.dylib"
#define SYMBOLS_BUNDLE "Symbols"
#define SYMBOL_DYLD_STUB_BINDER"dyld_stub_binder"
#define SYMBOL_LOOKUP_SYMBOL"_lookup_symbol"
#define SECT_NON_LAZY_SYMBOL_PTR"__nl_symbol_ptr"
#define SECT_SYMBOL_STUBS"__symbol_stub"
EFI_STATUS init_module_system(void);
VOID load_all_modules(void);
#define SYS_CLASS "SYMS"
#define SYSLIB_CLASS "SYS_LIB"
#define BundleHighPriority "high"
#define BundleNormalPriority "normal"
#define BundleLowPriority "low"
/*
* Modules Interface
* execute_hook
void rebase_macho(void* base, char* rebase_stream, UInt32 size);
EFI_STATUS bind_macho(char* module, void* base, char* bind_stream, UInt32 size);
EFI_STATUS load_module(char* module);
EFI_STATUS is_module_loaded(const char* name);
VOID module_loaded(const char* name);
long long add_symbol(char* module,char* symbol, long long addr, char is64);
void* parse_mach(char *module, void* binary, EFI_STATUS(*dylib_loader)(char*), long long(*symbol_handler)(char*, char*, long long, char));
unsigned int parse_mach(char *module, void* binary, long long(*symbol_handler)(char*, char*, long long, char));
unsigned int handle_symtable(char *module, UInt32 base,
struct symtab_command* symtabCommand,
long MatchBundlesLibraries(void);
long LoadBundles( char * dirSpec );
void * GetBundleDict( char * bundle_id );
void * GetBundlePersonalities( char * bundle_id );
void * GetBundlePersonality( char * bundle_id );
char * GetBundlePath( char * bundle_id );
#endif /* __BOOT_MODULES_H */
branches/cparm/i386/libsaio/sys.c
119119
120120
121121
122
123
124
122
125123
126
127124
128125
129126
......
383380
384381
385382
386
387
388
383
389384
390
391385
392386
393387
......
423417
424418
425419
426
427
428
420
429421
430
431422
432423
433424
434425
435426
436427
437
438
439
428
440429
441
442430
443431
444432
445433
446
447
448
434
449435
450
451436
452437
453438
......
486471
487472
488473
489
490
491
474
492475
493
494476
495477
496478
......
811793
812794
813795
814
815
816
796
817797
818
819798
820799
821800
......
848827
849828
850829
851
830
852831
853832
854833
......
918897
919898
920899
921
900
922901
923902
924903
static BVRef newBootVolumeRef( int biosdev, int partno );
static int GetFreeFd(void);
static struct iob * iob_from_fdesc(int fdesc);
#if UNUSED
static int open_bvr(BVRef bvr, const char *filePath, int flags);
#else
static int open_bvr(BVRef bvr, const char *filePath);
#endif
//==========================================================================
// LoadVolumeFile - LOW-LEVEL FILESYSTEM FUNCTION.
//==========================================================================
// open() - Open the file specified by 'path' for reading.
#if UNUSED
static int open_bvr(BVRef bvr, const char *filePath, int flags)
#else
static int open_bvr(BVRef bvr, const char *filePath)
#endif
{
struct iob*io;
intfdesc;
return fdesc;
}
#if UNUSED
int open(const char *path, int flags)
#else
int open(const char *path)
#endif
{
const char*filepath;
BVRefbvr;
// Resolve the boot volume from the file spec.
if ((bvr = getBootVolumeRef(path, &filepath)) != NULL) {
#if UNUSED
return open_bvr(bvr, filepath, flags);
#else
return open_bvr(bvr, filepath);
#endif
}
return -1;
}
#if UNUSED
int open_bvdev(const char *bvd, const char *path, int flags)
#else
int open_bvdev(const char *bvd, const char *path)
#endif
{
const struct devsw*dp;
const char*cp;
}
}
bvr = newBootVolumeRef(dp->biosdev + unit, partition);
#if UNUSED
return open_bvr(bvr, path, flags);
#else
return open_bvr(bvr, path);
#endif
}
}
return -1;
}
//==========================================================================
#if UNUSED
void scanDisks(int biosdev, int *count)
#else
void scanDisks(void)
#endif
{
#define MAX_HDD_COUNT 32
int bvCount;
if (chain->filtered) filteredChain = true;
int gBIOSDev = (int)get_env(envgBIOSDev);
#if UNUSED
if (multiboot_partition_set)
for (bvr = chain; bvr < (BVRef)ULONG_MAX; bvr = bvr->next) {
}
}
}
/*
* Use the standrad method for selecting the boot volume.
*/
branches/cparm/i386/libsaio/stringTable.c
539539
540540
541541
542
543
544
545
546
547
542548
543549
544550
*size = overrideSize;
return true;
}
else if (getValueForConfigTableKey(&bootInfo->bootConfig, key, &overrideVal, &overrideSize) && overrideSize)
{
*val = overrideVal;
*size = overrideSize;
return true;
}
}
return ret;
branches/cparm/i386/libsaio/fake_efi.c
2020
2121
2222
23
24
2325
26
2427
2528
2629
......
8790
8891
8992
90
93
9194
9295
9396
......
106109
107110
108111
109
112
110113
111114
112115
......
137140
138141
139142
143
140144
141145
142146
143147
148
149
144150
145151
146152
147153
148154
155
156
149157
158
150159
151160
152161
......
295304
296305
297306
307
298308
299309
300310
301311
312
302313
303314
304315
......
710721
711722
712723
713
714
715
716
724
717725
718726
719
720727
721728
722729
723730
724731
725732
726
727
728
733
729734
730
735
731736
732737
733738
......
991996
992997
993998
994
999
9951000
9961001
9971002
......
10121017
10131018
10141019
1015
1020
10161021
10171022
10181023
#include "sl.h"
#include "modules.h"
#include "vers.h"
#ifndef NO_SMP_SUPPORT
#include "smp-imps.h"
#endif
#ifndef DEBUG_EFI
#define DEBUG_EFI 0
#endif
return NULL;
}
efi_guid_unparse_upper(pGuid, string);
return string;
}
/* Info About the current Firmware */
#define FIRMWARE_MAINTENER "cparm, armelcadetpetit@gmail.com"
static EFI_CHAR16 const FIRMWARE_NAME[] = {'C','u','p','e','r','t','i','n','o', 0};
static EFI_CHAR16 const FIRMWARE_NAME[] = {'M','a','s','h','e','r','b','r','u','m','-','2', 0};
static EFI_UINT32 const FIRMWARE_REVISION = 0x00010800; //1.8
static EFI_UINT32 const DEVICE_SUPPORTED = 0x00000001;
0x8868e871, 0xe4f1, 0x11d3, { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \
}
#ifndef NO_SMP_SUPPORT
#define EFI_MPS_TABLE_GUID \
{ \
0xeb9d2d2f,0x2d88,0x11d3,{0x9a,0x16,0x0,0x90,0x27,0x3f,0xc1,0x4d} \
}
#endif
/* From Foundation/Efi/Guid/Smbios/SmBios.c */
EFI_GUID constgEfiSmbiosTableGuid = EFI_SMBIOS_TABLE_GUID;
EFI_GUID gEfiAcpiTableGuid = EFI_ACPI_TABLE_GUID;
EFI_GUID gEfiAcpi20TableGuid = EFI_ACPI_20_TABLE_GUID;
#ifndef NO_SMP_SUPPORT
EFI_GUID gEfiMpsTableGuid = EFI_MPS_TABLE_GUID;
#endif
EFI_UINT32 gNumTables32 = 0;
EFI_UINT64 gNumTables64 = 0;
{
sprintf(id, "%s", "RSD2");
}
#ifndef NO_SMP_SUPPORT
else if (memcmp(&Guid, &gEfiMpsTableGuid, sizeof(EFI_GUID)) == 0)
{
sprintf(id, "%s", "_MP_");
}
#endif
msglog("table [%d]:%s , 32Bit addr : 0x%x\n",i,id,table);
size = sizeof(appleClut8);
long clut = AllocateKernelMemory(size);
bcopy(&appleClut8, (void*)clut, size);
#if UNUSED
AllocateMemoryRange( "BootCLUT", clut, size,-1);
#else
AllocateMemoryRange( "BootCLUT", clut, size);
#endif
}
{
#include "failedboot.h"
size = 32 + kFailedBootWidth * kFailedBootHeight;
long bootPict = AllocateKernelMemory(size);
#if UNUSED
AllocateMemoryRange( "Pict-FailedBoot", bootPict, size,-1);
#else
AllocateMemoryRange( "Pict-FailedBoot", bootPict, size);
#endif
((boot_progress_element *)bootPict)->width = kFailedBootWidth;
((boot_progress_element *)bootPict)->height = kFailedBootHeight;
((boot_progress_element *)bootPict)->yOffset = kFailedBootOffset;
{
if (smbios_p)
addConfigurationTable(&gEfiSmbiosTableGuid, &smbios_p, NULL);
#ifndef NO_SMP_SUPPORT
if (get_env(envVendor) == CPUID_VENDOR_INTEL )
{
int num_cpus;
}
#endif
}
#endif
// PM_Model
if (get_env(envIsServer))
{
branches/cparm/i386/libsaio/saio_internal.h
159159
160160
161161
162
162
163163
164
165
166
167164
168
165
169166
170167
171168
......
254251
255252
256253
257
258
259
254
260255
261
262
263
264
265256
266
257
267258
268259
269260
......
281272
282273
283274
284
285
286
275
287276
288
277
289278
290279
291280
/* memory.c */
long AllocateKernelMemory( long inSize );
#if UNUSED
long
AllocateMemoryRange(char * rangeName, long start, long length, long type);
#else
long
AllocateMemoryRange(char * rangeName, long start, long length);
#endif
/* misc.c */
extern void enableA20(void);
extern void turnOffFloppy(void);
extern long GetFSUUID(char *spec, char *uuidStr);
extern long CreateUUIDString(uint8_t uubytes[], int nbytes, char *uuidStr);
extern int openmem(char *buf, int len);
#if UNUSED
extern int open(const char *path, int flags);
#else
extern int open(const char *path);
#endif
#if UNUSED
extern int open_bvdev(const char *bvd, const char *path, int flags);
#else
extern int open_bvdev(const char *bvd, const char *path);
#endif
extern int close(int fdesc);
extern int file_size(int fdesc);
extern int read(int fdesc, char *buf, int count);
long * time, FinderInfo *finderInfo, long *infoValid);
extern void flushdev(void);
extern void scanBootVolumes(int biosdev, int *count);
#if UNUSED
extern void scanDisks(int biosdev, int *count);
#else
extern void scanDisks(void);
#endif
extern BVRef selectBootVolume(BVRef chain);
extern void getBootVolumeDescription(BVRef bvr, char *str, long strMaxLen, bool verbose);
extern void setRootVolume(BVRef volume);
branches/cparm/i386/boot2/graphics.c
291291
292292
293293
294
295
296
294
297295
298
299296
300297
301298
......
507504
508505
509506
510
507
511508
512
509
513510
514511
515512
......
601598
602599
603600
604
605
606
601
607602
608
609603
610604
611605
612606
613607
614608
615
609
616610
617
618
619
620611
621
622612
623613
624614
//==========================================================================
// setVESAGraphicsMode
#if UNUSED
int __setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate )
#else
int __setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel)
#endif
{
VBEModeInfoBlock minfo;
unsigned short mode;
unsigned char bitsPerPixel )
{
VBEModeInfoBlock minfo;
minfo.XResolution = 0;
minfo.XResolution = 0;
minfo.YResolution = 0;
unsigned short mode = modeEndOfList;
if ( (cols != 80) || (rows != 25) ) // not 80x25 mode
if ( params[2] == 256 ) params[2] = 8;
if ( params[2] == 555 ) params[2] = 16;
if ( params[2] == 888 ) params[2] = 32;
#if UNUSED
return __setVESAGraphicsMode( params[0], params[1], params[2], params[3] );
#else
return __setVESAGraphicsMode( params[0], params[1], params[2] );
#endif
}
//==========================================================================
// setVideoMode
//
// Set the video mode to VGA_TEXT_MODE or GRAPHICS_MODE.
#if UNUSED
void
__setVideoMode( int mode, int drawgraphics)
#else
void
__setVideoMode( int mode)
#endif
{
unsigned long params[4];
int count;
branches/cparm/i386/boot2/boot.c
5757
5858
5959
60
6160
62
6361
6462
6563
......
143141
144142
145143
146
147
148
149
150
151
152
153
154144
155145
156146
......
164154
165155
166156
167
168
169
170157
171158
172159
......
181168
182169
183170
184
171
185172
186173
187174
......
287274
288275
289276
290
291
292
293
294
277
295278
296
297279
298280
299281
......
325307
326308
327309
328
329310
330311
331312
......
470451
471452
472453
473
454
474455
475456
476457
......
499480
500481
501482
502
503483
504484
505485
......
513493
514494
515495
516
517496
518
519
520
521497
522
523498
524499
525500
......
531506
532507
533508
534
535
536
537
538
539
540
541
542
509
510
543511
544512
545513
546514
547515
548
549
550
551
552516
553517
554518
......
571535
572536
573537
574
575
576
538
577539
578540
579541
......
621583
622584
623585
624
586
625587
626588
627
628589
629590
630591
......
843804
844805
845806
846
847
848
807
849808
850
809
851810
852811
853812
#include "libsa.h"
#include "platform.h"
#include "graphics.h"
#ifndef OPTION_ROM
#include "appleboot.h"
#endif
#include "modules.h"
#include "xml.h"
#include "options.h"
}
#endif
#if 0
static inline void exception_error(char *msg, int nb)
{
printf("\r\nException number = %d\r\nmessage = %s\r\n\r\n", nb, msg);
asm volatile ("hlt");
}
#endif
BVRef getBvChain(void)
{
return bvChain;
{
zeroBSS();
malloc_init(0, 0, 0, malloc_error);
#if 0
exception_init(exception_error);
#endif
}
static void init_pic(void)
outb(0x21, 0x01);
outb(0xA1, 0x01);
//outb(0x70, inb(0x70)|0x80); /* Disable NMI */ is this really necessary ?
//outb(0x70, inb(0x70)|0x80); /* Disable NMI */
outb(0x21, 0xff); /* Maskout all interrupts Pic1 */
outb(0xa1, 0xff); /* Maskout all interrupts Pic2 */
if ((execute_hook("GUI_ExecKernel", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS)) // (bootArgs->Video.v_display == VGA_TEXT_MODE)
{
#if UNUSED
__setVideoMode( GRAPHICS_MODE, 0 );
#else
__setVideoMode( GRAPHICS_MODE );
#endif
__setVideoMode( GRAPHICS_MODE );
#ifndef OPTION_ROM
if(!gVerboseMode)
{
}
}
#endif
}
finalizeEFIConfigTable();
setBootGlobals(bvChain);
// Load Booter boot.plist config file
/*status =*/ loadBooterConfig();
loadBooterConfig();
{
bool isServer = false;
}
{
#ifndef OPTION_ROM
bool ScanSingleDrive = false;
// Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config.
if (getBoolForKey(kScanSingleDriveKey, &ScanSingleDrive, DEFAULT_BOOT_CONFIG) && ScanSingleDrive)
scanBootVolumes(BIOSDev, &bvCount);
}
else
#endif
{
#if UNUSED
scanDisks(BIOSDev, &bvCount);
#else
scanDisks();
#endif
}
}
gBootVolume = selectBootVolume(bvChain);
{
// Intialize module system
EFI_STATUS sysinit = init_module_system();
if((sysinit == EFI_SUCCESS) || (sysinit == EFI_ALREADY_STARTED) /*should never happen*/ )
{
load_all_modules();
}
}
LoadBundles("/Extra/");
load_all_internal_modules();
// Loading preboot ramdisk if exists.
execute_hook("loadPrebootRAMDisk", NULL, NULL, NULL, NULL, NULL, NULL);
#ifndef OPTION_ROM
{
// Disable rescan option by default
bool CDROMRescan = false;
{
safe_set_env(envgEnableCDROMRescan, promptForRescanOption());
}
}
#endif
}
#if DEBUG
printf(" Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
if(gBootVolume == NULL)
{
freeFilteredBVChain(bvChain);
#ifndef OPTION_ROM
if (get_env(envgEnableCDROMRescan))
rescanBIOSDevice((int)get_env(envgBIOSDev));
#endif
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &devcnt);
safe_set_env(envgDeviceCount,devcnt);
{
if (getVideoMode() == GRAPHICS_MODE)
{// if we are already in graphics-mode,
#if UNUSED
__setVideoMode(VGA_TEXT_MODE, 0);// switch back to text mode
#else
__setVideoMode(VGA_TEXT_MODE);// switch back to text mode
#endif
}
}
#ifdef NBP_SUPPORT
branches/cparm/i386/boot2/graphics.h
2828
2929
3030
31
32
33
31
3432
35
3633
3734
3835
......
4845
4946
5047
51
52
5348
54
55
56
5749
58
5950
6051
const unsigned char *imageData,
unsigned char **newImageData );
#if UNUSED
int __setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate );
#else
int __setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel);
#endif
int __getNumberArrayFromProperty( const char * propKey,
unsigned long numbers[],
VBEModeInfoBlock * outModeInfo,
unsigned short * vesaVersion );
#if UNUSED
void
__setVideoMode( int mode, int drawgraphics);
#else
void
__setVideoMode( int mode);
#endif
#endif /* !__BOOT_GRAPHICS_H */
branches/cparm/i386/boot2/drivers.c
168168
169169
170170
171
171
172172
173173
174174
175175
176176
177
178177
179178
180179
181180
182181
183182
184
183
185184
186185
187186
......
193192
194193
195194
196
195
197196
198197
199198
200
199
201200
202201
203
202
204203
205204
206205
......
209208
210209
211210
212
211
213212
214213
215
214
216215
217216
218
217
219218
220219
221220
......
233232
234233
235234
236
235
237236
238237
239238
......
315314
316315
317316
318
317
319318
320319
321320
......
417416
418417
419418
420
421
422
423
424419
425
426420
427421
428422
......
451445
452446
453447
454
455
448
449
456450
457451
458452
459453
460454
461455
462
456
463457
464458
465459
......
542536
543537
544538
545
546539
547540
548541
......
582575
583576
584577
585
586
587
588
589
590
578
591579
592580
593581
......
615603
616604
617605
618
606
619607
620608
621609
622610
623
611
624612
625613
626614
627
628
629
630
615
631616
632
633617
634618
635619
......
837821
838822
839823
840
824
841825
842826
843827
......
848832
849833
850834
851
835
852836
853837
if ( gBootFileType == kBlockDeviceType )
{
// First try to load Extra extensions from the ramdisk if isn't aliased as bt(0,0).
#ifndef OPTION_ROM
// First try a specfic OS version folder ie 10.5
step = 1;
execute_hook("ramDiskLoadDrivers", &step, NULL, NULL, NULL, NULL, NULL);
#endif
// First try a specfic OS version folder ie 10.5
sprintf(dirSpecExtra, "/Extra/%s/", (char*)gBootVolume->OSVersion);
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
// Next try to load Extra extensions from the selected root partition.
strcpy(dirSpecExtra, "/Extra/");
strlcpy(dirSpecExtra, "/Extra/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
// If failed, then try to load Extra extensions from the boot partition
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
// Next we'll try the base
strcpy(dirSpecExtra, "bt(0,0)/Extra/");
strlcpy(dirSpecExtra, "bt(0,0)/Extra/", sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra, 0);
}
}
#ifndef OPTION_ROM
step = 2;
execute_hook("ramDiskLoadDrivers", &step, NULL, NULL, NULL, NULL, NULL);
#endif
}
}
// Also try to load Extensions from boot helper partitions.
if (gBootVolume->flags & kBVFlagBooter)
{
strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/");
strlcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/");
strlcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/", sizeof(dirSpecExtra));
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/");
strlcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/", sizeof(dirSpecExtra));
FileLoadDrivers(dirSpecExtra, 0);
}
}
}
else
{
strcpy(gExtensionsSpec, dirSpec);
strlcpy(gExtensionsSpec, dirSpec, 4096);
strcat(gExtensionsSpec, "System/Library/");
FileLoadDrivers(gExtensionsSpec, 0);
}
if (strcmp(name + length - 5, ".kext")) continue;
// Save the file name.
strcpy(gFileName, name);
strlcpy(gFileName, name, 4096);
// Determine the bundle type.
sprintf(gTempSpec, "%s/%s", dirSpec, gFileName);
// Add the MKext to the memory map.
sprintf(segName, "DriversPackage-%lx", driversAddr);
#if UNUSED
AllocateMemoryRange(segName, driversAddr, driversLength,
kBootDriverTypeMKEXT);
#else
AllocateMemoryRange(segName, driversAddr, driversLength);
#endif
return 0;
}
tmpExecutablePath = malloc(executablePathLength);
if (tmpExecutablePath == 0) break;
strcpy(tmpExecutablePath, gFileSpec);
strlcpy(tmpExecutablePath, gFileSpec, executablePathLength);
sprintf(gFileSpec, "%s/%s", dirSpec, name);
bundlePathLength = strlen(gFileSpec) + 1;
tmpBundlePath = malloc(bundlePathLength);
if (tmpBundlePath == 0) break;
strcpy(tmpBundlePath, gFileSpec);
strlcpy(tmpBundlePath, gFileSpec, bundlePathLength);
// Construct the file spec to the plist, then load it.
return ret;
}
//==========================================================================
// LoadMatchedModules
if ((length != -1) && executableAddr)
{
//driverModuleAddr = (void *)kLoadAddr;
//if (length != 0)
//{
// ThinFatFile(&driverModuleAddr, &length);
//}
// Make make in the image area.
execute_hook("LoadMatchedModules", module, &length, executableAddr, NULL, NULL, NULL);
driver->bundlePathLength = module->bundlePathLength;
// Save the plist, module and bundle.
strcpy(driver->plistAddr, module->plistAddr);
strlcpy(driver->plistAddr, module->plistAddr,driver->plistLength);
if (length != 0)
{
memcpy(driver->executableAddr, executableAddr, length);
}
strcpy(driver->bundlePathAddr, module->bundlePath);
strlcpy(driver->bundlePathAddr, module->bundlePath, module->bundlePathLength);
// Add an entry to the memory map.
sprintf(segName, "Driver-%lx", (unsigned long)driver);
#if UNUSED
AllocateMemoryRange(segName, driverAddr, driverLength,
kBootDriverTypeKEXT);
#else
AllocateMemoryRange(segName, driverAddr, driverLength);
#endif
}
}
if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64)
{
archCpuType=CPU_TYPE_I386;
/*ret =*/ ThinFatFile(&binary, &len);
ThinFatFile(&binary, &len);
}
ret = DecodeMachO(binary, rentry, raddr, rsize);
ret = DecodeMachO(binary, rentry, raddr, rsize);
}
}
return ret;
}
branches/cparm/i386/boot2/options.c
199199
200200
201201
202
202
203203
204204
205205
206206
207207
208
209208
210209
211210
......
489488
490489
491490
492
493491
494492
495493
......
569567
570568
571569
572
573570
574571
575572
......
852849
853850
854851
855
856852
857853
858854
......
889885
890886
891887
892
893888
894889
895890
......
902897
903898
904899
905
900
906901
907902
908903
......
916911
917912
918913
919
920
921
914
922915
923
916
924917
925918
926919
927
920
928921
929922
930923
......
10421035
10431036
10441037
1045
1046
1038
10471039
10481040
10491041
......
11571149
11581150
11591151
1160
1161
11621152
11631153
11641154
......
12981288
12991289
13001290
1301
13021291
1303
13041292
13051293
13061294
......
13101298
13111299
13121300
1313
clearBootArgs();
if (visible) {
#ifndef OPTION_ROM
if (get_env(envgEnableCDROMRescan))
{
printf( "%s",bootRescanPrompt );
}
else
#endif
{
printf( "%s",bootPrompt );
}
return kn;
}
#ifndef OPTION_ROM
//==========================================================================
void printMemoryInfo(void)
setActiveDisplayPage(0);
}
}
#endif
//==========================================================================
/*
* TODO: this needs to be refactored.
*/
#ifndef OPTION_ROM
#if UNUSED
if (strcmp( booterCommand, "video" ) == 0)
{
{
showHelp();
}
#endif
key = 0;
showBootPrompt(nextRow, showPrompt);
break;
case kEscapeKey:
clearBootArgs();
break;
#ifndef OPTION_ROM
case kF5Key:
// New behavior:
// Clear gBootVolume to restart the loop
case kF10Key:
safe_set_env(envgScanSingleDrive, false);
#if UNUSED
scanDisks((int)get_env(envgBIOSDev), &bvCount);
#else
scanDisks();
#endif
gBootVolume = NULL;
clearBootArgs();
break;
#endif
default:
key = 0;
break;
loadSystemConfig();
#if virtualM || PCI_FIX // we can simply make an option for this fix
addBootArg("npci=0x2000");
addBootArg("npci=0x2000");
#endif
#if verbose
addBootArg("-v");
return 0;
}
#ifndef OPTION_ROM
//==========================================================================
// Load the help file and display the file contents on the screen.
showTextBuffer(buf, size);
free(buf);
}
#endif
#ifndef OPTION_ROM
bool promptForRescanOption(void)
{
printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n");
return false;
}
}
#endif
branches/cparm/i386/boot2/Makefile
88
99
1010
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
1126
1227
1328
......
5368
5469
5570
56
57
58
59
60
61
62
63
64
65
66
6771
6872
6973
......
7276
7377
7478
75
79
7680
77
81
7882
79
83
8084
8185
8286
83
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
84108
85
86
87
88
89
90
109
110
111
112
91113
92
93
94114
95115
96116
......
101121
102122
103123
104
105
106
107
108
109
110
111124
112125
113126
114
115
127
128
116129
117130
118131
......
130143
131144
132145
133
146
134147
135
148
136149
150
137151
138152
139153
DIR = boot2
include ../MakePaths.dir
SYMBOLS_BUNDLE = Symbols
BUNDLE_NAME = $(SYMBOLS_BUNDLE)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_ID = com.boot.SYSTEM.SYMS
BUNDLE_INFO =
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = SYMS
BUNDLE_CLASS_PROVIDER = SYSTEM
OPTIM = -Os -Oz
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror -fno-stack-protector \
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \
BOOT2ADDR = 20200
MAXBOOTSIZE = 458240
#
# Strings used to retrieve the start location for the Symbols.dylib module
#
SYMBOLS_MODULE = Symbols.dylib
SYMBOL_START= _symbols_module_start
SYMBOL_ADDR = $(shell printf "%d" 0x`nm -s __DATA __data $(SYMROOT)/boot_embeded.sys | grep " $(SYMBOL_START)$$" | cut -f 1 -d " "`)
DATA_OFFSET = $(shell otool -l $(SYMROOT)/boot_embeded.sys | grep __data -A 4 | grep __DATA -A 3 | tail -n 1 | cut -f 6 -d " ")
DATA_ADDR = $(shell printf "%d" `otool -l $(SYMROOT)/boot_embeded.sys | grep __data -A 4 | grep __DATA -A 3 | head -n 2 | tail -n 1 | cut -f 8 -d " "`)
PATCH_ADDR = $(shell echo ${SYMBOL_ADDR}-${DATA_ADDR}+${DATA_OFFSET} | bc)
#CFLAGS += -DSAFE_MALLOC
# CFLAGS += -DBOOT_HELPER_SUPPORT # +992 bytes
all embedtheme: $(DIRS_NEEDED) boot
boot: embedded.h machOconv $(OBJS) $(LIBDEP)
boot: embedded.h machOconv $(OBJS) $(LIBDEP)
@echo "\t[LD] boot.sys"
@$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
@$(CC) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
-nostdlib -arch i386 -Wl,-segalign,20 \
-o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) #-e boot2
-o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) #-e boot2
@echo "\t[MACHOCONV] boot"
@$(SYMROOT)/machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot &> /dev/null
@make Symbols.dylib
@make Symbols
@rm -rf $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle
@mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle
@mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents
@mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(SYMBOLS_BUNDLE).bundle/Contents/MacOS
@mv $(SYMROOT)/Symbols.plist $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@##echo "\t[LD] boot_embeded.sys"
@##$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
-nostdlib -arch i386 -Wl,-segalign,20 \
-Wl,-sectcreate,__DATA,__Symbols,$(SYMROOT)/Symbols.dylib \
-o $(SYMROOT)/boot_embeded.sys $(filter %.o,$^) $(LIBS) -lcc_kext
@##make embed_symbols# this is done in a sub process after boot.sys exists so the strings are populated correctly
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
@##${RM} $(SYMROOT)/${SYMBOLS_MODULE}
@##size $(SYMROOT)/boot.sys
@ls -l $(SYMROOT)/boot
@( size=`ls -l $(SYMROOT)/boot | awk '{ print $$5}'` ; \
exit 1;\
fi)
embed_symbols: machOconv
@echo ================= Embedding Symbols.dylib =================
@echo ******* Patching at $(PATCH_ADDR) ******
@stat -f%z $(SYMROOT)/boot | perl -ane "print pack('V',@F[0]);" | dd conv=notrunc of=${SYMROOT}/boot_embeded.sys bs=1 count=4 seek=$(PATCH_ADDR) &> /dev/null
@echo "\t[MACHOCONV] boot_embeded"
@$(SYMROOT)/machOconv $(SYMROOT)/boot_embeded.sys $(SYMROOT)/boot_embeded
embedded.h:
@cd $(SYMROOT)/../../doc && xxd -i BootHelp.txt > $(SYMROOT)/embedded.h
Symbols.dylib: Symbols.o
@echo ================= Compiling ${SYMBOLS_MODULE} =================
Symbols: Symbols.o
@echo ================= Compiling ${BUNDLE_EXEC} =================
@echo "start" >> ${OBJROOT}/Symbols.save
@echo "_lookup_symbol" >> ${OBJROOT}/Symbols.save
-macosx_version_min 10.6 \
-exported_symbols_list ${OBJROOT}/Symbols.save \
${OBJROOT}/Symbols.o \
-o $(SYMROOT)/${SYMBOLS_MODULE}
-o $(SYMROOT)/${BUNDLE_EXEC}
@##size $(SYMROOT)/${SYMBOLS_MODULE}
@##size $(SYMROOT)/${BUNDLE_EXEC}
##deprecated ??
Symbols.o: Symbols.plist
@rm -rf $(SYMROOT)/Symbols.h
@echo "typedef struct {" >> $(SYMROOT)/Symbols.h
branches/cparm/i386/modules/NetbookInstaller/NBI.c
4141
4242
4343
44
45
4644
4745
48
49
50
51
52
46
5347
54
5548
5649
5750
......
175168
176169
177170
178
179
180
171
181172
182
173
183174
184175
185176
extern long InitDriverSupport(void);
extern long GetDriverGbl(void);
#define kEnableNBI"EnableNBIModule"
void NetbookInstaller_start(void);
void NetbookInstaller_start(void)
{
bool enable = true;
getBoolForKey(kEnableNBI, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable)
{
register_hook_callback("PreBoot", &NBI_PreBoot_hook);
}
void NBI_PreBoot_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)
// Read new ramdisk image contents in kernel memory.
if (read(fh, (char*) ramdiskPtr.base, ramdiskPtr.size) == ramdiskPtr.size)
{
#if UNUSED
AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size, kBootDriverTypeInvalid);
#else
AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size);
#endif
Node* node = DT__FindNode("/chosen/memory-map", false);
if(node != NULL)
{
branches/cparm/i386/modules/NetbookInstaller/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7285
7386
7487
75
76
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
77108
109
110
111
112
78113
79114
80115
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.FDISK.RAMDISK_NBI.netbootinstaller
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = RAMDISK_NBI
BUNDLE_CLASS_PROVIDER = FDISK
DIR = NetbookInstaller
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${NBI_OBJS} dylib
all embedtheme: ${NBI_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
-final_output $(MODULE_NAME) \
-macosx_version_min 10.6 \
$(OBJROOT)/*.o \
-weak_library $(SYMROOT)/Symbols.dylib \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
branches/cparm/i386/modules/RamDiskLoader/RamDiskLoader.c
33
44
55
6
6
77
88
99
......
1515
1616
1717
18
1918
2019
2120
......
135134
136135
137136
138
139
140
141
142
143
144
145
146
147
148
149
150
151
137
138
139
140
141
142
143
144
152145
153146
* Chameleon
*
* Created by cparm on 05/12/10. <armelcadetpetit@gmail.com>
* Copyright 2010. All rights reserved.
* Copyright 2010,2012. All rights reserved.
*
*/
#include "disk.h"
#define kEnableEDL"EnableRamDiskLoader"
void loadPrebootRAMDisk_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void md0Ramdisk_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void processRAMDiskCommand_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void RamDiskLoader_start(void);
void RamDiskLoader_start(void)
{
bool enable = true;
getBoolForKey(kEnableEDL, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable)
{
register_hook_callback("loadPrebootRAMDisk", &loadPrebootRAMDisk_hook);
register_hook_callback("md0Ramdisk", &md0Ramdisk_hook);
register_hook_callback("processRAMDiskCommand", &processRAMDiskCommand_hook);
register_hook_callback("ramDiskLoadDrivers", &ramDiskLoadDrivers_hook);
register_hook_callback("newRamDisk_BVR", &newRamDisk_BVR_hook);
register_hook_callback("p_get_ramdisk_info", &p_get_ramdisk_info_hook);
register_hook_callback("p_ramdiskReadBytes", &p_ramdiskReadBytes_hook);
register_hook_callback("isRamDiskRegistred", &is_Ram_Disk_Registred_Hook);
}
register_hook_callback("loadPrebootRAMDisk", &loadPrebootRAMDisk_hook);
register_hook_callback("md0Ramdisk", &md0Ramdisk_hook);
register_hook_callback("processRAMDiskCommand", &processRAMDiskCommand_hook);
register_hook_callback("ramDiskLoadDrivers", &ramDiskLoadDrivers_hook);
register_hook_callback("newRamDisk_BVR", &newRamDisk_BVR_hook);
register_hook_callback("p_get_ramdisk_info", &p_get_ramdisk_info_hook);
register_hook_callback("p_ramdiskReadBytes", &p_ramdiskReadBytes_hook);
register_hook_callback("isRamDiskRegistred", &is_Ram_Disk_Registred_Hook);
}
branches/cparm/i386/modules/RamDiskLoader/ramdisk.c
9696
9797
9898
99
100
101
99
102100
103
101
104102
105103
106104
// Read new ramdisk image contents in kernel memory.
if (read(fh, (char*) ramdiskPtr.base, ramdiskPtr.size) == ramdiskPtr.size)
{
#if UNUSED
AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size, kBootDriverTypeInvalid);
#else
AllocateMemoryRange("RAMDisk", ramdiskPtr.base, ramdiskPtr.size);
#endif
Node* node = DT__FindNode("/chosen/memory-map", false);
if(node != NULL)
{
branches/cparm/i386/modules/RamDiskLoader/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5770
5871
5972
60
73
6174
6275
63
76
6477
6578
6679
......
7386
7487
7588
76
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
77109
110
111
112
113
78114
79115
80116
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.FDISK.RAMDISK.ramdiskloader
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = RAMDISK
BUNDLE_CLASS_PROVIDER = FDISK
DIR = RamDiskLoader
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${RDL_OBJS} dylib
all embedtheme: ${RDL_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/stack_protector.o \
$(OBJROOT)/ramdisk.o \
$(OBJROOT)/RamDiskLoader.o \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
branches/cparm/i386/modules/YellowIconFixer/YellowIconFixer.c
11
2
2
33
44
55
......
1919
2020
2121
22
2322
2423
2524
......
6261
6362
6463
65
66
67
68
69
70
71
64
7265
7366
/*
* Copyright (c) 2011 cparm <armelcadetpetit@gmail.com>. All rights reserved.
* Copyright (c) 2011,2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
*
*/
#define DBG(x...)
#endif
#define kEnableSATA"EnableSATAModule"
void SATA_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
uint8_t default_SATA_ID[]= {
void YellowIconFixer_start(void);
void YellowIconFixer_start(void)
{
bool enable = true;
getBoolForKey(kEnableSATA, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable)
{
register_hook_callback("PCIDevice", &SATA_hook);
}
register_hook_callback("PCIDevice", &SATA_hook);
}
branches/cparm/i386/modules/YellowIconFixer/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7184
7285
7386
74
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
75107
108
109
110
111
76112
77113
78114
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.DTREE.SATA_EFI.yellowiconfixer
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = SATA_EFI
BUNDLE_CLASS_PROVIDER = DTREE
DIR = YellowIconFixer
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${SATA_OBJS} dylib
all embedtheme: ${SATA_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
-current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \
-final_output $(MODULE_NAME) \
-macosx_version_min 10.6 \
$(OBJROOT)/stack_protector.o $(OBJROOT)/YellowIconFixer.o -o $(SYMROOT)/$(MODULE_NAME).dylib
$(OBJROOT)/stack_protector.o $(OBJROOT)/YellowIconFixer.o -o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
branches/cparm/i386/modules/ACPIPatcher/AcpiPatcher.c
44
55
66
7
7
88
99
1010
......
1414
1515
1616
17
1817
19
20
21
2218
2319
24
25
26
27
28
29
30
31
32
33
34
35
20
3621
*/
/*
* Copyright (c) 2010 cparm <armelcadetpetit@gmail.com>. All rights reserved.
* Copyright (c) 2010,2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
*
*/
#include "pci_root.h"
#include "acpi_patcher.h"
#define kEnableAcpi"EnableAcpiModule"
void AcpiPatcher_start(void);
void is_ACPI_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void is_ACPI_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){}
void AcpiPatcher_start(void)
{
bool enable = true;
getBoolForKey(kEnableAcpi, &enable, DEFAULT_BOOT_CONFIG);
enable = (execute_hook("isACPIRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS);
if (enable) {
replace_system_function("_setup_acpi",&setupAcpi);
register_hook_callback("isACPIRegistred", &is_ACPI_Patcher_Registred_Hook);
}
replace_system_function("_setup_acpi",&setupAcpi);
}
branches/cparm/i386/modules/ACPIPatcher/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7588
7689
7790
78
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
79111
112
113
114
115
116
80117
81118
82119
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.ACPI.ACPIPLATFORM.acpipatcher
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = ACPIPLATFORM
BUNDLE_CLASS_PROVIDER = ACPI
DIR = AcpiPatcher
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${ACPI_PATCHER_OBJS} dylib
all embedtheme: ${ACPI_PATCHER_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/AcpiPatcher.o \
$(OBJROOT)/aml_generator.o \
$(OBJROOT)/acpi_patcher.o \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
AcpiPatcher.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "AcpiPatcher.c" $(INC) -o "$(OBJROOT)/AcpiPatcher.o"
branches/cparm/i386/modules/GUI/graphic_utils.h
6868
6969
7070
71
72
73
71
7472
75
7673
7774
7875
......
9996
10097
10198
102
103
104
99
105100
106
101
107102
108103
109104
unsigned long numbers[],
unsigned long maxArrayCount );
#if UNUSED
int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate );
#else
int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel);
#endif
void getGraphicModeParams(unsigned long params[]);
char *getVBEModeInfoString(void);
unsigned short height,
unsigned char colorIndex );
#if UNUSED
void setVideoMode(int mode, int drawgraphics);
#else
void setVideoMode(int mode);
#endif
char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );
branches/cparm/i386/modules/GUI/gui.c
8989
9090
9191
92
92
9393
94
95
96
9794
98
95
9996
10097
10198
......
11051102
11061103
11071104
1108
1109
1105
1106
11101107
11111108
11121109
......
13031300
13041301
13051302
1306
1307
1308
13091303
1310
1304
13111305
13121306
13131307
......
16191613
16201614
16211615
1622
1616
16231617
1624
1625
1626
16271618
1628
16291619
16301620
16311621
......
16781668
16791669
16801670
1681
1682
1683
1671
16841672
1685
1673
16861674
16871675
16881676
......
25732561
25742562
25752563
2576
2577
2578
2564
25792565
2580
2566
25812567
25822568
25832569
......
26442630
26452631
26462632
2647
2648
2649
26502633
2651
2634
26522635
26532636
26542637
static int dprintf( window_t * window, const char * fmt, ...);
#endif
static void sputc(int c, struct putc_info * pi);
#if UNUSED
static inline
void vramwrite (void *data, int width, int height);
#else
static inline
void vramwrite (void *data, int width);
#endif
static void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);
static int startGUI(void);
static void free_theme_list();
if (!dummybool) {
return 1;
}
getMemoryInfoString = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_getMemoryInfoString");
showHelp = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showHelp");
getMemoryInfoString = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_getMemoryInfoString");
showHelp = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showHelp");
getBoolForKey("RandomTheme", &theme_ran, DEFAULT_BOOT_CONFIG);
// lets copy the screen into the back buffer
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
#if UNUSED
setVideoMode( GRAPHICS_MODE, 0 );
#else
setVideoMode( GRAPHICS_MODE );
#endif
gui.initialised = true;
return 0;
}
return;
}
#if UNUSED
static inline
void vramwrite (void *data, int width, int height)
#else
static inline
void vramwrite (void *data, int width)
#endif
{
if (VIDEO (depth) == 0x20 /*32*/ && VIDEO (rowBytes) == (unsigned long)gui.backbuffer->width * 4)
memcpy((uint8_t *)vram, gui.backbuffer->pixels, VIDEO (rowBytes)*VIDEO (height));
if (gui.infobox.draw)
blend( gui.infobox.pixmap, gui.backbuffer, gui.infobox.pos );
}
#if UNUSED
vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width, gui.backbuffer->height );
#else
vramwrite ( gui.backbuffer->pixels, gui.backbuffer->width );
#endif
if (gui.redraw)
{
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
if (getVideoMode() == VGA_TEXT_MODE
|| (screen_params[0] != (uint32_t)oldScreenWidth && screen_params[1] != (uint32_t)oldScreenHeight) )
{
#if UNUSED
setVideoMode(GRAPHICS_MODE, 0);
#else
setVideoMode(GRAPHICS_MODE);
#endif
}
if (getValueForKey("-checkers", &dummyVal, &length, DEFAULT_BOOT_CONFIG)) {
if ( params[2] == 555 ) params[2] = 16;
if ( params[2] == 888 ) params[2] = 32;
#if UNUSED
return setVESAGraphicsMode( params[0], params[1], params[2], params[3] );
#else
return setVESAGraphicsMode( params[0], params[1], params[2] );
#endif
}
branches/cparm/i386/modules/GUI/GUI_module.c
257257
258258
259259
260
261
260
261
262262
263
264
265
266
267
268
263
264
265
266
267
268
269269
270270
271271
register_hook_callback("GUI_PreBoot", &GUI_PreBoot_hook);
getBvChain = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_getBvChain");
getMemoryInfoString = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_getMemoryInfoString");
getBvChain = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_getBvChain");
getMemoryInfoString = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_getMemoryInfoString");
printMemoryInfo = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_printMemoryInfo");
lspci = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_lspci");
showHelp = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showHelp");
showTextFile = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showTextFile");
showMessage = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showMessage");
showTextBuffer = (void*)lookup_all_symbols(SYMBOLS_MODULE,"_showTextBuffer");
printMemoryInfo = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_printMemoryInfo");
lspci = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_lspci");
showHelp = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showHelp");
showTextFile = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showTextFile");
showMessage = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showMessage");
showTextBuffer = (void*)lookup_all_symbols(SYMBOLS_BUNDLE,"_showTextBuffer");
safe_set_env(envgBootArgs,(uint32_t)gBootArgs);
msglog("* GUI successfully Displayed\n");
branches/cparm/i386/modules/GUI/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
6982
7083
7184
72
85
7386
7487
75
88
7689
7790
7891
......
87100
88101
89102
90
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
91123
124
125
126
127
128
92129
93130
94131
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.UI.GUI.gui
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = GUI
BUNDLE_CLASS_PROVIDER = UI
DIR = GUI
include ../../MakePaths.dir
#CFLAGS += -DBOOT_HELPER_SUPPORT
all: ${GUI_OBJS} dylib
all: ${GUI_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/gui.o \
$(OBJROOT)/picopng.o \
$(OBJROOT)/graphic_utils.o \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/modules/GUI/graphic_utils.c
630630
631631
632632
633
634
635
633636
634637
635638
......
668671
669672
670673
671
674
672675
673
674
675
676676
677
678677
679678
680679
......
730729
731730
732731
733
734
735
732
736733
737
738734
739735
740736
minfo.YResolution = 0;
unsigned short mode = modeEndOfList;
minfo.XResolution = 0;
minfo.YResolution = 0;
if ( (cols != 80) || (rows != 25) ) // not 80x25 mode
{
mode = getVESAModeWithProperties( cols, rows, bitsPerPixel,
// setVideoMode
//
// Set the video mode to VGA_TEXT_MODE or GRAPHICS_MODE.
#if UNUSED
void
setVideoMode( int mode, int drawgraphics)
#else
void
setVideoMode( int mode)
#endif
{
unsigned long params[4];
int count;
//==========================================================================
// setVESAGraphicsMode
#if UNUSED
int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate )
#else
int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel)
#endif
{
VBEModeInfoBlock minfo;
unsigned short mode;
branches/cparm/i386/modules/KernelPatcher/kernel_patcher.c
226226
227227
228228
229
229
230230
231231
232232
static int locate_symbols(void* kernelData)
{
char is64 = 1;
parse_mach("VirtualXnuSyms",kernelData, NULL, symbol_handler);
parse_mach("VirtualXnuSyms",kernelData, symbol_handler);
//handle_symtable((UInt32)kernelData, symtableData, &symbol_handler, determineKernelArchitecture(kernelData) == KERNEL_64);
return 1 << is64;
}
branches/cparm/i386/modules/KernelPatcher/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
63
76
6477
6578
6679
......
7285
7386
7487
75
76
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
77108
109
110
111
112
78113
79114
80115
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.kernelpatcher
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS =
BUNDLE_CLASS_PROVIDER =
DIR = KernelPatcher
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${KERN_OBJS} dylib
all embedtheme: ${KERN_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/stack_protector.o \
$(OBJROOT)/kernel_patcher.o \
-macosx_version_min 10.6 \
-weak_library $(SYMROOT)/Symbols.dylib \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
branches/cparm/i386/modules/Networking/Networking.c
2020
2121
2222
23
2423
2524
2625
......
6261
6362
6463
65
66
67
68
69
70
71
64
65
7266
7367
7468
#endif
#define kEnableWifi"EnableWifi"
#define kEthernetBuiltIn"EthernetBuiltIn"
#define kEnableNetworking"EnableNetworkModule"
static void set_eth_builtin(pci_dt_t *eth_dev);
static void set_wifi_airport(pci_dt_t *wlan_dev);
void Networking_start(void);
void Networking_start(void)
{
bool enable = true;
getBoolForKey(kEnableNetworking, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable) {
register_hook_callback("PCIDevice", &Networking_hook);
}
{
register_hook_callback("PCIDevice", &Networking_hook);
}
/* a fine place for this code */
branches/cparm/i386/modules/Networking/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7184
7285
7386
74
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
75107
108
109
110
111
112
76113
77114
78115
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.DTREE.NET_EFI.networking
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = NET_EFI
BUNDLE_CLASS_PROVIDER = DTREE
DIR = Networking
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${NET_OBJS} dylib
all embedtheme: ${NET_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
-current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \
-final_output $(MODULE_NAME) \
-macosx_version_min 10.6 \
$(OBJROOT)/stack_protector.o $(OBJROOT)/Networking.o -o $(SYMROOT)/$(MODULE_NAME).dylib
$(OBJROOT)/stack_protector.o $(OBJROOT)/Networking.o -o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/modules/GraphicsEnabler/GraphicsEnabler.c
1414
1515
1616
17
18
1917
2018
2119
2220
2321
24
25
26
27
28
29
30
31
22
3223
3324
3425
#include "modules.h"
#define kGraphicsEnabler"EnableGFXModule"
void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void GraphicsEnabler_start(void);
void GraphicsEnabler_start(void)
{
bool enable = true;
getBoolForKey(kGraphicsEnabler, &enable, DEFAULT_BOOT_CONFIG);
if (enable)
{
register_hook_callback("PCIDevice", &GraphicsEnabler_hook);
}
register_hook_callback("PCIDevice", &GraphicsEnabler_hook);
}
void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)
branches/cparm/i386/modules/GraphicsEnabler/nvidia.c
1919
2020
2121
22
23
22
23
2424
2525
2626
......
9090
9191
9292
93
9394
9495
95
96
97
9896
9997
10098
......
270268
271269
272270
273
271
274272
275273
276274
......
433431
434432
435433
434
436435
437436
437
438438
439439
440440
......
442442
443443
444444
445
445446
446447
447448
......
471472
472473
473474
475
474476
475477
476478
......
500502
501503
502504
505
503506
504507
505508
......
516519
517520
518521
522
519523
520524
521525
522526
523527
528
524529
525530
526531
......
547552
548553
549554
555
550556
551557
552558
......
569575
570576
571577
578
572579
573580
574581
......
588595
589596
590597
598
599
600
591601
592602
593603
......
615625
616626
617627
628
629
618630
619631
620632
......
624636
625637
626638
639
627640
628641
629642
......
648661
649662
650663
664
651665
666
652667
653668
654669
......
689704
690705
691706
707
692708
693709
694710
695
711
696712
697713
698714
......
722738
723739
724740
741
742
725743
726744
727745
728746
747
729748
749
730750
731751
732752
733753
734754
735755
756
736757
758
737759
760
761
738762
739763
740764
741765
742766
743767
768
769
770
771
744772
773
774
745775
746776
747777
......
754784
755785
756786
787
757788
789
790
758791
759792
760793
......
790823
791824
792825
793
826
827
828
794829
795830
831
832
833
834
835
796836
797837
838
798839
799840
800841
801842
802843
844
845
846
803847
848
849
804850
851
852
853
805854
806
855
856
807857
808858
809859
860
810861
811862
812
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
813885
886
887
888
889
890
891
892
893
894
895
814896
815
897
898
899
900
901
902
903
904
905
906
907
908
909
910
816911
817912
818913
......
876971
877972
878973
879
880
974
975
881976
882977
883978
......
9391034
9401035
9411036
942
1037
9431038
9441039
9451040
......
10471142
10481143
10491144
1050
1145
10511146
10521147
10531148
......
10601155
10611156
10621157
1063
1158
10641159
10651160
10661161
......
10771172
10781173
10791174
1080
1175
10811176
10821177
1083
1178
10841179
10851180
10861181
......
11001195
11011196
11021197
1103
1198
11041199
11051200
11061201
......
11091204
11101205
11111206
1112
1207
11131208
11141209
11151210
11161211
1117
1212
11181213
11191214
11201215
/*
* Alternatively you can choose to comply with APSL
*/
/*
* DCB-Table parsing is based on software (nouveau driver) originally distributed under following license:
*
#define NVCAP_LEN ( sizeof(default_NVCAP) / sizeof(uint8_t) )
//TODO: once the bundles will be implemented, add a plist reader so there will be no need anymore to hardcode the device ids of each cards, each one will be able to add his own device ids in the plist, it willl work great if the card is supported by the apple's drivers
struct nv_chipsets_t NVKnownChipsets[] = {
{ 0x00000000, "Unknown" },
// temporary placement
{ 0x10DE0DF4, "GeForce GT 450M" }, //Azi + issue #99
{ 0x10DE1251, "GeForce GTX 560M" }, // Asus G74SX
//========================================
// 0040 - 004F
{ 0x10DE0040, "GeForce 6800 Ultra" },
{ 0x10DE0325, "GeForce FX Go5250" },
{ 0x10DE0326, "GeForce FX 5500" },
{ 0x10DE0328, "GeForce FX Go5200 32M / 64M" },
{ 0x10DE032A, "Quadro NVS 55/280 PCI" },
{ 0x10DE032A, "Quadro NVS 55 / 280 PCI" },
{ 0x10DE032B, "Quadro FX 500 / 600 PCI" },
{ 0x10DE032C, "GeForce FX Go53xx Series" },
{ 0x10DE032D, "GeForce FX Go5100" },
{ 0x10DE061B, "Quadro VX 200" },
{ 0x10DE061C, "Quadro FX 3600M" },
{ 0x10DE061D, "Quadro FX 2800M" },
{ 0x10DE061E, "Quadro FX 3700M" },
{ 0x10DE061F, "Quadro FX 3800M" },
// 0620 - 062F
{ 0x10DE0621, "GeForce GT 230" },
{ 0x10DE0622, "GeForce 9600 GT" },
{ 0x10DE0623, "GeForce 9600 GS" },
{ 0x10DE0625, "GeForce 9600 GSO 512"},
{ 0x10DE0627, "GeForce GT 140" },
{ 0x10DE0628, "GeForce 9800M GTS" },
{ 0x10DE062A, "GeForce 9700M GTS" },
{ 0x10DE062B, "GeForce 9800M GS" },
{ 0x10DE062C, "GeForce 9800M GTS" },
{ 0x10DE062D, "GeForce 9600 GT" },
{ 0x10DE062E, "GeForce 9600 GT" },
{ 0x10DE0652, "GeForce GT 130M" },
{ 0x10DE0653, "GeForce GT 120M" },
{ 0x10DE0654, "GeForce GT 220M" },
{ 0x10DE0655, "GeForce GT 120" },
{ 0x10DE0656, "GeForce 9650 S" },
{ 0x10DE0658, "Quadro FX 380" },
{ 0x10DE0659, "Quadro FX 580" },
{ 0x10DE06DD, "Quadro 4000" },
{ 0x10DE06DE, "Tesla M2050 / M2070" },// TODO: sub-device id for the M2050: 0x0846
// 0x10DE06DE also applies to misc S2050, X2070, M2050, M2070
{ 0x10DE06DF, "Tesla M2070-Q" },
// 06E0 - 06EF
{ 0x10DE06E0, "GeForce 9300 GE" },
{ 0x10DE06E1, "GeForce 9300 GS" },
{ 0x10DE06EC, "GeForce G 105M" },
{ 0x10DE06EF, "GeForce G 103M" },
// 06F0 - 06FF
{ 0x10DE06F1, "GeForce G105M" },
{ 0x10DE06F8, "Quadro NVS 420" },
{ 0x10DE06F9, "Quadro FX 370 LP" },
{ 0x10DE06FA, "Quadro NVS 450" },
{ 0x10DE06FB, "Quadro FX 370M" },
{ 0x10DE06FD, "Quadro NVS 295" },
{ 0x10DE06FF, "HICx16 + Graphics" },
// 0700 - 070F
// 0710 - 071F
// 0720 - 072F
// 0820 - 082F
// 0830 - 083F
// 0840 - 084F
{ 0x10DE0840, "GeForce 8200M" },
{ 0x10DE0844, "GeForce 9100M G" },
{ 0x10DE0845, "GeForce 8200M G" },
{ 0x10DE0846, "GeForce 9200" },
{ 0x10DE0866, "GeForce 9400M G" },
{ 0x10DE0867, "GeForce 9400" },
{ 0x10DE0868, "nForce 760i SLI" },
{ 0x10DE0869, "GeForce 9400" },
{ 0x10DE086A, "GeForce 9400" },
{ 0x10DE086C, "GeForce 9300 / nForce 730i" },
{ 0x10DE086D, "GeForce 9200" },
// 0880 - 088F
// 0890 - 089F
// 08A0 - 08AF
{ 0x10DE08A0, "GeForce 320M" },
{ 0x10DE08A4, "GeForce 320M" },
{ 0x10DE08A5, "GeForce 320M" },
// 08B0 - 08BF
// 08C0 - 08CF
// 08D0 - 08DF
{ 0x10DE0A20, "GeForce GT220" },
{ 0x10DE0A22, "GeForce 315" },
{ 0x10DE0A23, "GeForce 210" },
{ 0x10DE0A26, "GeForce 405" },
{ 0x10DE0A27, "GeForce 405" },
{ 0x10DE0A28, "GeForce GT 230M" },
{ 0x10DE0A29, "GeForce GT 330M" },
{ 0x10DE0A2A, "GeForce GT 230M" },
// 0A30 - 0A3F
{ 0x10DE0A34, "GeForce GT 240M" },
{ 0x10DE0A35, "GeForce GT 325M" },
{ 0x10DE0A38, "Quadro 400" },
{ 0x10DE0A3C, "Quadro FX 880M" },
// 0A40 - 0A4F
// 0A50 - 0A5F
{ 0x10DE0A73, "GeForce 305M" },
{ 0x10DE0A74, "GeForce G210M" },
{ 0x10DE0A75, "GeForce G310M" },
{ 0x10DE0A76, "ION" },
{ 0x10DE0A78, "Quadro FX 380 LP" },
{ 0x10DE0A7A, "GeForce 315M" },
{ 0x10DE0A7C, "Quadro FX 380M" },
// 0A80 - 0A8F
// 0A90 - 0A9F
{ 0x10DE0CA2, "GeForce GT 320" },
{ 0x10DE0CA3, "GeForce GT 240" },
{ 0x10DE0CA4, "GeForce GT 340" },
{ 0x10DE0CA5, "GeForce GT 220" },
{ 0x10DE0CA7, "GeForce GT 330" },
{ 0x10DE0CA8, "GeForce GTS 260M" },
{ 0x10DE0CA9, "GeForce GTS 250M" },
{ 0x10DE0CAC, "GeForce 315" },
{ 0x10DE0CAC, "GeForce GT 220" },
{ 0x10DE0CAF, "GeForce GT 335M" },
// 0CB0 - 0CBF
{ 0x10DE0CB0, "GeForce GTS 350M" },
{ 0x10DE0DC5, "GeForce GTS 450" },
{ 0x10DE0DC6, "GeForce GTS 450" },
{ 0x10DE0DCA, "GF10x" },
{ 0x10DE0DCD, "GeForce GT 555M" },
{ 0x10DE0DCE, "GeForce GT 555M" },
// 0DD0 - 0DDF
{ 0x10DE0DD1, "GeForce GTX 460M" },
{ 0x10DE0DD2, "GeForce GT 445M" },
{ 0x10DE0DD3, "GeForce GT 435M" },
{ 0x10DE0DD6, "GeForce GT 550M" },
{ 0x10DE0DD8, "Quadro 2000" },
{ 0x10DE0DDA, "Quadro 2000M" },
{ 0x10DE0DDE, "GF106-ES" },
{ 0x10DE0DDF, "GF106-INT" },
// 0DE0 - 0DEF
{ 0x10DE0DE0, "GeForce GT 440" },
{ 0x10DE0DE1, "GeForce GT 430" },
{ 0x10DE0DE2, "GeForce GT 420" },
{ 0x10DE0DE4, "GeForce GT 520" },
{ 0x10DE0DE5, "GeForce GT 530" },
{ 0x10DE0DE9, "GeForce GT 630M" },
{ 0x10DE0DEB, "GeForce GT 555M" },
{ 0x10DE0DEC, "GeForce GT 525M" },
{ 0x10DE0DED, "GeForce GT 520M" },
{ 0x10DE0DEE, "GeForce GT 415M" },
// 0DF0 - 0DFF
{ 0x10DE0DF0, "GeForce GT 425M" },
{ 0x10DE0DF1, "GeForce GT 420M" },
{ 0x10DE0DF2, "GeForce GT 435M" },
{ 0x10DE0DF3, "GeForce GT 420M" },
{ 0x10DE0DF4, "GeForce GT 540M" },
{ 0x10DE0DF5, "GeForce GT 525M" },
{ 0x10DE0DF6, "GeForce GT 550M" },
{ 0x10DE0DF7, "GeForce GT 520M" },
{ 0x10DE0DF8, "Quadro 600" },
{ 0x10DE0DFA, "Quadro 1000M" },
{ 0x10DE0DFC, "NVS 5200M" },
{ 0x10DE0DFE, "GF108 ES" },
{ 0x10DE0DFF, "GF108 INT" },
// 0E00 - 0E0F
{ 0x10DE0E25, "D12U-50" },
// 0E30 - 0E3F
{ 0x10DE0E30, "GeForce GTX 470M" },
{ 0x10DE0E31, "GeForce GTX 485M" },
{ 0x10DE0E38, "GF104GL" },
{ 0x10DE0E3A, "Quadro 3000M" },
{ 0x10DE0E3B, "Quadro 4000M" },
{ 0x10DE0E3E, "GF104-ES" },
{ 0x10DE0E3F, "GF104-INT" },
// 0E40 - 0E4F
// 1020 - 102F
// 1030 - 103F
// 1040 - 104F
{ 0x10DE1040, "GeForce GT 520" },
{ 0x10DE1040, "GeForce GT 520" },
{ 0x10DE1042, "GeForce 510" },
{ 0x10DE1049, "GeForce GT 620" },
// 1050 - 105F
{ 0x10DE1050, "GeForce GT 520M" },
{ 0x10DE1051, "GeForce GT 520MX" },
{ 0x10DE1054, "GeForce GT 410M" },
{ 0x10DE1055, "GeForce 410M" },
{ 0x10DE1056, "Quadro NVS 4200M" },
{ 0x10DE1057, "Quadro NVS 4200M" },
// 1060 - 106F
// 1070 - 107F
{ 0x10DE107F, "NVIDIA GF119-ES" },
// 1080 - 108F
{ 0x10DE1080, "GeForce GTX 580" },
{ 0x10DE1081, "GeForce GTX 570" },
{ 0x10DE1082, "GeForce GTX 560 Ti" },
{ 0x10DE1083, "D13U" },
{ 0x10DE1084, "GeForce GTX 560" },
{ 0x10DE1086, "GeForce GTX 570" },
{ 0x10DE1087, "GeForce GTX 560 Ti 448 Cores" },
{ 0x10DE1088, "GeForce GTX 590" },
{ 0x10DE1089, "GeForce GTX 580" },
{ 0x10DE108B, "GeForce GTX 590" },
// 1090 - 109F
{ 0x10DE1091, "Tesla M2090" },
{ 0x10DE1094, "Tesla M2075" },
{ 0x10DE1096, "Tesla C2075" },
{ 0x10DE1098, "D13U" },
{ 0x10DE109A, "N12E-Q5" },
{ 0x10DE109A, "Quadro 5010M" },
{ 0x10DE109B, "Quadro 7000" },
// 10A0 - 10AF
// 10B0 - 10BF
// 10C0 - 10CF
{ 0x10DE10C0, "GeForce 9300 GS" },
{ 0x10DE10C3, "GeForce 8400 GS" },
{ 0x10DE10C5, "GeForce 405" },
// 1200 -
// 10D0 - 10DF
{ 0x10DE10D8, "NVS 300" },
// 10E0 - 10EF
// 10F0 - 10FF
// 1100 - 110F
// 1110 - 111F
// 1120 - 112F
// 1130 - 113F
// 1140 - 114F
// 1150 - 115F
// 1160 - 116F
// 1170 - 117F
// 1180 - 118F
{ 0x10DE1180, "GeForce GTX 680" },
// 1190 - 119F
// 11A0 - 11AF
// 11B0 - 11BF
// 11C0 - 11CF
// 11D0 - 11DF
// 11E0 - 11EF
// 11F0 - 11FF
// 1200 - 120F
{ 0x10DE1200, "GeForce GTX 560 Ti" },
{ 0x10DE1201, "GeForce GTX 560" },
{ 0x10DE1203, "GeForce GTX 460 SE v2" },
// 1210 - 121F
{ 0x10DE1210, "GeForce GTX 570M" },
{ 0x10DE1211, "GeForce GTX 580M" },
// 1220 - 122F
// 1230 - 123F
// 1240 - 124F
{ 0x10DE1241, "GeForce GT 545" },
{ 0x10DE1243, "GeForce GT 545" },
{ 0x10DE1244, "GeForce GTX 550 Ti" },
{ 0x10DE1245, "GeForce GTS 450" }
{ 0x10DE1245, "GeForce GTS 450" },
{ 0x10DE1247, "GeForce GT 555M" },
// 1250 - 125F
{ 0x10DE1251, "GeForce GTX 560M" }
// 1260 - 126F
// 1270 - 127F
// 1280 - 128F
// 1290 - 129F
// 12A0 - 12AF
// 12B0 - 12BF
// 12C0 - 12CF
// 12D0 - 12DF
// 12E0 - 12EF
// 12F0 - 12FF
};
static uint16_t swap16(uint16_t x);
static uint16_t read16(uint8_t *ptr, uint16_t offset);
printf("no dcb table found\n");
return PATCH_ROM_FAILED;
}/* else
printf("dcb table at offset 0x%04x\n", dcbptr);
*/
printf("dcb table at offset 0x%04x\n", dcbptr);
*/
uint8_t *dcbtable = &rom[dcbptr];
uint8_t dcbtable_version = dcbtable[0];
uint8_t headerlength = 0;
entries[num_outputs].type = connection & 0xf;
entries[num_outputs].index = num_outputs;
entries[num_outputs++].heads = (uint8_t*)&(dcbtable[(headerlength + recordlength * i) + 1]);
}
int has_lvds = false;
static char *get_nvidia_model(uint32_t id) {
unsigned inti;
for (i=1; i< (sizeof(NVKnownChipsets) / sizeof(NVKnownChipsets[0])); i++) {
if (NVKnownChipsets[i].device == id) {
return NVKnownChipsets[i].name;
{
intfd;
intsize;
if ((fd = open_bvdev("bt(0,0)", filename)) < 0) {
return 0;
}
static int devprop_add_nvidia_template(struct DevPropDevice *device)
{
chartmp[16];
if(!device)
return 0;
if(!DP_ADD_TEMP_VAL(device, nvidia_compatible_0))
return 0;
if(!DP_ADD_TEMP_VAL(device, nvidia_device_type_0))
sprintf(tmp, "Slot-%x",devices_number);
devprop_add_value(device, "AAPL,slot-name", (uint8_t *) tmp, strlen(tmp));
devices_number++;
return 1;
}
char*p;
inti;
charbuf[3];
if (hex == NULL || bin == NULL || len <= 0 || strlen(hex) != len * 2) {
printf("[ERROR] bin2hex input error\n");
return -1;
}
buf[2] = '\0';
p = (char *) hex;
for (i=0; i<len; i++) {
branches/cparm/i386/modules/GraphicsEnabler/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7689
7790
7891
79
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
80112
81
113
114
115
116
117
82118
83119
84120
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.DTREE.GFX_EFI.graphicsenabler
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = GFX_EFI
BUNDLE_CLASS_PROVIDER = DTREE
DIR = GraphicsEnabler
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${GRAPHICS_ENABLER_OBJS} dylib
all embedtheme: ${GRAPHICS_ENABLER_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/gma.o \
$(OBJROOT)/GraphicsEnabler.o \
-macosx_version_min 10.6 \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/modules/GraphicsEnabler/ati.c
4747
4848
4949
50
5051
5152
5253
......
221222
222223
223224
225
226
227
224228
225229
226
230
227231
228232
229233
230234
231
235
232236
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
250254
251255
252
253
254
255
256
257
256
257
258
259
260
261
258262
259
260
261
262
263
263
264
265
266
267
264268
265
269
266270
267271
268
272
269273
270
271
272
274
275
276
273277
274278
275279
276280
277281
278
282
279283
280284
281
285
282286
283
287
284288
285
289
286290
287
291
288292
289293
290
294
291295
292
296
293297
294
298
295299
296300
297301
298
302
299303
300
301
302
304
305
306
303307
304308
305
309
306310
307311
308312
309
313
310314
311315
312316
313317
314318
315
319
316320
317
318
321
322
319323
320324
321
322
325
326
323327
324328
325
329
326330
327
331
328332
329
330
331
332
333
334
335
336
333337
334338
335
336
339
340
337341
338
342
339343
340
344
341345
342346
343
347
344348
345
349
346350
347351
348352
349353
350354
351
352
355
356
353357
354358
355359
356
360
357361
358362
359
363
360364
361
365
362366
363
367
368
369
364370
365371
366
367
372
373
374
375
376
377
378
379
368380
369381
370
371
372
373
374
375
382
376383
377
378
379
380
381
382
383
384
385
386
387
388
389
384
385
386
387
388
389
390
391
392
393
394
395
396
390397
391398
392
393
394
395
396
397
398
399
400
399
400
401
402
403
404
405
406
407
401408
402
403
404
405
406
407
408
409
410
409
410
411
412
413
414
415
416
417
411418
412
419
413420
414421
415
422
416423
417424
418425
419
420
421
422
423
424
426
427
428
429
430
431
425432
426433
427434
428
435
429436
430437
431438
432
439
433440
434
441
435442
436
443
437444
438
439
445
446
440447
441448
442
449
443450
444451
445452
446453
447454
448455
449
456
450457
451458
452
459
453460
454
461
455462
456
457
458
459463
460
464
465
461466
462467
463468
......
469474
470475
471476
472
477
473478
474
479
475480
476
481
482
477483
478484
479
480
481
482
485
486
487
488
483489
484
490
491
492
485493
486494
487
495
488496
489
497
490498
491
499
500
501
502
492503
493504
494
505
495506
507
496508
497
498
499
509
510
500511
501512
502
503
504
513
514
515
516
517
518
519
520
521
505522
506
523
507524
508
525
526
527
528
529
530
509531
510
532
533
534
535
536
537
538
539
540
541
511542
512
543
513544
514
545
515546
516547
517548
......
519550
520551
521552
522
553
523554
524
555
525556
526557
527558
528559
529560
530561
531
562
532563
533
564
534565
535
536
537
538
539566
540
541
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
542583
543584
544585
586
587
545588
546589
547590
548591
549592
550593
551
594
552595
553596
554597
555
598
556599
557600
558601
559
602
560603
561604
605
606
607
608
609
610
611
612
613
614
615
562616
563617
564618
565619
566620
567
621
568622
569623
570
624
625
626
571627
572
628
629
573630
574631
575
632
576633
577
634
635
636
637
578638
579639
580640
581
582
583
641
642
643
584644
585645
646
586647
587648
588
649
650
651
652
589653
590654
591
655
592656
593
657
658
594659
595660
596661
597
662
663
664
598665
599
666
600667
601
668
602669
603670
604
605
606
671
672
673
607674
608
675
676
677
609678
610
679
611680
612
681
682
683
684
685
686
613687
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
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
668755
669
670
671
672
673
674
675
676
677
756
757
758
759
760
761
762
763
764
678765
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
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
696796
697
698
699
700
701
702
703
704
705
706
707
708
709
710
797
798
711799
712
713
800
714801
715
716
717
718
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
719820
720821
721822
......
13251426
13261427
13271428
1328
1329
1330
1429
1430
13311431
1332
1333
1334
13351432
13361433
13371434
1338
1435
1436
13391437
13401438
13411439
......
13861484
13871485
13881486
1389
1390
1487
1488
1489
1490
13911491
13921492
1393
1493
13941494
13951495
13961496
13971497
1398
1498
13991499
1400
1500
14011501
14021502
14031503
14041504
14051505
14061506
1407
1507
14081508
14091509
14101510
1411
1511
14121512
14131513
14141514
14151515
1416
1516
14171517
14181518
14191519
......
14741574
14751575
14761576
1477
1478
1479
1577
1578
14801579
14811580
1581
14821582
14831583
14841584
CHIP_FAMILY_RV730,
CHIP_FAMILY_RV740,
CHIP_FAMILY_RV770,
CHIP_FAMILY_RV790,
/* Evergreen */
CHIP_FAMILY_CEDAR,
CHIP_FAMILY_CYPRESS,
{ 0x9440,0x24411682, CHIP_FAMILY_RV770,"ATI Radeon HD 4870",kMotmot},
{ 0x9440,0x24441682, CHIP_FAMILY_RV770,"ATI Radeon HD 4870",kMotmot},
{ 0x9440,0x24451682, CHIP_FAMILY_RV770,"ATI Radeon HD 4870",kMotmot},
{ 0x9440,0x0851174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4870",kMotmot},
{ 0x9440,0x114A174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4870",kCardinal},
{ 0x9441,0x24401682, CHIP_FAMILY_RV770,"ATI Radeon HD 4870 X2",kMotmot},
{ 0x9442,0x080110B0, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x9442,0x24701682, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x9442,0x24711682, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x9442,0xE104174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944A,0x30001043, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944A,0x30001458, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944A,0x30001462, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944A,0x30001545, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944A,0x30001682, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944A,0x3000174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944A,0x30001787, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944A,0x300017AF, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944A,0x30001043, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944A,0x30001458, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944A,0x30001462, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944A,0x30001545, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944A,0x30001682, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944A,0x3000174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944A,0x30001787, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944A,0x300017AF, CHIP_FAMILY_RV770,"ATI Radeon HD 4850",kMotmot},
{ 0x944C,0x24801682, CHIP_FAMILY_RV770,"ATI Radeon HD 4830",kMotmot},
{ 0x944C,0x24811682, CHIP_FAMILY_RV770,"ATI Radeon HD 4830",kMotmot},
{ 0x944E,0x3260174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4810 Series",kMotmot},
{ 0x944E,0x3261174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4810 series",kMotmot},
{ 0x944E,0x30001787, CHIP_FAMILY_RV770,"ATI Radeon HD 4730 Series",kMotmot},
{ 0x944E,0x30101787, CHIP_FAMILY_RV770,"ATI Radeon HD 4810 Series",kMotmot},
{ 0x944E,0x3260174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4810",kMotmot},
{ 0x944E,0x3261174B, CHIP_FAMILY_RV770,"ATI Radeon HD 4810",kMotmot},
{ 0x944E,0x30001787, CHIP_FAMILY_RV770,"ATI Radeon HD 4730",kMotmot},
{ 0x944E,0x30101787, CHIP_FAMILY_RV770,"ATI Radeon HD 4810",kMotmot},
{ 0x944E,0x31001787, CHIP_FAMILY_RV770,"ATI Radeon HD 4820",kMotmot},
{ 0x9480,0x3628103C, CHIP_FAMILY_RV730,"ATI Radeon HD 4650M",kGliff},
{ 0x9480,0x9035104D, CHIP_FAMILY_RV730,"ATI Radeon HD 4650M",kGliff},
{ 0x9480,0x3628103C, CHIP_FAMILY_RV730,"ATI Mobility Radeon HD 4650",kGliff},
{ 0x9480,0x9035104D, CHIP_FAMILY_RV730,"ATI Mobility Radeon HD 4650",kGliff},
{ 0x9490,0x4710174B, CHIP_FAMILY_RV730,"ATI Radeon HD 4710",kNull},
{ 0x9490,0x20031787, CHIP_FAMILY_RV730,"ATI Radeon HD 4670",kFlicker},
{ 0x9490,0x30501787, CHIP_FAMILY_RV730,"ATI Radeon HD 4710",kNull},
{ 0x9490,0x300017AF, CHIP_FAMILY_RV730,"ATI Radeon HD 4710",kNull},
{ 0x9498,0x21CF1458, CHIP_FAMILY_RV730,"ATI Radeon HD 4600 Series",kNull},
{ 0x9498,0x21CF1458, CHIP_FAMILY_RV730,"ATI Radeon HD 4600",kNull},
{ 0x9498,0x24511682, CHIP_FAMILY_RV730,"ATI Radeon HD 4650",kNull},
{ 0x9498,0x24521682, CHIP_FAMILY_RV730,"ATI Radeon HD 4650",kNull},
{ 0x9498,0x24541682, CHIP_FAMILY_RV730,"ATI Radeon HD 4650",kNull},
{ 0x9498,0x29331682, CHIP_FAMILY_RV730,"ATI Radeon HD 4670",kNull},
{ 0x9498,0x29341682, CHIP_FAMILY_RV730,"ATI Radeon HD 4670",kNull},
{ 0x9498,0x30501787, CHIP_FAMILY_RV730,"ATI Radeon HD 4700",kNull},
{ 0x9498,0x31001787, CHIP_FAMILY_RV730,"ATI Radeon HD 4720",kNull},
{ 0x94B3,0x0D001002, CHIP_FAMILY_RV740,"ATI Radeon HD 4770",kFlicker},
{ 0x94B3,0x29001682, CHIP_FAMILY_RV740,"ATI Radeon HD 4770",kFlicker},
{ 0x94B3,0x1170174B, CHIP_FAMILY_RV740,"ATI Radeon HD 4770",kFlicker},
{ 0x94C1,0x0D021002, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 XT",kNull},
{ 0x94C1,0x10021002, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 Pro",kNull},
{ 0x94C1,0x0D021028, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 XT",kNull},
{ 0x94C1,0x21741458, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 XT",kNull},
{ 0x94C1,0x10331462, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 XT",kNull},
{ 0x94C1,0x10401462, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 XT",kNull},
{ 0x94C1,0x11101462, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 XT",kNull},
{ 0x94C3,0x03421002, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x30001025, CHIP_FAMILY_RV610,"ATI Radeon HD 2350 Series",kNull},
{ 0x94C3,0x30001025, CHIP_FAMILY_RV610,"ATI Radeon HD 2350",kNull},
{ 0x94C3,0x03021028, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x04021028, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x216A1458, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x21721458, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x30001458, CHIP_FAMILY_RV610,"ATI Radeon HD 3410",kNull},
{ 0x94C3,0x10321462, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x10411462, CHIP_FAMILY_RV610,"ATI Radeon HD 2400",kNull},
{ 0x94C3,0x11041462, CHIP_FAMILY_RV610,"ATI Radeon HD 2400",kNull},
{ 0x94C3,0x11051462, CHIP_FAMILY_RV610,"ATI Radeon HD 2400",kNull},
{ 0x94C3,0x30001462, CHIP_FAMILY_RV610,"ATI Radeon HD 3410",kNull},
{ 0x94C3,0x2247148C, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 LE",kNull},
{ 0x94C3,0x3000148C, CHIP_FAMILY_RV610,"ATI Radeon HD 2350 Series",kNull},
{ 0x94C3,0x3000148C, CHIP_FAMILY_RV610,"ATI Radeon HD 2350",kNull},
{ 0x94C3,0x30001642, CHIP_FAMILY_RV610,"ATI Radeon HD 3410",kNull},
{ 0x94C3,0x37161642, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x3000174B, CHIP_FAMILY_RV610,"ATI Radeon HD 2350 Series",kNull},
{ 0x94C3,0x3000174B, CHIP_FAMILY_RV610,"ATI Radeon HD 2350",kNull},
{ 0x94C3,0xE370174B, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0xE400174B, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x203817AF, CHIP_FAMILY_RV610,"ATI Radeon HD 2400",kNull},
{ 0x94C3,0x22471787, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 LE",kNull},
{ 0x94C3,0x30001787, CHIP_FAMILY_RV610,"ATI Radeon HD 2350 Series",kNull},
{ 0x94C3,0x01011A93, CHIP_FAMILY_RV610,"Qimonda Radeon HD 2400 PRO",kNull},
{ 0x94C3,0x30001787, CHIP_FAMILY_RV610,"ATI Radeon HD 2350",kNull},
{ 0x94C3,0x01011A93, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 PRO",kNull},
{ 0x9501,0x25421002, CHIP_FAMILY_RV670,"ATI Radeon HD 3870",kNull},
{ 0x9501,0x30001002, CHIP_FAMILY_RV670,"ATI Radeon HD 3690",kNull},
{ 0x9501,0x3000174B, CHIP_FAMILY_RV670,"Sapphire Radeon HD 3690",kNull},
{ 0x9501,0x3000174B, CHIP_FAMILY_RV670,"ATI Radeon HD 3690",kNull},
{ 0x9501,0x4750174B, CHIP_FAMILY_RV670,"ATI Radeon HD 4750",kNull},
{ 0x9501,0x30001787, CHIP_FAMILY_RV670,"ATI Radeon HD 3690",kNull},
{ 0x9505,0x25421002, CHIP_FAMILY_RV670,"ATI Radeon HD 3850",kNull},
{ 0x9505,0x30001002, CHIP_FAMILY_RV670,"ATI Radeon HD 3690",kNull},
{ 0x9505,0x30011043, CHIP_FAMILY_RV670,"ATI Radeon HD 4730",kNull},
{ 0x9505,0x3000148C, CHIP_FAMILY_RV670,"ATI Radeon HD 3850",kNull},
{ 0x9505,0x3001148C, CHIP_FAMILY_RV670,"ATI Radeon HD 4730",kNull},
{ 0x9505,0x3002148C, CHIP_FAMILY_RV670,"ATI Radeon HD 4730",kNull},
{ 0x9505,0x3003148C, CHIP_FAMILY_RV670,"ATI Radeon HD 4750",kNull},
{ 0x9505,0x3004148C, CHIP_FAMILY_RV670,"ATI Radeon HD 4750",kNull},
{ 0x9505,0x3000174B, CHIP_FAMILY_RV670,"Sapphire Radeon HD 3690",kNull},
{ 0x9505,0x3000174B, CHIP_FAMILY_RV670,"ATI Radeon HD 3690",kNull},
{ 0x9505,0x3001174B, CHIP_FAMILY_RV670,"ATI Radeon HD 4750",kNull},
{ 0x9505,0x3010174B, CHIP_FAMILY_RV670,"ATI Radeon HD 4750",kNull},
{ 0x9505,0x4730174B, CHIP_FAMILY_RV670,"ATI Radeon HD 4730",kNull},
{ 0x9505,0x30001787, CHIP_FAMILY_RV670,"ATI Radeon HD 3690",kNull},
{ 0x9505,0x301017AF, CHIP_FAMILY_RV670,"ATI Radeon HD 4750",kNull},
{ 0x9540,0x4590174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4590",kNull},
{ 0x9540,0x30501787, CHIP_FAMILY_RV710,"ATI Radeon HD 4590",kNull},
{ 0x954F,0x16131462, CHIP_FAMILY_RV710,"ATI Radeon HD 4550",kNull},
{ 0x954F,0x29201682, CHIP_FAMILY_RV710,"ATI Radeon HD 4550",kNull},
{ 0x954F,0x29211682, CHIP_FAMILY_RV710,"ATI Radeon HD 4550",kNull},
{ 0x954F,0x30901682, CHIP_FAMILY_RV710,"XFX Radeon HD 4570",kNull},
{ 0x954F,0x30901682, CHIP_FAMILY_RV710,"ATI Radeon HD 4570",kNull},
{ 0x954F,0x3000174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4520",kNull},
{ 0x954F,0x4450174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4450",kNull},
{ 0x954F,0x4570174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4570",kNull},
{ 0x954F,0xE990174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4350",kNull},
{ 0x954F,0x20081787, CHIP_FAMILY_RV710,"ATI Radeon HD 4350",kNull},
{ 0x954F,0x30501787, CHIP_FAMILY_RV710,"ATI Radeon HD 4450",kNull},
{ 0x954F,0x31001787, CHIP_FAMILY_RV710,"ATI Radeon HD 4520",kNull},
{ 0x954F,0x3000174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4520",kNull},
{ 0x954F,0x4450174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4450",kNull},
{ 0x954F,0x4570174B, CHIP_FAMILY_RV710,"Sapphire Radeon HD 4570",kNull},
{ 0x954F,0xE990174B, CHIP_FAMILY_RV710,"Sapphire Radeon HD 4350",kNull},
{ 0x954F,0x301017AF, CHIP_FAMILY_RV710,"ATI Radeon HD 4450",kNull},
{ 0x9552,0x04341028, CHIP_FAMILY_RV710,"ATI Mobility Radeon 4330",kShrike},
{ 0x9552,0x308B103C, CHIP_FAMILY_RV710,"ATI Mobility Radeon HD 4300 Series", kShrike},
{ 0x9552,0x3000148C, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500 Series",kNull},
{ 0x9552,0x3000174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500 Series",kNull},
{ 0x9552,0x30001787, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500 Series",kNull},
{ 0x9552,0x300017AF, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500 Series",kNull},
{ 0x9552,0x04341028, CHIP_FAMILY_RV710,"ATI Mobility Radeon HD 4330",kShrike},
{ 0x9552,0x308B103C, CHIP_FAMILY_RV710,"ATI Mobility Radeon HD 4330",kShrike},
{ 0x9552,0x3000148C, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500",kNull},
{ 0x9552,0x3000174B, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500",kNull},
{ 0x9552,0x30001787, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500",kNull},
{ 0x9552,0x300017AF, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500",kNull},
{ 0x9553,0x18751043, CHIP_FAMILY_RV710,"ATI Mobility Radeon HD 4570",kShrike},
{ 0x9553,0x1B321043, CHIP_FAMILY_RV710,"ATI Mobility Radeon HD 4570",kShrike},
{ 0x9581,0x95811002, CHIP_FAMILY_RV630,"ATI Radeon HD 3600 Series",kNull},
{ 0x9581,0x3000148C, CHIP_FAMILY_RV630,"ATI Radeon HD 3600 Series",kNull},
{ 0x9583,0x3000148C, CHIP_FAMILY_RV630,"ATI Radeon HD 3600 Series",kNull},
{ 0x9588,0x01021A93, CHIP_FAMILY_RV630,"Qimonda Radeon HD 2600 XT",kNull},
{ 0x9581,0x95811002, CHIP_FAMILY_RV630,"ATI Radeon HD 3600",kNull},
{ 0x9581,0x3000148C, CHIP_FAMILY_RV630,"ATI Radeon HD 3600",kNull},
{ 0x9583,0x3000148C, CHIP_FAMILY_RV630,"ATI Radeon HD 3600",kNull},
{ 0x9588,0x01021A93, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 XT",kNull},
{ 0x9589,0x30001462, CHIP_FAMILY_RV630,"ATI Radeon HD 3610",kNull},
{ 0x9589,0x0E41174B, CHIP_FAMILY_RV630,"ATI Radeon HD 3600 Series",kNull},
{ 0x9589,0x30001787, CHIP_FAMILY_RV630,"ATI Radeon HD 3600 Series",kNull},
{ 0x9589,0x01001A93, CHIP_FAMILY_RV630,"Qimonda Radeon HD 2600 PRO",kNull},
{ 0x9591,0x2303148C, CHIP_FAMILY_RV635,"ATI Radeon HD 3600 Series",kNull},
{ 0x9589,0x0E41174B, CHIP_FAMILY_RV630,"ATI Radeon HD 3610",kNull},
{ 0x9589,0x30001787, CHIP_FAMILY_RV630,"ATI Radeon HD 3610",kNull},
{ 0x9589,0x01001A93, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 PRO",kNull},
{ 0x9591,0x2303148C, CHIP_FAMILY_RV635,"ATI Radeon HD 3600",kNull},
{ 0x9598,0xB3831002, CHIP_FAMILY_RV635,"ATI All-in-Wonder HD",kNull},
{ 0x9598,0x30001043, CHIP_FAMILY_RV635,"ATI Radeon HD 3730",kNull},
{ 0x9598,0x30011043, CHIP_FAMILY_RV635,"ATI Radeon HD 4570",kNull},
{ 0x9598,0x3000148C, CHIP_FAMILY_RV635,"ATI Radeon HD 3730",kNull},
{ 0x9598,0x3001148C, CHIP_FAMILY_RV635,"ATI Radeon HD 4580",kNull},
{ 0x9598,0x3031148C, CHIP_FAMILY_RV635,"ATI Radeon HD 4570",kNull},
{ 0x9598,0x30001545, CHIP_FAMILY_RV635,"VisionTek Radeon HD 2600 XT",kNull},
{ 0x9598,0x30011545, CHIP_FAMILY_RV635,"VisionTek Radeon HD 2600 Pro",kNull},
{ 0x9598,0x3000174B, CHIP_FAMILY_RV635,"Sapphire Radeon HD 3730",kNull},
{ 0x9598,0x3001174B, CHIP_FAMILY_RV635,"Sapphire Radeon HD 3750",kNull},
{ 0x9598,0x30001545, CHIP_FAMILY_RV635,"ATI Radeon HD 2600 XT",kNull},
{ 0x9598,0x30011545, CHIP_FAMILY_RV635,"ATI Radeon HD 2600 Pro",kNull},
{ 0x9598,0x3000174B, CHIP_FAMILY_RV635,"ATI Radeon HD 3730",kNull},
{ 0x9598,0x3001174B, CHIP_FAMILY_RV635,"ATI Radeon HD 3750",kNull},
{ 0x9598,0x4570174B, CHIP_FAMILY_RV635,"ATI Radeon HD 4570",kNull},
{ 0x9598,0x4580174B, CHIP_FAMILY_RV635,"ATI Radeon HD 4580",kNull},
{ 0x9598,0x4610174B, CHIP_FAMILY_RV635,"ATI Radeon HD 4610",kNull},
{ 0x9598,0x300117AF, CHIP_FAMILY_RV635,"ATI Radeon HD 3750",kNull},
{ 0x9598,0x301017AF, CHIP_FAMILY_RV635,"ATI Radeon HD 4570",kNull},
{ 0x9598,0x301117AF, CHIP_FAMILY_RV635,"ATI Radeon HD 4580",kNull},
{ 0x9598,0x30501787, CHIP_FAMILY_RV635,"ATI Radeon HD 4610",kNull},
{ 0x95C0,0x3000148C, CHIP_FAMILY_RV620,"ATI Radeon HD 3550",kNull},
{ 0x95C0,0xE3901745, CHIP_FAMILY_RV620,"ATI Radeon HD 3550",kNull},
{ 0x95C0,0x3000174B, CHIP_FAMILY_RV620,"Sapphire Radeon HD 3550",kNull},
{ 0x95C0,0x3000174B, CHIP_FAMILY_RV620,"ATI Radeon HD 3550",kNull},
{ 0x95C0,0x3002174B, CHIP_FAMILY_RV620,"ATI Radeon HD 3570",kNull},
{ 0x95C0,0x3020174B, CHIP_FAMILY_RV620,"ATI Radeon HD 4250",kNull},
{ 0x95C5,0x3000148C, CHIP_FAMILY_RV620,"ATI Radeon HD 3450",kNull},
{ 0x95C5,0x3001148C, CHIP_FAMILY_RV620,"ATI Radeon HD 3550",kNull},
{ 0x95C5,0x3002148C, CHIP_FAMILY_RV620,"ATI Radeon HD 4230",kNull},
{ 0x95C5,0x3003148C, CHIP_FAMILY_RV620,"ATI Radeon HD 4250",kNull},
{ 0x95C5,0x3032148C, CHIP_FAMILY_RV620,"ATI Radeon HD 4250",kNull},
{ 0x95C5,0x3033148C, CHIP_FAMILY_RV620,"ATI Radeon HD 4230",kNull},
{ 0x95C5,0x3010174B, CHIP_FAMILY_RV620,"ATI Radeon HD 4250",kNull},
{ 0x95C5,0x4250174B, CHIP_FAMILY_RV620,"ATI Radeon HD 4250",kNull},
{ 0x95C5,0x30501787, CHIP_FAMILY_RV620,"ATI Radeon HD 4250",kNull},
{ 0x95C5,0x301017AF, CHIP_FAMILY_RV620,"ATI Radeon HD 4230",kNull},
{ 0x95C5,0x01041A93, CHIP_FAMILY_RV620,"Qimonda Radeon HD 3450",kNull},
{ 0x95C5,0x01051A93, CHIP_FAMILY_RV620,"Qimonda Radeon HD 3450",kNull},
{ 0x95CC,0x00000000/*0x1b0317aa*/, CHIP_FAMILY_RV620,"ATI FirePro V3700 (FireGL)", kNull},
{ 0x95C5,0x01041A93, CHIP_FAMILY_RV620,"ATI Radeon HD 3450",kNull},
{ 0x95C5,0x01051A93, CHIP_FAMILY_RV620,"ATI Radeon HD 3450",kNull},
/* Evergreen */
{ 0x6898,0x0B001002, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5870",kZonalis},
{ 0x6898,0xE140174B, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5870",kUakari},
{ 0x6898,0x29611682, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5870",kUakari},
{ 0x6899,0x21E41458, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0xE140174B, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0xE174174B, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0x200A1787, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0x22901787, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x689C,0x03521043, CHIP_FAMILY_HEMLOCK,"ASUS ARES",kUakari},
{ 0x689C,0x039E1043, CHIP_FAMILY_HEMLOCK,"ASUS EAH5870 Series",kUakari},
{ 0x689C,0x03521043, CHIP_FAMILY_HEMLOCK,"ATI Radeon HD 5970",kUakari},
{ 0x689C,0x039E1043, CHIP_FAMILY_HEMLOCK,"ATI Radeon HD 5970",kUakari},
{ 0x689C,0x30201682, CHIP_FAMILY_HEMLOCK,"ATI Radeon HD 5970",kUakari},
{ 0x68A0,0x043A1028,CHIP_FAMILY_CYPRESS,"ATI Mobility Radeon HD 5870",kNomascus},
{ 0x68A1,0x144D103C,CHIP_FAMILY_CYPRESS,"ATI Mobility Radeon HD 5850",kNomascus},
{ 0x68A1,0x1522103C, CHIP_FAMILY_CYPRESS,"ATI Mobility Radeon HD 5850",kHoolock},
{ 0x68A8,0x050E1025, CHIP_FAMILY_CYPRESS,"AMD Radeon HD 6850M",kUakari},
{ 0x68B8,0x00CF106B, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kHoolock},
{ 0x68B8,0x21D71458, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x21F61458, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x29901682, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x29911682, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x1482174B, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0xE144174B, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kHoolock},
{ 0x68B8,0xE147174B, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x21D71458, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x200A1787, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x200B1787, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68B8,0x22881787, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5770",kVervet},
{ 0x68BF,0x220E1458, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 6750",kVervet},
{ 0x68BA,0x31501682, CHIP_FAMILY_JUNIPER,"AMD Radeon HD 6770",kVervet},
{ 0x68BE,0x22881787, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5750",kVervet},
{ 0x68BF,0x220E1458, CHIP_FAMILY_JUNIPER,"AMD Radeon HD 6750",kVervet},
{ 0x68BF,0x31401682, CHIP_FAMILY_JUNIPER,"AMD Radeon HD 6750",kVervet},
{ 0x68C0,0x1594103C, CHIP_FAMILY_REDWOOD,"AMD Radeon HD 6570M",kNull},
{ 0x68C0,0x392717AA, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5730",kNull},
{ 0x68C0,0x395217AA, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5730",kNull},
{ 0x68C1,0x02051025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x02961025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x030A1025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x033D1025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x033E1025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5650",kNull},
{ 0x68C1,0x03471025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x03561025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x03581025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x035A1025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x035C1025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x03641025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x03791025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x037E1025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x03821025, CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5750",kNull},
{ 0x68C1,0x9071104D,CHIP_FAMILY_REDWOOD,"ATI Mobility Radeon HD 5650",kEulemur},
{ 0x68C8,0x2306103C, CHIP_FAMILY_REDWOOD,"ATI FirePro V4800 (FireGL)",kNull},
{ 0x68D8,0x03561043, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5670",kBaboon},
{ 0x68D8,0x21D91458, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5670",kBaboon},
{ 0x68D8,0x5690174B, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5690",kNull},
{ 0x68D8,0x5730174B, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5730",kNull},
{ 0x68D8,0xE151174B, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5670",kBaboon},
{ 0x68D8,0x30001787, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5730",kNull},
{ 0x68D8,0x301017AF, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5730",kNull},
{ 0x68D8,0x301117AF, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5690",kNull},
{ 0x68D9,0x301017AF, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5630",kNull},
{ 0x68DA,0x5630174B, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5630",kNull},
{ 0x68DA,0x30001787, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5630",kNull},
{ 0x68DA,0x301017AF, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5630",kNull},
{ 0x68E0,0x04561028, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470M",kEulemur},
{ 0x68E0,0x1433103C, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470M",kEulemur},
{ 0x68E1,0x1426103C, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5430M",kEulemur},
{ 0x68E0,0x04561028, CHIP_FAMILY_CEDAR,"ATI Mobility Radeon HD 5470",kEulemur},
{ 0x68E0,0x1433103C, CHIP_FAMILY_CEDAR,"ATI Mobility Radeon HD 5470",kEulemur},
{ 0x68E1,0x1426103C, CHIP_FAMILY_CEDAR,"ATI Mobility Radeon HD 5430",kEulemur},
{ 0x68E4,0x1426103C, CHIP_FAMILY_CEDAR,"AMD Radeon HD 6370M ",kNull},
{ 0x68E4,0x397917AA, CHIP_FAMILY_CEDAR,"AMD Radeon HD 6370M ",kNull},
{ 0x68F9,0x010E1002, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x03741043, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x23401462, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x5470174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470",kNull},
{ 0x68F9,0x5490174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5490",kNull},
{ 0x68F9,0x5530174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5530",kNull},
{ 0x68F9,0xE145174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0xE153174B, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x20091787, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x22911787, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5450",kEulemur},
{ 0x68F9,0x30001787, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470",kNull},
{ 0x68F9,0x30011787, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5530",kNull},
{ 0x68F9,0x30021787, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5490",kNull},
{ 0x68F9,0x301117AF, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470",kNull},
{ 0x68F9,0x301217AF, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5490",kNull},
{ 0x68F9,0x301317AF, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5470",kNull},
/* Northen Islands */
{ 0x6718,0x0B001002, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970",kNull},
{ 0x6718,0x67181002, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970",kNull},
{ 0x6718,0x31301682, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970",kNull},
{ 0x6719,0x0B001002, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950",kGibba},
{ 0x6719,0x21FD1458, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950",kGibba},
{ 0x6719,0x186B174B, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950",kNull},
{ 0x6719,0x20101787, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950",kGibba},
{ 0x6720,0x04901028, CHIP_FAMILY_BARTS,"AMD Radeon HD 6970M",kElodea},
{ 0x6720,0x04BA1028, CHIP_FAMILY_BARTS,"AMD Radeon HD 6970M",kElodea},
{ 0x6738,0x00D01002,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x21FA1002,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x67381002, CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x21FA1458,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x31031682,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x31041682,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x31071682,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x31081682,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0xE178174B,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x174B174B,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kBulrushes},
{ 0x6738,0x20101787,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6738,0x23051787,CHIP_FAMILY_BARTS,"AMD Radeon HD 6870",kDuckweed},
{ 0x6739,0x67391002, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0xAA881002, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0x03B41043, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0x21F81458, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0x24411462, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0x31101682, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0x31101682, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6739,0xE177174B,CHIP_FAMILY_BARTS,"AMD Radeon HD 6850",kDuckweed},
{ 0x6740,0x1631103C, CHIP_FAMILY_TURKS,"AMD FirePro M5950",kNull},
{ 0x6740,0x1657103C, CHIP_FAMILY_TURKS,"AMD Radeon HD 6770M",kNull},
{ 0x6740,0x165A103C, CHIP_FAMILY_TURKS,"AMD Radeon HD 6770M",kNull},
{ 0x6740,0x3388103C, CHIP_FAMILY_TURKS,"AMD Radeon HD 6770M",kNull},
{ 0x6740,0x1D121043, CHIP_FAMILY_TURKS,"AMD Radeon HD 6730M",kNull},
{ 0x6741,0x050E1025, CHIP_FAMILY_TURKS,"AMD Radeon HD 6650M",kNull},
{ 0x6741,0x05131025, CHIP_FAMILY_TURKS,"AMD Radeon HD 6650M",kNull},
{ 0x6741,0x1646103C, CHIP_FAMILY_TURKS,"AMD Radeon HD 6750M",kNull},
{ 0x6741,0x1688103C, CHIP_FAMILY_TURKS,"AMD Radeon HD 7690M",kNull},
{ 0x6741,0x9080104D,CHIP_FAMILY_TURKS,"AMD Radeon HD 6630M",kNull},
{ 0x6758,0x67581002,CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6758,0x00121028,CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6758,0x22051458,CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6758,0xE194174B,CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6758,0x31811682,CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6758,0x31831682,CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6758,0xE1941746,CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6758,0xE194174B,CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6759,0xE193174B, CHIP_FAMILY_TURKS,"AMD Radeon HD 6570",kNull},
{ 0x6759,0x20121787, CHIP_FAMILY_TURKS,"AMD Radeon HD 6570",kPithecia},
{ 0x6760,0x04CC1028,CHIP_FAMILY_CAICOS,"AMD Radeon HD 6490M",kNull},
{ 0x6760,0x1CB21043, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6470M",kNull},
{ 0x6760,0x165A103C, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6470M",kNull},
{ 0x6760,0x167D103C, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6470M",kNull},
{ 0x6760,0x00031179, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450M",kNull},
{ 0x6779,0x64501092,CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kBulrushes},
{ 0x6779,0xE164174B,CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kBulrushes},
/* standard/default models */
{ 0x9400,0x00000000, CHIP_FAMILY_R600,"ATI Radeon HD 2900 XT",kNull},
{ 0x9405,0x00000000, CHIP_FAMILY_R600,"ATI Radeon HD 2900 GT",kNull},
{ 0x9440,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9441,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4870 X2",kMotmot},
{ 0x9442,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9443,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4850 X2",kMotmot},
{ 0x944C,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944E,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4700 Series",kMotmot},
{ 0x9450,0x00000000, CHIP_FAMILY_RV770,"AMD FireStream 9270",kMotmot},
{ 0x9452,0x00000000, CHIP_FAMILY_RV770,"AMD FireStream 9250",kMotmot},
{ 0x9460,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9462,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9490,0x00000000, CHIP_FAMILY_RV730,"ATI Radeon HD 4600 Series",kFlicker},
{ 0x9498,0x00000000, CHIP_FAMILY_RV730,"ATI Radeon HD 4600 Series",kFlicker},
{ 0x94B3,0x00000000, CHIP_FAMILY_RV740,"ATI Radeon HD 4770",kFlicker},
{ 0x94B4,0x00000000, CHIP_FAMILY_RV740,"ATI Radeon HD 4700 Series",kFlicker},
{ 0x94B5,0x00000000, CHIP_FAMILY_RV740,"ATI Radeon HD 4770",kFlicker},
{ 0x94C1,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 Series",kIago},
{ 0x94C3,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 Series",kIago},
{ 0x94C7,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 2350",kIago},
{ 0x94CC,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 Series",kIago},
{ 0x9501,0x00000000, CHIP_FAMILY_RV670,"ATI Radeon HD 3800 Series",kMegalodon},
{ 0x9505,0x00000000, CHIP_FAMILY_RV670,"ATI Radeon HD 3800 Series",kMegalodon},
{ 0x9507,0x00000000, CHIP_FAMILY_RV670,"ATI Radeon HD 3830",kMegalodon},
{ 0x950F,0x00000000, CHIP_FAMILY_RV670,"ATI Radeon HD 3870 X2",kMegalodon},
{ 0x9513,0x00000000, CHIP_FAMILY_RV670,"ATI Radeon HD 3850 X2",kMegalodon},
{ 0x9519,0x00000000, CHIP_FAMILY_RV670,"AMD FireStream 9170",kMegalodon},
{ 0x9540,0x00000000, CHIP_FAMILY_RV710,"ATI Radeon HD 4550",kNull},
{ 0x954F,0x00000000, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500 Series",kNull},
{ 0x9553,0x00000000, CHIP_FAMILY_RV710,"ATI Mobility Radeon HD 4500/5100 Series",kShrike },
{ 0x9588,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 XT",kLamna},
{ 0x9589,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 PRO",kLamna},
{ 0x958A,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 X2 Series",kLamna},
{ 0x9598,0x00000000, CHIP_FAMILY_RV635,"ATI Radeon HD 3600 Series",kMegalodon},
{ 0x95C0,0x00000000, CHIP_FAMILY_RV620,"ATI Radeon HD 3400 Series",kIago},
{ 0x95C5,0x00000000, CHIP_FAMILY_RV620,"ATI Radeon HD 3400 Series",kIago},
{ 0x6779,0xE164174B,CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kBulrushes},
{ 0x6779,0xE180174B, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kPithecia},
//
// standard/default models
// these definitions are used when no subsys_id was found
//
{ 0x9400,0x00000000, CHIP_FAMILY_R600,"ATI Radeon HD 2900 XT/PRO Series",kNull},
{ 0x9405,0x00000000, CHIP_FAMILY_R600,"ATI Radeon HD 2900 GT Series",kNull},
{ 0x9440,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9441,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4870 X2 Series",kMotmot},
{ 0x9442,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9443,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4850 X2 Series",kMotmot},
{ 0x944A,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944C,0x00000000, CHIP_FAMILY_RV770,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x944E,0x00000000, CHIP_FAMILY_RV740,"ATI Radeon HD 4700 Series",kMotmot},
{ 0x9450,0x00000000, CHIP_FAMILY_RV770,"AMD FireStream 9270 Series",kMotmot},
{ 0x9452,0x00000000, CHIP_FAMILY_RV770,"AMD FireStream 9250 Series",kMotmot},
{ 0x9460,0x00000000, CHIP_FAMILY_RV790,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9462,0x00000000, CHIP_FAMILY_RV790,"ATI Radeon HD 4800 Series",kMotmot},
{ 0x9480,0x00000000, CHIP_FAMILY_RV730,"ATI Mobility Radeon HD 4650 Series",kGliff},
{ 0x9490,0x00000000, CHIP_FAMILY_RV730,"ATI Radeon HD 4600 Series",kFlicker},
{ 0x9498,0x00000000, CHIP_FAMILY_RV730,"ATI Radeon HD 4600 Series",kFlicker},
{ 0x94B3,0x00000000, CHIP_FAMILY_RV740,"ATI Radeon HD 4770 Series",kFlicker},
{ 0x94B4,0x00000000, CHIP_FAMILY_RV740,"ATI Radeon HD 4700 Series",kFlicker},
{ 0x94B5,0x00000000, CHIP_FAMILY_RV740,"ATI Radeon HD 4770 Series",kFlicker},
{ 0x94C1,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 Series",kIago},
{ 0x94C3,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 Series",kIago},
{ 0x94C7,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 2350 Series",kIago},
{ 0x94CC,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 2400 Series",kIago},
{ 0x9501,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3800 Series",kMegalodon},
{ 0x9505,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3800 Series",kMegalodon},
{ 0x9507,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3830 Series",kMegalodon},
{ 0x950F,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3870 X2 Series",kMegalodon},
{ 0x9513,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3850 X2 Series",kMegalodon},
{ 0x9519,0x00000000, CHIP_FAMILY_RV630,"AMD FireStream 9170 Series",kMegalodon},
{ 0x9540,0x00000000, CHIP_FAMILY_RV710,"ATI Radeon HD 4550/4590 Series",kNull},
{ 0x954F,0x00000000, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500 Series",kNull},
{ 0x9552,0x00000000, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500 Series",kShrike},
{ 0x9553,0x00000000, CHIP_FAMILY_RV710,"ATI Radeon HD 4300/4500 Series",kShrike},
{ 0x9588,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 XT Series",kLamna},
{ 0x9589,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 PRO Series",kLamna},
{ 0x958A,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 X2 Series",kLamna},
{ 0x9581,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3600 Series",kNull},
{ 0x9583,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3600 Series",kNull},
{ 0x9588,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 2600 XT Series",kNull},
{ 0x9589,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3610 Series",kNull},
{ 0x9591,0x00000000, CHIP_FAMILY_RV635,"ATI Radeon HD 3600 Series",kNull},
{ 0x9598,0x00000000, CHIP_FAMILY_RV630,"ATI Radeon HD 3600 Series",kMegalodon},
{ 0x95C0,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 3400 Series",kIago},
{ 0x95C5,0x00000000, CHIP_FAMILY_RV610,"ATI Radeon HD 3400 Series",kIago},
/* IGP */
{ 0x9610,0x00000000, CHIP_FAMILY_RS780,"ATI Radeon HD 3200 Graphics",kNull},
{ 0x9611,0x00000000, CHIP_FAMILY_RS780,"ATI Radeon 3100 Graphics",kNull},
{ 0x9614,0x00000000, CHIP_FAMILY_RS780,"ATI Radeon HD 3300 Graphics",kNull},
{ 0x9616,0x00000000, CHIP_FAMILY_RS780,"AMD 760G",kNull},
{ 0x9710,0x00000000, CHIP_FAMILY_RS880,"ATI Radeon HD 4200",kNull},
{ 0x9715,0x00000000, CHIP_FAMILY_RS880,"ATI Radeon HD 4250",kNull},
{ 0x9714,0x00000000, CHIP_FAMILY_RS880,"ATI Radeon HD 4290",kNull},
{ 0x9610,0x00000000, CHIP_FAMILY_RS780,"ATI Radeon HD 3200 Graphics",kNull},
{ 0x9611,0x00000000, CHIP_FAMILY_RS780,"ATI Radeon 3100 Graphics",kNull},
{ 0x9614,0x00000000, CHIP_FAMILY_RS780,"ATI Radeon HD 3300 Graphics",kNull},
{ 0x9616,0x00000000, CHIP_FAMILY_RS780,"ATI Radeon 3000 Graphics",kNull},
{ 0x9710,0x00000000, CHIP_FAMILY_RS880,"ATI Radeon HD 4200 Series",kNull},
{ 0x9714,0x00000000, CHIP_FAMILY_RS880,"ATI Radeon HD 4290 Series",kNull},
{ 0x9715,0x00000000, CHIP_FAMILY_RS880,"ATI Radeon HD 4250 Series",kNull},
/* Evergreen */
{ 0x688D,0x00000000, CHIP_FAMILY_CYPRESS,"AMD FireStream 9350",kUakari},
{ 0x6898,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x6899,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x689C,0x00000000, CHIP_FAMILY_HEMLOCK,"ATI Radeon HD 5900 Series",kUakari},
{ 0x689E,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x68B8,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5700 Series",kVervet},
{ 0x68B9,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5600 Series",kVervet},
{ 0x68BE,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5700 Series",kVervet},
{ 0x68D8,0x00000000, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5600 Series",kBaboon},
{ 0x68D9,0x00000000, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5500 Series",kBaboon},
{ 0x68DA,0x00000000, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5500 Series",kBaboon},
{ 0x68F9,0x00000000, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5400 Series",kNull},
{ 0x688D,0x00000000, CHIP_FAMILY_CYPRESS,"AMD FireStream 9350 Series",kUakari},
{ 0x6898,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x6899,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x689C,0x00000000, CHIP_FAMILY_HEMLOCK,"ATI Radeon HD 5900 Series",kUakari},
{ 0x689E,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5800 Series",kUakari},
{ 0x68A0,0x00000000, CHIP_FAMILY_CYPRESS,"ATI Mobility Radeon HD 5800 Series",kNomascus},
{ 0x68A1,0x00000000,CHIP_FAMILY_CYPRESS,"ATI Mobility Radeon HD 5800 Series",kNomascus},
{ 0x68A8,0x00000000, CHIP_FAMILY_CYPRESS,"AMD Radeon HD 6800M Series",kUakari},
{ 0x68B8,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5700/6700 Series",kVervet},
{ 0x68B9,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5600/5700 Series",kVervet},
{ 0x68BA,0x00000000, CHIP_FAMILY_JUNIPER,"AMD Radeon HD 6700 Series",kVervet},
{ 0x68BE,0x00000000, CHIP_FAMILY_JUNIPER,"ATI Radeon HD 5700/6750 Series",kVervet},
{ 0x68BF,0x00000000, CHIP_FAMILY_JUNIPER,"AMD Radeon HD 6700 Series",kVervet},
{ 0x68C0,0x00000000, CHIP_FAMILY_REDWOOD,"AMD Radeon HD 6570M/5700 Series",kNull},
{ 0x68C1,0x00000000, CHIP_FAMILY_REDWOOD,"AMD Radeon HD 6500M/5600/5700 Series",kNull},
{ 0x68D8,0x00000000, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5600 Series",kBaboon},
{ 0x68D9,0x00000000, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5500/5600 Series",kBaboon},
{ 0x68DA,0x00000000, CHIP_FAMILY_REDWOOD,"ATI Radeon HD 5500 Series",kBaboon},
{ 0x68E0,0x00000000, CHIP_FAMILY_CEDAR,"ATI Mobility Radeon HD 5400 Series",kEulemur},
{ 0x68E1,0x00000000, CHIP_FAMILY_CEDAR,"ATI Mobility Radeon HD 5400 Series",kEulemur},
{ 0x68E4,0x00000000, CHIP_FAMILY_CEDAR,"ATI Radeon HD 6300M Series",kNull},
{ 0x68F9,0x00000000, CHIP_FAMILY_CEDAR,"ATI Radeon HD 5400 Series",kNull},
/* Northen Islands */
{ 0x6718,0x00000000, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970 Series",kNull},
{ 0x6719,0x00000000, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950 Series",kNull},
{ 0x6720,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6900M Series",kNull},
{ 0x6738,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6870 Series",kDuckweed},
{ 0x6739,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850 Series",kDuckweed},
{ 0x673E,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6790 Series",kNull},
{ 0x6740,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6700M Series",kNull},
{ 0x6741,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6600M/6700M Series",kNull},
{ 0x6758,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6670 Series",kBulrushes},
{ 0x6759,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6500 Series",kNull},
{ 0x6718,0x00000000, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6970 Series",kNull},
{ 0x6719,0x00000000, CHIP_FAMILY_CAYMAN,"AMD Radeon HD 6950 Series",kGibba},
{ 0x6760,0x00000000, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6400M Series",kNull},
{ 0x6761,0x00000000, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6430M Series",kNull},
{ 0x6720,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6900M Series",kNull},
{ 0x6770,0x00000000, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6400 Series",kNull},
{ 0x6779,0x00000000, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450 Series",kBulrushes},
{ 0x0000,0x00000000, CHIP_FAMILY_UNKNOW,NULL,kNull}
{ 0x6738,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6870 Series",kDuckweed},
{ 0x6739,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6850 Series",kDuckweed},
{ 0x673E,0x00000000, CHIP_FAMILY_BARTS,"AMD Radeon HD 6790 Series",kNull},
{ 0x6740,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6700M Series",kNull},
{ 0x6741,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6600M/6700M Series",kNull},
{ 0x6750,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6600A Series",kNull},
{ 0x6758,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6670 Series",kBulrushes},
{ 0x6759,0x00000000, CHIP_FAMILY_TURKS,"AMD Radeon HD 6570/7570 Series",kNull},
{ 0x6760,0x00000000, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6400M Series",kNull},
{ 0x6761,0x00000000, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6430M Series",kNull},
{ 0x6770,0x00000000, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6400 Series",kNull},
{ 0x6779,0x00000000, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450 Series",kBulrushes},
{ 0x0000,0x00000000, CHIP_FAMILY_UNKNOW,NULL,kNull}
};
typedef struct {
if (radeon_cards[i].device_id == pci_dev->device_id)
{
card->info = &radeon_cards[i];
if (radeon_cards[i].subsys_id == 0x00000000)
{
radeon_cards[i].subsys_id = pci_dev->subsys_id.subsys_id;
if ((radeon_cards[i].subsys_id == 0x00000000) ||
(radeon_cards[i].subsys_id == pci_dev->subsys_id.subsys_id))
break;
}
else if (radeon_cards[i].subsys_id == pci_dev->subsys_id.subsys_id)
break;
}
}
if (!card->info->device_id || !card->info->cfg_name)
//if (!card->info->device_id || !card->info->cfg_name)
if (!card->info->device_id)
{
verbose("Unsupported ATI card! Device ID: [%04x:%04x] Subsystem ID: [%08x] \n",
pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id.subsys_id);
{
// use cfg_name on radeon_cards, to retrive the default name from card_configs,
card->cfg_name = card_configs[card->info->cfg_name].name;
// and leave ports alone!
//card->ports = card_configs[card->info->cfg_name].ports;
// Uncommented the following line and added verbose for debugging AtiPorts issues on some cards
card->ports = card_configs[card->info->cfg_name].ports;
// Report number of ports card reports
verbose("Card reported ports: %d\n", card->ports);
// which means one of the fb's or kNull
verbose("Framebuffer set to device's default: %s\n", card->cfg_name);
verbose("Framebuffer set to: %s using device's default.\n", card->cfg_name);
}
else
{
// else, use the fb name returned by AtiConfig.
verbose("(AtiConfig) Framebuffer set to: %s\n", card->cfg_name);
verbose("Framebuffer set to: %s using AtiConfig=%s\n", card->cfg_name, card->cfg_name);
}
// Check AtiPorts key for nr of ports,
card->ports = getIntForKey(kAtiPorts, &n_ports, DEFAULT_BOOT_CONFIG);
// if a value bigger than 0 ?? is found, (do we need >= 0 ?? that's null FB on card_configs)
if (n_ports > 0)
{
card->ports = n_ports; // use it.
verbose("(AtiPorts) Nr of ports set to: %d\n", card->ports);
verbose("Number of ports set to: %d using AtiPorts=%d\n", card->ports, card->ports);
}
else// if (card->cfg_name > 0) // do we want 0 ports if fb is kNull or mistyped ?
{
// else, match cfg_name with card_configs list and retrive default nr of ports.
// else, match fb name with card_configs list and retrive default nr of ports.
for (i = 0; i < kCfgEnd; i++)
if (strcmp(card->cfg_name, card_configs[i].name) == 0)
card->ports = card_configs[i].ports; // default
verbose("Nr of ports set to framebuffer's default: %d\n", card->ports);
verbose("Number of ports set to: %d using framebuffer's default.\n", card->ports);
}
//else
//card->ports = 2/1 ?; // set a min if 0 ports ?
stringlength = string->length;
// -------------------------------------------------
verbose("ATI %s %s %dMB (%s) [%04x:%04x] (subsys [%04x:%04x]):: %s\n",
chip_family_name[card->info->chip_family], card->info->model_name,
(uint32_t)(card->vram_size / (1024 * 1024)), card->cfg_name,
verbose("%s %dMB [%04x:%04x] (subsys [%04x:%04x]) (%s:%s) :: %s\n",
card->info->model_name, (uint32_t)(card->vram_size / (1024 * 1024)),
ati_dev->vendor_id, ati_dev->device_id,
ati_dev->subsys_id.subsys.vendor_id, ati_dev->subsys_id.subsys.device_id,
chip_family_name[card->info->chip_family], card->cfg_name,
devicepath);
free(card);
branches/cparm/i386/modules/SMBiosGetters/SMBiosGetters.c
11
2
2
33
44
55
......
88
99
1010
11
1211
1312
1413
15
1614
1715
1816
......
2220
2321
2422
25
2623
27
2824
2925
3026
31
32
33
34
27
3528
3629
3730
......
4538
4639
4740
48
4941
5042
5143
52
5344
5445
5546
......
6354
6455
6556
66
6757
6858
6959
70
7160
7261
7362
7463
7564
76
77
7865
7966
8067
81
82
83
84
85
86
87
88
89
90
91
68
69
70
9271
/*
* Copyright 2011 cparm <armelcadetpetit@gmail.com>. All rights reserved.
* Copyright 2011,2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
*/
#include "libsaio.h"
#include "bootstruct.h"
#include "efi.h"
#include "mysmbios.h"
#define kEnableSMBIOSGetters"EnableSMBIOSGetters"
void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void getProductName_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void getboardproduct_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void is_SMB_Getters_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)
{
SMBEntryPoint *patched_smb = setupSMBIOSTable(getSmbiosOriginal());
if (patched_smb != NULL)
//smbios_p = ((uint64_t)((uint32_t)patched_smb));
Register_Smbios_Efi(patched_smb);
else
{
verbose("Error: Could not get patched SMBIOS, fallback to original SMBIOS !!\n");
//struct SMBEntryPoint *smbios_o = getSmbiosOriginal();
//smbios_p = ((uint64_t)((uint32_t)smbios_o));
Register_Smbios_Efi(getSmbiosOriginal());
}
const char *val = 0;
if (getValueForKey("SMproductname", &val, &len, DEFAULT_SMBIOS_CONFIG)) {
//gPlatformName = (char *)val;
SetgPlatformName(val);
} else {
//gPlatformName = (char *)getDefaultSMBproductName();
SetgPlatformName(getDefaultSMBproductName());
}
const char *val = 0;
if (getValueForKey("SMboardproduct", &val, &len, DEFAULT_SMBIOS_CONFIG)) {
//gboardproduct = (char *)val;
Setgboardproduct(val);
} else {
//gboardproduct = (char *)getDefaultSMBBoardProduct();
Setgboardproduct(getDefaultSMBBoardProduct());
}
}
void is_SMB_Getters_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){}
void SMBiosGetters_start(void);
void SMBiosGetters_start(void)
{
bool enable = true;
getBoolForKey(kEnableSMBIOSGetters, &enable, DEFAULT_BOOT_CONFIG) ;
enable = (execute_hook("isSMBIOSRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS);
if (enable) {
register_hook_callback("getSmbiosPatched", &getSmbiosPatched_hook);
register_hook_callback("getProductNamePatched", &getProductName_hook);
register_hook_callback("getboardproductPatched", &getboardproduct_hook);
register_hook_callback("isSMBIOSRegistred", &is_SMB_Getters_Registred_Hook);
}
register_hook_callback("getSmbiosPatched", &getSmbiosPatched_hook);
register_hook_callback("getProductNamePatched", &getProductName_hook);
register_hook_callback("getboardproductPatched", &getboardproduct_hook);
}
branches/cparm/i386/modules/SMBiosGetters/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7689
7790
7891
79
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
80112
113
114
115
116
81117
82118
83119
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.SMBIOS.SMBIOSPLATFORM.smbiosgetters
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = SMBIOSPLATFORM
BUNDLE_CLASS_PROVIDER = SMBIOS
DIR = SMBiosGetters
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${SMBiosGetters_OBJS} dylib
all embedtheme: ${SMBiosGetters_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/smbios_getters.o \
$(OBJROOT)/smbios_decode.o \
-macosx_version_min 10.6 \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
branches/cparm/i386/modules/HibernateEnabler/resume.c
368368
369369
370370
371
372
373
371
374372
375
376373
377374
378375
Unforutnaltely I cannot find a note why to switch back to text mode for nVidia cards only
and because it check_vga_nvidia does not work (cards normally are behind a bridge) I will
remove it completely*/
#if UNUSED
setVideoMode(VGA_TEXT_MODE, 0);
#else
setVideoMode(VGA_TEXT_MODE);
#endif
#endif
}
branches/cparm/i386/modules/HibernateEnabler/graphic_utils.h
2020
2121
2222
23
23
2424
25
26
27
2825
29
26
3027
void
loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);
#if UNUSED
void
setVideoMode( int mode, int drawgraphics);
#else
void
setVideoMode( int mode);
#endif
#endif//H_GRAPHIC_UTILS_H
branches/cparm/i386/modules/HibernateEnabler/HibernateEnabler.c
1414
1515
1616
17
17
1818
1919
2020
......
7878
7979
8080
81
82
83
84
85
86
87
88
81
82
8983
#define kWake"Wake"/* boot.c */
#define kForceWake"ForceWake"/* boot.c */
#define kWakeImage"WakeImage"/* boot.c */
#define kEnableHibernate"EnableHibernateModule"
void HibernateEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void HibernateEnabler_start(void);
void HibernateEnabler_start(void)
{
bool enable = true;
getBoolForKey(kEnableHibernate, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable)
{
register_hook_callback("PreBoot", &HibernateEnabler_hook);
register_hook_callback("spinActivity_hook", &spinActivityIndicator_hook);
}
register_hook_callback("PreBoot", &HibernateEnabler_hook);
register_hook_callback("spinActivity_hook", &spinActivityIndicator_hook);
}
branches/cparm/i386/modules/HibernateEnabler/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5770
5871
5972
60
73
6174
6275
63
76
6477
6578
6679
......
7487
7588
7689
77
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
78110
111
112
113
114
79115
80116
81117
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.VM.WAKE.hibernateenabler
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = WAKE
BUNDLE_CLASS_PROVIDER = VM
DIR = HibernateEnabler
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${H_ENAB_OBJS} dylib
all embedtheme: ${H_ENAB_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/resume.o \
$(OBJROOT)/HibernateEnabler.o \
-macosx_version_min 10.6 \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
HibernateEnabler.o:
branches/cparm/i386/modules/HibernateEnabler/graphic_utils.c
2525
2626
2727
28
29
30
28
29
3130
32
3331
3432
3533
......
136134
137135
138136
139
140
141
137
142138
143
144139
145140
146141
......
315310
316311
317312
318
319
320
313
321314
322
323315
324316
325317
......
438430
439431
440432
433
434
435
441436
442437
443438
......
476471
477472
478473
479
474
480475
481
482
483
484476
485
486477
487478
488479
......
601592
602593
603594
604
605
606
595
607596
608
609597
610598
611599
int previewTotalSectors = 0;
uint8_t *previewSaveunder = 0;
int previewLoadedSectors = 0;
#if UNUSED
static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate );
#else
static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel);
#endif
void
loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or)
if ( params[2] == 256 ) params[2] = 8;
if ( params[2] == 555 ) params[2] = 16;
if ( params[2] == 888 ) params[2] = 32;
#if UNUSED
return setVESAGraphicsMode( params[0], params[1], params[2], params[3] );
#else
return setVESAGraphicsMode( params[0], params[1], params[2] );
#endif
}
//==========================================================================
//==========================================================================
// setVESAGraphicsMode
#if UNUSED
static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel, unsigned short refreshRate )
#else
static int setVESAGraphicsMode( unsigned short width, unsigned short height, unsigned char bitsPerPixel)
#endif
{
VBEModeInfoBlock minfo;
unsigned short mode;
minfo.YResolution = 0;
unsigned short mode = modeEndOfList;
minfo.XResolution = 0;
minfo.YResolution = 0;
if ( (cols != 80) || (rows != 25) ) // not 80x25 mode
{
mode = getVESAModeWithProperties( cols, rows, bitsPerPixel,
// setVideoMode
//
// Set the video mode to VGA_TEXT_MODE or GRAPHICS_MODE.
#if UNUSED
void
setVideoMode( int mode, int drawgraphics)
#else
void
setVideoMode( int mode)
#endif
{
unsigned long params[4];
int count;
if (src && (uncomp=DecompressData(src, &origwidth, &origheight, &origbpx)))
{
#if UNUSED
if (!setVESAGraphicsMode(origwidth, origheight, origbpx, 0))
#else
if (!setVESAGraphicsMode(origwidth, origheight, origbpx))
#endif
if (initGraphicsMode () != errSuccess)
return;
screen = (uint8_t *) VIDEO (baseAddr);
branches/cparm/i386/modules/Keymapper/Keylayout.c
6666
6767
6868
69
70
71
69
7270
73
7471
7572
7673
char magic[KEYBOARD_LAYOUTS_MAGIC_SIZE];
uint32_t version;
#if UNUSED
if ((fd = open_bvdev("bt(0,0)", filename, 0)) < 0) {
#else
if ((fd = open_bvdev("bt(0,0)", filename)) < 0) {
#endif
goto fail; // fail
}
branches/cparm/i386/modules/Keymapper/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5770
5871
5972
60
73
6174
6275
63
76
6477
6578
6679
......
7386
7487
7588
76
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
77109
110
111
112
113
78114
79115
116
117
80118
81119
82120
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.KEY.KEYMAP.keymapper
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 0.1
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 0.1
BUNDLE_CLASS = KEYMAP
BUNDLE_CLASS_PROVIDER = KEY
DIR = Keymapper
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${KEY_MAPPER_OBJS} dylib
all embedtheme: ${KEY_MAPPER_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/stack_protector.o \
$(OBJROOT)/Keymapper.o \
$(OBJROOT)/Keylayout.o \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
Keymapper.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "Keymapper.c" $(INC) -o "$(OBJROOT)/Keymapper.o"
branches/cparm/i386/modules/Keymapper/Keymapper.c
1313
1414
1515
16
1716
1817
1918
......
240239
241240
242241
243
244
245
246
247
248
249
250
251
252
253
242
243
244
245
246
254247
255
256
257
258
259
248
249
250
251
252
260253
261
262
263
264
254
255
256
257
265258
266
267
259
268260
#include "modules.h"
#include "Keylayout.h"
#define kEnableKeyMap "EnableKeyMapper"
static int AZERTY_switch(int c);
void Keymapper_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
int Keymapper_getc(void);
void Keymapper_start(void);
void Keymapper_start(void)
{
bool enable = true;
getBoolForKey(kEnableKeyMap, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable)
{
if (Keylayout_real_start())
{
return;
}
if (Keylayout_real_start())
{
return;
}
#ifdef TRUNK
if (!replace_system_function("_getchar", &Keymapper_getc))
{
printf("no function getchar() to replace. Keymapper will not be used ! \n");
}
if (!replace_system_function("_getchar", &Keymapper_getc))
{
printf("no function getchar() to replace. Keymapper will not be used ! \n");
}
#else
if (replace_system_function("_getc", &Keymapper_getc) != EFI_SUCCESS)
{
printf("no function getc() to replace. Keymapper will not be used ! \n");
}
if (replace_system_function("_getc", &Keymapper_getc) != EFI_SUCCESS)
{
printf("no function getc() to replace. Keymapper will not be used ! \n");
}
#endif
}
}
branches/cparm/i386/modules/USBFix/USBFix.c
88
99
1010
11
12
1311
1412
1513
......
3432
3533
3634
37
38
39
40
41
42
43
44
45
35
36
4637
4738
#include "pci.h"
#include "bootstruct.h"
#define kEnableUSBMod"EnableUSBModule"
extern int usb_loop(void);
extern void notify_usb_dev(pci_dt_t *pci_dev);
void USBFix_start(void);
void USBFix_start(void)
{
bool enable = true;
getBoolForKey(kEnableUSBMod, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable) {
register_hook_callback("PCIDevice", &USBFix_pci_hook);
register_hook_callback("Kernel Start", &USBFix_start_hook);
}
register_hook_callback("PCIDevice", &USBFix_pci_hook);
register_hook_callback("Kernel Start", &USBFix_start_hook);
}
branches/cparm/i386/modules/USBFix/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7487
7588
7689
77
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
78110
111
112
113
114
79115
80116
81117
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.HWDRV.USB.usbfix
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = USB
BUNDLE_CLASS_PROVIDER = HWDRV
DIR = USBFix
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${USB_OBJS} dylib
all embedtheme: ${USB_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/USBFix.o \
$(OBJROOT)/usb.o \
-macosx_version_min 10.6 \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
branches/cparm/i386/modules/HPET/HPET.c
3737
3838
3939
40
41
4240
43
44
41
4542
4643
4744
void HPET_start(void);
void HPET_start(void)
{
bool enable = true;
getBoolForKey(EnableHPETModule, &enable, DEFAULT_BOOT_CONFIG);
if (enable)
register_hook_callback("PCIDevice", &HPET_hook);
register_hook_callback("PCIDevice", &HPET_hook);
}
/*
branches/cparm/i386/modules/HPET/hpet.h
88
99
1010
11
1211
1312
1413
#include "libsaio.h"
#define REG32(base, reg) ((volatile uint32_t *)base)[(reg) >> 2]
#define EnableHPETModule"EnableHPETModule"
//void force_enable_hpet(pci_dt_t *lpc_dev);
branches/cparm/i386/modules/HPET/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7184
7285
7386
74
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
75107
108
109
110
111
76112
77
78113
79114
80115
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.HWDRV.HPET.hpet
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = HPET
BUNDLE_CLASS_PROVIDER = HWDRV
DIR = HPET
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${HPET_OBJS} dylib
all embedtheme: ${HPET_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
-current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \
-final_output $(MODULE_NAME) \
-macosx_version_min 10.6 \
$(OBJROOT)/stack_protector.o $(OBJROOT)/HPET.o -o $(SYMROOT)/$(MODULE_NAME).dylib
$(OBJROOT)/stack_protector.o $(OBJROOT)/HPET.o -o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/modules/SMBiosPatcher/SMBiosPatcher.c
11
2
2
33
44
55
......
2020
2121
2222
23
2423
2524
2625
27
2826
29
3027
3128
3229
......
8683
8784
8885
89
90
9186
9287
9388
94
95
96
97
9889
99
10090
10191
10292
103
104
93
10594
/*
* Copyright 2011 cparm. All rights reserved.
* Copyright 2011,2012 cparm. All rights reserved.
*/
#include "libsaio.h"
#include "bootstruct.h"
#define DBG(x...)
#endif
#define kEnableSMBIOSPatcher"EnableSMBIOSPatcher"
void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void getProductName_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void getboardproduct_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void is_SMB_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void getSmbiosPatched_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)
{
struct SMBEntryPoint *patched_smb = NULL;
}
void is_SMB_Patcher_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){}
void SMBiosPatcher_start(void);
void SMBiosPatcher_start(void)
{
bool enable = true;
getBoolForKey(kEnableSMBIOSPatcher, &enable, DEFAULT_BOOT_CONFIG) ;
enable = (execute_hook("isSMBIOSRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS);
if (enable) {
register_hook_callback("getSmbiosPatched", &getSmbiosPatched_hook);
register_hook_callback("getProductNamePatched", &getProductName_hook);
register_hook_callback("getboardproductPatched", &getboardproduct_hook);
register_hook_callback("isSMBIOSRegistred", &is_SMB_Patcher_Registred_Hook);
}
}
branches/cparm/i386/modules/SMBiosPatcher/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7487
7588
7689
77
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
78110
111
112
113
114
79115
80116
81117
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.SMBIOS.SMBIOSPLATFORM.smbiospatcher
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = SMBIOSPLATFORM
BUNDLE_CLASS_PROVIDER = SMBIOS
DIR = SMBiosPatcher
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${SMBiosPatcher_OBJS} dylib
all embedtheme: ${SMBiosPatcher_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/stack_protector.o \
$(OBJROOT)/SMBiosPatcher.o \
$(OBJROOT)/smbios_patcher.o \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
branches/cparm/i386/modules/Resolution/Resolution.c
88
99
1010
11
12
1311
1412
1513
16
17
18
19
20
21
22
23
14
15
2416
2517
#include "modules.h"
#include "bootstruct.h"
#define kEnableResolution"EnableResolutionModule"
void Resolution_start(void);
void Resolution_start(void)
{
bool enable = true;
getBoolForKey(kEnableResolution, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable) {
register_hook_callback("getResolution_hook", &getResolutionHook);
patchVideoBios();
}
register_hook_callback("getResolution_hook", &getResolutionHook);
patchVideoBios();
}
branches/cparm/i386/modules/Resolution/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5770
5871
5972
60
73
6174
6275
63
76
6477
6578
6679
......
7487
7588
7689
77
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
78110
79
111
112
113
114
115
116
80117
81118
82119
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.UI.GUI.RESOLUTION.resolution
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = RESOLUTION
BUNDLE_CLASS_PROVIDER = GUI
DIR = Resolution
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${RESOLUTION_OBJS} dylib
all embedtheme: ${RESOLUTION_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/edid.o \
$(OBJROOT)/915resolution.o \
$(OBJROOT)/Resolution.o \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "OSBundleLibraries" -dict "com.boot.GUI.GUI" '0'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/modules/CPUfreq/CPUfreq.c
11
2
2
33
44
55
......
223223
224224
225225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
226
227
228
229
230
231
232
233
240234
/*
* Copyright 2010,2011 valv, cparm <armelcadetpetit@gmail.com>. All rights reserved.
* Copyright 2010,2011,2012 valv, cparm <armelcadetpetit@gmail.com>. All rights reserved.
*/
#include "libsaio.h"
#include "bootstruct.h"
void CPUfreq_start(void);
void CPUfreq_start(void)
{
bool enable = true;
getBoolForKey(kEnableCPUfreq, &enable, DEFAULT_BOOT_CONFIG) ;
if (enable)
{
if (get_env(envFeatures) & CPUID_FEATURE_MSR)
{
register_hook_callback("PreBoot", &CPUfreq_hook);
}
else
{
verbose ("Unsupported CPU: CPUfreq disabled !!!\n");
}
}
if (get_env(envFeatures) & CPUID_FEATURE_MSR)
{
register_hook_callback("PreBoot", &CPUfreq_hook);
}
else
{
verbose ("Unsupported CPU: CPUfreq disabled !!!\n");
}
}
branches/cparm/i386/modules/CPUfreq/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
820
921
1022
......
5870
5971
6072
61
73
6274
6375
64
76
6577
6678
6779
......
7183
7284
7385
74
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
75106
107
108
109
110
111
112
76113
77114
78115
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.CPU.CPU_ENV.cpufreq
BUNDLE_COPYRIGHT = Copyright 2010,2011 valv, cparm . All rights reserved.
BUNDLE_LICENCE =
BUNDLE_VERSION = 0.1
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = CPU_ENV
BUNDLE_CLASS_PROVIDER = CPU
DIR = CPUfreq
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${CPUfreq_OBJS} dylib
all embedtheme: ${CPUfreq_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
-current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \
-final_output $(MODULE_NAME) \
-macosx_version_min 10.6 \
$(OBJROOT)/stack_protector.o $(OBJROOT)/CPUfreq.o -o $(SYMROOT)/$(MODULE_NAME).dylib
$(OBJROOT)/stack_protector.o $(OBJROOT)/CPUfreq.o -o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/modules/Memory/spd.c
421421
422422
423423
424
425
426
424
425
427426
428
429427
430428
431429
}
return false;
}
#if UNUSED
void scan_spd(PlatformInfo_t *p, pci_dt_t* smbus_controller_dev)
#else
void scan_spd(pci_dt_t* smbus_controller_dev)
#endif
{
int i = 0;
for ( ; (unsigned)i < sizeof(smbus_controllers) / sizeof(smbus_controllers[0]); i++ )
branches/cparm/i386/modules/Memory/Memory.c
1414
1515
1616
17
18
1917
2018
2119
......
2826
2927
3028
31
32
33
34
35
36
29
30
3731
38
32
33
34
35
36
3937
40
41
42
43
44
45
46
4738
4839
4940
......
6960
7061
7162
72
73
74
63
7564
76
65
7766
7867
7968
#include "bootstruct.h"
#include "modules.h"
#define kEnableMemory"EnableMemoryModule"
pci_dt_t * dram_controller_dev = NULL;
pci_dt_t * smbus_controller_dev = NULL;
void Memory_start(void);
void Memory_start(void)
{
bool enable = true;
getBoolForKey(kEnableMemory, &enable, DEFAULT_BOOT_CONFIG);
{
if (pci_config_read16(PCIADDR(0, 0x00, 0), 0x00) != 0x8086)
enable = false;
return;
register_hook_callback("PCIDevice", &Memory_PCIDevice_hook);
register_hook_callback("ScanMemory", &Memory_hook);
register_hook_callback("isMemoryRegistred", &is_Memory_Registred_Hook);
enable = (execute_hook("isMemoryRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS);
if (enable) {
register_hook_callback("PCIDevice", &Memory_PCIDevice_hook);
register_hook_callback("ScanMemory", &Memory_hook);
register_hook_callback("isMemoryRegistred", &is_Memory_Registred_Hook);
}
}
void Memory_PCIDevice_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)
if(smbus_controller_dev)
{
#if UNUSED
scan_spd(Platform, smbus_controller_dev);
#else
scan_spd(smbus_controller_dev);
#endif
}
}
branches/cparm/i386/modules/Memory/spd.h
1111
1212
1313
14
15
16
14
1715
18
16
1917
2018
2119
#include "libsaio.h"
bool is_smbus_controller(pci_dt_t* pci_dt);
#if UNUSED
void scan_spd(PlatformInfo_t *p, pci_dt_t* smbus_controller_dev);
#else
void scan_spd(pci_dt_t* smbus_controller_dev);
#endif
struct smbus_controllers_t {
uint32_tvendor;
uint32_tdevice;
branches/cparm/i386/modules/Memory/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7689
7790
7891
79
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
80112
113
114
115
116
117
118
81119
120
121
82122
83123
84124
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.SMBIOS.SMBIOSPLATFORM.MEMORY.memory
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = MEMORY
BUNDLE_CLASS_PROVIDER = SMBIOSPLATFORM
DIR = Memory
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${MEMORY_OBJS} dylib
all embedtheme: ${MEMORY_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/spd.o \
$(OBJROOT)/Memory.o \
-macosx_version_min 10.6 \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "OSBundleLibraries" -dict "com.boot.SMBIOS.SMBIOSPLATFORM" '0'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/modules/ACPICodec/acpi_codec.c
4949
5050
5151
52
5253
5354
5455
......
190191
191192
192193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
193210
194211
195212
......
370387
371388
372389
373
390
374391
375392
376393
......
477494
478495
479496
480
497
481498
482499
483500
......
9951012
9961013
9971014
998
1015
9991016
10001017
10011018
10021019
1003
1020
10041021
10051022
10061023
......
11151132
11161133
11171134
1135
1136
1137
1138
1139
1140
11181141
11191142
11201143
......
14911514
14921515
14931516
1494
1517
14951518
14961519
14971520
......
15111534
15121535
15131536
1514
1537
15151538
15161539
15171540
......
15301553
15311554
15321555
1533
1556
15341557
15351558
15361559
......
15531576
15541577
15551578
1556
15571579
15581580
15591581
15601582
1561
1562
1583
1584
1585
1586
15631587
1564
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
15651601
1566
1602
15671603
15681604
15691605
1570
1606
15711607
15721608
15731609
15741610
1575
1611
15761612
15771613
15781614
......
15981634
15991635
16001636
1601
1637
16021638
16031639
1604
1640
16051641
1606
1642
16071643
16081644
16091645
......
16191655
16201656
16211657
1622
1658
16231659
16241660
16251661
......
16771713
16781714
16791715
1680
1716
16811717
16821718
16831719
......
17211757
17221758
17231759
1724
1725
1726
1727
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
17281776
17291777
17301778
1731
1732
1779
17331780
1734
1735
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
17361797
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
17481798
17491799
17501800
......
17581808
17591809
17601810
1761
1811
17621812
17631813
17641814
......
18961946
18971947
18981948
1899
1949
19001950
19011951
19021952
19031953
1904
1954
19051955
1906
1956
19071957
19081958
19091959
......
19111961
19121962
19131963
1914
1964
19151965
1916
1917
1966
1967
19181968
19191969
19201970
......
24072457
24082458
24092459
2410
2460
24112461
24122462
24132463
......
36693719
36703720
36713721
3672
3722
36733723
36743724
36753725
......
36803730
36813731
36823732
3683
3733
36843734
36853735
36863736
......
39984048
39994049
40004050
4001
4051
40024052
40034053
40044054
......
41394189
41404190
41414191
4142
4192
41434193
41444194
41454195
......
41554205
41564206
41574207
4158
4208
41594209
41604210
41614211
......
41734223
41744224
41754225
4176
4226
41774227
41784228
41794229
......
42004250
42014251
42024252
4203
4253
42044254
42054255
42064256
......
42644314
42654315
42664316
4267
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
42684330
42694331
42704332
......
43104372
43114373
43124374
4313
4375
43144376
43154377
43164378
......
43404402
43414403
43424404
4343
4405
43444406
43454407
43464408
......
43524414
43534415
43544416
4417
43554418
43564419
43574420
43584421
43594422
4360
4423
43614424
43624425
43634426
......
44434506
44444507
44454508
4446
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
44474521
44484522
44494523
......
44784552
44794553
44804554
4481
4555
44824556
44834557
44844558
......
45074581
45084582
45094583
4510
4584
45114585
45124586
45134587
......
45184592
45194593
45204594
4595
45214596
45224597
45234598
......
46394714
46404715
46414716
4717
4718
46424719
46434720
46444721
......
46494726
46504727
46514728
4652
4653
4729
4730
46544731
4655
4656
4657
4658
4732
4733
4734
4735
46594736
4660
4661
4737
4738
46624739
4663
4740
46644741
4665
4742
46664743
46674744
46684745
......
49715048
49725049
49735050
4974
5051
49755052
49765053
49775054
......
49825059
49835060
49845061
4985
5062
49865063
49875064
49885065
#include "pci_root.h"
#include "sl.h"
#include "convert.h"
#include "modules.h"
U64 rsd_p;
ACPI_TABLES acpi_tables;
__RES(pss, long)
__RES(cst, int)
static config_file_t *personality = (config_file_t*)0;
static void initPersonality (void)
{
TagPtr dict = GetBundlePersonality( __BUNDLE_ID__ );
if (dict) {
if ((personality = (config_file_t*)malloc(sizeof(config_file_t))))
{
memset(personality, 0, sizeof(config_file_t));
personality->dictionary = dict;
personality->canOverride = true;
}
}
}
static ACPI_TABLE_HEADER * get_new_table_in_list(U32 *new_table_list, U32 Signature, U8 *retIndex )
{
printf("\n");
#endif
int method = 0;
getIntForKey(kAcpiMethod, &method, DEFAULT_BOOT_CONFIG);
getIntForKey(kAcpiMethod, &method, personality);
if (method != 0x2)
printf("\n");
#endif
int method = 0;
getIntForKey(kAcpiMethod, &method, DEFAULT_BOOT_CONFIG);
getIntForKey(kAcpiMethod, &method, personality);
if (method != 0x2)
U32 temp32 = 0;
U64 temp64= 0;
int tdp;
if (getIntForKey("TDP", &tdp, DEFAULT_BOOT_CONFIG))
if (getIntForKey("TDP", &tdp, personality))
{
temp32 = (U32) (tdp*8) ;
int tdc;
if (getIntForKey("TDC", &tdc, DEFAULT_BOOT_CONFIG))
if (getIntForKey("TDC", &tdc, personality))
{
temp32 = (U32) (temp32) | tdc<<16 ;
cpu->max_ratio_as_cfg = (U32) ((U32)platform_info >> 8) & 0xff;
cpu->min_ratio = (U32) ((platform_info >> 40) & 0xff);
cpu->tdc_tdp_limits_for_turbo_flag = (platform_info & (1ULL << 29)) ? 1 : 0;
cpu->ratio_limits_for_turbo_flag = (platform_info & (1ULL << 28)) ? 1 : 0;
cpu->xe_available = cpu->tdc_tdp_limits_for_turbo_flag | cpu->ratio_limits_for_turbo_flag;
if (is_sandybridge() || is_jaketown())
{
cpu->package_power_limit = rdmsr64(MSR_PKG_RAPL_POWER_LIMIT);
}
// Generating Pstate PKG
if (p_states_count)
if (p_states_count > 0)
{
U32 fsb = (U32)get_env(envFSBFreq);
U8 minPSratio = (p_states[p_states_count-1].Frequency / (fsb / 10000000 ));
{
int user_max_ratio = 0;
getIntForKey(kMaxRatio, &user_max_ratio, DEFAULT_BOOT_CONFIG);
getIntForKey(kMaxRatio, &user_max_ratio, personality);
if (user_max_ratio >= minPSratio && maxPSratio >= user_max_ratio)
{
{
int user_min_ratio = 0;
getIntForKey(kMinRatio, &user_min_ratio, DEFAULT_BOOT_CONFIG);
getIntForKey(kMinRatio, &user_min_ratio, personality);
if (user_min_ratio >= minPSratio && cpu_ratio >= user_min_ratio)
{
if (maxPSratio >= cpu_ratio && cpu_ratio >= minPSratio)maxPSratio = cpu_ratio;
{
TagPtr personality = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"P-States")); // TODO: fix me
int base = 16;
U8 expert = 0; /* Default: 0 , mean mixed mode
* expert mode : 1 , mean add only p-states found in boot.plist
*/
TagPtr PstateTag;
U32 pstate_tag_count = 0;
{
if (personality)
if (personality->dictionary)
{
PstateTag = XMLCastDict(XMLGetProperty(personality->dictionary, (const char*)"P-States"));
if (PstateTag) pstate_tag_count = XMLTagCount(PstateTag) ;
}
if (!pstate_tag_count)
if ((PstateTag = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"P-States")))) pstate_tag_count = XMLTagCount(PstateTag);
if ((pstate_tag_count > 0) && PstateTag)
{
char *tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Mode"));
char *tmpstr = XMLCastString(XMLGetProperty(PstateTag, (const char*)"Mode"));
if (strcmp(tmpstr,"Expert") == 0)
{
p_states_count = XMLTagCount(personality) - 1 ; // - 1 = - ("Mode" tag)
p_states_count = pstate_tag_count - 1 ; // - 1 = - ("Mode" tag)
expert = 1;
}
if ((tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Base"))))
if ((tmpstr = XMLCastString(XMLGetProperty(PstateTag, (const char*)"Base"))))
{
if (expert) p_states_count--; // -= ("Base" tag)
{
char *Lat1 = NULL, *clk = NULL, *Pw = NULL, *Lat2 = NULL, *Ctrl = NULL ;
if (personality)
if ((pstate_tag_count > 0) && PstateTag)
{
sprintf(MatchStat, "%d",i);
TagPtr match_Status = XMLGetProperty(personality, (const char*)MatchStat);
TagPtr match_Status = XMLGetProperty(PstateTag, (const char*)MatchStat);
if (match_Status)
if (match_Status && (XMLTagCount(match_Status) > 0))
{
clk = XMLCastString(XMLGetProperty(match_Status, (const char*)"CoreFreq"));
unsigned long Frequency = 0x00000000;
if (!expert || !personality) Frequency = p_states[i].Frequency;
if (!expert || !pstate_tag_count) Frequency = p_states[i].Frequency;
if (clk)
Frequency = strtoul((const char *)clk, NULL,base);
{
U32 Control = 0 /*encode_pstate(curr_ratio)*/ ;
if (!expert || !personality) Control = p_states[i].Control;
if (!expert || !pstate_tag_count) Control = p_states[i].Control;
pstate->control = resolve_pss(Control, Ctrl, base); // Control
}
//-----------------------------------------------------------------------------
static U32 BuildCstateInfo(CPU_DETAILS * cpu, U32 pmbase)
{
{
TagPtr personality = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"C-States")); // TODO :fix me
if (personality)
{
TagPtr CstateTag;
U32 entry_count = 0;
if (personality->dictionary)
{
CstateTag = XMLCastDict(XMLGetProperty(personality->dictionary, (const char*)"C-States"));
if (CstateTag) entry_count = XMLTagCount(CstateTag);
}
if (!entry_count)
CstateTag = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"C-States"));
if (CstateTag)
{
int base = 16;
U32 entry_count = XMLTagCount(personality);
char *tmpstr =NULL;
entry_count = XMLTagCount(CstateTag);
if ((tmpstr = XMLCastString(XMLGetProperty(personality, (const char*)"Base"))))
{
if (entry_count > 0)
{
{
char *tmpstr;
if ((tmpstr = XMLCastString(XMLGetProperty(CstateTag, (const char*)"Base"))))
{
entry_count--; // -= ("Base" tag)
int mybase = strtol(tmpstr, NULL, 10);
if (mybase == 8 || mybase == 10 || mybase == 16 )
base = mybase;
}
}
entry_count--; // -= ("Base" tag)
int mybase = strtol(tmpstr, NULL, 10);
if (mybase == 8 || mybase == 10 || mybase == 16 )
base = mybase;
}
if (entry_count)
{
cpu->pkg_io_cstates.num_cstates = 0;
cpu->pkg_mwait_cstates.num_cstates = 0;
U32 num_cstates = 0;
char *Lat = NULL, *Pw = NULL, *BWidth= NULL, *BOffset= NULL, *Address= NULL, *AccessSize= NULL, *index= NULL;
sprintf(MatchStat, "C%d",i);
TagPtr match_Status = XMLGetProperty(personality, (const char*)MatchStat);
TagPtr match_Status = XMLGetProperty(CstateTag, (const char*)MatchStat);
if (match_Status)
{
Pw = XMLCastString(XMLGetProperty(match_Status, (const char*)"Power"));
bool tmpval;
if (getBoolForKey(kEnableC2State, &tmpval, DEFAULT_BOOT_CONFIG))
if (getBoolForKey(kEnableC2State, &tmpval, personality))
{
c2_enabled = tmpval;
}
if (!getIntForKey("C3StateOption", &c3_enabled, DEFAULT_BOOT_CONFIG))
if (!getIntForKey("C3StateOption", &c3_enabled, personality))
{
c3_enabled = (getBoolForKey(kEnableC3State, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval) ? 3 : 0;
c3_enabled = (getBoolForKey(kEnableC3State, &tmpval, personality)&&tmpval) ? 3 : 0;
}
if (c3_enabled == 6)
{
}
else
{
c4_enabled = (getBoolForKey(kEnableC4State, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval) ? 1 : 0;
c4_enabled = (getBoolForKey(kEnableC4State, &tmpval, personality)&&tmpval) ? 1 : 0;
}
c6_enabled = (getBoolForKey(kEnableC6State, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval) ? 1 : 0;
c7_enabled = (getBoolForKey(kEnableC7State, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval) ? 1 : 0;
c6_enabled = (getBoolForKey(kEnableC6State, &tmpval, personality)&&tmpval) ? 1 : 0;
c7_enabled = (getBoolForKey(kEnableC7State, &tmpval, personality)&&tmpval) ? 1 : 0;
}
cpu->pkg_mwait_cstates.num_cstates = 0;
{
bool tmpval;
oem_apic=getBoolForKey(kOEMAPIC, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
oem_apic=getBoolForKey(kOEMAPIC, &tmpval, personality)&&tmpval;
}
if (oem_apic == true)
cstates_enabled = BuildCstateInfo(&cpu, pmbase);
if (cstates_enabled)
{
getBoolForKey(KEnableMwait, &enable_mwait, DEFAULT_BOOT_CONFIG);
getBoolForKey(KEnableMwait, &enable_mwait, personality);
}
}
pstates_enabled = BuildPstateInfo(&cpu);
if (pstates_enabled)
{
const char *str = getStringForKey(KAcpiCoordType, DEFAULT_BOOT_CONFIG);
const char *str = getStringForKey(KAcpiCoordType, personality);
U8 tmp = (U8)strtoul(str, NULL,16);
if ((tmp == ACPI_COORD_TYPE_SW_ALL) || (tmp == ACPI_COORD_TYPE_SW_ANY) || (tmp == ACPI_COORD_TYPE_HW_ALL) )
{
if (get_env(envVendor) == CPUID_VENDOR_INTEL)
{
fix_restart = true;
getBoolForKey(kRestartFix, &fix_restart, DEFAULT_BOOT_CONFIG);
getBoolForKey(kRestartFix, &fix_restart, personality);
} else {
verbose ("Not an Intel platform: Restart Fix disabled !!!\n");
if (fadt_mod->PreferredProfile != get_env(envType))
{
bool val = false;
getBoolForKey("PreferInternalProfileDetect", &val, DEFAULT_BOOT_CONFIG); // if true Give prior to the profile resolved trought the CPU model
getBoolForKey("PreferInternalProfileDetect", &val, personality); // if true Give prior to the profile resolved trought the CPU model
val = get_env(envIsServer) ;
}
// Set PM_Profile and System-type if user wanted this value to be forced
if ( (value=getStringForKey("SystemType", DEFAULT_BOOT_CONFIG))!=NULL)
if ( (value=getStringForKey("SystemType", personality))!=NULL)
{
if ((Type = (unsigned char) strtoul(value, NULL, 10) ) <= MaxSupportedPMProfile)
{
} else printf("Error: system-type must be 0..6. Defaulting to %d !\n", (U8)get_env(envType));
}
getBoolForKey(KIntelFADT, &intelfadtspec, DEFAULT_BOOT_CONFIG);
getBoolForKey(KIntelFADT, &intelfadtspec, personality);
if ((pmbase == 0) && (cpu_map_error == 0) && (intelfadtspec == true))
{
ACPI_TABLE_DSDT *DsdtPointer ;
fadt_mod->Flags|= 0x400;
int type = PCI_RESET_TYPE;
getIntForKey(KResetType, &type, DEFAULT_BOOT_CONFIG);
getIntForKey(KResetType, &type, personality);
if (type == KEYBOARD_RESET_TYPE)
{
//Azi: keyboard reset; http://forum.voodooprojects.org/index.php/topic,1056.msg9802.html#msg9802
static U32 process_xsdt (ACPI_TABLE_RSDP *rsdp_mod , U32 *new_table_list)
{
TagPtr DropTables_p = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"ACPIDropTables")); // TODO: fix me
TagPtr DropTables_p = 0;
int DropTables_tag_count = 0;
if (personality->dictionary)
{
DropTables_p = XMLCastDict(XMLGetProperty(personality->dictionary, (const char*)"ACPIDropTables"));
if (DropTables_p) DropTables_tag_count = XMLTagCount(DropTables_p) ;
}
if (!DropTables_tag_count)
if ((DropTables_p = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"ACPIDropTables")))) DropTables_tag_count = XMLTagCount(DropTables_p);
U32 new_table = 0ul;
U8 new_table_index = 0, table_added = 0;
ACPI_TABLE_XSDT *xsdt = (void*)0ul, *xsdt_mod = (void*)0ul;
}
int method = 0;
getIntForKey(kAcpiMethod, &method, DEFAULT_BOOT_CONFIG);
getIntForKey(kAcpiMethod, &method, personality);
if (method != 0x2)
bool oem = false;
char oemOption[OEMOPT_SIZE];
sprintf(oemOption, "oem%s",tableSig );
if (getBoolForKey(oemOption, &oem, DEFAULT_BOOT_CONFIG) && oem) // This method don't work for DSDT and FACS
if (getBoolForKey(oemOption, &oem, personality) && oem) // This method don't work for DSDT and FACS
{
DBG(" %s required\n", oemOption);
}
}
if ((DropTables_tag_count > 0) && DropTables_p)
{
TagPtr match_drop = XMLGetProperty(DropTables_p, (const char*)tableSig);
if ( match_drop )
{
char *tmp = XMLCastString(match_drop);
if (strcmp(tmp,"No") != 0)
if (tmp && (strcmp(tmp,"No") != 0))
{
dropoffset++;
DBG(" %s table dropped\n",tableSig);
static U32 process_rsdt(ACPI_TABLE_RSDP *rsdp_mod , bool gen_xsdt, U32 *new_table_list)
{
TagPtr DropTables_p = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"ACPIDropTables")); // TODO: fix me
TagPtr DropTables_p = 0;
int DropTables_tag_count = 0;
if (personality->dictionary)
{
DropTables_p = XMLCastDict(XMLGetProperty(personality->dictionary, (const char*)"ACPIDropTables"));
if (DropTables_p) DropTables_tag_count = XMLTagCount(DropTables_p) ;
}
if (!DropTables_tag_count)
if ((DropTables_p = XMLCastDict(XMLGetProperty(DEFAULT_BOOT_CONFIG_DICT, (const char*)"ACPIDropTables")))) DropTables_tag_count = XMLTagCount(DropTables_p);
U32 new_table = 0ul;
U8 new_table_index = 0, table_added = 0;
U32 dropoffset=0, index;
{
int method = 0;
getIntForKey(kAcpiMethod, &method, DEFAULT_BOOT_CONFIG);
getIntForKey(kAcpiMethod, &method, personality);
if (method != 0x2)
bool oem = false;
char oemOption[OEMOPT_SIZE];
sprintf(oemOption, "oem%s",tableSig );
if (getBoolForKey(oemOption, &oem, DEFAULT_BOOT_CONFIG) && oem) // This method don't work for DSDT and FACS
if (getBoolForKey(oemOption, &oem, personality) && oem) // This method don't work for DSDT and FACS
{
DBG(" %s required\n", oemOption);
}
}
if ((DropTables_tag_count > 0) && DropTables_p)
{
TagPtr match_drop = XMLGetProperty(DropTables_p, (const char*)tableSig);
if ( match_drop )
getc();
return EFI_NOT_FOUND;
}
initPersonality();
{
U8 i;
}
bool tmpval;
oem_dsdt=getBoolForKey(kOEMDSDT, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
oem_fadt=getBoolForKey(kOEMFADT, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
oem_dsdt=getBoolForKey(kOEMDSDT, &tmpval, personality)&&tmpval;
oem_fadt=getBoolForKey(kOEMFADT, &tmpval, personality)&&tmpval;
gen_csta=getBoolForKey(kGenerateCStates, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
gen_psta=getBoolForKey(kGeneratePStates, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
gen_ssdt=getBoolForKey(KForceSSDT, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
update_acpi=getBoolForKey(kUpdateACPI, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
gen_csta=getBoolForKey(kGenerateCStates, &tmpval, personality)&&tmpval;
gen_psta=getBoolForKey(kGeneratePStates, &tmpval, personality)&&tmpval;
gen_ssdt=getBoolForKey(KForceSSDT, &tmpval, personality)&&tmpval;
update_acpi=getBoolForKey(kUpdateACPI, &tmpval, personality)&&tmpval;
speed_step=getBoolForKey(kSpeedstep, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
turbo_enabled=(U32)getBoolForKey(kCoreTurbo, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
speed_step=getBoolForKey(kSpeedstep, &tmpval, personality)&&tmpval;
turbo_enabled=(U32)getBoolForKey(kCoreTurbo, &tmpval, personality)&&tmpval;
#if BUILD_ACPI_TSS
gen_tsta=(U32)getBoolForKey(kGenerateTStates, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
gen_tsta=(U32)getBoolForKey(kGenerateTStates, &tmpval, personality)&&tmpval;
#endif
checkOem=getBoolForKey(kOnlySignedAml, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
checkOem=getBoolForKey(kOnlySignedAml, &tmpval, personality)&&tmpval;
}
{
MADT_INFO madt_info;
bool strip_madt = true;
getBoolForKey(kSTRIPAPIC, &strip_madt, DEFAULT_BOOT_CONFIG);
getBoolForKey(kSTRIPAPIC, &strip_madt, personality);
if ((strip_madt == false) || (!buildMADT(new_table_list, DsdtPtr, &madt_info )))
{
{
bool tmpval;
oem_apic=getBoolForKey(kOEMAPIC, &tmpval, DEFAULT_BOOT_CONFIG)&&tmpval;
oem_apic=getBoolForKey(kOEMAPIC, &tmpval, personality)&&tmpval;
}
if ((madt_file = (ACPI_TABLE_MADT *)get_new_table_in_list(new_table_list, NAMESEG("APIC"), &new_table_index)) != (void *)0ul)
branches/cparm/i386/modules/ACPICodec/ACPICodec.c
11
2
2
33
44
55
......
99
1010
1111
12
13
14
1512
16
17
18
1913
20
21
22
23
24
25
26
27
28
29
30
31
32
14
15
3316
/*
* Copyright (c) 2010 cparm <armelcadetpetit@gmail.com>. All rights reserved.
* Copyright (c) 2010,2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
*
*/
#include "pci_root.h"
#include "acpi_codec.h"
#define kEnableAcpi"EnableAcpiModule"
void is_ACPI_Codec_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
void ACPICodec_start(void);
void is_ACPI_Codec_Registred_Hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6){}
void ACPICodec_start(void)
{
bool enable = true;
getBoolForKey(kEnableAcpi, &enable, DEFAULT_BOOT_CONFIG) ;
enable = (execute_hook("isACPIRegistred", NULL, NULL, NULL, NULL, NULL, NULL) != EFI_SUCCESS);
if (enable)
{
replace_system_function("_setup_acpi",&setupAcpi);
register_hook_callback("isACPIRegistred", &is_ACPI_Codec_Registred_Hook);
}
{
replace_system_function("_setup_acpi",&setupAcpi);
}
branches/cparm/i386/modules/ACPICodec/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
2841
2942
3043
31
44
3245
3346
3447
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7689
7790
7891
79
92
93
94
95
96
97
98
99
100
80101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
81121
82122
83123
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.ACPI.ACPIPLATFORM.cparm.acpicodec
BUNDLE_COPYRIGHT = Copyright 2012, cparm
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = ACPIPLATFORM
BUNDLE_CLASS_PROVIDER = ACPI
DIR = ACPICodec
include ../../MakePaths.dir
-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
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -fno-common -D__BUNDLE_ID__=\"$(BUNDLE_ID)\"
DEFINES=
CONFIG = hd
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${ACPI_CODEC_OBJS} dylib
all embedtheme: ${ACPI_CODEC_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
$(OBJROOT)/acpidecode.o \
$(OBJROOT)/ACPICodec.o \
$(OBJROOT)/acpi_codec.o \
-o $(SYMROOT)/$(MODULE_NAME).dylib
-o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOKitPersonalities" -dict "ResetType" '0' "IntelFADTSpec" 'Yes'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/modules/HelloWorld/Makefile
55
66
77
8
9
10
11
12
13
14
15
16
17
18
19
20
821
922
1023
......
5871
5972
6073
61
74
6275
6376
64
77
6578
6679
6780
......
7184
7285
7386
74
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
75107
108
109
110
111
76112
77
113
78114
79115
80116
MODULE_START = _$(MODULE_NAME)_start
MODULE_DEPENDENCIES =
BUNDLE_NAME = $(MODULE_NAME)
BUNDLE_EXEC = $(BUNDLE_NAME)
BUNDLE_LIBS =
BUNDLE_INFO =
BUNDLE_ID = com.boot.TEST.TEST.hello
BUNDLE_COPYRIGHT =
BUNDLE_LICENCE =
BUNDLE_VERSION = 1.0
BUNDLE_ICON =
BUNDLE_SHORT_VERSION = 1
BUNDLE_CLASS = TEST
BUNDLE_CLASS_PROVIDER = TEST
DIR = HelloWorld
include ../../MakePaths.dir
$(HFILES) $(OTHERFILES)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: ${HELLO_WORLD_OBJS} dylib
all embedtheme: ${HELLO_WORLD_OBJS} bundle
dylib:
bundle:
ld -arch i386 \
-undefined dynamic_lookup \
-alias $(MODULE_START) start \
-current_version $(MODULE_VERSION) -compatibility_version $(MODULE_COMPAT_VERSION) \
-final_output $(MODULE_NAME) \
-macosx_version_min 10.6 \
$(OBJROOT)/stack_protector.o $(OBJROOT)/HelloWorld.o -o $(SYMROOT)/$(MODULE_NAME).dylib
$(OBJROOT)/stack_protector.o $(OBJROOT)/HelloWorld.o -o $(SYMROOT)/$(BUNDLE_EXEC)
@rm -rf $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Resources
@mkdir $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@mv $(SYMROOT)/$(BUNDLE_EXEC) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/MacOS
@#mv $(SYMROOT)/$(SYMBOLS_BUNDLE_LIBS) $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/PlugIns
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleGetInfoString" '$(BUNDLE_INFO)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSHumanReadableCopyright" '$(BUNDLE_COPYRIGHT)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleShortVersionString" '$(BUNDLE_SHORT_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIconFile" '$(BUNDLE_ICON)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleVersion" '$(BUNDLE_VERSION)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundlePackageType" 'BNDL'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleInfoDictionaryVersion" '6.0'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleName" '$(BUNDLE_NAME)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleIdentifier" '$(BUNDLE_ID)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "NSPrincipalClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "CFBundleExecutable" '$(BUNDLE_EXEC)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOClass" '$(BUNDLE_CLASS)'
@defaults write $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info "IOProviderClass" '$(BUNDLE_CLASS_PROVIDER)'
@plutil -convert xml1 $(SYMROOT)/$(BUNDLE_NAME).bundle/Contents/Info.plist
stack_protector.o:
$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c "$(LIBSAIODIR)/stack_protector.c" $(INC) -o "$(OBJROOT)/stack_protector.o"
branches/cparm/i386/libsa/Makefile
1010
1111
1212
13
14
13
1514
1615
1716
OPTIM = -Os -Oz
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror -fno-stack-protector \
-fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float
-march=pentium4 -msse2 -msoft-float -ffreestanding -mpreferred-stack-boundary=2 -fno-align-functions -mfpmath=sse
INC = -I. -I$(SYMROOT) -I$(UTILDIR) -I$(LIBSAIODIR)
ifneq "" "$(wildcard /bin/mkdirs)"

Archive Download the corresponding diff file

Revision: 1931