2020-12-06 23:46:37 -05:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2020-11-30 06:40:33 -05:00
|
|
|
#include "config.h"
|
2020-12-06 23:46:37 -05:00
|
|
|
#endif
|
2020-11-30 06:40:33 -05:00
|
|
|
|
2020-12-07 21:56:38 -05:00
|
|
|
#ifdef ARCH_I386
|
|
|
|
#include <kernaux/arch/i386.h>
|
2020-11-30 06:32:12 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <kernaux/console.h>
|
2021-12-15 05:45:40 -05:00
|
|
|
#include <kernaux/libc.h>
|
2020-12-06 19:09:47 -05:00
|
|
|
#include <kernaux/printf.h>
|
2020-11-30 06:32:12 -05:00
|
|
|
|
|
|
|
void kernaux_console_print(const char *const s)
|
|
|
|
{
|
2021-12-15 05:45:40 -05:00
|
|
|
kernaux_console_write(s, strlen(s));
|
2020-11-30 06:32:12 -05:00
|
|
|
}
|
|
|
|
|
2020-12-05 20:41:31 -05:00
|
|
|
void kernaux_console_putc(const char c __attribute__((unused)))
|
|
|
|
{
|
2020-12-07 21:56:38 -05:00
|
|
|
#ifdef ARCH_I386
|
|
|
|
kernaux_arch_i386_outportb(0x3F8, c);
|
2020-11-30 06:32:12 -05:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void kernaux_console_puts(const char *const s)
|
|
|
|
{
|
|
|
|
kernaux_console_print(s);
|
|
|
|
kernaux_console_putc('\n');
|
|
|
|
}
|
|
|
|
|
2020-12-05 20:41:31 -05:00
|
|
|
void kernaux_console_write(const char *const data, const unsigned int size)
|
|
|
|
{
|
2020-11-30 06:32:12 -05:00
|
|
|
for (unsigned int i = 0; i < size; i++) {
|
|
|
|
kernaux_console_putc(data[i]);
|
|
|
|
}
|
|
|
|
}
|
2020-12-05 21:42:56 -05:00
|
|
|
|
|
|
|
void kernaux_console_printf(const char *format, ...)
|
|
|
|
{
|
2020-12-06 19:09:47 -05:00
|
|
|
va_list va;
|
|
|
|
va_start(va, format);
|
|
|
|
kernaux_printf_va(kernaux_console_putc, format, va);
|
|
|
|
va_end(va);
|
2020-12-05 21:42:56 -05:00
|
|
|
}
|