diff options
Diffstat (limited to 'kernel/include')
-rw-r--r-- | kernel/include/boot/gdt.h | 11 | ||||
-rw-r--r-- | kernel/include/drivers/serial.h | 8 | ||||
-rw-r--r-- | kernel/include/drivers/vga_text_buffer.h | 10 | ||||
-rw-r--r-- | kernel/include/kernel/halt.h | 8 | ||||
-rw-r--r-- | kernel/include/kernel/io.h | 8 | ||||
-rw-r--r-- | kernel/include/kernel/spinlock.h | 8 | ||||
-rw-r--r-- | kernel/include/libk/kmalloc.h | 8 | ||||
-rw-r--r-- | kernel/include/libk/stdio.h | 8 | ||||
-rw-r--r-- | kernel/include/libk/string.h | 8 | ||||
-rw-r--r-- | kernel/include/mm/memory_map.h | 11 | ||||
-rw-r--r-- | kernel/include/mm/multiboot.h | 22 | ||||
-rw-r--r-- | kernel/include/mm/physical_mm.h | 11 | ||||
-rw-r--r-- | kernel/include/mm/virtual_mm.h | 8 |
13 files changed, 118 insertions, 11 deletions
diff --git a/kernel/include/boot/gdt.h b/kernel/include/boot/gdt.h index e79ca48..607b4e8 100644 --- a/kernel/include/boot/gdt.h +++ b/kernel/include/boot/gdt.h @@ -19,9 +19,8 @@ #ifndef __boot_gdt_h #define __boot_gdt_h -#include <stdint.h> - #include <common.h> +#include <stdint.h> /* Access Flags: * 7 PRESENT @@ -88,6 +87,10 @@ ((base >> 24) & 0xff) /* base_high */ \ } +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { uint16_t limit_low; uint16_t base_low; @@ -105,4 +108,8 @@ typedef struct { extern void _GDT_flush(GDT_descriptor_t *GDT_descriptor); void GDT_load(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/drivers/serial.h b/kernel/include/drivers/serial.h index 48ed75c..fc6c564 100644 --- a/kernel/include/drivers/serial.h +++ b/kernel/include/drivers/serial.h @@ -23,8 +23,16 @@ #define PORT 0x3f8 // COM1 +#ifdef __cplusplus +extern "C" { +#endif + bool serial_initialize(void); void serial_write_char(const char chr); void serial_write_string(const char *string); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/drivers/vga_text_buffer.h b/kernel/include/drivers/vga_text_buffer.h index 4b0da93..1a506f6 100644 --- a/kernel/include/drivers/vga_text_buffer.h +++ b/kernel/include/drivers/vga_text_buffer.h @@ -27,6 +27,10 @@ #include <stdbool.h> #include <stdint.h> +#ifdef __cplusplus +extern "C" { +#endif + #define VGA_WIDTH 80 #define VGA_HEIGHT 25 @@ -47,7 +51,7 @@ typedef enum { VGA_COLOR_LIGHT_RED = 12, VGA_COLOR_LIGHT_MAGENTA = 13, VGA_COLOR_LIGHT_BROWN = 14, - VGA_COLOR_WHITE = 15, + VGA_COLOR_WHITE = 15 } vga_color; /* @@ -70,4 +74,8 @@ void vga_text_buffer_write_char(const char); void vga_text_buffer_write_string(const char *string); void vga_text_buffer_printf(const char *string, ...); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/kernel/halt.h b/kernel/include/kernel/halt.h index db511cf..60ac008 100644 --- a/kernel/include/kernel/halt.h +++ b/kernel/include/kernel/halt.h @@ -19,7 +19,15 @@ #ifndef __kernel_halt_h #define __kernel_halt_h +#ifdef __cplusplus +extern "C" { +#endif + void halt(void); void exit(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/kernel/io.h b/kernel/include/kernel/io.h index f58bd2d..5cef4f5 100644 --- a/kernel/include/kernel/io.h +++ b/kernel/include/kernel/io.h @@ -21,7 +21,15 @@ #include <stdint.h> +#ifdef __cplusplus +extern "C" { +#endif + uint8_t inb(uint16_t port); void outb(uint16_t port, uint8_t val); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/kernel/spinlock.h b/kernel/include/kernel/spinlock.h index 9398e65..e7b8228 100644 --- a/kernel/include/kernel/spinlock.h +++ b/kernel/include/kernel/spinlock.h @@ -21,7 +21,15 @@ #include <stdatomic.h> +#ifdef __cplusplus +extern "C" { +#endif + void spinlock_acquire(atomic_flag *lock); void spinlock_release(atomic_flag *lock); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/libk/kmalloc.h b/kernel/include/libk/kmalloc.h index 85e247a..e124c70 100644 --- a/kernel/include/libk/kmalloc.h +++ b/kernel/include/libk/kmalloc.h @@ -21,6 +21,10 @@ #include <stdint.h> +#ifdef __cplusplus +extern "C" { +#endif + #define MIN_PAGES 4 typedef struct memory_chunk_t { @@ -32,4 +36,8 @@ typedef struct memory_chunk_t { void *kmalloc(uint32_t size); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/libk/stdio.h b/kernel/include/libk/stdio.h index f944fe4..44050dd 100644 --- a/kernel/include/libk/stdio.h +++ b/kernel/include/libk/stdio.h @@ -22,6 +22,10 @@ #include <stdarg.h> #include <stddef.h> +#ifdef __cplusplus +extern "C" { +#endif + typedef int (*_printf_engine_output_func)(const char *str, size_t len, void *state); @@ -39,4 +43,8 @@ int vsnprintf(char *str, size_t len, const char *fmt, va_list ap); void printk(const char *from, const char *msg, ...); void printk_raw(const char *msg, ...); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/libk/string.h b/kernel/include/libk/string.h index edb4a06..490878f 100644 --- a/kernel/include/libk/string.h +++ b/kernel/include/libk/string.h @@ -21,6 +21,14 @@ #include <stddef.h> +#ifdef __cplusplus +extern "C" { +#endif + size_t strlen(const char *str); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/mm/memory_map.h b/kernel/include/mm/memory_map.h index 428c99f..d72abc0 100644 --- a/kernel/include/mm/memory_map.h +++ b/kernel/include/mm/memory_map.h @@ -19,13 +19,16 @@ #ifndef __mm_memory_map_h #define __mm_memory_map_h -#include <stdint.h> - #include <mm/multiboot.h> +#include <stdint.h> /* TODO: Practically, do we need more than 32? */ #define MAX_FREE_REGIONS 32 +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { uint8_t n_regions; multiboot_memory_map_t *region_list[MAX_FREE_REGIONS]; @@ -34,4 +37,8 @@ typedef struct { void memory_map_load(multiboot_info_t *mmap); free_memory_regions_t *memory_map_get_free_regions(void); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/mm/multiboot.h b/kernel/include/mm/multiboot.h index 2a25bcd..d95ab55 100644 --- a/kernel/include/mm/multiboot.h +++ b/kernel/include/mm/multiboot.h @@ -23,6 +23,8 @@ #ifndef _mm_multiboot_h #define _mm_multiboot_h +#include <stdint.h> + /* How many bytes from the start of the file we search for the header. */ #define MULTIBOOT_SEARCH 8192 #define MULTIBOOT_HEADER_ALIGN 4 @@ -92,10 +94,14 @@ #ifndef ASM_FILE -typedef unsigned char multiboot_uint8_t; -typedef unsigned short multiboot_uint16_t; -typedef unsigned int multiboot_uint32_t; -typedef unsigned long long multiboot_uint64_t; +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint8_t multiboot_uint8_t; +typedef uint16_t multiboot_uint16_t; +typedef uint32_t multiboot_uint32_t; +typedef uint64_t multiboot_uint64_t; struct multiboot_header { /* Must be MULTIBOOT_MAGIC - see above. */ @@ -197,6 +203,9 @@ struct multiboot_info { #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1 #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2 multiboot_uint8_t framebuffer_type; +/* warning: ISO C++ prohibits anonymous structs [-Wpedantic] */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" union { struct { multiboot_uint32_t framebuffer_palette_addr; @@ -211,6 +220,7 @@ struct multiboot_info { multiboot_uint8_t framebuffer_blue_mask_size; }; }; +#pragma GCC diagnostic pop }; typedef struct multiboot_info multiboot_info_t; @@ -261,6 +271,10 @@ struct multiboot_apm_info { multiboot_uint16_t dseg_len; }; +#ifdef __cplusplus +} +#endif + #endif /* ! ASM_FILE */ #endif /* ! MULTIBOOT_HEADER */ diff --git a/kernel/include/mm/physical_mm.h b/kernel/include/mm/physical_mm.h index 7ad97d9..0058cc5 100644 --- a/kernel/include/mm/physical_mm.h +++ b/kernel/include/mm/physical_mm.h @@ -19,11 +19,10 @@ #ifndef __mm_physical_mm_h #define __mm_physical_mm_h +#include <common.h> #include <stdbool.h> #include <stdint.h> -#include <common.h> - /* TODO: Update this to 2MiB when PAE is enabled */ #define BLOCK_SIZE (4 * KiB) @@ -32,6 +31,10 @@ /* This is the maximum number of blocks for a 4GiB system. */ #define MAX_BLOCKS 1048576 +#ifdef __cplusplus +extern "C" { +#endif + void physical_mm_init(void); uint32_t physical_mm_find_free_block(void); @@ -47,4 +50,8 @@ void physical_mm_set_usable(const uint32_t bit, uint32_t *memory_map); bool physical_mm_test_bit(const uint32_t bit, uint32_t *memory_map); +#ifdef __cplusplus +} +#endif + #endif diff --git a/kernel/include/mm/virtual_mm.h b/kernel/include/mm/virtual_mm.h index f900c52..6246ce3 100644 --- a/kernel/include/mm/virtual_mm.h +++ b/kernel/include/mm/virtual_mm.h @@ -69,6 +69,10 @@ #define VIRTUAL_ADDRESS(pd_index, pt_index) \ (((pd_index) << 22) | ((pt_index) << 12)) +#ifdef __cplusplus +extern "C" { +#endif + /* * Loads a given page directory into CR0 */ @@ -109,4 +113,8 @@ void *virtual_mm_alloc_pages(uint32_t n_pages); */ void virtual_mm_free_pages(void *starting_address, uint32_t n_pages); +#ifdef __cplusplus +} +#endif + #endif |