mirror of https://github.com/tailix/mrubyvisor.git
Use new drivers
This commit is contained in:
parent
42c7bbbbcf
commit
ec3e68b9b4
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <kernaux/drivers/shutdown.h>
|
||||
#include <drivers/shutdown.h>
|
||||
#include <kernaux/generic/malloc.h>
|
||||
#include <kernaux/free_list.h>
|
||||
#include <kernaux/libc.h>
|
||||
|
@ -43,7 +43,7 @@ void my_abort()
|
|||
void my_exit(const int status)
|
||||
{
|
||||
logger_exit(status);
|
||||
kernaux_drivers_shutdown_poweroff();
|
||||
drivers_shutdown_poweroff();
|
||||
|
||||
// TODO: libkernaux shutdown poweroff noreturn
|
||||
volatile int x = 0;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#include "logger.h"
|
||||
|
||||
#include <kernaux/drivers/console.h>
|
||||
#include <drivers/console.h>
|
||||
|
||||
void logger_assert(
|
||||
const char *const file,
|
||||
const int line,
|
||||
const char *const str
|
||||
) {
|
||||
kernaux_drivers_console_printf("panic: %s:%u: \"%s\"\n", file, line, str);
|
||||
drivers_console_printf("panic: %s:%u: \"%s\"\n", file, line, str);
|
||||
}
|
||||
|
||||
void logger_exit(const int status)
|
||||
{
|
||||
kernaux_drivers_console_printf("exit: %d\n", status);
|
||||
drivers_console_printf("exit: %d\n", status);
|
||||
}
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <kernaux/drivers/console.h>
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <drivers/console.h>
|
||||
|
||||
#include <mruby.h>
|
||||
#include <mruby/compile.h>
|
||||
#include <mruby/proc.h>
|
||||
|
@ -93,6 +94,6 @@ mrb_value ruby_console_puts(
|
|||
) {
|
||||
const char *str = NULL;
|
||||
mrb_get_args(mrb, "z", &str);
|
||||
kernaux_drivers_console_puts(str);
|
||||
drivers_console_puts(str);
|
||||
return mrb_nil_value();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include "logger.h"
|
||||
#include "panic.h"
|
||||
|
||||
#include <drivers/shutdown.h>
|
||||
#include <kernaux/assert.h>
|
||||
#include <kernaux/drivers/shutdown.h>
|
||||
|
||||
void panic_init()
|
||||
{
|
||||
|
@ -12,5 +12,5 @@ void panic_init()
|
|||
void assert(const char *const file, const int line, const char *const str)
|
||||
{
|
||||
logger_assert(file, line, str);
|
||||
kernaux_drivers_shutdown_poweroff();
|
||||
drivers_shutdown_poweroff();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include <kernaux/drivers/console.h>
|
||||
#include <drivers/console.h>
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
@ -34,7 +34,7 @@ void stack_trace_init(
|
|||
);
|
||||
|
||||
if (!elf_symbols_tag) {
|
||||
kernaux_drivers_console_puts("ELF symbols tag not found");
|
||||
drivers_console_puts("ELF symbols tag not found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,13 @@ void stack_trace_init(
|
|||
// (const struct SectionEntry*)KERNAUX_MULTIBOOT2_DATA(elf_symbols_tag);
|
||||
(const struct SectionEntry*)(&((uint8_t*)elf_symbols_tag)[20]);
|
||||
|
||||
kernaux_drivers_console_puts("ELF symbols tag:");
|
||||
drivers_console_puts("ELF symbols tag:");
|
||||
KernAux_Multiboot2_ITag_ELFSymbols_print(
|
||||
elf_symbols_tag,
|
||||
kernaux_drivers_console_printf
|
||||
drivers_console_printf
|
||||
);
|
||||
kernaux_drivers_console_printf(" data: 0x%p\n", (void*)section_headers);
|
||||
kernaux_drivers_console_putc('\n');
|
||||
drivers_console_printf(" data: 0x%p\n", (void*)section_headers);
|
||||
drivers_console_putc('\n');
|
||||
|
||||
const struct SectionEntry *const shstrtab =
|
||||
// FIXME: GRUB 2 doesn't conform the spec!
|
||||
|
@ -71,8 +71,7 @@ void stack_trace_init(
|
|||
const char *const section_name =
|
||||
&((const char*)shstrtab->vaddr)[section_header->name];
|
||||
|
||||
kernaux_drivers_console_printf("section %lu: %s\n",
|
||||
index, section_name);
|
||||
drivers_console_printf("section %lu: %s\n", index, section_name);
|
||||
|
||||
if (strcmp(section_name, ".debug_info") == 0) {
|
||||
debug_info_index = index;
|
||||
|
@ -83,12 +82,12 @@ void stack_trace_init(
|
|||
}
|
||||
}
|
||||
|
||||
kernaux_drivers_console_putc('\n');
|
||||
drivers_console_putc('\n');
|
||||
|
||||
kernaux_drivers_console_printf(".debug_info: %lu\n", debug_info_index);
|
||||
kernaux_drivers_console_printf(".debug_abbrev: %lu\n", debug_abbrev_index);
|
||||
kernaux_drivers_console_printf(".debug_str: %lu\n", debug_str_index);
|
||||
kernaux_drivers_console_putc('\n');
|
||||
drivers_console_printf(".debug_info: %lu\n", debug_info_index);
|
||||
drivers_console_printf(".debug_abbrev: %lu\n", debug_abbrev_index);
|
||||
drivers_console_printf(".debug_str: %lu\n", debug_str_index);
|
||||
drivers_console_putc('\n');
|
||||
|
||||
if (!debug_info_index || !debug_abbrev_index || !debug_str_index) return;
|
||||
/*
|
||||
|
|
|
@ -22,6 +22,6 @@ _start:
|
|||
push %ebx // Multiboot information pointer
|
||||
push %eax // Multiboot magic number
|
||||
call main
|
||||
call kernaux_drivers_shutdown_poweroff
|
||||
call drivers_shutdown_poweroff
|
||||
|
||||
.size _start, . - _start
|
||||
|
|
Loading…
Reference in New Issue