git: b38c8d4c6d69 - stable/12 - boot2: need to expand tab output and mask getchar
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Oct 2021 06:10:49 UTC
The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b38c8d4c6d691a3a65f90a7023c99bf64790caa4 commit b38c8d4c6d691a3a65f90a7023c99bf64790caa4 Author: Toomas Soome <tsoome@FreeBSD.org> AuthorDate: 2020-06-16 20:35:00 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2021-10-08 02:42:54 +0000 boot2: need to expand tab output and mask getchar The BIOS ouput char function does not expand tab. Mask getchar with 0xFF. (cherry picked from commit 6469d2b422960de4b1253cc63b11fa67f896604f) --- stand/i386/common/cons.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/stand/i386/common/cons.c b/stand/i386/common/cons.c index 96e782fda5c9..25dda1ce7405 100644 --- a/stand/i386/common/cons.c +++ b/stand/i386/common/cons.c @@ -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