入口
    OF 1/2 の場合
    OF 3 の場合
      設置後すぐ
      CDROM 無で
    Mac OS の場合
    その他
  NetBSD
  Booting Media
Primary
  bootxx
Secondary
  xcf/elf
    release(7)
    /usr/mdec
ofwboot
  Locore.c
  boot.c
    main()
    boot-file
    chain()
    OF_chain()
kernel(1)
  locore.S
  machdep.c
    initppc()
kernel(2)
  init_main.c
    main()
その他
  installboot
    旧版
    新版
    実例
  DEFAULT CATCH
GENERIC_MD
  mdsetimage

NetBSD/macppc booting

Locore.c

ofwboot は、その Makefile の 記述から (ofwboot.xcf の場合は -e _entry という部分 を通して、 それ以外の場合は
.elf .xcf: -Ttext ${RELOC} 
     flat: -Ttext ${RELOC_FLATFILE}
) _start に制御が渡されるように作られている。(??) その _start は次のところにある。

sys/arch/macppc/stand/ofwboot/Locore.c:

  48 #ifdef XCOFF_GLUE
  49 asm("
  50         .text
  51         .globl  _entry
  52 _entry:
  53         .long   _start,0,0
  54 ");
  55 #endif
  56
  57 asm("
  58         .text
  59         .globl  _start
  60 _start:
  ..
  ..
 115 
 116         ba      startup
 117 ");
上の 116 行目 から 同じ Locore.c の中の 130 行目付辺の startup に行く
 131 static void
 132 startup(vpd, res, openfirm, arg, argl)
 133         void *vpd;
 134         int res;
 135         int (*openfirm)(void *);
 136         char *arg;
 137         int argl;
 138 {
 139         extern char etext[], _end[], _edata[];
 140 
 141         bzero(_edata, (_end - _edata));
 142         openfirmware = openfirm;
 143         setup();
 144         main();
 145         OF_exit();
 146 }
setup() は Locore.c の中にあって短いが、ここで入出力先の設定をしている。
その次に boot.c の中 の main() に行く。 これが NetBSD を起動し、その後本体に制御を移す。 NetBSD を終了した場合には、この 145 行目に実行が移される。
Last Update: Sat, 04 May 2019 00:45:20 GMT 1.66 2008/03/08