From 272af22984d1afcbb10b9d3451e1a8cee901baab Mon Sep 17 00:00:00 2001 From: AlmuHS Date: Sat, 15 Jun 2019 17:30:42 +0200 Subject: docs: added paging work --- README.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4bba9e0a..9628b120 100644 --- a/README.md +++ b/README.md @@ -284,17 +284,7 @@ We have split this task in some steps: The final code is stored in [`i386/i386/cpuboot.S`](https://github.com/AlmuHS/GNUMach_SMP/blob/smp/i386/i386/cpuboot.S) -### Register cpus in the system (WIP) - -Although cpus are enabled, this cpus aren't available to the system. To mark the cpus as available, we need to register them in the system. - -The function which register a cpu in the system is `cpu_up()`. This function initialize the `processor_t` struct for the cpu, and add the cpu to default processor set for scheduling. - -To register the cpus, we've added a call to `cpu_up()` in `intel_startCPU()`, after `startup_cpu()`. - -After this, `nproc` command shows all cpus of the machine, but this cpus aren't used for any process. - -### Add interrupt stack to cpus (Pending review) +### Add interrupt stack to cpus To allow cpus execute interrupt handlers, It's needed a interrupt stack. Each cpu has its own interrupt stack. @@ -303,6 +293,17 @@ After this, `nproc` command shows all cpus of the machine, but this cpus aren't This step don't shows any new effect yet. +### Enable paging in the cpus (WIP) + +Before add the cpus to the kernel, we need to configure paging in them, to allow fully access to the memory. + +To enable paging, we need to initialize CR0, CR2 and CR4 registers. as similar for to [this](https://github.com/AlmuHS/GNUMach_SMP/blob/smp/i386/i386at/model_dep.c#L477-L500). + +This code, translated to assembly, has been added to [`cpuboot.S`](https://github.com/AlmuHS/GNUMach_SMP/blob/wip/i386/i386/cpuboot.S) assembly routine. + +Once paging will be enabled, each cpu will can to read its own Local APIC, using the `*lapic` pointer. It will also allow to execute `cpu_number()` function, which is necessary to execute the `slave_main()` function to add the cpu to the kernel. + + ## Gratitude - [Bosco GarcĂ­a](https://github.com/jbgg): Development guidance, original [MinSMP](https://github.com/jbgg/MinSMP) developer, explainations and documentation about MultiProcessor architecture, helpful with *gnumach* development. -- cgit v1.2.3