diff --git a/25_day/bootpack.c b/25_day/bootpack.c index 9d5c075..0b011af 100644 --- a/25_day/bootpack.c +++ b/25_day/bootpack.c @@ -21,7 +21,7 @@ void HariMain(void) struct MEMMAN *memman = (struct MEMMAN *) MEMMAN_ADDR; unsigned char *buf_back, buf_mouse[256], *buf_win, *buf_cons[2]; struct SHEET *sht_back, *sht_mouse, *sht_win, *sht_cons[2]; - struct TASK *task_a, *task_cons[2]; + struct TASK *task_a, *task_cons[2], *task; struct TIMER *timer; static char keytable0[0x80] = { 0, 0, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '^', 0, 0, @@ -232,13 +232,15 @@ void HariMain(void) fifo32_put(&keycmd, KEYCMD_LED); fifo32_put(&keycmd, key_leds); } - if (i == 256 + 0x3b && key_shift != 0 && task_cons[0]->tss.ss0 != 0) { /* Shift+F1 */ - cons = (struct CONSOLE *) *((int *) 0x0fec); - cons_putstr0(cons, "\nBreak(key) :\n"); - io_cli(); /*强制结束处理时禁止任务切换*/ - task_cons[0]->tss.eax = (int) &(task_cons[0]->tss.esp0); - task_cons[0]->tss.eip = (int) asm_end_app; - io_sti(); + 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"); + 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 */ sheet_updown(shtctl->sheets[1], shtctl->top - 1); @@ -298,11 +300,11 @@ void HariMain(void) if (sht->bxsize - 21 <= x && x < sht->bxsize - 5 && 5 <=y && y < 19) { /*点击“×”按钮*/ if ((sht->flags & 0x10) != 0) { /*该窗口是否为应用程序窗口?*/ - cons = (struct CONSOLE *) *((int *) 0x0fec); + task = sht->task; cons_putstr0(cons, "\nBreak(mouse) :\n"); - io_cli(); /*强制结束处理中禁止切换任务*/ - task_cons[0]->tss.eax = (int) &(task_cons[0]->tss.esp0); - task_cons[0]->tss.eip = (int) asm_end_app; + io_cli(); /*强制结束处理时禁止任务切换*/ + task->tss.eax = (int) &(task->tss.esp0);/*到此结束*/ + task->tss.eip = (int) asm_end_app; io_sti(); } }