Get the userland kernel closer to working again

This commit is contained in:
Pierre Pronchery 2018-08-03 04:51:23 +02:00
parent eaab8021e2
commit 7a87b00851
7 changed files with 37 additions and 33 deletions

View File

@ -95,6 +95,10 @@ _start:
push $0x0
push $0x0
push boot
call boot_init
add $0x4, %esp
2:
/* initialize the platform */
push boot

View File

@ -5,6 +5,7 @@
#include <string.h>
#include <errno.h>
#include "drivers/console.h"
#include "stdio.h"
@ -53,6 +54,11 @@ static STDIOConsoleDriver * _stdio_console_init(ukBus * bus, va_list ap)
STDIOConsole stdio;
(void) ap;
if(bus == NULL)
{
errno = ENODEV;
return NULL;
}
_stdio_console_driver.bus = bus;
stdio.interface = &stdio_console;
stdio.driver = &_stdio_console_driver;

View File

@ -51,6 +51,8 @@ void boot_init(ukBoot * boot, char const * name, char const * args,
{
boot->name = name;
boot->args = args;
boot->console = CONFIG_DEFAULT_CONSOLE;
boot->console_bus = CONFIG_DEFAULT_CONSOLE_BUS;
boot_set_physmem(boot, physmem_low, physmem_high);
}

View File

@ -12,5 +12,17 @@
# ifndef CONFIG_BOOT_MODULES
# define CONFIG_BOOT_MODULES 32
# endif
# ifndef CONFIG_DEFAULT_CONSOLE
# define CONFIG_DEFAULT_CONSOLE "uart"
# endif
# ifndef CONFIG_DEFAULT_CONSOLE_BUS
# define CONFIG_DEFAULT_CONSOLE_BUS "ioport"
# endif
# ifndef CONFIG_DEFAULT_DISPLAY
# define CONFIG_DEFAULT_DISPLAY "vga"
# endif
# ifndef CONFIG_DEFAULT_DISPLAY_BUS
# define CONFIG_DEFAULT_DISPLAY_BUS "vga"
# endif
#endif /* !UKERNEL_KERNEL_CONFIG_H */

View File

@ -7,19 +7,7 @@
#if defined(__amd64__) || defined(__i386__)
# include <stdio.h>
# include "drivers/boot/multiboot.h"
# ifndef KERNEL_CONSOLE
# define KERNEL_CONSOLE "uart"
# endif
# ifndef KERNEL_CONSOLE_BUS
# define KERNEL_CONSOLE_BUS "ioport"
# endif
# ifndef KERNEL_DISPLAY
# define KERNEL_DISPLAY "vga"
# endif
# ifndef KERNEL_DISPLAY_BUS
# define KERNEL_DISPLAY_BUS "vga"
# endif
# include "config.h"
/* public */
@ -27,34 +15,24 @@
/* multiboot */
int multiboot(ukMultibootInfo * mi)
{
char const * console = KERNEL_CONSOLE;
char const * display = KERNEL_DISPLAY;
char const * display = CONFIG_DEFAULT_DISPLAY;
char const * bus;
size_t i;
ukMultibootMod * mod;
boot_init(boot, mi->loader_name, mi->cmdline,
mi->mem_lower * 1024, mi->mem_upper * 1024);
boot_set_console(boot, console, KERNEL_CONSOLE_BUS);
#ifdef notyet
/* detect the video driver to use */
bus = CONFIG_DEFAULT_DISPLAY_BUS;
#ifdef notyet
if(mi->flags & BOOT_MULTIBOOT_INFO_HAS_VBE)
{
display = "vesa";
bus = "vga";
}
#endif
boot_set_display(boot, display, KERNEL_DISPLAY_BUS);
#if 0
/* report information on the boot process */
puts("DeforaOS Multiboot");
if(mi->loader_name != NULL)
printf("Loader: %s\n", mi->loader_name);
if(mi->cmdline != NULL)
printf("Command line: %s\n", mi->cmdline);
printf("%u MB memory available\n",
(mi->mem_upper - mi->mem_lower) / 1024);
printf("Booted from %#x\n", mi->boot_device_drive);
#endif
boot_set_display(boot, display, bus);
/* register the modules */
if(mi->flags & BOOT_MULTIBOOT_INFO_HAS_MODS)

View File

@ -2,4 +2,7 @@
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS uKernel */
#define CONFIG_DEFAULT_CONSOLE "stdio"
#define CONFIG_DEFAULT_CONSOLE_BUS "tty"
#include "kernel/boot.c"

View File

@ -14,7 +14,6 @@
int _init(void)
{
boot_init(boot, "user", NULL, 0, 0);
boot_set_console(boot, "tty", "stdio");
platform_init(platform, boot);
platform_start(platform);
return 0;