mirror of
https://github.com/tailix/libkernaux.git
synced 2025-06-02 18:21:48 -04:00
Use libkernaux in Stivale 2 Limine example
This commit is contained in:
parent
3d7b6b5898
commit
0aa8134fe8
2 changed files with 4 additions and 24 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue