Skip to content

Commit

Permalink
增加命令行窗口(2)
Browse files Browse the repository at this point in the history
  • Loading branch information
yourtion committed May 13, 2016
1 parent d046ca6 commit c512f3e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions 25_day/bootpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ struct TASK {
int level, priority; /* 优先级 */
struct FIFO32 fifo;
struct TSS32 tss;
struct CONSOLE *cons;
int ds_base;
};
struct TASKLEVEL {
int running; /*正在运行的任务数量*/
Expand Down
12 changes: 6 additions & 6 deletions 25_day/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void console_task(struct SHEET *sheet, unsigned int memtotal)
cons.cur_x = 8;
cons.cur_y = 28;
cons.cur_c = -1;
*((int *) 0x0fec) = (int) &cons;
task->cons = &cons;

fifo32_init(&task->fifo, 128, fifobuf, task);
timer = timer_alloc();
Expand Down Expand Up @@ -293,7 +293,7 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline)
datsiz = *((int *) (p + 0x0010));
dathrb = *((int *) (p + 0x0014));
q = (char *) memman_alloc_4k(memman, segsiz);
*((int *) 0xfe8) = (int) q;
task->ds_base = (int) q;
set_segmdesc(gdt + 1003, finfo->size - 1, (int) p, AR_CODE32_ER + 0x60);
set_segmdesc(gdt + 1004, segsiz - 1, (int) q, AR_DATA32_RW + 0x60);
for (i = 0; i < datsiz; i++) {
Expand Down Expand Up @@ -323,9 +323,9 @@ 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 ds_base = *((int *) 0xfe8);
struct TASK *task = task_now();
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
int ds_base = task->ds_base;
struct CONSOLE *cons = task->cons;
struct SHTCTL *shtctl = (struct SHTCTL *) *((int *) 0x0fe4);
struct SHEET *sht;
int *reg = &eax + 1; /* eax后面的地址*/
Expand Down Expand Up @@ -435,8 +435,8 @@ int *hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int

int *inthandler0c(int *esp)
{
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
struct TASK *task = task_now();
struct CONSOLE *cons = task->cons;
char s[30];
cons_putstr0(cons, "\nINT 0C :\n Stack Exception.\n");
sprintf(s, "EIP = %08X\n", esp[11]);
Expand All @@ -446,8 +446,8 @@ int *inthandler0c(int *esp)

int *inthandler0d(int *esp)
{
struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec);
struct TASK *task = task_now();
struct CONSOLE *cons = task->cons;
char s[30];
cons_putstr0(cons, "\nINT 0D :\n General Protected Exception.\n");
sprintf(s, "EIP = %08X\n", esp[11]);
Expand Down

0 comments on commit c512f3e

Please sign in to comment.