diff options
author | Marvin Borner | 2021-07-04 21:31:28 +0200 |
---|---|---|
committer | Marvin Borner | 2021-07-04 21:34:15 +0200 |
commit | 9b8698769535846d029c44247956eed9a21f1185 (patch) | |
tree | 294a17af4102805ab9863274339e8e030897804e /src/loader/inc |
Initial commit
Diffstat (limited to 'src/loader/inc')
-rw-r--r-- | src/loader/inc/cpu.h | 13 | ||||
-rw-r--r-- | src/loader/inc/def.h | 28 | ||||
-rw-r--r-- | src/loader/inc/lib.h | 14 | ||||
-rw-r--r-- | src/loader/inc/log.h | 11 |
4 files changed, 66 insertions, 0 deletions
diff --git a/src/loader/inc/cpu.h b/src/loader/inc/cpu.h new file mode 100644 index 0000000..88db34b --- /dev/null +++ b/src/loader/inc/cpu.h @@ -0,0 +1,13 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#ifndef CPU_H +#define CPU_H + +#include <def.h> + +u8 inb(u16 port); +u16 inw(u16 port); + +void outb(u16 port, u8 data); + +#endif diff --git a/src/loader/inc/def.h b/src/loader/inc/def.h new file mode 100644 index 0000000..8c2f9aa --- /dev/null +++ b/src/loader/inc/def.h @@ -0,0 +1,28 @@ +// MIT License, Copyright (c) 2021 Marvin Borner +// Useful macros/types + +#ifndef DEF_H +#define DEF_H + +typedef signed char s8; +typedef unsigned char u8; + +typedef signed short s16; +typedef unsigned short u16; + +typedef signed int s32; +typedef unsigned int u32; + +typedef __builtin_va_list va_list; +#define va_start __builtin_va_start +#define va_end __builtin_va_end +#define va_arg __builtin_va_arg + +#define NULL ((void *)0) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#define ABS(a) (((a) < 0) ? -(a) : (a)) + +#define PACKED __attribute__((packed)) + +#endif diff --git a/src/loader/inc/lib.h b/src/loader/inc/lib.h new file mode 100644 index 0000000..997db67 --- /dev/null +++ b/src/loader/inc/lib.h @@ -0,0 +1,14 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#ifndef LIB_H +#define LIB_H + +#include <def.h> + +u32 strlen(const char *str); +u32 strnlen(const char *s, u32 max); +u32 strlcpy(char *dst, const char *src, u32 size); + +int itoa(s32 value, char *buffer, u32 base); + +#endif diff --git a/src/loader/inc/log.h b/src/loader/inc/log.h new file mode 100644 index 0000000..2d65a76 --- /dev/null +++ b/src/loader/inc/log.h @@ -0,0 +1,11 @@ +// MIT License, Copyright (c) 2021 Marvin Borner + +#ifndef LOG_H +#define LOG_H + +void serial_install(void); +void serial_print(const char *data); + +void log(const char *format, ...); + +#endif |