Bare metal VGA: implement "status report" escape codes (#613)

* Bare metal VGA: implement "status report" escape codes
* Minor fix to pseudoteletypewriter code

Co-authored-by: tkchia <tkchia-cosmo@gmx.com>
This commit is contained in:
tkchia 2022-09-13 17:14:10 +08:00 committed by GitHub
parent e0fabd1d49
commit df08b541af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 113 additions and 10 deletions

View file

@ -20,15 +20,29 @@
#include "libc/calls/struct/fd.internal.h"
#include "libc/calls/struct/iovec.h"
#include "libc/calls/struct/iovec.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/macros.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
#include "libc/vga/vga.internal.h"
ssize_t sys_readv_metal(struct Fd *fd, const struct iovec *iov, int iovlen) {
int i;
size_t got, toto;
struct MetalFile *file;
switch (fd->kind) {
case kFdConsole:
/*
* The VGA teletypewriter code may wish to send out "status report"
* escape sequences, in response to requests sent to it via write().
* Read & return these if they are available.
*/
if (weaken(sys_readv_vga)) {
ssize_t res = weaken(sys_readv_vga)(fd, iov, iovlen);
if (res > 0)
return res;
}
/* fall through */
case kFdSerial:
return sys_readv_serial(fd, iov, iovlen);
case kFdFile: