From 24945ddb181a49e24c5a1ecc8610e4d0ef96575c Mon Sep 17 00:00:00 2001 From: Yourtion Date: Fri, 13 May 2016 11:30:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=91=BD=E4=BB=A4=E8=A1=8C?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=EF=BC=884=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 25_day/bootpack.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) 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(); } }