[BOOT] Print functions for debugging
This commit is contained in:
31
kernel/include/debug.h
Normal file
31
kernel/include/debug.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <string.h>
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define debug(...) debug_printf(__VA_ARGS__)
|
||||
#else
|
||||
#define debug(...) ((void)0)
|
||||
#endif
|
||||
#define debug_info(...) do{debug("[INFO] ");debug(__VA_ARGS__);}while(0)
|
||||
#define debug_ok(...) do{debug("[OK] ");debug(__VA_ARGS__);}while(0)
|
||||
#define debug_warning(...) do{debug("[WARNING] ");debug(__VA_ARGS__);}while(0)
|
||||
#define debug_error(...) do{debug("[ERROR] ");debug(__VA_ARGS__);}while(0)
|
||||
|
||||
void debug_init();
|
||||
void debug_putch(char c);
|
||||
void debug_putsn(char *s, size_t n);
|
||||
void debug_puts(char *s);
|
||||
void debug_printf(char *, ...);
|
||||
|
||||
char *_kernel_build_date;
|
||||
char *_kernel_build_time;
|
||||
|
||||
char *_kernel_git_hash;
|
||||
char *_kernel_git_date;
|
||||
int kernel_git_dirty;
|
||||
char *_kernel_git_message;
|
||||
char *_kernel_git_branch;
|
||||
|
||||
void debug_build_time();
|
||||
void debug_git_info();
|
||||
|
||||
8
kernel/include/ports.h
Normal file
8
kernel/include/ports.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
void outb(uint16_t port, uint8_t value);
|
||||
uint8_t inb(uint16_t port);
|
||||
|
||||
void outw(uint16_t port, uint16_t value);
|
||||
uint16_t inw(uint16_t port);
|
||||
10
kernel/include/serial.h
Normal file
10
kernel/include/serial.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#define PORT_COM1 0x3F8
|
||||
#define PORT_COM2 0x2F8
|
||||
#define PORT_COM3 0x3E8
|
||||
#define PORT_COM4 0x2E8
|
||||
|
||||
void serial_init(uint16_t port);
|
||||
void serial_write(uint16_t port, uint8_t c);
|
||||
13
kernel/include/string.h
Normal file
13
kernel/include/string.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
void *memcpy(void *dest, const void *src, size_t n);
|
||||
|
||||
void *memset(void *s, int c, size_t n);
|
||||
|
||||
void *memmove(void *dest, const void *src, size_t n);
|
||||
|
||||
int memcmp(const void *s1, const void *s2, size_t n);
|
||||
|
||||
size_t strlen(const char *s);
|
||||
8
kernel/include/vga.h
Normal file
8
kernel/include/vga.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#define VGA_WIDTH 80
|
||||
#define VGA_LINES 25
|
||||
#define VGA_SIZE (VGA_WIDTH*VGA_LINES)
|
||||
|
||||
void vga_init();
|
||||
void vga_printch(char c);
|
||||
Reference in New Issue
Block a user