diff --git a/21_day/console.c b/21_day/console.c index 60a7103..051ed8a 100644 --- a/21_day/console.c +++ b/21_day/console.c @@ -284,6 +284,7 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) if (finfo != 0) { /*找到文件的情况*/ p = (char *) memman_alloc_4k(memman, finfo->size); + *((int *) 0xfe8) = (int) p; file_loadfile(finfo->clustno, finfo->size, p, fat, (char *) (ADR_DISKIMG + 0x003e00)); set_segmdesc(gdt + 1003, finfo->size - 1, (int) p, AR_CODE32_ER); farcall(0, 1003 * 8); @@ -297,13 +298,14 @@ int cmd_app(struct CONSOLE *cons, int *fat, char *cmdline) void hrb_api(int edi, int esi, int ebp, int esp, int ebx, int edx, int ecx, int eax) { + int cs_base = *((int *) 0xfe8); struct CONSOLE *cons = (struct CONSOLE *) *((int *) 0x0fec); if (edx == 1) { cons_putchar(cons, eax & 0xff, 1); } else if (edx == 2) { - cons_putstr0(cons, (char *) ebx); + cons_putstr0(cons, (char *) ebx + cs_base); } else if (edx == 3) { - cons_putstr1(cons, (char *) ebx, ecx); + cons_putstr1(cons, (char *) ebx + cs_base, ecx); } return; }