Page 1 of 1

SMP environment and, then....????????????

Posted: Wed Sep 18, 2024 9:36 am
by jay94ks
I implemented SMP. and APs are running well.

And, I refined memory map and,....
I initialized early paging enabled with identity paging 4MB on bootstrap code that called by grub multiboot, and I loaded the kernel to high 0xf0400000.

and I switched the page directory to absolute address: 0x6000.
then, I implemented just ACPI, APIC, and SMP.
so, I don't know what I want to do.

now, I'm going to implement physical page mapping function.
but I don't know how to make it clean code.

I splitted my kernel to few modules.

1. `x86` as `arch` module.
this is separated as three parts: `boot`, `k86` and `klib`.
2. `main` module: currently empty `kmain` only defined.
it just put `a` to screen.

boot sequence is:
1) multiboot -> `_start`.
2) `_start` calls `kboot` and, this just copy memory map to `unpaged` physical memory.
3) and `kboot` enables `bootstrap paging`.
4) `_start` calls `__karch_init` (located at 0xf0400000, and this switch kernel stack to highly mapped memory).
5) `karch_init` initialize basical IDT/GDT/TSS and then initialize SMP and startup APs.
6) finally, wait for APs to be ready and then, jump to `kmain` and provides `architecture specific interfaces` to `kmain`.
7) (plan) `kmain` calls `smp->exec(...)` to run really kernel space codes when `proc` initialized.

and this my-own modular design make my brain sick....

I want to expose just `karch_phys_map` function with memory map, and kernel's virtual address space mappings to `kernel` body from `arch` module. and, `karch_switch_task(...)` too. (these are not implemented yet, just plan)

how can I approach this in reasonable way?

all codes are here: https://github.com/jay94ks/zeronix
and `arch` module's init is: https://github.com/jay94ks/zeronix/blob ... src/init.c