Bare metal VGA: clarify code comments (#616)

This commit is contained in:
tkchia 2022-09-14 06:26:33 +08:00 committed by GitHub
parent aab4ee4072
commit 945699694e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View file

@ -30,7 +30,15 @@
#include "libc/vga/vga.internal.h" #include "libc/vga/vga.internal.h"
ssize_t sys_readv_vga(struct Fd *fd, const struct iovec *iov, int iovlen) { ssize_t sys_readv_vga(struct Fd *fd, const struct iovec *iov, int iovlen) {
/* NOTE: this routine is always non-blocking. */ /*
* NOTE: this routine is always non-blocking.
*
* sys_readv_metal() calls here to ask if the VGA teletypewriter has any
* "status reports" escape sequences to send out.
*
* If there are no such status reports, then immediately return 0.
* sysv_readv_metal() will then try to read from an actual input device.
*/
size_t i, redd = 0; size_t i, redd = 0;
ssize_t res = 0; ssize_t res = 0;
for (i = 0; i < iovlen; ++i) { for (i = 0; i < iovlen; ++i) {

View file

@ -2,9 +2,9 @@
#define COSMOPOLITAN_LIBC_VGA_VGA_INTERNAL_H_ #define COSMOPOLITAN_LIBC_VGA_VGA_INTERNAL_H_
/* /*
* VGA_TTY_HEIGHT, VGA_TTY_WIDTH, & VGA_USE_WCS are configuration knobs * VGA_TTY_HEIGHT, VGA_TTY_WIDTH, VGA_USE_WCS, & VGA_PERSNICKETY_STATUS are
* which can potentially be used to tweak the features to be compiled into * configuration knobs which can potentially be used to tweak the features
* our VGA teletypewriter support. * to be compiled into our VGA teletypewriter support.
*/ */
/** /**
@ -20,8 +20,14 @@
/** /**
* If VGA_USE_WCS is defined, the tty code can maintain an array of the * If VGA_USE_WCS is defined, the tty code can maintain an array of the
* Unicode characters "underlying" the 8-bit (or 9-bit) characters that are * Unicode characters "underlying" the 8-bit (or 9-bit) characters that are
* actually displayed on the text screen. This can be used to implement * actually displayed on the text screen. This Unicode character
* something similar to Linux's /dev/vcsu* facility. * information is not used in Cosmopolitan as of now (Sep 2022). A Linux
* mailing list post suggests that such information could be of use to
* applications such as screen readers.
*
* If VGA_USE_WCS is undefined, then the Unicode character information is
* not maintained, & we arrange for the relevant logic to be optimized away
* by the compiler.
* *
* @see lkml.kernel.org/lkml/204888.1529277815@turing-police.cc.vt.edu/T/ * @see lkml.kernel.org/lkml/204888.1529277815@turing-police.cc.vt.edu/T/
*/ */