Chameleon

Chameleon Commit Details

Date:2014-09-27 14:15:02 (9 years 6 months ago)
Author:ErmaC
Commit:2398
Parents: 2397
Message:Optimization Level.
Changes:
M/trunk/i386/boot0/boot0.s
M/trunk/i386/Cconfig
M/trunk/i386/boot0/boot0hfs.s
M/trunk/i386/boot0/boot0md.s
M/trunk/i386/boot2/gui.c
M/trunk/i386/boot2/gui.h
M/trunk/i386/boot2/Makefile

File differences

trunk/i386/boot0/boot0.s
283283
284284
285285
286
286
287287
288288
289289
......
473473
474474
475475
476
476477
477478
478479
......
519520
520521
521522
522
523
523524
524525
525526
; to boot an inactive but boot1h aware HFS+ partition
; by scanning the MBR partition entries again.
.start_scan:
.start_scan:
mov cx, kPartCount ; number of partition entries per table
.loop:
jmp SHORT initBootLoader
.gpt_continue:
add si, bx; advance SI to next partition entry
loop .gpt_loop; loop through all partition entries
je.checkBootSignature
cmpax, kHFSPCaseSignature; 'HX'
je.checkBootSignature
;
; Looking for boot1f32 magic string.
;
trunk/i386/boot0/boot0hfs.s
283283
284284
285285
286
286
287287
288288
289289
......
444444
445445
446446
447
447
448448
449449
450450
......
519519
520520
521521
522
522
523523
524524
525525
; to boot an inactive but boot1h aware HFS+ partition
; by scanning the MBR partition entries again.
.start_scan:
.start_scan:
mov cx, kPartCount ; number of partition entries per table
.loop:
.gpt_loop:
mov eax, [si + gpta.PartitionTypeGUID + kGUIDLastDwordOffs]
cmpeax, kAppleGUID; check current GUID Partition for Apple's GUID type
je.gpt_ok
je.checkBootSignature
cmpax, kHFSPCaseSignature; 'HX'
je.checkBootSignature
;
; Looking for boot1f32 magic string.
;
trunk/i386/boot0/boot0md.s
306306
307307
308308
309
310
309
311310
312311
313312
......
325324
326325
327326
328
327
329328
330329
331330
332331
333332
334333
335
334
336335
337
336
338337
339338
340339
341
340
342341
343342
344343
345344
346
347345
346
348347
349348
350349
351350
352351
353
352
354353
355
354
356355
357356
358357
......
386385
387386
388387
389
388
389
390390
391391
392392
......
418418
419419
420420
421
421
422422
423423
424424
......
499499
500500
501501
502
502
503503
504504
505505
......
546546
547547
548548
549
549
550550
551551
552552
......
623623
624624
625625
626
626
627627
628628
629629
DebugChar('P'); starting new pass
pushdx; save dl (boot drive) for next pass
.scan_drive:
;
jc .next_pass; MBR load error - normally because we scanned all drives
DebugChar('D'); starting disk scanning
;
; Look for the booter partition in the MBR partition table,
; which is at offset kMBRPartTable.
;
mov si, kMBRPartTable; pointer to partition table
call find_boot; will not return on success
; if returns - booter partition is not found
; skip scanning of all drives in Pass1
cmpbh, kPass1
je.next_pass
; try next drive
; if next drive does not exists - will break on the MBR load error above
incdl
jmpshort .scan_drive
.next_pass:
; all drives scanned - move to next pass
popdx; restore orig boot drive
decbh; decrement scan pass counter
jnzpass_loop; if not zero - exec next pass
; we ran all passes - nothing found - error
error:
DebugChar('E')
DebugPause
xor bl, bl; BL will be set to 1 later in case of
; Protective MBR has been found
.start_scan:
.start_scan:
mov cx, kPartCount ; number of partition entries per table
.loop:
;
; Code may be harder to read because I tried to optimized it for minimum size.
;
.testPass:
DebugChar('t'); testing partition
xordh, dh ; DH=0 This will be used in Pass3 (partition is active, not HFS+).
DebugChar('G'); found GPT
mov si, di
;
; Loading GUID Partition Table Array
;
.gpt_loop:
mov eax, [si + gpta.PartitionTypeGUID + kGUIDLastDwordOffs]
cmpeax, kAppleGUID; check current GUID Partition for Apple's GUID type
je.gpt_ok
je.checkBootSignature
cmpax, kHFSPCaseSignature; 'HX'
je.checkBootSignature
;
; Looking for boot1f32 magic string.
;
trunk/i386/boot2/Makefile
1919
2020
2121
22
22
2323
2424
2525
DIR = boot2
include ${SRCROOT}/Make.rules
OPTIM = -Os -Oz
OPTIM = $(CONFIG_OPTIMIZATION_LEVEL)
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) -fno-stack-protector \
-march=pentium4 -msse2 -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
trunk/i386/boot2/gui.c
3131
3232
3333
34
3435
3536
3637
......
115116
116117
117118
119
120
118121
119122
120123
......
195198
196199
197200
201
202
198203
199204
200205
......
342347
343348
344349
350
351
345352
346353
347354
......
428435
429436
430437
438
439
431440
432441
433442
......
446455
447456
448457
458
459
449460
450461
451462
......
458469
459470
460471
472
473
461474
462475
463476
......
482495
483496
484497
498
499
485500
486501
487502
......
501516
502517
503518
519
520
504521
505522
506523
......
521538
522539
523540
541
542
524543
525544
526545
......
531550
532551
533552
553
554
534555
535556
536557
......
543564
544565
545566
567
568
546569
547570
548571
......
563586
564587
565588
589
590
566591
567592
568593
......
635660
636661
637662
663
664
638665
639666
640667
......
834861
835862
836863
864
865
837866
838867
839868
......
915944
916945
917946
947
948
918949
919950
920951
921952
922953
954
955
923956
924957
925958
......
10101043
10111044
10121045
1046
1047
10131048
10141049
10151050
......
11141149
11151150
11161151
1152
1153
11171154
11181155
11191156
......
11311168
11321169
11331170
1171
1172
11341173
11351174
11361175
......
11561195
11571196
11581197
1198
1199
11591200
11601201
11611202
......
11901231
11911232
11921233
1234
1235
11931236
11941237
11951238
......
12151258
12161259
12171260
1261
1262
12181263
12191264
12201265
12211266
12221267
12231268
1269
1270
12241271
12251272
12261273
......
12341281
12351282
12361283
1284
1285
12371286
12381287
12391288
......
13161365
13171366
13181367
1368
1369
13191370
13201371
13211372
......
13991450
14001451
14011452
1453
1454
14021455
14031456
14041457
......
14741527
14751528
14761529
1530
1531
14771532
14781533
14791534
......
14831538
14841539
14851540
1541
1542
14861543
14871544
14881545
......
14931550
14941551
14951552
1553
1554
14961555
14971556
14981557
......
15161575
15171576
15181577
1578
1579
15191580
15201581
15211582
......
15471608
15481609
15491610
1611
1612
15501613
15511614
15521615
......
15621625
15631626
15641627
1628
1629
15651630
15661631
15671632
......
16181683
16191684
16201685
1686
1687
16211688
16221689
16231690
......
16441711
16451712
16461713
1714
1715
16471716
16481717
16491718
......
16881757
16891758
16901759
1760
1761
16911762
16921763
16931764
......
18181889
18191890
18201891
1892
1893
18211894
18221895
18231896
......
18381911
18391912
18401913
1914
1915
18411916
18421917
18431918
......
18981973
18991974
19001975
1976
1977
19011978
19021979
19031980
......
19402017
19412018
19422019
2020
2021
19432022
19442023
19452024
......
19512030
19522031
19532032
2033
2034
19542035
19552036
19562037
......
20082089
20092090
20102091
2092
2093
20112094
20122095
20132096
......
21102193
21112194
21122195
2113
2196
21142197
2198
int lasttime = 0; // we need this for animating maybe
// ====================================================================
/*
* ATTENTION: the enum and the following array images[] MUST match !!!
iFontSmall,
};
// ====================================================================
image_t images[] = {
{.name = "background", .image = NULL},
{.name = "logo", .image = NULL},
{.name = "font_small", .image = NULL},
};
// ====================================================================
int imageCnt = 0;
extern intgDeviceCount;
return 1;
}
// ====================================================================
static int loadGraphics(void)
{
LOADPNG(background, IMG_REQUIRED);
return 0;
}
// ====================================================================
static int unloadGraphics(void)
{
int i;
return 0;
}
// ====================================================================
int freeBackBuffer( window_t *window )
{
if (gui.backbuffer && gui.backbuffer->pixels) {
return 1;
}
// ====================================================================
pixmap_t *getCroppedPixmapAtPosition( pixmap_t *from, position_t pos, uint16_t width, uint16_t height )
{
pixmap_t *cropped = malloc( sizeof( pixmap_t ) );
return cropped;
}
// ====================================================================
int createBackBuffer( window_t *window )
{
gui.backbuffer = malloc(sizeof(pixmap_t));
return 0;
}
// ====================================================================
int createWindowBuffer( window_t *window )
{
window->pixmap = malloc(sizeof(pixmap_t));
return 0;
}
// ====================================================================
int freeWindowBuffer( window_t *window )
{
if (window->pixmap && window->pixmap->pixels) {
return 1;
}
// ====================================================================
void fillPixmapWithColor(pixmap_t *pm, uint32_t color)
{
int x,y;
}
}
// ====================================================================
void drawBackground()
{
// reset text cursor
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
}
// ====================================================================
void setupDeviceList(config_file_t *theme)
{
unsigned int pixel;
}
}
// ====================================================================
void loadThemeValues(config_file_t *theme)
{
unsigned int screen_width = gui.screen.width;
}
}
// ====================================================================
int initGUI(void)
{
intval;
return 1;
}
// ====================================================================
bool is_image_loaded(int i)
{
return (images[i].image != NULL) ? true : false;
}
// ====================================================================
void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected)
{
int devicetype;
}
// ====================================================================
void drawDeviceList (int start, int end, int selection)
{
inti;
}
// ====================================================================
void clearGraphicBootPrompt()
{
// clear text buffer
return;
}
// ====================================================================
void updateGraphicBootPrompt()
{
fillPixmapWithColor( gui.bootprompt.pixmap, gui.bootprompt.bgcolor);
return;
}
// ====================================================================
static inline
void vramwrite (void *data, int width, int height)
{
}
}
// ====================================================================
void updateVRAM()
{
if (gui.redraw) {
}
}
// ====================================================================
struct putc_info //Azi: exists on console.c & printf.c
{
char * str;
char * last_str;
};
// ====================================================================
static int
sputc(int c, struct putc_info * pi) //Azi: same as above
{
return c;
}
// ====================================================================
int gprintf( window_t * window, const char * fmt, ...)
{
char *formattedtext;
return 1;
}
// ====================================================================
int dprintf( window_t * window, const char * fmt, ...)
{
char *formattedtext;
return 1;
}
// ====================================================================
int vprf(const char * fmt, va_list ap)
{
int i;
return 1;
}
// ====================================================================
pixmap_t* charToPixmap(unsigned char ch, font_t *font) {
unsigned int cha = (unsigned int)ch - 32;
if (cha >= font->count) {
return font->chars[cha] ? font->chars[cha] : NULL;
}
// ====================================================================
position_t drawChar(unsigned char ch, font_t *font, pixmap_t *blendInto, position_t p) {
pixmap_t* pm = charToPixmap(ch, font);
if (pm && ((p.x + pm->width) < blendInto->width)) {
}
}
// ====================================================================
void drawStr(char *ch, font_t *font, pixmap_t *blendInto, position_t p)
{
int i=0;
}
}
// ====================================================================
void drawStrCenteredAt(char *text, font_t *font, pixmap_t *blendInto, position_t p)
{
int i = 0;
drawStr(text, font, blendInto, p);
}
// ====================================================================
int destroyFont(font_t *font)
{
int i;
return 0;
}
// ====================================================================
int initFont(font_t *font, image_t *data)
{
unsigned int x = 0, y = 0, x2 = 0, x3 = 0;
return 0;
}
// ====================================================================
void colorFont(font_t *font, uint32_t color)
{
if( !color ) {
}
}
// ====================================================================
void makeRoundedCorners(pixmap_t *p)
{
int x,y;
}
}
// ====================================================================
void showInfoBox(char *title, char *text_orig)
{
char* text;
free(text);
}
// ====================================================================
void animateProgressBar()
{
int y;
}
}
// ====================================================================
void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress)
{
if(progress>100) {
free(progressbar.pixels);
}
// ====================================================================
void drawInfoMenuItems()
{
int i,n;
gui.redraw = true;
}
// ====================================================================
int drawInfoMenu()
{
drawInfoMenuItems();
return 1;
}
// ====================================================================
int updateInfoMenu(int key)
{
switch (key)
return DO_NOT_BOOT;
}
// ====================================================================
uint16_t bootImageWidth = 0;
uint16_t bootImageHeight = 0;
uint8_t *bootImageData = NULL;
}
free(appleBootPict);
}
}
}
}
// ====================================================================
trunk/i386/boot2/gui.h
3333
3434
3535
36
37
3638
3739
3840
3941
4042
43
44
4145
4246
4347
......
4953
5054
5155
56
57
5258
5359
5460
......
5763
5864
5965
66
67
6068
6169
6270
......
6775
6876
6977
78
79
7080
7181
7282
......
8696
8797
8898
89
99
100
101
90102
91103
92104
#define MENU_SHOW_VIDEO_INFO5
#define MENU_SHOW_HELP6
// ====================================================================
enum {
HorizontalLayout= 0,
VerticalLayout= 1,
};
// ====================================================================
/*
* Menu item structure.
*/
boolexpandable;
} menuitem_t;
// ====================================================================
/*
* Image structure.
*/
charname[32];
} image_t;
// ====================================================================
/*
* Font structure.
*/
uint16_tcount;// Number of chars in font
} font_t;
// ====================================================================
/*
* Window structure.
*/
uint32_tfont_console_color;// Color for consle font AARRGGBB
booldraw;// Draw flag
} window_t;
// ====================================================================
/*
* gui structure
*/
trunk/i386/Cconfig
44
55
66
7
7
88
99
1010
config OPTIMIZATION_LEVEL
string "Optimization Level"
default "-Oz"
default "-Os"
---help---
Specify the level to compile chameleon with.

Archive Download the corresponding diff file

Revision: 2398