From ae675195d4c4e51795dceb26d4f0d23d277f79da Mon Sep 17 00:00:00 2001 From: Yourtion <yourtion@gmail.com> Date: Wed, 4 May 2016 16:15:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BB=E5=85=8B=E9=9A=BE=E9=A2=98=E2=80=94?= =?UTF-8?q?=E2=80=94=E5=AD=97=E7=AC=A6=E4=B8=B2=E6=98=BE=E7=A4=BAAPI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 21_day/console.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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; }