diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm/io.h | 14 | ||||
| -rw-r--r-- | include/kernel/con.h | 14 | ||||
| -rw-r--r-- | include/kernel/vsprintf.h | 14 | ||||
| -rw-r--r-- | include/stdarg.h | 27 | ||||
| -rw-r--r-- | include/stdbool.h | 17 | ||||
| -rw-r--r-- | include/stdint.h | 19 |
6 files changed, 105 insertions, 0 deletions
diff --git a/include/asm/io.h b/include/asm/io.h new file mode 100644 index 0000000..6ca5bbc --- /dev/null +++ b/include/asm/io.h @@ -0,0 +1,14 @@ +/* + * asm/io.h + * + * Provides acces to x86 I/O functions + */ + +#define inb(port) ({ \ + unsigned char _val; \ + asm volatile ("inb %%dx, %%al" : "=a" (_val) : "d" (port)); \ + _val; \ + }) + +#define outb(port, val) \ + asm volatile ("outb %%al, %%dx" : : "d" (port), "a" (val)); diff --git a/include/kernel/con.h b/include/kernel/con.h new file mode 100644 index 0000000..4e564ed --- /dev/null +++ b/include/kernel/con.h @@ -0,0 +1,14 @@ +/* + * con.h + * + * Basic VGA text console + */ + +#ifndef _CON_H +#define _CON_H + +void con_init(void); + +void con_print(char*); + +#endif diff --git a/include/kernel/vsprintf.h b/include/kernel/vsprintf.h new file mode 100644 index 0000000..08297d6 --- /dev/null +++ b/include/kernel/vsprintf.h @@ -0,0 +1,14 @@ +/* + * vsprintf.h + * + * A very basic implmentation of thr vsprintf function + */ + +#ifndef _VSPRINTF_H +#define _VSPRINTF_H + +#include <stdarg.h> + +int vsprintf(char*, char*, va_list); + +#endif diff --git a/include/stdarg.h b/include/stdarg.h new file mode 100644 index 0000000..8eb1341 --- /dev/null +++ b/include/stdarg.h @@ -0,0 +1,27 @@ +/* + * stdarg.h + * + * Provides va_list and associated functions + */ + +#ifndef _STDARG_H +#define _STDARG_H + +typedef char* va_list; + +#define __va_rounded_size(TYPE) \ + (((sizeof(TYPE) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) + +#define va_start(AP, LAST) \ + (AP = ((char*) &LAST + __va_rounded_size(LAST))) + +#define va_arg(AP, TYPE) \ + (AP += __va_rounded_size(TYPE), \ + *((TYPE*) (AP - __va_rounded_size(TYPE)))) + +#define va_end(AP) + +#define va_copy(DEST, SRC) \ + (DEST = SRC) + +#endif diff --git a/include/stdbool.h b/include/stdbool.h new file mode 100644 index 0000000..f96b223 --- /dev/null +++ b/include/stdbool.h @@ -0,0 +1,17 @@ +/* + * stdbool.h + * + * Defines bool, true and false + */ + +#ifndef _STDBOOL_H +#define _STDBOOL_H + +typedef char bool; + +#undef false +#define false 0 +#undef true +#define true 1 + +#endif diff --git a/include/stdint.h b/include/stdint.h new file mode 100644 index 0000000..3dc068e --- /dev/null +++ b/include/stdint.h @@ -0,0 +1,19 @@ +/* + * stdint.h + * + * Common integer types + */ + +#ifndef _STDINT_H +#define _STDINT_H + +typedef char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +typedef long int64_t; +typedef unsigned long uint64_t; + +#endif |
