mirror of https://github.com/tailix/libkernaux.git
Use libkernaux in Stivale 2 Limine example
This commit is contained in:
parent
3d7b6b5898
commit
0aa8134fe8
|
@ -14,6 +14,6 @@ export AR="$BIN/$HOST-ar"
|
|||
export CC="$BIN/$HOST-gcc"
|
||||
export RANLIB="$BIN/$HOST-ranlib"
|
||||
|
||||
export CFLAGS='-ffreestanding -nostdlib -fno-builtin -fno-stack-protector'
|
||||
export CFLAGS='-ffreestanding -nostdlib -fno-builtin -fno-stack-protector -fno-pic -mabi=sysv -mno-80387 -mno-3dnow -mno-sse -mno-sse2 -mno-red-zone -mcmodel=kernel -MMD'
|
||||
|
||||
"$REPO/configure" --host="$HOST" --enable-assert --enable-guard --with-libc
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <kernaux/console.h>
|
||||
|
||||
#include "stivale2.h"
|
||||
|
||||
static void poweroff();
|
||||
static void putc(char c);
|
||||
|
||||
// We need to tell the stivale bootloader where we want our stack to be.
|
||||
// We are going to allocate our stack as an array in .bss.
|
||||
|
@ -105,21 +106,7 @@ void *stivale2_get_tag(struct stivale2_struct *stivale2_struct, uint64_t id) {
|
|||
|
||||
// The following will be our kernel's entry point.
|
||||
void _start(struct stivale2_struct *stivale2_struct __attribute__((unused))) {
|
||||
putc('H');
|
||||
putc('e');
|
||||
putc('l');
|
||||
putc('l');
|
||||
putc('o');
|
||||
putc(',');
|
||||
putc(' ');
|
||||
putc('W');
|
||||
putc('o');
|
||||
putc('r');
|
||||
putc('l');
|
||||
putc('d');
|
||||
putc('!');
|
||||
putc('\n');
|
||||
|
||||
kernaux_console_puts("Hello, World!");
|
||||
poweroff();
|
||||
}
|
||||
|
||||
|
@ -129,10 +116,3 @@ void poweroff()
|
|||
const uint16_t value = 0x2000;
|
||||
__asm__ volatile("outw %1, %0" : : "dN" (port), "a" (value));
|
||||
}
|
||||
|
||||
void putc(const char c)
|
||||
{
|
||||
const uint16_t port = 0x3F8;
|
||||
const uint16_t value = c;
|
||||
__asm__ volatile("outw %1, %0" : : "dN" (port), "a" (value));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue