vga_textmode: Replace BIOS calls to enable and disable hardware cursor with direct VGA port IO

This commit is contained in:
mintsuki 2021-08-17 00:06:20 +02:00
parent 19ecfe9c1e
commit 385af687b3
4 changed files with 15 additions and 15 deletions

View File

@ -173,22 +173,22 @@ void init_vga_textmode(size_t *_rows, size_t *_cols, bool managed) {
*_rows = VD_ROWS; *_rows = VD_ROWS;
*_cols = VD_COLS / 2; *_cols = VD_COLS / 2;
struct rm_regs r; // VGA cursor code taken from: https://wiki.osdev.org/Text_Mode_Cursor
if (!managed) { if (!managed) {
text_disable_cursor(); text_disable_cursor();
r = (struct rm_regs){0};
r.eax = 0x0200; outb(0x3d4, 0x0a);
rm_int(0x10, &r, &r); outb(0x3d5, (inb(0x3d5) & 0xc0) | 14);
r = (struct rm_regs){0}; outb(0x3d4, 0x0b);
r.eax = 0x0100; outb(0x3d5, (inb(0x3d5) & 0xe0) | 15);
r.ecx = 0x0607; outb(0x3d4, 0x0f);
rm_int(0x10, &r, &r); outb(0x3d5, 0);
outb(0x3d4, 0x0e);
outb(0x3d5, 0);
} else { } else {
r = (struct rm_regs){0}; outb(0x3d4, 0x0a);
r.eax = 0x0100; outb(0x3d5, 0x20);
r.ecx = 0x2706;
rm_int(0x10, &r, &r);
} }
} }

View File

@ -8,7 +8,7 @@ static const char CONVERSION_TABLE[] = "0123456789abcdef";
void e9_putc(char c) { void e9_putc(char c) {
if (stivale2_print != NULL) if (stivale2_print != NULL)
stivale2_print(&c, 1); stivale2_print(&c, 1);
asm volatile ("outb %0, %1" :: "a" (c), "Nd" (0xe9) : "memory"); //asm volatile ("outb %0, %1" :: "a" (c), "Nd" (0xe9) : "memory");
} }
void e9_print(const char *msg) { void e9_print(const char *msg) {

View File

@ -1,6 +1,6 @@
DEFAULT_ENTRY=1 DEFAULT_ENTRY=1
TIMEOUT=3 TIMEOUT=3
GRAPHICS=yes #GRAPHICS=yes
MENU_FONT=boot:///boot/font.bin MENU_FONT=boot:///boot/font.bin
VERBOSE=yes VERBOSE=yes

View File

@ -12,7 +12,7 @@ struct stivale_header header = {
.framebuffer_bpp = 0, .framebuffer_bpp = 0,
.framebuffer_width = 0, .framebuffer_width = 0,
.framebuffer_height = 0, .framebuffer_height = 0,
.flags = 1 | (1 << 3), .flags = (1 << 3),
.entry_point = (uint64_t)(uintptr_t)stivale_main .entry_point = (uint64_t)(uintptr_t)stivale_main
}; };