From nobody Fri Oct 08 06:10:49 2021 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 0015112D35F7; Fri, 8 Oct 2021 06:10:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HQd9G2pH2z3L4W; Fri, 8 Oct 2021 06:10:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AC7C217EA; Fri, 8 Oct 2021 06:10:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1986An2s007229; Fri, 8 Oct 2021 06:10:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1986AnkC007228; Fri, 8 Oct 2021 06:10:49 GMT (envelope-from git) Date: Fri, 8 Oct 2021 06:10:49 GMT Message-Id: <202110080610.1986AnkC007228@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: b38c8d4c6d69 - stable/12 - boot2: need to expand tab output and mask getchar List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b38c8d4c6d691a3a65f90a7023c99bf64790caa4 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b38c8d4c6d691a3a65f90a7023c99bf64790caa4 commit b38c8d4c6d691a3a65f90a7023c99bf64790caa4 Author: Toomas Soome AuthorDate: 2020-06-16 20:35:00 +0000 Commit: Kyle Evans 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