term: Misc improvements and fixes
This commit is contained in:
parent
385af687b3
commit
b2e66e5a2d
@ -16,6 +16,7 @@ void text_get_cursor_pos(size_t *x, size_t *y);
|
||||
void text_set_text_fg(size_t fg);
|
||||
void text_set_text_bg(size_t bg);
|
||||
void text_set_text_fg_bright(size_t fg);
|
||||
void text_set_text_bg_bright(size_t bg);
|
||||
void text_set_text_fg_default(void);
|
||||
void text_set_text_bg_default(void);
|
||||
bool text_scroll_disable(void);
|
||||
|
@ -186,6 +186,10 @@ void init_vga_textmode(size_t *_rows, size_t *_cols, bool managed) {
|
||||
outb(0x3d5, 0);
|
||||
outb(0x3d4, 0x0e);
|
||||
outb(0x3d5, 0);
|
||||
|
||||
struct rm_regs r = {0};
|
||||
r.eax = 0x0200;
|
||||
rm_int(0x10, &r, &r);
|
||||
} else {
|
||||
outb(0x3d4, 0x0a);
|
||||
outb(0x3d5, 0x20);
|
||||
@ -261,6 +265,10 @@ void text_set_text_fg_bright(size_t fg) {
|
||||
text_palette = (text_palette & 0xf0) | (ansi_colours[fg] | (1 << 3));
|
||||
}
|
||||
|
||||
void text_set_text_bg_bright(size_t bg) {
|
||||
text_palette = (text_palette & 0x0f) | ((ansi_colours[bg] | (1 << 3)) << 4);
|
||||
}
|
||||
|
||||
void text_set_text_fg_default(void) {
|
||||
text_palette = (text_palette & 0xf0) | 7;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void term_textmode(void) {
|
||||
set_text_fg = text_set_text_fg;
|
||||
set_text_bg = text_set_text_bg;
|
||||
set_text_fg_bright = text_set_text_fg_bright;
|
||||
set_text_bg_bright = text_set_text_bg;
|
||||
set_text_bg_bright = text_set_text_bg_bright;
|
||||
set_text_fg_default = text_set_text_fg_default;
|
||||
set_text_bg_default = text_set_text_bg_default;
|
||||
scroll_disable = text_scroll_disable;
|
||||
|
@ -382,14 +382,17 @@ failed_to_load_header_section:
|
||||
|
||||
size_t req_width = 0, req_height = 0, req_bpp = 0;
|
||||
|
||||
if (hdrtag != NULL) {
|
||||
req_width = hdrtag->framebuffer_width;
|
||||
req_height = hdrtag->framebuffer_height;
|
||||
req_bpp = hdrtag->framebuffer_bpp;
|
||||
char *resolution = config_get_value(config, 0, "RESOLUTION");
|
||||
if (resolution != NULL)
|
||||
parse_resolution(&req_width, &req_height, &req_bpp, resolution);
|
||||
|
||||
char *resolution = config_get_value(config, 0, "RESOLUTION");
|
||||
if (resolution != NULL)
|
||||
parse_resolution(&req_width, &req_height, &req_bpp, resolution);
|
||||
if (hdrtag != NULL) {
|
||||
if (hdrtag->framebuffer_width)
|
||||
req_width = hdrtag->framebuffer_width;
|
||||
if (hdrtag->framebuffer_height)
|
||||
req_height = hdrtag->framebuffer_height;
|
||||
if (hdrtag->framebuffer_bpp)
|
||||
req_bpp = hdrtag->framebuffer_bpp;
|
||||
}
|
||||
|
||||
struct stivale2_header_tag_any_video *avtag = get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_ANY_VIDEO_ID);
|
||||
@ -411,7 +414,8 @@ failed_to_load_header_section:
|
||||
struct stivale2_header_tag_terminal *terminal_hdr_tag = get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_TERMINAL_ID);
|
||||
|
||||
if (bits == 64 && terminal_hdr_tag != NULL) {
|
||||
if (bios && ((hdrtag == NULL) || (avtag != NULL && preference == 1))) {
|
||||
if (bios &&
|
||||
((avtag == NULL && hdrtag == NULL) || (avtag != NULL && preference == 1))) {
|
||||
term_textmode();
|
||||
textmode = true;
|
||||
} else {
|
||||
|
@ -8,7 +8,7 @@ static const char CONVERSION_TABLE[] = "0123456789abcdef";
|
||||
void e9_putc(char c) {
|
||||
if (stivale2_print != NULL)
|
||||
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) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
DEFAULT_ENTRY=1
|
||||
TIMEOUT=3
|
||||
#GRAPHICS=yes
|
||||
GRAPHICS=yes
|
||||
MENU_FONT=boot:///boot/font.bin
|
||||
VERBOSE=yes
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <stddef.h>
|
||||
|
||||
typedef uint8_t stack[4096];
|
||||
static stack stacks[10] = {0};
|
||||
static stack stacks[64] = {0};
|
||||
void stivale2_main(struct stivale2_struct *info);
|
||||
|
||||
struct stivale2_header_tag_terminal terminal_request = {
|
||||
@ -28,14 +28,12 @@ struct stivale2_tag unmap_null_request = {
|
||||
.next = (uint64_t)&smp_request
|
||||
};
|
||||
|
||||
struct stivale2_header_tag_framebuffer framebuffer_request = {
|
||||
struct stivale2_header_tag_any_video any_video_request = {
|
||||
.tag = {
|
||||
.identifier = STIVALE2_HEADER_TAG_FRAMEBUFFER_ID,
|
||||
.identifier = STIVALE2_HEADER_TAG_ANY_VIDEO_ID,
|
||||
.next = (uint64_t)&unmap_null_request
|
||||
},
|
||||
.framebuffer_width = 0,
|
||||
.framebuffer_height = 0,
|
||||
.framebuffer_bpp = 0,
|
||||
.preference = 0
|
||||
};
|
||||
|
||||
__attribute__((section(".stivale2hdr"), used))
|
||||
@ -43,7 +41,7 @@ struct stivale2_header header2 = {
|
||||
.entry_point = (uint64_t)stivale2_main,
|
||||
.stack = (uintptr_t)stacks[0] + sizeof(stack),
|
||||
.flags = (1 << 1) | (1 << 2),
|
||||
.tags = (uint64_t)&framebuffer_request
|
||||
.tags = (uint64_t)&any_video_request
|
||||
};
|
||||
|
||||
static volatile int cpu_up = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user