diff --git a/25_day/bootpack.c b/25_day/bootpack.c index 8a2a773..d2aa307 100644 --- a/25_day/bootpack.c +++ b/25_day/bootpack.c @@ -14,17 +14,17 @@ void HariMain(void) struct SHTCTL *shtctl; char s[40]; struct FIFO32 fifo, keycmd; - int fifobuf[128], keycmd_buf[32], *cons_fifo[2]; + int fifobuf[128], keycmd_buf[32], *cons_fifo[2]; int mx, my, i; unsigned int memtotal; struct MOUSE_DEC mdec; struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; unsigned char *buf_back, buf_mouse[256], *buf_cons[2]; - struct SHEET *sht_back, *sht_mouse, *sht_win, *sht_cons[2]; + struct SHEET *sht_back, *sht_mouse, *sht_cons[2]; struct TASK *task_a, *task_cons[2], *task; static char keytable0[0x80] = { - 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[', 0, 0, 'A', 'S', + 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0x08, 0, + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '@', '[', 0x0a, 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', ':', 0, 0, ']', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', @@ -33,8 +33,8 @@ void HariMain(void) 0, 0, 0, 0x5c, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x5c, 0, 0 }; static char keytable1[0x80] = { - 0, 0, '!', 0x22, '#', '$', '%', '&', 0x27, '(', ')', '~', '=', '~', 0, 0, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '`', '{', 0, 0, 'A', 'S', + 0, 0, '!', 0x22, '#', '$', '%', '&', 0x27, '(', ')', '~', '=', '~', 0x08, 0, + 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '`', '{', 0x0a, 0, 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', '+', '*', 0, 0, '}', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '7', '8', '9', '-', '4', '5', '6', '+', '1', @@ -43,7 +43,6 @@ void HariMain(void) 0, 0, 0, '_', 0, 0, 0, 0, 0, 0, 0, 0, 0, '|', 0, 0 }; int key_shift = 0, key_leds = (binfo->leds >> 4) & 7, keycmd_wait = -1; - struct CONSOLE *cons; int j, x, y, mmx = -1, mmy = -1; struct SHEET *sht = 0, *key_win; @@ -109,15 +108,15 @@ void HariMain(void) my = (binfo->scrny - 28 - 16) / 2; sheet_slide(sht_back, 0, 0); - sheet_slide(sht_cons[1], 56, 6); - sheet_slide(sht_cons[0], 8, 2); - sheet_slide(sht_win, 64, 56); + sheet_slide(sht_cons[1], 56, 6); + sheet_slide(sht_cons[0], 8, 2); sheet_slide(sht_mouse, mx, my); - sheet_updown(sht_back, 0); - sheet_updown(sht_cons[1], 1); - sheet_updown(sht_cons[0], 2); - sheet_updown(sht_mouse, 3); + sheet_updown(sht_back, 0); + sheet_updown(sht_cons[1], 1); + sheet_updown(sht_cons[0], 2); + sheet_updown(sht_mouse, 3); key_win = sht_cons[0]; + keywin_on(key_win); /*为了避免和键盘当前状态冲突,在一开始先进行设置*/ fifo32_put(&keycmd, KEYCMD_LED); @@ -125,7 +124,7 @@ void HariMain(void) for (;;) { if (fifo32_status(&keycmd) > 0 && keycmd_wait < 0) { - /*如果存在向键盘控制器发送的数据,则发送它 */ + /* �L�[�{�[�h�R���g���[���ɑ���f�[�^������΁A���� */ keycmd_wait = fifo32_get(&keycmd); wait_KBC_sendready(); io_out8(PORT_KEYDAT, keycmd_wait); @@ -139,6 +138,7 @@ void HariMain(void) io_sti(); if (key_win->flags == 0) { /*输入窗口被关闭*/ key_win = shtctl->sheets[shtctl->top - 1]; + keywin_on(key_win); } if (256 <= i && i <= 511) { /* 键盘数据*/ if (i < 0x80 + 256) { /*将按键编码转换为字符编码*/ @@ -151,7 +151,8 @@ void HariMain(void) s[0] = 0; } if ('A' <= s[0] && s[0] <= 'Z') { /*当输入字符为英文字母时*/ - if (((key_leds & 4) == 0 && key_shift == 0) ||((key_leds & 4) != 0 && key_shift != 0)) { + if (((key_leds & 4) == 0 && key_shift == 0) || + ((key_leds & 4) != 0 && key_shift != 0)) { s[0] += 0x20; /*将大写字母转换为小写字母*/ } } @@ -196,15 +197,15 @@ void HariMain(void) } if (i == 256 + 0x3b && key_shift != 0) { task = key_win->task; - if (task != 0 && task->tss.ss0 != 0) { /* Shift+F1 */ - cons_putstr0(cons, "\nBreak(key) :\n"); + if (task != 0 && task->tss.ss0 != 0) { /* Shift+F1 */ + cons_putstr0(task->cons, "\nBreak(key) :\n"); io_cli(); /*强制结束处理时禁止任务切换*/ task->tss.eax = (int) &(task->tss.esp0); task->tss.eip = (int) asm_end_app; io_sti(); } } - if (i == 256 + 0x57 && shtctl->top > 2) { /* F11 */ + if (i == 256 + 0x57) { /* F11 */ sheet_updown(shtctl->sheets[1], shtctl->top - 1); } if (i == 256 + 0xfa) { /*键盘成功接收到数据*/ @@ -231,9 +232,7 @@ void HariMain(void) if (my > binfo->scrny - 1) { my = binfo->scrny - 1; } - sheet_slide(sht_mouse, mx, my);/* 包含sheet_refresh含sheet_refresh */ - if ((mdec.btn & 0x01) != 0) { /* 按下左键 */ if (mmx < 0) { /*如果处于通常模式*/ @@ -254,13 +253,13 @@ void HariMain(void) mmx = mx; /*进入窗口移动模式*/ mmy = my; } - if (sht->bxsize - 21 <= x && x < sht->bxsize - 5 && 5 <=y && y < 19) { + if (sht->bxsize - 21 <= x && x < sht->bxsize - 5 && 5 <= y && y < 19) { /*点击“×”按钮*/ if ((sht->flags & 0x10) != 0) { /*该窗口是否为应用程序窗口?*/ task = sht->task; - cons_putstr0(cons, "\nBreak(mouse) :\n"); + cons_putstr0(task->cons, "\nBreak(mouse) :\n"); io_cli(); /*强制结束处理时禁止任务切换*/ - task->tss.eax = (int) &(task->tss.esp0);/*到此结束*/ + task->tss.eax = (int) &(task->tss.esp0); task->tss.eip = (int) asm_end_app; io_sti(); } @@ -279,9 +278,8 @@ void HariMain(void) } } else { /*没有按下左键*/ - mmx = -1; /*返回通常模式*/ + mmx = -1; /*返回通常模式*/ } - } } } diff --git a/25_day/bootpack.h b/25_day/bootpack.h index 5f6554d..9975f09 100644 --- a/25_day/bootpack.h +++ b/25_day/bootpack.h @@ -28,7 +28,6 @@ void asm_inthandler0c(void); void asm_inthandler0d(void); void asm_inthandler20(void); void asm_inthandler21(void); -void asm_inthandler27(void); void asm_inthandler2c(void); unsigned int memtest_sub(unsigned int start, unsigned int end); void farjmp(int eip, int cs); @@ -102,7 +101,6 @@ void set_gatedesc(struct GATE_DESCRIPTOR *gd, int offset, int selector, int ar); /* int.c */ void init_pic(void); -void inthandler27(int *esp); #define PIC0_ICW1 0x0020 #define PIC0_OCW2 0x0020 #define PIC0_IMR 0x0021 @@ -133,12 +131,12 @@ void enable_mouse(struct FIFO32 *fifo, int data0, struct MOUSE_DEC *mdec); int mouse_decode(struct MOUSE_DEC *mdec, unsigned char dat); /* memory.c */ -#define MEMMAN_FREES 4090 /* 大约是32KB*/ +#define MEMMAN_FREES 4090 /* ����Ŗ�32KB */ #define MEMMAN_ADDR 0x003c0000 -struct FREEINFO { /* 可用信息 */ +struct FREEINFO { /* ������� */ unsigned int addr, size; }; -struct MEMMAN { /* 内存管理 */ +struct MEMMAN { /* �������Ǘ� */ int frees, maxfrees, lostsize, losts; struct FREEINFO free[MEMMAN_FREES]; }; @@ -177,7 +175,7 @@ void sheet_free(struct SHEET *sht); struct TIMER { struct TIMER *next; unsigned int timeout; - char flags, flags2; + char flags, flags2; struct FIFO32 *fifo; int data; }; @@ -199,8 +197,8 @@ void timer_cancelall(struct FIFO32 *fifo); /* mtask.c */ #define MAX_TASKS 1000 /*最大任务数量*/ #define TASK_GDT0 3 /*定义从GDT的几号开始分配给TSS */ -#define MAX_TASKS_LV 100 -#define MAX_TASKLEVELS 10 +#define MAX_TASKS_LV 100 +#define MAX_TASKLEVELS 10 struct TSS32 { int backlink, esp0, ss0, esp1, ss1, esp2, ss2, cr3; int eip, eflags, eax, ecx, edx, ebx, esp, ebp, esi, edi; @@ -227,6 +225,7 @@ struct TASKCTL { struct TASK tasks0[MAX_TASKS]; }; extern struct TIMER *task_timer; +struct TASK *task_now(void); struct TASK *task_init(struct MEMMAN *memman); struct TASK *task_alloc(void); void task_run(struct TASK *task, int level, int priority); @@ -246,20 +245,21 @@ struct CONSOLE { int cur_x, cur_y, cur_c; struct TIMER *timer; }; -void console_task(struct SHEET *sheet, unsigned int memtotal); +void console_task(struct SHEET *sheet, int memtotal); void cons_putchar(struct CONSOLE *cons, int chr, char move); void cons_newline(struct CONSOLE *cons); void cons_putstr0(struct CONSOLE *cons, char *s); void cons_putstr1(struct CONSOLE *cons, char *s, int l); -void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, unsigned int memtotal); -void cmd_mem(struct CONSOLE *cons, unsigned int memtotal); +void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal); +void cmd_mem(struct CONSOLE *cons, int memtotal); void cmd_cls(struct CONSOLE *cons); void cmd_dir(struct CONSOLE *cons); void cmd_type(struct CONSOLE *cons, int *fat, char *cmdline); int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline); int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax); -int *inthandler0c(int *esp); int *inthandler0d(int *esp); +int *inthandler0c(int *esp); +void hrb_api_linewin(struct SHEET *sht, int x0, int y0, int x1, int y1, int col); /* file.c */ struct FILEINFO { @@ -271,3 +271,4 @@ struct FILEINFO { void file_readfat(int *fat, unsigned char *img); void file_loadfile(int clustno, int size, char *buf, int *fat, char *img); struct FILEINFO *file_search(char *name, struct FILEINFO *finfo, int max); + diff --git a/25_day/console.c b/25_day/console.c index 2cfb82a..7df9bea 100644 --- a/25_day/console.c +++ b/25_day/console.c @@ -4,48 +4,48 @@ #include #include -void console_task(struct SHEET *sheet, unsigned int memtotal) +void console_task(struct SHEET *sheet, int memtotal) { - struct TIMER *timer; struct TASK *task = task_now(); struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; int i, *fat = (int *) memman_alloc_4k(memman, 4 * 2880); struct CONSOLE cons; char cmdline[30]; cons.sht = sheet; - cons.cur_x = 8; + cons.cur_x = 8; cons.cur_y = 28; cons.cur_c = -1; task->cons = &cons; - timer = timer_alloc(); - timer_init(timer, &task->fifo, 1); - timer_settime(timer, 50); - file_readfat(fat, (unsigned char *) (ADR_DISKIMG + 0x000200)); + cons.timer = timer_alloc(); + timer_init(cons.timer, &task->fifo, 1); + timer_settime(cons.timer, 50); + file_readfat(fat, (unsigned char *) (ADR_DISKIMG + 0x000200)); /*显示提示符*/ cons_putchar(&cons, '>', 1); + for (;;) { io_cli(); if (fifo32_status(&task->fifo) == 0) { - task_sleep(task); + task_sleep(task); io_sti(); } else { i = fifo32_get(&task->fifo); io_sti(); if (i <= 1) { /*光标用定时器*/ if (i != 0) { - timer_init(timer, &task->fifo, 0); /*下次置0 */ + timer_init(cons.timer, &task->fifo, 0); /*下次置0 */ if (cons.cur_c >= 0) { cons.cur_c = COL8_FFFFFF; } } else { - timer_init(timer, &task->fifo, 1); /*下次置1 */ + timer_init(cons.timer, &task->fifo, 1); /*下次置1 */ if (cons.cur_c >= 0) { cons.cur_c = COL8_000000; } } - timer_settime(timer, 50); + timer_settime(cons.timer, 50); } if (i == 2) { /*光标ON */ cons.cur_c = COL8_FFFFFF; @@ -163,7 +163,7 @@ void cons_putstr1(struct CONSOLE *cons, char *s, int l) return; } -void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, unsigned int memtotal) +void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, int memtotal) { if (strcmp(cmdline, "mem") == 0) { cmd_mem(cons, memtotal); @@ -182,11 +182,11 @@ void cons_runcmd(char *cmdline, struct CONSOLE *cons, int *fat, unsigned int mem return; } -void cmd_mem(struct CONSOLE *cons, unsigned int memtotal) +void cmd_mem(struct CONSOLE *cons, int memtotal) { struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; char s[60]; - sprintf(s, "total %dMB\nfree %dKB\n\n", memtotal / (1024 * 1024), memman_total(memman) / 1024); + sprintf(s, "total %dMB\nfree %dKB\n\n", memtotal / (1024 * 1024), memman_total(memman) / 1024); cons_putstr0(cons, s); return; } @@ -216,7 +216,7 @@ void cmd_dir(struct CONSOLE *cons) } if (finfo[i].name[0] != 0xe5) { if ((finfo[i].type & 0x18) == 0) { - sprintf(s, "filename.ext %7d\n", finfo[i].size); + sprintf(s, "filename.ext %7d\n", finfo[i].size); for (j = 0; j < 8; j++) { s[j] = finfo[i].name[j]; } @@ -241,7 +241,7 @@ void cmd_type(struct CONSOLE *cons, int *fat, char *cmdline) p = (char *) memman_alloc_4k(memman, finfo->size); file_loadfile(finfo->clustno, finfo->size, p, fat, (char *) (ADR_DISKIMG + 0x003e00)); cons_putstr1(cons, p, finfo->size); - memman_free_4k(memman, (int) p, finfo->size); + memman_free_4k(memman, (int) p, finfo->size); } else { /*没有找到文件的情况*/ cons_putstr0(cons, "File not found.\n"); @@ -272,9 +272,9 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) /*寻找文件 */ finfo = file_search(name, (struct FILEINFO *) (ADR_DISKIMG + 0x002600), 224); - if (finfo == 0 && name[i -1]!= '.') { + if (finfo == 0 && name[i - 1] != '.') { /*由于找不到文件,故在文件名后面加上“.hrb”后重新寻找*/ - name[i ] = '.'; + name[i ] = '.'; name[i + 1] = 'H'; name[i + 2] = 'R'; name[i + 3] = 'B'; @@ -294,7 +294,7 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) q = (char *) memman_alloc_4k(memman, segsiz); task->ds_base = (int) q; set_segmdesc(gdt + task->sel / 8 + 1000, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60); - set_segmdesc(gdt + task->sel / 8 + 2000, segsiz - 1, (int) q, AR_DATA32_RW + 0x60); + set_segmdesc(gdt + task->sel / 8 + 2000, segsiz - 1, (int) q, AR_DATA32_RW + 0x60); for (i = 0; i < datsiz; i++) { q[esp + i] = p[dathrb + i]; } @@ -329,8 +329,8 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int struct SHEET *sht; int *reg = &eax + 1; /* eax后面的地址*/ /*强行改写通过PUSHAD保存的值*/ - /* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */ - /* reg[4] : EBX, reg[5] : EDX, reg[6] : ECX, reg[7] : EAX */ + /* reg[0] : EDI, reg[1] : ESI, reg[2] : EBP, reg[3] : ESP */ + /* reg[4] : EBX, reg[5] : EDX, reg[6] : ECX, reg[7] : EAX */ int i; if (edx == 1) { @@ -349,7 +349,7 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int make_window8((char *) ebx + ds_base, esi, edi, (char *) ecx + ds_base, 0); sheet_slide(sht, (shtctl->xsize - esi) / 2, (shtctl->ysize - edi) / 2); sheet_updown(sht, shtctl->top); /*将窗口图层高度指定为当前鼠标所在图层的高度,鼠标移到上层*/ - reg[7] = (int) sht; + reg[7] = (int) sht; } else if (edx == 6) { sht = (struct SHEET *) (ebx & 0xfffffffe); putfonts8_asc(sht->buf, sht->bxsize, esi, edi, eax, (char *) ebp + ds_base); @@ -419,7 +419,7 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int return 0; } } - } else if (edx == 16) { + } else if (edx == 16) { reg[7] = (int) timer_alloc(); ((struct TIMER *) reg[7])->flags2 = 1; /*允许自动取消*/ } else if (edx == 17) { @@ -428,7 +428,7 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int timer_settime((struct TIMER *) ebx, eax); } else if (edx == 19) { timer_free((struct TIMER *) ebx); - } else if (edx == 20) { + } else if (edx == 20) { if (eax == 0) { i = io_in8(0x61); io_out8(0x61, i & 0x0d); diff --git a/25_day/dsctbl.c b/25_day/dsctbl.c index 05bfe89..9ff2c67 100644 --- a/25_day/dsctbl.c +++ b/25_day/dsctbl.c @@ -27,9 +27,8 @@ void init_gdtidt(void) set_gatedesc(idt + 0x0d, (int) asm_inthandler0d, 2 * 8, AR_INTGATE32); set_gatedesc(idt + 0x20, (int) asm_inthandler20, 2 * 8, AR_INTGATE32); set_gatedesc(idt + 0x21, (int) asm_inthandler21, 2 * 8, AR_INTGATE32); - set_gatedesc(idt + 0x27, (int) asm_inthandler27, 2 * 8, AR_INTGATE32); set_gatedesc(idt + 0x2c, (int) asm_inthandler2c, 2 * 8, AR_INTGATE32); - set_gatedesc(idt + 0x40, (int) asm_hrb_api, 2 * 8, AR_INTGATE32 + 0x60); + set_gatedesc(idt + 0x40, (int) asm_hrb_api, 2 * 8, AR_INTGATE32 + 0x60); return; } diff --git a/25_day/file.c b/25_day/file.c index c289350..bf9d063 100644 --- a/25_day/file.c +++ b/25_day/file.c @@ -7,7 +7,7 @@ void file_readfat(int *fat, unsigned char *img) { int i, j = 0; for (i = 0; i < 2880; i += 2) { - fat[i + 0] = (img[j + 0] | img[j + 1] << 8) & 0xfff; + fat[i + 0] = (img[j + 0] | img[j + 1] << 8) & 0xfff; fat[i + 1] = (img[j + 1] >> 4 | img[j + 2] << 4) & 0xfff; j += 3; } @@ -51,12 +51,12 @@ struct FILEINFO *file_search(char *name, struct FILEINFO *finfo, int max) if ('a' <= s[j] && s[j] <= 'z') { /*将小写字母转换为大写字母*/ s[j] -= 0x20; - } + } j++; } } for (i = 0; i < max; ) { - if (finfo[i].name[0] == 0x00) { + if (finfo->name[0] == 0x00) { break; } if ((finfo[i].type & 0x18) == 0) { @@ -67,8 +67,8 @@ struct FILEINFO *file_search(char *name, struct FILEINFO *finfo, int max) } return finfo + i; /*找到文件*/ } - next: - i++; +next: + i++; } return 0; /*没有找到*/ } diff --git a/25_day/int.c b/25_day/int.c index c717372..54c4c7a 100644 --- a/25_day/int.c +++ b/25_day/int.c @@ -24,14 +24,3 @@ void init_pic(void) return; } - -void inthandler27(int *esp) -/* PIC0中断的不完整策略 */ -/* 这个中断在Athlon64X2上通过芯片组提供的便利,只需执行一次 */ -/* 这个中断只是接收,不执行任何操作 */ -/* 为什么不处理? - → 因为这个中断可能是电气噪声引发的、只是处理一些重要的情况。*/ -{ - io_out8(PIC0_OCW2, 0x67); /* 通知PIC的IRQ-07(参考7-1) */ - return; -} diff --git a/25_day/mtask.c b/25_day/mtask.c index b518641..b91869d 100644 --- a/25_day/mtask.c +++ b/25_day/mtask.c @@ -163,6 +163,24 @@ void task_run(struct TASK *task, int level, int priority) return; } +void task_sleep(struct TASK *task) +{ + struct TASK *now_task; + if (task->flags == 2) { + /*如果处于活动状态*/ + now_task = task_now(); + task_remove(task); /*执行此语句的话flags将变为1 */ + if (task == now_task) { + /*如果是让自己休眠,则需要进行任务切换*/ + task_switchsub(); + now_task = task_now(); /*在设定后获取当前任务的值*/ + farjmp(0, now_task->sel); + } + } + return; +} + + void task_switch(void) { struct TASKLEVEL *tl = &taskctl->level[taskctl->now_lv]; @@ -182,20 +200,3 @@ void task_switch(void) } return; } - -void task_sleep(struct TASK *task) -{ - struct TASK *now_task; - if (task->flags == 2) { - /*如果处于活动状态*/ - now_task = task_now(); - task_remove(task); /*执行此语句的话flags将变为1 */ - if (task == now_task) { - /*如果是让自己休眠,则需要进行任务切换*/ - task_switchsub(); - now_task = task_now(); /*在设定后获取当前任务的值*/ - farjmp(0, now_task->sel); - } - } - return; -} diff --git a/25_day/naskfunc.nas b/25_day/naskfunc.nas index d32a472..a45775d 100644 --- a/25_day/naskfunc.nas +++ b/25_day/naskfunc.nas @@ -14,14 +14,14 @@ GLOBAL _load_cr0, _store_cr0 GLOBAL _load_tr GLOBAL _asm_inthandler20, _asm_inthandler21 - GLOBAL _asm_inthandler27, _asm_inthandler2c - GLOBAL _asm_inthandler0c, _asm_inthandler0d - GLOBAL _asm_end_app, _memtest_sub + GLOBAL _asm_inthandler2c, _asm_inthandler0c + GLOBAL _asm_inthandler0d, _asm_end_app + GLOBAL _memtest_sub GLOBAL _farjmp, _farcall GLOBAL _asm_hrb_api, _start_app EXTERN _inthandler20, _inthandler21 - EXTERN _inthandler27, _inthandler2c - EXTERN _inthandler0c, _inthandler0d + EXTERN _inthandler2c, _inthandler0d + EXTERN _inthandler0c EXTERN _hrb_api [SECTION .text] @@ -79,14 +79,14 @@ _io_out32: ; void io_out32(int port, int data); RET _io_load_eflags: ; int io_load_eflags(void); - PUSHFD ; PUSH EFLAGS + PUSHFD ; PUSH EFLAGS POP EAX RET _io_store_eflags: ; void io_store_eflags(int eflags); MOV EAX,[ESP+4] PUSH EAX - POPFD ; POP EFLAGS + POPFD ; POP EFLAGS RET _load_gdtr: ; void load_gdtr(int limit, int addr); @@ -146,22 +146,6 @@ _asm_inthandler21: POP ES IRETD -_asm_inthandler27: - PUSH ES - PUSH DS - PUSHAD - MOV EAX,ESP - PUSH EAX - MOV AX,SS - MOV DS,AX - MOV ES,AX - CALL _inthandler27 - POP EAX - POPAD - POP DS - POP ES - IRETD - _asm_inthandler2c: PUSH ES PUSH DS @@ -278,8 +262,8 @@ _asm_hrb_api: IRETD _asm_end_app: ; EAX为tss.esp0的地址 - MOV ESP,[EAX] - MOV DWORD [EAX+4],0 + MOV ESP,[EAX] + MOV DWORD [EAX+4],0 POPAD RET ; 返回cmd_app