On 07.04.2011, at 14:07, Ralf Ramsauer wrote: > On 07.04.2011 um 10:38, Alexander Graf wrote: >> >> Also, I just realized that you did miss another small part that needs >> change. A few lines above, there is code to interpret the modules right >> before that as well: >> >> if (initrd_filename) { >> const char *r = initrd_filename; >> mbs.mb_buf_size += strlen(r) + 1; >> mbs.mb_mods_avail = 1; >> while ((r = strchr(r, ','))) { >> mbs.mb_mods_avail++; >> r++; >> } >> mbs.mb_buf_size += MB_MOD_SIZE * mbs.mb_mods_avail; >> } >> >> This code would need some change as well, as now the mb_buf_size field is >> incorrect. It doesn't really hurt, but is bad style to not use the exact >> amount of memory we need to. > > You're right, I didn't look at this section. But now i had a deeper look into > the code, and I noticed the the mb_buf size seems to be incorrect anyway. > > Look at this line: > > mbs.mb_buf_size += strlen(r) + 1; > > If I start qemu with the option -initrd "mod1 arg=bla, mod2 arg=foo, mod3 > arg=bar", then r contains > "mod1 arg=bla, mod2 arg=foo, mod3 arg=bar", so the commas and spaces after > the comma are counted for the size of the multiboot command line. > Yes, this doesn't really hurt, but it's nevertheless not the exact amount of > memory. I'll try to fix it.
Good point. Thanks! Alex