2009年4月3日金曜日

machine number

Linux Kernel は、ブートローダの中でマシンチェックを行っているので、r1 レジスタに適切な machine number を入れておかないとブートできない。

http://www.arm.linux.org.uk/developer/machines/

を見ると ARM Versatile Porting Board (versatile_pb) は 387 と書いてある。

QEMU の hw/versatilepb.c を見ると、vab_init() の中で versatile_init() の最後の引数に 0x183 を指定して呼び出している。まさしく 0x183 = 387。

というわけで、マジックナンバーの謎が解けた。linux kernel のロードのための引数だったのね。static

void vpb_init(int ram_size, int vga_ram_size,
const char *boot_device, DisplayState *ds,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
versatile_init(ram_size, vga_ram_size,
boot_device, ds,
kernel_filename, kernel_cmdline,
initrd_filename, cpu_model, 0x183);
}

...

QEMUMachine versatilepb_machine = {
"versatilepb",
"ARM Versatile/PB (ARM926EJ-S)",
vpb_init,
};

0 件のコメント:

コメントを投稿