Boot to C in 64-bit long mode

This commit is contained in:
Pierre-Emmanuel Gob. 2026-09-17 22:07:47 +02:00
parent 53f1295927
commit 7d736cd76d
14 changed files with 668 additions and 46 deletions

27
include/console.h Normal file
View file

@ -0,0 +1,27 @@
/* Nadir early console: VGA text-mode driver.
*
* Writes straight to the VGA text buffer at 0xB8000, which the stage-2
* page tables identity-map. Runs in 64-bit long mode at Ring 0 (CPL 0);
* no faults are possible beyond a programming bug. There is no IDT yet,
* so a wild pointer here triple-faults the machine.
*/
#ifndef NADIR_CONSOLE_H
#define NADIR_CONSOLE_H
#include <stdint.h>
/* Clear the screen and park the cursor at the top left. */
void console_clear(void);
/* Print one character. '\n' moves to the start of the next line; the
* screen scrolls up when the cursor runs past the last line. */
void console_putchar(char c);
/* Print a NUL-terminated string. */
void console_puts(const char *s);
/* Print a 64-bit value as 0x-prefixed, zero-padded hexadecimal. */
void console_puthex64(uint64_t value);
#endif /* NADIR_CONSOLE_H */