linux-0.01 読み (17)

hd.c のアタマに書いてあるコメントが以下。

/*
 * This code handles all hd-interrupts, and read/write requests to
 * the hard-disk. It is relatively straigthforward (not obvious maybe,
 * but interrupts never are), while still being efficient, and never
 * disabling interrupts (except to overcome possible race-condition).
 * The elevator block-seek algorithm doesn't need to disable interrupts
 * due to clever programming.
 */

ええと _elevator block-seek algorithm_ ってさっき聞いたようなそうではないような。

#define port_read(port,buf,nr) \
__asm__("cld;rep;insw"::"d" (port),"D" (buf),"c" (nr)/*:"cx","di"*/)

#define port_write(port,buf,nr) \
__asm__("cld;rep;outsw"::"d" (port),"S" (buf),"c" (nr)/*:"cx","si"*/)

insw とか outsw とかなんですが、intel のマニュアルによれば insw は以下。

ワードをDX で指定された I/O ポートからES:(E)DI で指定されたメモリ・ロケーションに入力する。

ええと cld とか rep とかさえ微妙なんスけどorz

  • cld : CLear Direction flag との事
  • rep : Repeat String Operation Prefix って何だろ
    • あ、上記の例であれば cx の回数分 insw (あるいは outsw) を、という事なのかな

ええとやっぱ hd.c の hd_out のあたりがナニ。this_request とか hd_request 構造体とか。

ちょっと

disk controller 云々と hd.c で自分合宿とゆーのはありかも。呑み杉をアレな方面に指摘されているのでアレを断った状態で云々、みたいな?