aboutsummaryrefslogtreecommitdiff
path: root/kernel/include/mm
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/include/mm')
-rw-r--r--kernel/include/mm/memory_map.h11
-rw-r--r--kernel/include/mm/multiboot.h22
-rw-r--r--kernel/include/mm/physical_mm.h11
-rw-r--r--kernel/include/mm/virtual_mm.h8
4 files changed, 44 insertions, 8 deletions
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