2 #include "../port/lib.h"
8 static char *confname[MAXCONF];
9 static char *confval[MAXCONF];
13 extern char* rgbmask2chan(char *buf, int depth, u32int rm, u32int gm, u32int bm);
16 extern char* vesabootscreenconf(char*, char*, uchar*);
21 extern ulong multibootptr;
29 multiboot = (ulong*)KADDR(multibootptr);
32 if((multiboot[0] & (1<<2)) != 0)
33 strncpy(BOOTLINE, KADDR(multiboot[4]), BOOTLINELEN-1);
36 ep = cp + BOOTARGSLEN-1;
39 if((multiboot[0] & (1<<6)) != 0 && (l = multiboot[11]) >= 24){
40 cp = seprint(cp, ep, "*e820=");
41 m = KADDR(multiboot[12]);
42 while(m[0] >= 20 && m[0]+4 <= l){
45 base = ((uvlong)m[0] | (uvlong)m[1]<<32);
46 size = ((uvlong)m[2] | (uvlong)m[3]<<32);
47 cp = seprint(cp, ep, "%.1lux %.16llux %.16llux ",
48 m[4] & 0xF, base, base+size);
50 m = (ulong*)((uintptr)m + m[-1]);
55 if((multiboot[0] & (1<<12)) != 0 && multiboot[22] != 0){ /* framebuffer */
56 uchar *p = (uchar*)multiboot + 112;
57 int depth = multiboot[27] & 0xFF;
60 switch((multiboot[27]>>8) & 0xFF){
62 snprint(chan, sizeof chan, "m%d", depth);
65 rgbmask2chan(chan, depth,
66 (1UL<<p[1])-1 << p[0],
67 (1UL<<p[3])-1 << p[2],
68 (1UL<<p[5])-1 << p[4]);
70 cp = seprint(cp, ep, "*bootscreen=%dx%dx%d %s %#lux\n",
71 (int)multiboot[24]*8 / depth,
78 if((multiboot[0] & (1<<11)) != 0 && multiboot[19] != 0) /* vbe mode info */
79 cp = vesabootscreenconf(cp, ep, KADDR(multiboot[19]));
81 /* plan9.ini passed as the first module */
82 if((multiboot[0] & (1<<3)) != 0 && multiboot[5] > 0){
83 m = KADDR(multiboot[6]);
98 char *cp, *line[MAXCONF], *p, *q;
103 * parse configuration args from dos file plan9.ini
105 cp = BOOTARGS; /* where b.com leaves its config */
106 cp[BOOTARGSLEN-1] = 0;
109 * Strip out '\r', change '\t' -> ' '.
112 for(q = cp; *q; q++){
121 n = getfields(cp, line, MAXCONF, 1, "\n");
122 for(i = 0; i < n; i++){
125 cp = strchr(line[i], '=');
129 for(j = 0; j < nconf; j++){
130 if(cistrcmp(confname[j], line[i]) == 0)
133 confname[j] = line[i];
145 for(i = 0; i < nconf; i++)
146 if(cistrcmp(confname[i], name) == 0)
156 for(i = 0; i < nconf; i++){
157 if(confname[i][0] != '*')
158 ksetenv(confname[i], confval[i], 0);
159 ksetenv(confname[i], confval[i], 1);
175 /* convert to name=value\n format */
184 error("kernel configuration too large");
185 memset(BOOTLINE, 0, BOOTLINELEN);
186 memmove(BOOTARGS, p, n);