Date: Tue, 16 Jun 2020 20:35:00 +0000 (UTC) From: Toomas Soome <tsoome@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r362239 - head/stand/i386/common Message-ID: <202006162035.05GKZ0hH057421@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tsoome Date: Tue Jun 16 20:35:00 2020 New Revision: 362239 URL: https://svnweb.freebsd.org/changeset/base/362239 Log: boot2: need to expand tab output and mask getchar The BIOS ouput char function does not expand tab. Mask getchar with 0xFF. Sponsored by: Netflix, Klara Inc. Modified: head/stand/i386/common/cons.c Modified: head/stand/i386/common/cons.c ============================================================================== --- head/stand/i386/common/cons.c Tue Jun 16 20:23:57 2020 (r362238) +++ head/stand/i386/common/cons.c Tue Jun 16 20:35:00 2020 (r362239) @@ -53,12 +53,38 @@ xputc(int c) sio_putc(c); } +static void +getcursor(int *row, int *col) +{ + v86.ctl = V86_FLAGS; + v86.addr = 0x10; + v86.eax = 0x300; + v86.ebx = 0x7; + v86int(); + + if (row != NULL) + *row = v86.edx >> 8; + if (col != NULL) + *col = v86.edx & 0xff; +} + void putchar(int c) { + int i, col; - if (c == '\n') + switch (c) { + case '\n': xputc('\r'); + break; + case '\t': + col = 0; + getcursor(NULL, &col); + col = 8 - (col % 8); + for (i = 0; i < col; i++) + xputc(' '); + return; + } xputc(c); } @@ -100,7 +126,7 @@ int getchar(void) { - return (xgetc(0)); + return (xgetc(0) & 0xff); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006162035.05GKZ0hH057421>