[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
#include "def.h"
#include "prot.h"
#define ADR_BOOTINFO 0x0ff0
BOOTINFO *binfo = (BOOTINFO *)ADR_BOOTINFO;
struct IDTR {
short limit;
int base;
}__attribute((__packed__));
void Main() {
init_gdtidt(); // GDT/IDTの初期化
init_pic(); // PICの初期化
io_sti(); // 割り込み許可
init_palete(); // パレットの初期化
init_screen(binfo->scrnx, binfo->scrny);
draw_mouse();
io_out8(PIC0_IMR, 0xf8); // PIC1とキーボードを許可
io_out8(PIC1_IMR, 0xef); // マウスを許可
char s[30];
struct IDTR idtr = {0};
_sidt(&idtr);
lsprintf(s, "idtr.limit = %x", idtr.limit);
vprint(s, 0, 0, COL_FFFFFF);
lsprintf(s, "idtr.base = %x", idtr.base);
vprint(s, 0, 16, COL_FFFFFF);
while(1) {
io_hlt();
}
}
今のところ、boot.cがこんな感じ。// IDTの設定 set_gatedesc(idt + 0x21, (int)inthandler21, 2 * 8, AR_INTGATE32); set_gatedesc(idt + 0x2c, (int)inthandler2c, 2 * 8, AR_INTGATE32); set_gatedesc(idt + 0x20, (int)inthandler21, 2 * 8, AR_INTGATE32);面倒なので、タイマ用のハンドラはキーボード用に用意したものを流用。
inthandler21: pushw %es pushw %ds pusha movl %esp, %eax pushl %eax movw %ss,%ax movw %ax, %ds movw %ax, %es call hInt21 popl %eax popa popw %ds popw %es iretまず、この処理は16行目にはたどり着いていないということは確実。
COMMENT
無題
「inthandler21」の部分、「inthandler20」だと思います。
Re:無題
そこは、単にタイマ用の割り込みハンドラ「inthandler20」を用意しても、
どうせメッセージを表示するだけなので、キーボード用に用意してある
割り込みハンドラ「inthandler21」を流用しただけです。
まあ、inthandler20を用意してもいいんですが、大した意味はありませんので…。