Chameleon

Chameleon Commit Details

Date:2010-08-19 01:00:44 (10 years 3 months ago)
Author:Azimutz
Commit:388
Parents: 387
Message:Trunk it, revs 383, 384. Will update CHANGES later. Also, leaving a note for updating TODO file.
Changes:
A/branches/azimutz/CleanCut/i386/util/bdmesg.c
M/branches/azimutz/CleanCut/i386/libsaio/console.c
M/branches/azimutz/CleanCut/i386/boot2/boot.c
M/branches/azimutz/CleanCut/i386/libsaio/cpu.c
M/branches/azimutz/CleanCut/i386/util/Makefile
M/branches/azimutz/CleanCut/i386/libsaio/saio_internal.h

File differences

branches/azimutz/CleanCut/i386/libsaio/console.c
5252
5353
5454
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
55116
56117
57118
......
103164
104165
105166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
106184
107185
108186
......
111189
112190
113191
192
114193
115194
116
117195
118196
119197
120198
121
122199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
123218
124219
125220
bool gVerboseMode;
bool gErrors;
/* Kabyl: BooterLog */
#define BOOTER_LOG_SIZE(64 * 1024)
#define SAFE_LOG_SIZE80
char *msgbuf = 0;
char *cursor = 0;
struct putc_info {
char * str;
char * last_str;
};
static void sputc(int c, struct putc_info * pi)
{
if (pi->last_str)
if (pi->str == pi->last_str)
{
*(pi->str) = '\0';
return;
}
*(pi->str)++ = c;
}
void initBooterLog(void)
{
msgbuf = malloc(BOOTER_LOG_SIZE);
bzero(msgbuf, BOOTER_LOG_SIZE);
cursor = msgbuf;
}
void msglog(const char * fmt, ...)
{
va_list ap;
struct putc_info pi;
if (!msgbuf)
return;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return;
va_start(ap, fmt);
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
va_end(ap);
cursor += (pi.str - cursor);
}
void setupBooterLog(void)
{
if (!msgbuf)
return;
Node *node = DT__FindNode("/", false);
if (node)
DT__AddProperty(node, "boot-log", strlen((char *)msgbuf) + 1, msgbuf);
}
/* Kabyl: !BooterLog */
/*
* write one character to console
*/
prf(fmt, ap, putchar, 0);
else
vprf(fmt, ap);
{
/* Kabyl: BooterLog */
struct putc_info pi;
if (!msgbuf)
return 0;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return 0;
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
cursor += (pi.str - cursor);
}
va_end(ap);
return 0;
}
{
va_list ap;
va_start(ap, fmt);
if (gVerboseMode)
{
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
prf(fmt, ap, putchar, 0);
else
vprf(fmt, ap);
va_end(ap);
}
{
/* Kabyl: BooterLog */
struct putc_info pi;
if (!msgbuf)
return 0;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return 0;
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
cursor += (pi.str - cursor);
}
va_end(ap);
return(0);
}
branches/azimutz/CleanCut/i386/libsaio/cpu.c
1414
1515
1616
17
17
1818
1919
2020
......
297297
298298
299299
300
300
301301
302302
303303
......
307307
308308
309309
310
310311
311312
312313
#if DEBUG_CPU
#define DBG(x...)printf(x)
#else
#define DBG(x...)
#define DBG(x...)msglog(x)
#endif
/*
p->CPU.TSCFrequency = tscFrequency;
p->CPU.FSBFrequency = fsbFrequency;
p->CPU.CPUFrequency = cpuFrequency;
#if DEBUG_CPU
DBG("CPU: Vendor/Model/ExtModel: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Model, p->CPU.ExtModel);
DBG("CPU: Family/ExtFamily: 0x%x/0x%x\n", p->CPU.Family, p->CPU.ExtFamily);
DBG("CPU: MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef);
DBG("CPU: CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000);
DBG("CPU: NoCores/NoThreads: %d/%d\n", p->CPU.NoCores, p->CPU.NoThreads);
DBG("CPU: Features: 0x%08x\n", p->CPU.Features);
#if DEBUG_CPU
pause();
#endif
}
branches/azimutz/CleanCut/i386/libsaio/saio_internal.h
8989
9090
9191
92
93
9294
9395
96
9497
9598
9699
/* console.c */
extern bool gVerboseMode;
extern bool gErrors;
extern void initBooterLog(void);
extern void setupBooterLog(void);
extern void putchar(int ch);
extern int getchar(void);
extern void msglog(const char * format, ...);
extern int printf(const char *format, ...);
extern int error(const char *format, ...);
extern int verbose(const char *format, ...);
branches/azimutz/CleanCut/i386/boot2/boot.c
194194
195195
196196
197
198
197199
198200
199201
......
250252
251253
252254
255
256
253257
254258
255259
else
drawBootGraphics();
setupBooterLog();
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
// Initialize boot info structure.
initKernBootStruct();
initBooterLog();
// Setup VGA text mode.
// Not sure if it is safe to call setVideoMode() before the
// config table has been loaded. Call video_mode() instead.
branches/azimutz/CleanCut/i386/util/bdmesg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* BooterLog Dump Tool, part of the Chameleon Boot Loader Project
*
* Copyright 2010 by Islam M. Ahmed Zaid. All rights reserved.
*
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "IOKit/IOKitLib.h"
int main(int argc, char *argv[])
{
io_registry_entry_t root = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
if (!root)
{
printf("IORegistryEntry \"IOIOService:/\" not found.\n");
return 0;
}
CFTypeRef bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);
if (!bootLog)
{
printf("\"boot-log\" property not found.\n");
return 0;
}
//CFShow(bootLog);
const UInt8 *msglog = CFDataGetBytePtr((CFDataRef)bootLog);
if (msglog)
printf("%s\n", msglog);
return 0;
}
branches/azimutz/CleanCut/i386/util/Makefile
1818
1919
2020
21
21
2222
2323
2424
2525
2626
27
27
28
2829
2930
3031
3132
33
34
35
3236
3337
3438
CFILES = machOconv.c
ALLSRC = $(CFILES) $(MFILES) $(HFILES) $(EXPORT_HFILES)
PROGRAMS = machOconv
PROGRAMS = machOconv bdmesg
OUTFILES = $(PROGRAMS)
DIRS_NEEDED = $(OBJROOT) $(SYMROOT) $(LANGDIR)
all embedtheme: $(DIRS_NEEDED) $(PROGRAMS)
all embedtheme autores_dbg debug: $(DIRS_NEEDED) $(PROGRAMS)
debug: CFLAGS += -DDEBUG
machOconv: machOconv.o
$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $(SYMROOT)/$(@F) machOconv.o
bdmesg: bdmesg.o
$(CC) $(CFLAGS) $(LDFLAGS) -framework IOKit -framework CoreFoundation -o $(SYMROOT)/$(@F) bdmesg.o
include ../MakeInc.dir
#dependencies

Archive Download the corresponding diff file

Revision: 388