Add E9_OUTPUT config option

This commit is contained in:
mintsuki 2020-10-20 02:38:44 +02:00
parent 54eaf96860
commit 74c7c0d776
5 changed files with 21 additions and 5 deletions

Binary file not shown.

View File

@ -8,6 +8,8 @@
#define SEPARATOR '\n'
bool config_ready = false;
static char *config_addr;
int init_config(int drive, int part) {
@ -33,6 +35,8 @@ int init_config(int drive, int part) {
}
}
config_ready = true;
return 0;
}

View File

@ -4,6 +4,8 @@
#include <stddef.h>
#include <stdbool.h>
extern bool config_ready;
int init_config(int drive, int part);
int config_get_entry_name(char *ret, size_t index, size_t limit);
int config_set_entry(size_t index);

View File

@ -3,8 +3,12 @@
#include <stdint.h>
#include <lib/print.h>
#include <lib/blib.h>
#include <sys/cpu.h>
#include <lib/config.h>
#include <lib/term.h>
#include <lib/libc.h>
#include <sys/cpu.h>
static int e9_output = -1;
static const char *base_digits = "0123456789abcdef";
@ -114,6 +118,11 @@ void print(const char *fmt, ...) {
static char print_buf[PRINT_BUF_MAX];
void vprint(const char *fmt, va_list args) {
if (config_ready && e9_output == -1) {
e9_output = config_get_value(print_buf, 0, PRINT_BUF_MAX, "E9_OUTPUT") &&
!strcmp(print_buf, "yes");
}
size_t print_buf_i = 0;
for (;;) {
@ -170,8 +179,8 @@ void vprint(const char *fmt, va_list args) {
out:
term_write(print_buf, print_buf_i);
#ifdef E9_OUTPUT
for (size_t i = 0; i < print_buf_i; i++)
outb(0xe9, print_buf[i]);
#endif
if (e9_output == 1) {
for (size_t i = 0; i < print_buf_i; i++)
outb(0xe9, print_buf[i]);
}
}

View File

@ -1,6 +1,7 @@
DEFAULT_ENTRY=0
TIMEOUT=3
GRAPHICS=yes
E9_OUTPUT=yes
THEME_BLACK=80000000
THEME_RED=aa0000