Compare commits
No commits in common. "9353c3f66e2893e8f41440aa4f8373b0a89994fa" and "916b8d053bbf6f8c6abec0bf565229056deca87a" have entirely different histories.
9353c3f66e
...
916b8d053b
7
Makefile
7
Makefile
|
|
@ -4,7 +4,7 @@ ARCH ?= x86_64
|
||||||
|
|
||||||
KERNEL_HDD = kornos.img
|
KERNEL_HDD = kornos.img
|
||||||
|
|
||||||
.PHONY: clean all $(COMPONENTS) run bochs
|
.PHONY: clean all $(COMPONENTS)
|
||||||
.DEFAULT_GOAL = $(KERNEL_HDD)
|
.DEFAULT_GOAL = $(KERNEL_HDD)
|
||||||
|
|
||||||
$(COMPONENTS):
|
$(COMPONENTS):
|
||||||
|
|
@ -19,11 +19,6 @@ run: $(KERNEL_HDD)
|
||||||
-enable-kvm \
|
-enable-kvm \
|
||||||
-debugcon stdio
|
-debugcon stdio
|
||||||
|
|
||||||
bochs: $(KERNEL_HDD) ext/bochsrc
|
|
||||||
rm -f $(KERNEL_HDD).lock
|
|
||||||
bochs -qf ext/bochsrc
|
|
||||||
rm bochsout.txt
|
|
||||||
|
|
||||||
ext/limine/limine-install:
|
ext/limine/limine-install:
|
||||||
$(MAKE) -C ext/limine/ limine-install
|
$(MAKE) -C ext/limine/ limine-install
|
||||||
|
|
||||||
|
|
|
||||||
17
ext/bochsrc
17
ext/bochsrc
|
|
@ -1,17 +0,0 @@
|
||||||
cpu: count=2, reset_on_triple_fault=0
|
|
||||||
|
|
||||||
display_library: x, options="gui_debug"
|
|
||||||
|
|
||||||
megs: 512
|
|
||||||
|
|
||||||
clock: sync=realtime, time0=local
|
|
||||||
|
|
||||||
ata0-master: type=disk, path="kornos.img", mode=flat
|
|
||||||
|
|
||||||
boot: c
|
|
||||||
|
|
||||||
log: ./bochsout.txt
|
|
||||||
|
|
||||||
mouse: enabled=0
|
|
||||||
|
|
||||||
magic_break: enabled=1
|
|
||||||
|
|
@ -1,2 +1 @@
|
||||||
ARCHFILES := $(shell find src/arch/x86 -type f -name '*.c' -print)
|
ARCHFILES := $(shell find src/arch/x86 -type f -name '*.c' -print)
|
||||||
ARCH_CFLAGS := -masm=intel
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
-include make/x86/make.config
|
-include make/x86/make.config
|
||||||
|
|
||||||
ARCH_CFLAGS := $(ARCH_CFLAGS) -mcmodel=kernel
|
ARCH_CFLAGS := -mcmodel=kernel
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "../../main.h"
|
#include "../../main.h"
|
||||||
#include <arch/x86/stivale2-parse.h>
|
|
||||||
|
|
||||||
void stivale2_main(struct stivale2_struct *info);
|
void stivale2_main(struct stivale2_struct *info);
|
||||||
|
|
||||||
|
|
@ -24,8 +23,6 @@ struct stivale2_header header2 = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void stivale2_main(struct stivale2_struct *info) {
|
void stivale2_main(struct stivale2_struct *info) {
|
||||||
parse_stivale2(info);
|
|
||||||
|
|
||||||
char *argv[3] = {"stivale2", info->bootloader_brand, info->bootloader_version};
|
char *argv[3] = {"stivale2", info->bootloader_brand, info->bootloader_version};
|
||||||
kmain(3, argv);
|
kmain(3, argv);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
void breakpoint() {
|
|
||||||
asm volatile ("xchgw %bx, %bx");
|
|
||||||
}
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
||||||
#include <limine/stivale/stivale2.h>
|
|
||||||
#include <print/print.h>
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
void parse_stivale2(struct stivale2_struct *info) {
|
|
||||||
struct stivale2_tag *tag = (struct stivale2_tag*)(info->tags);
|
|
||||||
while(tag != 0) {
|
|
||||||
switch(tag->identifier) {
|
|
||||||
case STIVALE2_STRUCT_TAG_CMDLINE_ID: {
|
|
||||||
struct stivale2_struct_tag_cmdline *cmd = (struct stivale2_struct_tag_cmdline*)tag;
|
|
||||||
printf("cmdline: %s\n", (const char*)cmd->cmdline);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STIVALE2_STRUCT_TAG_MEMMAP_ID: {
|
|
||||||
struct stivale2_struct_tag_memmap *m = (struct stivale2_struct_tag_memmap *)tag;
|
|
||||||
printf("Memmap (%d entries):\n", m->entries);
|
|
||||||
for (size_t i = 0; i < m->entries; i++) {
|
|
||||||
struct stivale2_mmap_entry me = m->memmap[i];
|
|
||||||
printf("\t[%x+%x] %x\n", me.base, me.length, me.type);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STIVALE2_STRUCT_TAG_FRAMEBUFFER_ID: {
|
|
||||||
struct stivale2_struct_tag_framebuffer *f = (struct stivale2_struct_tag_framebuffer *)tag;
|
|
||||||
printf("Framebuffer tag: %dx%d at %x\n", f->framebuffer_width, f->framebuffer_height, f->framebuffer_addr);
|
|
||||||
printf("\tPitch: %d\n", f->framebuffer_pitch);
|
|
||||||
printf("\tBPP: %d\n", f->framebuffer_bpp);
|
|
||||||
printf("\tMemory model: %d\n", f->memory_model);
|
|
||||||
printf("\tRed mask size: %d\n", f->red_mask_size);
|
|
||||||
printf("\tRed mask size: %d\n", f->red_mask_shift);
|
|
||||||
printf("\tGreen mask size: %d\n", f->green_mask_size);
|
|
||||||
printf("\tGreen mask size: %d\n", f->green_mask_shift);
|
|
||||||
printf("\tBlue mask size: %d\n", f->blue_mask_size);
|
|
||||||
printf("\tBlue mask size: %d\n", f->blue_mask_shift);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STIVALE2_STRUCT_TAG_MODULES_ID: {
|
|
||||||
struct stivale2_struct_tag_modules *m = (struct stivale2_struct_tag_modules *)tag;
|
|
||||||
printf("Modules tag (count: %d):", m->module_count);
|
|
||||||
for (size_t i = 0; i < m->module_count; i++) {
|
|
||||||
struct stivale2_module *me = &m->modules[i];
|
|
||||||
printf("\t[%x+%x] %s", me->begin, me->end, me->string);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STIVALE2_STRUCT_TAG_RSDP_ID: {
|
|
||||||
struct stivale2_struct_tag_rsdp *r = (struct stivale2_struct_tag_rsdp *)tag;
|
|
||||||
printf("RSDP: %x\n", r->rsdp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STIVALE2_STRUCT_TAG_EPOCH_ID: {
|
|
||||||
struct stivale2_struct_tag_epoch *e = (struct stivale2_struct_tag_epoch *)tag;
|
|
||||||
printf("Epoch: %d\n", e->epoch);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STIVALE2_STRUCT_TAG_FIRMWARE_ID: {
|
|
||||||
struct stivale2_struct_tag_firmware *f = (struct stivale2_struct_tag_firmware *)tag;
|
|
||||||
printf("Firmware flags: %x\n", f->flags);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STIVALE2_STRUCT_TAG_SMP_ID: {
|
|
||||||
struct stivale2_struct_tag_smp *s = (struct stivale2_struct_tag_smp *)tag;
|
|
||||||
printf("SMP tag (cores: %d, bootstrap: %d, flags: %x)\n", s->cpu_count, s->bsp_lapic_id, s->flags);
|
|
||||||
for (size_t i = 0; i < s->cpu_count; i++) {
|
|
||||||
struct stivale2_smp_info *in = &s->smp_info[i];
|
|
||||||
printf("\tprocID: %d, lapicID: %d, stack: %x, goto: %x, extra: %x\n",
|
|
||||||
in->processor_id, in->lapic_id, in->target_stack, in->goto_address, in->extra_argument);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
printf("ERR: Unidentifier tag %x\n", tag->identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
tag = (struct stivale2_tag *)tag->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// void parse_stivale2(struct stivale2_struct *info) {
|
|
||||||
// struct stivale2_tag *tag = (struct stivale2_tag*)(info->tags);
|
|
||||||
// while(tag != 0) {
|
|
||||||
// switch(tag->identifier) {
|
|
||||||
// case STIVALE2_STRUCT_TAG_CMDLINE_ID: {
|
|
||||||
// struct stivale2_struct_tag_cmdline *cmd = (struct stivale2_struct_tag_cmdline*)tag;
|
|
||||||
// printf("cmdline: %s\n", (const char*)cmd->cmdline);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case STIVALE2_STRUCT_TAG_MEMMAP_ID: {
|
|
||||||
// struct stivale2_struct_tag_memmap *m = (struct stivale2_struct_tag_memmap *)tag;
|
|
||||||
// printf("Memmap (%d entries):\n", m->entries);
|
|
||||||
// for (size_t i = 0; i < m->entries; i++) {
|
|
||||||
// struct stivale2_mmap_entry me = m->memmap[i];
|
|
||||||
// printf("\t[%x+%x] %x\n", me.base, me.length, me.type);
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case STIVALE2_STRUCT_TAG_FRAMEBUFFER_ID: {
|
|
||||||
// struct stivale2_struct_tag_framebuffer *f = (struct stivale2_struct_tag_framebuffer *)tag;
|
|
||||||
// printf("Framebuffer tag: %dx%d at %x\n", f->framebuffer_width, f->framebuffer_height, f->framebuffer_addr);
|
|
||||||
// printf("\tPitch: %d\n", f->framebuffer_pitch);
|
|
||||||
// printf("\tBPP: %d\n", f->framebuffer_bpp);
|
|
||||||
// printf("\tMemory model: %d\n", f->memory_model);
|
|
||||||
// printf("\tRed mask size: %d\n", f->red_mask_size);
|
|
||||||
// printf("\tRed mask size: %d\n", f->red_mask_shift);
|
|
||||||
// printf("\tGreen mask size: %d\n", f->green_mask_size);
|
|
||||||
// printf("\tGreen mask size: %d\n", f->green_mask_shift);
|
|
||||||
// printf("\tBlue mask size: %d\n", f->blue_mask_size);
|
|
||||||
// printf("\tBlue mask size: %d\n", f->blue_mask_shift);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case STIVALE2_STRUCT_TAG_MODULES_ID: {
|
|
||||||
// struct stivale2_struct_tag_modules *m = (struct stivale2_struct_tag_modules *)tag;
|
|
||||||
// printf("Modules tag (count: %d):", m->module_count);
|
|
||||||
// for (size_t i = 0; i < m->module_count; i++) {
|
|
||||||
// struct stivale2_module me = m->modules[i];
|
|
||||||
// printf("\t[%x+%x] %s", me.begin, me.end, me.string);
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case STIVALE2_STRUCT_TAG_RSDP_ID: {
|
|
||||||
// struct stivale2_struct_tag_rsdp *r = (struct stivale2_struct_tag_rsdp *)tag;
|
|
||||||
// puts("RSDP tag:");
|
|
||||||
// printf("\tRSDP: %x\n", r->rsdp);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case STIVALE2_STRUCT_TAG_EPOCH_ID: {
|
|
||||||
// struct stivale2_struct_tag_epoch *e = (struct stivale2_struct_tag_epoch *)tag;
|
|
||||||
// printf("Epoch: %x", e->epoch);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case STIVALE2_STRUCT_TAG_FIRMWARE_ID: {
|
|
||||||
// struct stivale2_struct_tag_firmware *f = (struct stivale2_struct_tag_firmware *)tag;
|
|
||||||
// printf("Firmware flags: %x\n", f->flags);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case STIVALE2_STRUCT_TAG_SMP_ID: {
|
|
||||||
// struct stivale2_struct_tag_smp *s = (struct stivale2_struct_tag_smp *)tag;
|
|
||||||
// printf("SMP tag (cores: %d, bootstrap: %d, flags: %x)\n", s->cpu_count, s->bsp_lapic_id, s->flags);
|
|
||||||
// for (size_t i = 0; i < s->cpu_count; i++) {
|
|
||||||
// struct stivale2_smp_info *in = &s->smp_info[i];
|
|
||||||
// printf("\tProcessor ID: %d\n", in->processor_id);
|
|
||||||
// printf("\tLAPIC ID: %d\n", in->lapic_id);
|
|
||||||
// printf("\tTarget Stack: %x\n", in->target_stack);
|
|
||||||
// printf("\tGOTO Address: %x\n", in->goto_address);
|
|
||||||
// printf("\tExtra Argument: %x\n", in->extra_argument);
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// default:
|
|
||||||
// printf("ERR: Unidentifier tag %x\n", tag->identifier);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// tag = (struct stivale2_tag *)tag->next;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
void parse_stivale2(struct stivale2_struct *info);
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "../../main.h"
|
#include "../../main.h"
|
||||||
#include "arch/x86/stivale2-parse.h"
|
|
||||||
|
|
||||||
static uint8_t stack[4096] = {0};
|
static uint8_t stack[4096] = {0};
|
||||||
void stivale2_main(struct stivale2_struct *info);
|
void stivale2_main(struct stivale2_struct *info);
|
||||||
|
|
@ -25,8 +24,6 @@ struct stivale2_header header2 = {
|
||||||
};
|
};
|
||||||
|
|
||||||
void stivale2_main(struct stivale2_struct *info) {
|
void stivale2_main(struct stivale2_struct *info) {
|
||||||
parse_stivale2(info);
|
|
||||||
|
|
||||||
char *argv[3] = {"stivale2", info->bootloader_brand, info->bootloader_version};
|
char *argv[3] = {"stivale2", info->bootloader_brand, info->bootloader_version};
|
||||||
kmain(3, argv);
|
kmain(3, argv);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
void breakpoint();
|
|
||||||
|
|
@ -38,22 +38,20 @@ static void printhex(size_t num) {
|
||||||
|
|
||||||
static void printdec(size_t num) {
|
static void printdec(size_t num) {
|
||||||
int i;
|
int i;
|
||||||
char buf[32];
|
char buf[21] = {0};
|
||||||
|
|
||||||
if (!num) {
|
if (!num) {
|
||||||
puts("0");
|
putchar('0');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[32] = 0;
|
for (i = 19; num; i--) {
|
||||||
|
buf[i] = (num % 10) + 0x30;
|
||||||
for (i = 31; num; i--) {
|
num = num / 10;
|
||||||
buf[i] = (num % 10) + '0';
|
|
||||||
num /= 10;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
puts(&buf[i]);
|
puts(buf + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printf(const char *format, ...) {
|
void printf(const char *format, ...) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue