mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-04-19 05:14:43 +00:00
VGA tty initialization should not run outside of bare metal mode (#614)
This commit is contained in:
parent
945699694e
commit
6a3330d7c9
1 changed files with 23 additions and 20 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "libc/calls/struct/fd.internal.h"
|
#include "libc/calls/struct/fd.internal.h"
|
||||||
#include "libc/calls/struct/iovec.h"
|
#include "libc/calls/struct/iovec.h"
|
||||||
#include "libc/calls/struct/iovec.internal.h"
|
#include "libc/calls/struct/iovec.internal.h"
|
||||||
|
#include "libc/dce.h"
|
||||||
#include "libc/vga/vga.internal.h"
|
#include "libc/vga/vga.internal.h"
|
||||||
#include "libc/runtime/pc.internal.h"
|
#include "libc/runtime/pc.internal.h"
|
||||||
#include "libc/str/str.h"
|
#include "libc/str/str.h"
|
||||||
|
@ -58,6 +59,7 @@ ssize_t sys_writev_vga(struct Fd *fd, const struct iovec *iov, int iovlen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((__constructor__)) static textstartup void _vga_init(void) {
|
__attribute__((__constructor__)) static textstartup void _vga_init(void) {
|
||||||
|
if (IsMetal()) {
|
||||||
void * const vid_buf = (void *)(BANE + 0xb8000ull);
|
void * const vid_buf = (void *)(BANE + 0xb8000ull);
|
||||||
/*
|
/*
|
||||||
* Get the initial cursor position from the BIOS data area. Also get
|
* Get the initial cursor position from the BIOS data area. Also get
|
||||||
|
@ -73,9 +75,10 @@ __attribute__((__constructor__)) static textstartup void _vga_init(void) {
|
||||||
if (chr_ht_hi != 0 || chr_ht > 32)
|
if (chr_ht_hi != 0 || chr_ht > 32)
|
||||||
chr_ht = 32;
|
chr_ht = 32;
|
||||||
/*
|
/*
|
||||||
* Initialize our tty structure from the current screen contents, current
|
* Initialize our tty structure from the current screen contents,
|
||||||
* cursor position, & character height.
|
* current cursor position, & character height.
|
||||||
*/
|
*/
|
||||||
_StartTty(&_vga_tty, VGA_TTY_HEIGHT, VGA_TTY_WIDTH, pos.row, pos.col,
|
_StartTty(&_vga_tty, VGA_TTY_HEIGHT, VGA_TTY_WIDTH, pos.row, pos.col,
|
||||||
chr_ht, vid_buf, vga_wcs);
|
chr_ht, vid_buf, vga_wcs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue