Chameleon

Chameleon Commit Details

Date:2011-06-24 11:08:09 (12 years 10 months ago)
Author:Azimutz
Commit:1047
Parents: 1046
Message:Mostly, the getc --> getchar changes. It's getting impossible to merge trunk changes to this folder in a productive way, due to too many style edits (for readability; the noob here gets confused with some styles/messes) and tidy up, comments, reminders, etc...
Changes:
M/branches/azimutz/Chazi/i386/libsaio/load.c
M/branches/azimutz/Chazi/i386/libsaio/biosfn.c
M/branches/azimutz/Chazi/i386/boot2/drivers.c
M/branches/azimutz/Chazi/i386/libsaio/acpi_patcher.c
M/branches/azimutz/Chazi/i386/modules/GraphicsEnabler/ATiGraphicsEnabler/ati.c
M/branches/azimutz/Chazi/i386/modules/HPET/HPET.c
M/branches/azimutz/Chazi/i386/boot2/gui.c
M/branches/azimutz/Chazi/i386/libsaio/disk.c
M/branches/azimutz/Chazi/i386/modules/Resolution/915resolution.c
M/branches/azimutz/Chazi/i386/libsaio/saio_internal.h
M/branches/azimutz/Chazi/i386/boot2/gui.h
M/branches/azimutz/Chazi/i386/boot2/ramdisk.c
M/branches/azimutz/Chazi/i386/boot2/options.c
M/branches/azimutz/Chazi/i386/boot2/Makefile
M/branches/azimutz/Chazi/i386/libsaio/xml.c
M/branches/azimutz/Chazi/i386/libsaio/console.c
M/branches/azimutz/Chazi/i386/boot2/resume.c
M/branches/azimutz/Chazi/i386/boot2/options.h
M/branches/azimutz/Chazi/i386/modules/KernelPatcher/kernel_patcher.c
M/branches/azimutz/Chazi/i386/boot2/boot.c
M/branches/azimutz/Chazi/i386/modules/GraphicsEnabler/IntelGraphicsEnabler/gma.c
M/branches/azimutz/Chazi/i386/boot2/modules.c
M/branches/azimutz/Chazi/i386/boot2/boot.h
M/branches/azimutz/Chazi/i386/modules/HelloWorld/HelloWorld.cpp

File differences

branches/azimutz/Chazi/i386/libsaio/xml.c
2727
2828
2929
30
31
32
30
31
3332
3433
3534
#include "sl.h"
#include "xml.h"
//getchar(); //getc(); Azi: getc stuff
//Azi: start - this code is unchanged since boot132, were it was exactly the same
//Azi: UPDATE THIS FILE - ADLER STUFF*****
// start - this code is unchanged since boot132, were it was exactly the same
// as the one in drivers.c. Atm, the one in drivers.c has some more stuff; it could be
// added on xml.h which is included on drivers.c and here??
struct Module {
branches/azimutz/Chazi/i386/libsaio/console.c
159159
160160
161161
162
162
163163
164
164
165165
166166
167167
......
260260
261261
262262
263
263
264264
{
register int c = getc();
if ( c == '\r' ) c = '\n';
//if ( c == '\r' ) c = '\n';
if ( c >= ' ' && c < 0x7f) putchar(c);
//if ( c >= ' ' && c < 0x7f) putchar(c);
return (c);
}
void pause()
{
printf("Press a key to continue...\n");
getc();
getchar(); // replace getchar() by pause() ??
}
branches/azimutz/Chazi/i386/libsaio/acpi_patcher.c
11071107
11081108
11091109
1110
1110
11111111
11121112
11131113
}
#if DEBUG_ACPI
printf("Press a key to continue... (DEBUG_ACPI)\n");
getc(); //getchar(); Azi: getc stuff
getchar();
#endif
return 1;
}
branches/azimutz/Chazi/i386/libsaio/load.c
137137
138138
139139
140
140
141141
142142
143143
......
221221
222222
223223
224
224
225225
226226
227227
......
241241
242242
243243
244
244
245245
246246
247247
......
325325
326326
327327
328
328
329329
330330
331331
printf("ncmds: %x\n", (unsigned)mH->ncmds);
printf("sizeofcmds: %x\n", (unsigned)mH->sizeofcmds);
printf("flags: %x\n", (unsigned)mH->flags);
getc(); //getchar(); Azi: getc stuff
getchar();
#endif
ncmds = mH->ncmds;
printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
(unsigned) segCmd->nsects, (unsigned)segCmd->flags);
getc(); //getchar(); Azi: getc stuff
getchar();
#endif
}
else
printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
(unsigned) segCmd->nsects, (unsigned)segCmd->flags);
getc(); //getchar(); Azi: getc stuff
getchar();
#endif
}
#ifdef DEBUG
printf("symoff: %x, nsyms: %x, stroff: %x, strsize: %x\n",
symTab->symoff, symTab->nsyms, symTab->stroff, symTab->strsize);
getc(); //getchar(); Azi: getc stuff
getchar();
#endif
symsSize = symTab->stroff - symTab->symoff;
branches/azimutz/Chazi/i386/libsaio/disk.c
16491649
16501650
16511651
1652
1652
16531653
16541654
16551655
printf(" bvr: %d, dev: %d, part: %d, flags: %d, vis: %d\n", bvr, bvr->biosdev, bvr->part_no, bvr->flags, bvr->visible);
}
printf("count: %d\n", bvCount);
getc(); //getchar(); Azi: getc stuff
getchar();
#endif
*count = bvCount;
branches/azimutz/Chazi/i386/libsaio/biosfn.c
187187
188188
189189
190
190
191191
192192
193193
......
254254
255255
256256
257
257
258258
259259
260
260
261261
262262
263263
// Some BIOSes will simply ignore the value of ECX on entry.
// Probably best to keep its value at 20 to avoid surprises.
//printf("Get memory map 0x%x, %d\n", rangeArray);getc();
//printf("Get memory map 0x%x, %d\n", rangeArray); getchar();
if (maxRangeCount > (BIOS_LEN / sizeof(MemoryRange))) {
maxRangeCount = (BIOS_LEN / sizeof(MemoryRange));
}
#if DEBUG
{
int i;
printf("%d total ranges\n", count); getc(); //getchar(); Azi: getc stuff
printf("%d total ranges\n", count); getchar();
for (i=0, range = rangeArray; i<count; i++, range++) {
printf("range: type %d, base 0x%x, length 0x%x\n",
range->type, (unsigned int)range->base, (unsigned int)range->length); getc(); //getchar(); Azi: getc stuff
range->type, (unsigned int)range->base, (unsigned int)range->length); getchar();
}
}
#endif
branches/azimutz/Chazi/i386/libsaio/saio_internal.h
9191
9292
9393
94
9594
9695
9796
extern void initBooterLog(void);
extern void setupBooterLog(void);
extern int putchar(int ch);
extern int getc(void); //Azi: getc stuff
extern int getchar(void);
extern void msglog(const char * format, ...);
extern int printf(const char *format, ...);
branches/azimutz/Chazi/i386/boot2/options.h
3131
3232
3333
34
34
3535
3636
3737
//AZI: KEEP THIS FILE ???
extern intgDeviceCount;
//extern intgDeviceCount;
void clearBootArgs(void);
typedef struct {
branches/azimutz/Chazi/i386/boot2/drivers.c
579579
580580
581581
582
582
583583
584584
585585
......
795795
796796
797797
798
798
799799
800800
801801
length = LoadFile(gFileSpec);
executableAddr = (void *)kLoadAddr;
}
//printf("%s length = %d addr = 0x%x\n", gFileSpec, length, driverModuleAddr); getc();
//printf("%s length = %d addr = 0x%x\n", gFileSpec, length, driverModuleAddr); getchar();
}
else
length = 0;
printf("adler32: 0x%x\n", kernel_header->adler32);
printf("uncompressed_size: 0x%x\n", kernel_header->uncompressed_size);
printf("compressed_size: 0x%x\n", kernel_header->compressed_size);
getc();
getchar();
#endif
if (kernel_header->signature == OSSwapBigToHostConstInt32('comp')) {
branches/azimutz/Chazi/i386/boot2/Makefile
2323
2424
2525
26
26
2727
2828
2929
......
4343
4444
4545
46
46
47
4748
4849
4950
......
112113
113114
114115
115
116116
117117
118118
......
122122
123123
124124
125
126125
127
128
129
130126
131127
132
128
129
133130
134131
135
136132
137133
138134
......
145141
146142
147143
148
149144
150145
151146
......
153148
154149
155150
156
151
157152
158153
159154
160155
161
162156
163157
164158
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
CPPFLAGS := $(CPPFLAGS) -nostdinc++ -include $(SRCROOT)/autoconf.h
DEFINES=
# The ordering is important;
# boot2.o must be first.
OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o mboot.o \
ramdisk.o picopng.o resume.o bmdecompress.o graphic_utils.o gui.o modules.o modules_support.o boot_modules.o
ramdisk.o picopng.o resume.o bmdecompress.o graphic_utils.o gui.o modules.o \
modules_support.o boot_modules.o
# button.o browser.o scrollbar.o == NOTYET
UTILDIR = ../util
@${RM} $(SYMROOT)/${SYMBOLS_MODULE}
@$(LD) -arch i386 \
-undefined dynamic_lookup \
-dylib -read_only_relocs suppress \
-final_output Symbols \
-macosx_version_min 10.6 \
-o $(OBJROOT)/Symbols_LINKER_ONLY.dylib
endif
@make embed_symbols# this is done in a sub process after boot.sys exists so the strings are populated correctly
@# this is done in a sub process after boot.sys exists so the strings are populated correctly
@make embed_symbols
@${RM} $(SYMROOT)/boot2.sys
@( size=`ls -l $(SYMROOT)/boot | awk '{ print $$5}'` ; \
if expr "$$size" ">" "$(MAXBOOTSIZE)" > /dev/null ;\
echo "\t******* boot is $$size bytes *******"; \
fi)
embed_symbols:
ifeq (${CONFIG_MODULES}, y)
@echo ================= Embedding Symbols.dylib =================
@$(SYMROOT)/machOconv $(SYMROOT)/boot2.sys $(SYMROOT)/boot &> /dev/null
@echo "\t******* Patching at $(PATCH_ADDR) ******"
@stat -f%z $(SYMROOT)/boot | perl -ane "print pack('V',@F[0]);" | dd conv=notrunc of=${SYMROOT}/boot.sys bs=1 count=4 seek=$(PATCH_ADDR) &> /dev/null
@stat -f%z $(SYMROOT)/boot | perl -ane "print pack('V',@F[0]);" | dd conv=notrunc of=${SYMROOT}/boot.sys bs=1 count=4 seek=$(PATCH_ADDR) &> /dev/null
endif
@echo "\t[MACHOCONV] boot"
@$(SYMROOT)/machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot
$(SYMROOT)/art.h:
@if [ "$(PNGCRUSH)" ]; then\
echo "optimizing art files ...\n$(PNGCRUSH) $(PNGOPTIONS) artwork/$(THEME)"; \
branches/azimutz/Chazi/i386/boot2/resume.c
118118
119119
120120
121
121
122122
123123
124124
......
145145
146146
147147
148
148
149149
150150
151151
printf ("Resuming from Encrypted image is unsupported.\n"
"Uncheck \"Use secure virtual memory\" in \"Security\" pane on system preferences.\n"
"Press any key to proceed with normal boot.\n");
getc(); //getchar(); Azi: getc stuff
getchar();
return;
}
// depends on NVRAM
if ( (long long)mem_base + allocSize < 1024*bootInfo->extmem + 0x100000 )
{
printf("Not enough space to restore image. Press any key to proceed with normal boot.\n");
getc(); //getchar(); Azi: getc stuff
getchar();
return;
}
branches/azimutz/Chazi/i386/boot2/boot.c
7979
8080
8181
82
82
8383
8484
8585
......
199199
200200
201201
202
202
203203
204204
205205
......
397397
398398
399399
400
400
401401
402402
403403
int bvCount = 0; // global ?? - Slice
//intmenucount = 0;
int gDeviceCount = 0;
//int gDeviceCount = 0;
BVRef bvr;
//BVRef menuBVR; - doesn't seem used here
//Azi: Wait=y is breaking other keys when typed "after them" at boot prompt.
// Works properly if typed in first place or used on Boot.plist.
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
verbose("(Wait) ");
printf("(Wait) "); // Add to trunk?? don't forget that puse uses printf, not verbose!!
pause();
}
//printf
msglog(":something...???\n Default: %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBootVolume, gBootVolume->biosdev, gBootVolume->part_no, gBootVolume->flags);
msglog(" bt(0,0): %d, ->biosdev: %d, ->part_no: %d ->flags: %d\n", gBIOSBootVolume, gBIOSBootVolume->biosdev, gBIOSBootVolume->part_no, gBIOSBootVolume->flags);
// getchar(); //getc(); Azi: getc stuff - DON'T FORGET pause() - take modules.c as reference.
// getchar();
//#endif
useGUI = true;
branches/azimutz/Chazi/i386/boot2/boot.h
176176
177177
178178
179
180
181
182
183
184
185
186
187
188
189
190
191
179192
180193
181194
#define kBootTimeout -1
#define kCDBootTimeout 8
enum {
kBackspaceKey= 0x08,
kTabKey= 0x09,
kReturnKey= '\r',
kEscapeKey= 0x1b,
kUpArrowkey= 0x4800,
kDownArrowkey= 0x5000,
kASCIIKeyMask= 0x7f,
kF2Key= 0x3c00, //Azi:autoresolution
kF5Key= 0x3f00,
kF10Key= 0x4400
};
/*
* A global set by boot() to record the device that the booter
* was loaded from.
branches/azimutz/Chazi/i386/boot2/modules.c
1717
1818
1919
20
20
2121
2222
2323
......
8787
8888
8989
90
90
9191
9292
9393
......
186186
187187
188188
189
189
190190
191191
192192
......
305305
306306
307307
308
308
309309
310310
311311
......
371371
372372
373373
374
374
375375
376376
377377
378
379
380378
381379
382380
383
381
384382
385383
386384
......
391389
392390
393391
394
395392
396393
397394
......
414411
415412
416413
417
414
415
418416
419
420
421
417
418
422419
423420
424421
......
427424
428425
429426
427
430428
431429
432430
......
442440
443441
444442
445
443
444
446445
447
448
446
447
449448
450449
451450
......
454453
455454
456455
457
458
456
459457
460458
461459
......
463461
464462
465463
466
464
467465
468466
469467
......
474472
475473
476474
477
478475
479476
480477
......
499496
500497
501498
502
503499
504
505500
506501
507502
508
503
504
509505
510506
511
507
512508
513509
514
510
511
515512
516
517
518
513
514
515
516
517
518
519519
520520
521521
522
523522
524523
525524
......
892891
893892
894893
895
894
896895
897896
898897
......
911910
912911
913912
914
913
915914
916915
917916
......
929928
930929
931930
932
931
933932
934933
935934
......
954953
955954
956955
957
956
958957
959958
960959
......
10861085
10871086
10881087
1089
1088
10901089
10911090
10921091
......
11341133
11351134
11361135
1137
1136
11381137
11391138
11401139
#if CONFIG_MODULE_DEBUG
#define DBG(x...)printf(x);
#define DBGPAUSE()getc() // getchar() - ";" needed ?
#define DBGPAUSE()getchar() // ";" needed ?
#else
#define DBG(x...)
#define DBGPAUSE()
else
{
// The module does not have a valid start function
printf("Unable to start %s\n", SYMBOLS_MODULE); getc(); //Azi: getchar();
printf("Unable to start %s\n", SYMBOLS_MODULE); getchar();
}
}
}
else // The module does not have a valid start function. This may be a library.
{
printf("WARNING: Unable to start %s\n", module);
getc(); //Azi: getchar();
getchar();
}
#else
else msglog("WARNING: Unable to start %s\n", module);
#if CONFIG_MODULE_DEBUG
printf("Unable to locate symbol %s\n", name);
getc(); //Azi: getchar();
getchar();
#endif
if(strcmp(name, VOID_SYMBOL) == 0) return 0xFFFFFFFF;
else
{
verbose("Invalid mach magic 0x%X\n", ((struct mach_header*)binary)->magic);
//getc(); //Azi: getchar();
//getchar(); Azi: this gets a bit annoying when using kernelcache :P
return NULL;
}
/*if(((struct mach_header*)binary)->filetype != MH_DYLIB)
{
printf("Module is not a dylib. Unable to load.\n");
getc(); //Azi: getchar();
getchar();
return NULL; // Module is in the incorrect format
}*/
loadCommand = binary + binaryIndex;
UInt32 cmdSize = loadCommand->cmdsize;
switch ((loadCommand->cmd & 0x7FFFFFFF))
{
case LC_SYMTAB:
sectionIndex += sizeof(struct section);
if(section_handler) section_handler(sect->sectname, segCommand->segname, sect->offset, sect->addr);
if (section_handler)
section_handler(sect->sectname, segCommand->segname, sect->offset, sect->addr);
if((strcmp("__TEXT", segCommand->segname) == 0) && (strcmp("__text", sect->sectname) == 0))
if ((strcmp("__TEXT", segCommand->segname) == 0)
&& (strcmp("__text", sect->sectname) == 0))
{
// __TEXT,__text found, save the offset and address for when looking for the calls.
textSection = sect->offset;
}
}
break;
case LC_SEGMENT_64:// 64bit macho's
{
segCommand64 = binary + binaryIndex;
sectionIndex += sizeof(struct section_64);
if(section_handler) section_handler(sect->sectname, segCommand->segname, sect->offset, sect->addr);
if (section_handler)
section_handler(sect->sectname, segCommand->segname, sect->offset, sect->addr);
if((strcmp("__TEXT", segCommand->segname) == 0) && (strcmp("__text", sect->sectname) == 0))
if ((strcmp("__TEXT", segCommand->segname) == 0)
&& (strcmp("__text", sect->sectname) == 0))
{
// __TEXT,__text found, save the offset and address for when looking for the calls.
textSection = sect->offset;
}
}
break;
case LC_LOAD_DYLIB:
case LC_LOAD_WEAK_DYLIB ^ LC_REQ_DYLD:
dylibCommand = binary + binaryIndex;
// Possible enhancments: verify version
// =dylibCommand->dylib.current_version;
// =dylibCommand->dylib.compatibility_version;
if(dylib_loader)
if (dylib_loader)
{
char* name = malloc(strlen(module) + strlen(".dylib") + 1);
sprintf(name, "%s.dylib", module);
free(name);
}
}
break;
case LC_ID_DYLIB:
default:
DBG("Unhandled loadcommand 0x%X\n", loadCommand->cmd & 0x7FFFFFFF);
break;
}
binaryIndex += cmdSize;
}
// bind_macho uses the symbols, if the textAdd does not exist (Symbols.dylib, no code), addresses are static and not relative
// bind_macho uses the symbols, if the textAdd does not exist (Symbols.dylib, no code),
// addresses are static and not relative
module_start = (void*)handle_symtable((UInt32)binary, symtabCommand, symbol_handler, is64);
if(dyldInfoCommand)
if (dyldInfoCommand)
{
// Rebase the module before binding it.
if(dyldInfoCommand->rebase_off)rebase_macho(binary, (char*)dyldInfoCommand->rebase_off,dyldInfoCommand->rebase_size);
if (dyldInfoCommand->rebase_off)
rebase_macho(binary, (char*)dyldInfoCommand->rebase_off, dyldInfoCommand->rebase_size);
// Bind all symbols.
if(dyldInfoCommand->bind_off)bind_macho(binary, (UInt8*)dyldInfoCommand->bind_off,dyldInfoCommand->bind_size);
if(dyldInfoCommand->weak_bind_off)bind_macho(binary, (UInt8*)dyldInfoCommand->weak_bind_off,dyldInfoCommand->weak_bind_size);
if(dyldInfoCommand->lazy_bind_off)bind_macho(binary, (UInt8*)dyldInfoCommand->lazy_bind_off,dyldInfoCommand->lazy_bind_size);
if (dyldInfoCommand->bind_off)
bind_macho(binary, (UInt8*)dyldInfoCommand->bind_off, dyldInfoCommand->bind_size);
if (dyldInfoCommand->weak_bind_off)
bind_macho(binary, (UInt8*)dyldInfoCommand->weak_bind_off,dyldInfoCommand->weak_bind_size);
if (dyldInfoCommand->lazy_bind_off)
bind_macho(binary, (UInt8*)dyldInfoCommand->lazy_bind_off, dyldInfoCommand->lazy_bind_size);
}
return module_start;
}
/*
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc(); //Azi: getchar();
getchar();
}
segmentAddress += sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc(); //Azi: getchar();
getchar();
}
segmentAddress += tmp + sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc(); //Azi: getchar();
getchar();
}
segmentAddress += (immediate * sizeof(void*)) + sizeof(void*);
else
{
printf("Unable to bind symbol %s\n", symbolName);
getc(); //Azi: getchar();
getchar();
}
break;
}
#if CONFIG_MODULE_DEBUG
//print_hook_list();
//getc(); //Azi: getchar();
//getchar();
#endif
}
void dyld_stub_binder()
{
printf("ERROR: dyld_stub_binder was called, should have been take care of by the linker.\n");
getc(); //Azi: getchar();
getchar();
}
#else /* CONFIG_MODULES */
branches/azimutz/Chazi/i386/boot2/gui.c
1313
1414
1515
16
17
18
19
1620
1721
1822
1923
2024
21
22
23
25
26
2427
25
2628
2729
2830
......
128130
129131
130132
131
133
132134
133135
134136
135137
136
138
139
137140
138
139
140141
141142
142143
......
967968
968969
969970
970
971
971
972
972973
973974
974975
......
982983
983984
984985
985
986
986987
987
988
989
990
991
992
993
994
995
996988
997989
998990
......
1004996
1005997
1006998
1007
1008
1009
1010
1011
1012
1013999
1014
1000
10151001
10161002
10171003
......
16341620
16351621
16361622
1637
1623
16381624
16391625
16401626
#include "appleboot.h"
#include "vers.h"
#ifdef CONFIG_EMBED_THEME
#include "art.h"
#endif
#define IMG_REQUIRED -1
#define LOADPNG(img, alt_img) if (loadThemeImage(#img, alt_img) != 0) { return 1; }
#define VIDEO(x) (bootArgs->Video.v_ ## x)
#define vram VIDEO(baseAddr)
#ifdef CONFIG_EMBED_THEME
#include "art.h"
#endif
intgDeviceCount = 0;
intlasttime = 0; // we need this for animating maybe
int lasttime = 0; // we need this for animating maybe
static const char *theme_name = kDefaultThemeName; // #define'ed on boot.h
/*
int imageCnt = 0;
extern intgDeviceCount;
//extern intgDeviceCount;
//extern intselectIndex; Azi: not in use
extern MenuItem *menuItems;
char prompt[BOOT_STRING_LEN];
//char prompt[BOOT_STRING_LEN];
extern char gBootArgs[BOOT_STRING_LEN];
int prompt_pos=0;
char prompt_text[] = "boot: ";
menuitem_t infoMenuItems[] =
void clearGraphicBootPrompt()
{
// clear text buffer
prompt[0] = '\0';
prompt_pos=0;
//prompt[0] = '\0';
//prompt_pos=0;
if(gui.bootprompt.draw == true )
return;
}
void updateGraphicBootPrompt(int key)
void updateGraphicBootPrompt()
{
if ( key == kBackspaceKey )
prompt[--prompt_pos] = '\0';
else
{
prompt[prompt_pos] = key;
prompt_pos++;
prompt[prompt_pos] = '\0';
}
fillPixmapWithColor( gui.bootprompt.pixmap, gui.bootprompt.bgcolor);
makeRoundedCorners( gui.bootprompt.pixmap);
// get the position of the end of the boot prompt text to display user input
position_t p_prompt = pos( p_text.x + ( ( strlen(prompt_text) ) * font_console.chars[0]->width ), p_text.y );
// calculate the position of the cursor
intoffset = ( prompt_pos - ( ( gui.bootprompt.width / font_console.chars[0]->width ) - strlen(prompt_text) - 2 ) );
if ( offset < 0)
offset = 0;
drawStr( prompt+offset, &font_console, gui.bootprompt.pixmap, p_prompt);
drawStr( gBootArgs, &font_console, gui.bootprompt.pixmap, p_prompt);
gui.menu.draw = false;
gui.bootprompt.draw = true;
updateVRAM();
key = getc(); //getchar(); Azi: getc stuff
key = getchar();
if( key == kUpArrowkey )
if( currentline > 0 )
branches/azimutz/Chazi/i386/boot2/gui.h
1616
1717
1818
19
19
2020
2121
2222
23
23
2424
2525
26
27
26
27
2828
29
30
31
29
30
31
3232
3333
3434
35
35
3636
37
37
3838
3939
40
41
42
43
40
41
42
43
4444
4545
46
47
48
49
50
46
47
48
49
50
5151
5252
5353
......
139139
140140
141141
142
143
142144
143145
144146
......
159161
160162
161163
162
164
163165
164166
165167
#define CHARACTERS_COUNT223
#define BOOT_NORMAL0
#define BOOT_NORMAL0
#define BOOT_VERBOSE1
#define BOOT_IGNORECACHE2
#define BOOT_SINGLEUSER3
#define DO_NOT_BOOT4
#define DO_NOT_BOOT4
#define CLOSE_INFO_MENU5
#define INFOMENU_NATIVEBOOT_START 1
#define INFOMENU_NATIVEBOOT_END3
#define INFOMENU_NATIVEBOOT_START1
#define INFOMENU_NATIVEBOOT_END3
#define MENU_SHOW_MEMORY_INFO4
#define MENU_SHOW_VIDEO_INFO5
#define MENU_SHOW_HELP6
#define MENU_SHOW_MEMORY_INFO4
#define MENU_SHOW_VIDEO_INFO5
#define MENU_SHOW_HELP6
enum {
HorizontalLayout= 0,
VerticalLayout= 1,
VerticalLayout= 1
};
/* moved to boot.h ??
/*
enum {
kBackspaceKey= 0x08,
kTabKey= 0x09,
kReturnKey= 0x0d,
kEscapeKey= 0x1b,
kUpArrowkey= 0x4800,
kTabKey= 0x09,
kReturnKey= '\r',
kEscapeKey= 0x1b,
kUpArrowkey= 0x4800,
kDownArrowkey= 0x5000,
kASCIIKeyMask= 0x7f,
kF2Key= 0x3c00, //Azi:autoresolution
kF5Key= 0x3f00,
kF10Key= 0x4400
};*/
kF2Key= 0x3c00, //Azi:autoresolution
kF5Key= 0x3f00,
kF10Key= 0x4400
};
*/
/*
* Menu item structure.
*/
font_t font_small;
font_t font_console;
extern intgDeviceCount;
int initGUI();
void drawBackground();
void showGraphicBootPrompt();
void clearGraphicBootPrompt();
void updateGraphicBootPrompt(int key);
void updateGraphicBootPrompt();
void updateVRAM();
branches/azimutz/Chazi/i386/boot2/ramdisk.c
276276
277277
278278
279
279
280280
281
281
282282
283283
284284
......
291291
292292
293293
294
294
295295
296296
297297
clearScreenRows(0, 24);
setCursorPosition(0, 0, 1);
showInfoRAMDisk();
//Azi: check Chazileon on these line breaks here***
//Azi: check Chazi on these line breaks here***
printf("\n\nPress any key to continue.\n");
getc(); //getchar(); Azi: getc stuff
getchar();
setActiveDisplayPage(0);
}
else
printf("\n?rd m <filename> - mount ramdisk image\n?rd u - unmount ramdisk image");
printf("\n?rd e - enable bt(0,0) alias\n?rd d - disable bt(0,0) alias");
printf("\n\nPress any key to continue.\n");
getc(); //getchar(); Azi: getc stuff
getchar();
setActiveDisplayPage(0);
}
}
branches/azimutz/Chazi/i386/boot2/options.c
149149
150150
151151
152
152
153153
154154
155155
......
165165
166166
167167
168
168
169
169170
170171
171172
......
177178
178179
179180
180
181
181182
182183
183184
......
205206
206207
207208
208
209
209210
210211
211212
......
213214
214215
215216
217
216218
217219
218220
219
220
221
222
221223
222224
223225
......
235237
236238
237239
240
241
238242
239243
240244
241245
242246
243247
244
245
248
249
246250
247251
248252
249253
250
251
252
253
254
255
254
255
256
257
258
259
256260
257261
258262
259263
260264
261
262
263
264
265
266
265
266
267
268
267269
268270
269271
......
339341
340342
341343
342
344
343345
344346
345347
......
376378
377379
378380
379
381
380382
381383
382384
......
702704
703705
704706
705
707
706708
707709
708710
......
878880
879881
880882
881
883
882884
883885
884886
......
918920
919921
920922
921
923
922924
923925
924926
925927
926928
927
929
928930
929931
930932
......
956958
957959
958960
959
961
960962
961963
962964
......
967969
968970
969971
970
972
971973
972974
973975
......
10161018
10171019
10181020
1019
1021
10201022
10211023
10221024
......
10421044
10431045
10441046
1045
1047
10461048
10471049
10481050
......
10711073
10721074
10731075
1076
10741077
10751078
10761079
......
14461449
14471450
14481451
1449
1452
14501453
14511454
14521455
......
14891492
14901493
14911494
1492
1495
14931496
14941497
14951498
......
15091512
15101513
15111514
1512
1515
15131516
15141517
15151518
......
15621565
15631566
15641567
1565
1568
15661569
15671570
15681571
......
16131616
16141617
16151618
1616
1619
16171620
16181621
16191622
}
}
if( bootArgs->Video.v_display == GRAPHICS_MODE )
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
{
drawProgressBar( gui.screen.pixmap, 100, gui.progressbar.pos , ( multi * 100 / multi_buff ) );
gui.redraw = true;
//==========================================================================
//Azi: bootargs reminder
static char gBootArgs[BOOT_STRING_LEN];
//static - getc --> getchar
char gBootArgs[BOOT_STRING_LEN];
static char * gBootArgsPtr = gBootArgs;
static char * gBootArgsEnd = gBootArgs + BOOT_STRING_LEN - 1;
static char booterCommand[BOOT_STRING_LEN];
gBootArgsPtr = gBootArgs;
memset(gBootArgs, '\0', BOOT_STRING_LEN);
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
clearGraphicBootPrompt();
}
}
clearScreenRows( row, kScreenLastRow );
}
clearBootArgs();
//clearBootArgs();
if (visible) {
if (bootArgs->Video.v_display == VGA_TEXT_MODE) {
printf( bootRescanPrompt );
} else {
printf( bootPrompt );
printf( gBootArgs );
}
}
} else {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
clearGraphicBootPrompt();
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
//clearGraphicBootPrompt();
} else {
printf("Press Enter to start up the foreign OS. ");
}
case kBackspaceKey:
if ( gBootArgsPtr > gBootArgs )
{
*--gBootArgsPtr = '\0';
int x, y, t;
getCursorPositionAndType( &x, &y, &t );
if ( x == 0 && y )
{
x = 80; y--;
}
if (x)
x--;
if (x) x--;
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
{
setCursorPosition( x, y, 0 );
putca(' ', 0x07, 1);
} else
updateGraphicBootPrompt(kBackspaceKey);
*gBootArgsPtr-- = '\0';
}
}
else
{
updateGraphicBootPrompt();
}
}
break;
default:
if ( key >= ' ' && gBootArgsPtr < gBootArgsEnd)
{
if( bootArgs->Video.v_display == VGA_TEXT_MODE )
putchar(key); // echo to screen
else
updateGraphicBootPrompt(key);
*gBootArgsPtr++ = key;
*gBootArgsPtr++ = key;
if( bootArgs->Video.v_display != VGA_TEXT_MODE ) updateGraphicBootPrompt();
else if ( key >= ' ' && key < 0x7f) putchar(key);
}
break;
// Draw the visible items.
if( bootArgs->Video.v_display == GRAPHICS_MODE )
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
drawDeviceList(gMenuStart, gMenuEnd, gMenuSelection);
if ( gMenuItems == NULL )
return 0;
if( bootArgs->Video.v_display == GRAPHICS_MODE )
if( bootArgs->Video.v_display != VGA_TEXT_MODE )
{
int res;
}
// ensure we're in graphics mode if gui is setup
if (gui.initialised && bootArgs->Video.v_display == VGA_TEXT_MODE)
if (firstRun && gui.initialised && bootArgs->Video.v_display == VGA_TEXT_MODE)
{
setVideoMode(GRAPHICS_MODE, 0);
}
}
}
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
// redraw the background buffer
gui.logo.draw = true;
drawBackground();
showBootPrompt( nextRow, showPrompt );
do {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
// redraw background
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
// reset cursor co-ords
gui.debug.cursor = pos( gui.screen.width - 160 , 10 );
}
key = getc(); //getchar(); Azi: getc stuff
key = getchar();
updateMenu( key, (void **) &menuBVR );
newShowPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
*/
if (strcmp( booterCommand, "video" ) == 0)
{
if (bootArgs->Video.v_display == GRAPHICS_MODE)
if (bootArgs->Video.v_display != VGA_TEXT_MODE)
{
showInfoBox(getVBEInfoString(), getVBEModeInfoString());
}
}
else if ( strcmp( booterCommand, "memory" ) == 0)
{
if (bootArgs->Video.v_display == GRAPHICS_MODE )
if (bootArgs->Video.v_display != VGA_TEXT_MODE )
{
showInfoBox("Memory Map", getMemoryInfoString());
}
// AutoResolution - Reapply the patch if Graphics Mode was incorrect
// or EDID Info was insane.
case kF2Key:
reloadAutoRes();
reloadAutoRes(); // clearBootArgs is on the function
break;
case kF5Key:
// Switch between text & graphic interfaces
// Only Permitted if started in graphics interface
if (useGUI) {
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
setVideoMode(VGA_TEXT_MODE, 0);
setCursorPosition(0, 0, 0);
gui.redraw = true;
setVideoMode(GRAPHICS_MODE, 0);
updateVRAM();
updateGraphicBootPrompt();
}
}
key = 0;
intline_offset;
intc;
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
showInfoBox( "Press q to quit\n",buf );
return;
}
printf("[Type %s%sq to quit viewer]", (line_offset > 0) ? "p for previous page, " : "", (*bp != '\1') ? "space for next page, " : "");
}
c = getc(); //getchar(); Azi: getc stuff
c = getchar();
if (c == 'q' || c == 'Q') {
break;
}
void showHelp(void)
{
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
if (bootArgs->Video.v_display != VGA_TEXT_MODE) {
showInfoBox("Help. Press q to quit.\n", (char *)BootHelp_txt);
} else {
showTextBuffer((char *)BootHelp_txt, BootHelp_txt_len);
printf("Typical boot devices are 80 (First HD), 81 (Second HD)\n");
printf("Enter two-digit hexadecimal boot device [%02x]: ", bootdevice);
do {
key = getc(); //getchar(); Azi: getc stuff
key = getchar();
switch (key & kASCIIKeyMask) {
case kBackspaceKey:
if (digitsI > 0) {
bool promptForRescanOption(void)
{
printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n");
if ( getc()/*getchar(); Azi: getc stuff*/ == kReturnKey) {
if (getchar() == kReturnKey) {
return true;
} else {
return false;
branches/azimutz/Chazi/i386/modules/HPET/HPET.c
104104
105105
106106
107
107
108108
109109
110110
......
195195
196196
197197
198
199198
200199
201200
}
/*#if DEBUG_HPET
pause(); - getchar(); //getc(); Azi: getc stuff
pause();
#endif*/
}
if (!(val & 0x80))
verbose(" Failed to force enable HPET\n");
}
break;
}
}
branches/azimutz/Chazi/i386/modules/Resolution/915resolution.c
182182
183183
184184
185
185
186186
187187
188188
if((id & 0x0000FFFF) == 0x00008086) // Intel chipset
{
//printf("Unknown chipset 0x%llX, please email id to meklort@gmail.com", id);
//getchar(); //getc(); Azi: getc stuff
//getchar();
type = CT_UNKNOWN_INTEL;
//type = CT_UNKNOWN;
branches/azimutz/Chazi/i386/modules/KernelPatcher/kernel_patcher.c
385385
386386
387387
388
388
389389
390390
391391
392392
393
393
394394
395395
396396
// Total: 24 bytes
printf("Running on a 10.2.0+ kernel\n");
//getchar(); //getc(); Azi: getc stuff
//getchar();
}
else {
printf("Running on a 10.0.0 kernel, patch unsupported\n");
getc(); //getchar(); Azi: getc stuff
getchar();
}
branches/azimutz/Chazi/i386/modules/GraphicsEnabler/IntelGraphicsEnabler/gma.c
109109
110110
111111
112
112
113113
114114
115115
......
161161
162162
163163
164
164
165165
166166
167167
{
printf("Failed initializing dev-prop string dev-entry, press any key...\n");
getc(); //Azi: getchar();
getchar();
return false;
}
if (!stringdata)
{
printf("no stringdata press a key...\n");
getc(); //Azi: getchar();
getchar();
return false;
}
branches/azimutz/Chazi/i386/modules/GraphicsEnabler/ATiGraphicsEnabler/ati.c
658658
659659
660660
661
661
662662
663663
664664
device = devprop_add_device(string, devicepath);
if (!device) {
printf("Failed initializing dev-prop string dev-entry, press any key...\n");
getc(); //Azi: getchar();
getchar();
return false;
}
branches/azimutz/Chazi/i386/modules/HelloWorld/HelloWorld.cpp
3535
3636
3737
38
38
3939
4040
4141
......
4343
4444
4545
46
4746
4847
4948
delete obj2;
printf("Hello world from ExecKernel hook. Binary located at 0x%X\n", binary);
getc(); //Azi: getchar();
getchar();
}
void HelloWorld_start()
//printf("Hooking 'ExecKernel'\n");
register_hook_callback("ExecKernel", &helloWorld);
register_hook_callback("Kernel Start", &helloWorld);
}
void HW::printHello()

Archive Download the corresponding diff file

Revision: 1047