summaryrefslogtreecommitdiff
path: root/kernel/src/boot/tag.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/src/boot/tag.c')
-rw-r--r--kernel/src/boot/tag.c75
1 files changed, 0 insertions, 75 deletions
diff --git a/kernel/src/boot/tag.c b/kernel/src/boot/tag.c
deleted file mode 100644
index a344d72..0000000
--- a/kernel/src/boot/tag.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <panic.h>
-#include <string.h>
-
-#include "print.h"
-#include "tag.h"
-#include "acpi/acpi.h"
-#include "memory/memory.h"
-
-static struct BootInfo info;
-
-static void read_cmdline(struct BootTag *tag, char *data, uint8_t len) {
- if (len >= CMDLINE_MAX)
- panic("multiboot2 cmd line to long\nmax is %d but was provided %d\n",
- CMDLINE_MAX, len);
- memcpy(tag->data.cmdline, data, len);
- info.tags[ID_CMDLINE] = *tag;
-}
-
-static void read_memorymap(struct BootTag *tag, uint32_t *data) {
- tag->data.memory_map = (struct MemoryMap *) data;
- info.tags[iD_MEMORYMAP] = *tag;
-}
-
-static void read_rsdp(struct BootTag *tag, char *data) {
- tag->data.rsdp = (struct RootSystemDescriptionPointer *) data;
- info.tags[ID_RSDP] = *tag;
-}
-
-static uint32_t *read_tag(uint32_t *data) {
- struct BootTag tag;
- tag.type = ((uint16_t*)data)[0];
- tag.size = data[1];
- tag.valid = 1;
-
- uint8_t data_len = tag.size - 2 * sizeof(uint32_t);
-
- switch (tag.type) {
- case ID_CMDLINE:
- read_cmdline(&tag, (char *)(data + 2), data_len);
- break;
- case iD_MEMORYMAP:
- read_memorymap(&tag, data + 2);
- break;
- case ID_RSDP:
- read_rsdp(&tag, (char *) (data + 2));
- break;
- default:
- break;
- }
-
- if(tag.size % 8 != 0) {
- tag.size += 8 - (tag.size % 8);
- }
-
- return data + tag.size / sizeof(uint32_t);
-}
-
-void load_boot_info(void* boot_info) {
-
- memset(&info, 0, sizeof(boot_info));
-
- uint32_t* data = (uint32_t*) boot_info;
- info.total_size = *data++;
- info.reserved = *data++;
-
- while((uint8_t*) data < (uint8_t*) boot_info + info.total_size) {
- data = read_tag(data);
- }
-
-}
-
-bool get_boot_tag(enum BootTagID id, struct BootTag **tag) {
- *tag = &info.tags[id];
- return (*tag)->valid;
-}