1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-12-11 11:35:39 -05:00

Refactoring: move code to separate tag functions

This commit is contained in:
Braiden Vasco 2017-11-02 08:49:55 +00:00
parent 9d0d45b52a
commit 326f729ef9

View file

@ -71,6 +71,11 @@ static void printf(const char *format, ...);
static void print_multiboot_tag(const struct multiboot_tag *tag); static void print_multiboot_tag(const struct multiboot_tag *tag);
static void print_multiboot_tag_cmdline (const struct multiboot_tag_string *tag);
static void print_multiboot_tag_module (const struct multiboot_tag_module *tag);
static void print_multiboot_tag_basic_meminfo(const struct multiboot_tag_basic_meminfo *tag);
static void print_multiboot_tag_mmap (const struct multiboot_tag_mmap *tag);
void print_multiboot_info(struct KernelMQ_Multiboot_Info info) void print_multiboot_info(struct KernelMQ_Multiboot_Info info)
{ {
if (info.magic == MULTIBOOT_1_MAGIC) { if (info.magic == MULTIBOOT_1_MAGIC) {
@ -102,30 +107,39 @@ void print_multiboot_tag(const struct multiboot_tag *const tag)
switch (tag->type) switch (tag->type)
{ {
case MULTIBOOT_TAG_TYPE_CMDLINE: case MULTIBOOT_TAG_TYPE_CMDLINE:
printf( print_multiboot_tag_cmdline((struct multiboot_tag_string*)tag);
"Kernel command line: %s\n",
((struct multiboot_tag_string *) tag)->string
);
break; break;
case MULTIBOOT_TAG_TYPE_MODULE: case MULTIBOOT_TAG_TYPE_MODULE:
printf( print_multiboot_tag_module((struct multiboot_tag_module*)tag);
"Module at 0x%x-0x%x, command line: %s\n",
((struct multiboot_tag_module *) tag)->mod_start,
((struct multiboot_tag_module *) tag)->mod_end,
((struct multiboot_tag_module *) tag)->cmdline
);
break; break;
case MULTIBOOT_TAG_TYPE_BASIC_MEMINFO: case MULTIBOOT_TAG_TYPE_BASIC_MEMINFO:
printf( print_multiboot_tag_basic_meminfo((struct multiboot_tag_basic_meminfo*)tag);
"mem_lower = %uKB, mem_upper = %uKB\n",
((struct multiboot_tag_basic_meminfo *) tag)->mem_lower,
((struct multiboot_tag_basic_meminfo *) tag)->mem_upper
);
break; break;
case MULTIBOOT_TAG_TYPE_MMAP: case MULTIBOOT_TAG_TYPE_MMAP:
print_multiboot_tag_mmap((struct multiboot_tag_mmap*)tag);
break;
}
}
void print_multiboot_tag_cmdline(const struct multiboot_tag_string *const tag)
{
printf("Kernel command line: %s\n", tag->string);
}
void print_multiboot_tag_module(const struct multiboot_tag_module *const tag)
{
printf("Module at 0x%x-0x%x, command line: %s\n", tag->mod_start, tag->mod_end, tag->cmdline);
}
void print_multiboot_tag_basic_meminfo(const struct multiboot_tag_basic_meminfo *const tag)
{
printf("mem_lower = %uKB, mem_upper = %uKB\n", tag->mem_lower, tag->mem_upper);
}
void print_multiboot_tag_mmap(const struct multiboot_tag_mmap *const tag)
{ {
printf("Memory map:\n"); printf("Memory map:\n");
@ -144,9 +158,6 @@ void print_multiboot_tag(const struct multiboot_tag *const tag)
); );
} }
} }
break;
}
}
void itoa(char *buf, int base, int d) void itoa(char *buf, int base, int d)
{ {