diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-08 12:20:59 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-08 12:20:59 +0200 |
| commit | 591335ea0cf843c198ef8f75c3adbbf6a733e14f (patch) | |
| tree | 0748536407359c53a2d5c46a3e0d6006f56fdb73 | |
| parent | 49df5ae7f4475695e04567771dffe50292e695de (diff) | |
[ IMP ] Don't use the functions when jumping to user space via scheduler, since they're not on the same page.
[ ADD ] Add ZXD diagram (ZKA eXtended Driver)
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
| -rw-r--r-- | dev/ZKA/HALKit/AMD64/HalProcessor.cxx | 18 | ||||
| -rw-r--r-- | dev/ZKA/Sources/ExeMain.cxx | 20 | ||||
| -rw-r--r-- | doc/ZXD.drawio | 22 |
3 files changed, 39 insertions, 21 deletions
diff --git a/dev/ZKA/HALKit/AMD64/HalProcessor.cxx b/dev/ZKA/HALKit/AMD64/HalProcessor.cxx index b31f58e2..56b4e190 100644 --- a/dev/ZKA/HALKit/AMD64/HalProcessor.cxx +++ b/dev/ZKA/HALKit/AMD64/HalProcessor.cxx @@ -42,14 +42,14 @@ namespace Kernel::HAL // And then PTE volatile UIntPtr* pt_entry = (volatile UIntPtr*)(pt_base + (pte_idx * kPTEAlign)); - kcout << (pt_entry[pte_idx] & 0x01 ? "Page Present." : "Page Not Present.") << endl; - kcout << (pt_entry[pte_idx] & 0x02 ? "Page RW." : "Page Not RW.") << endl; - kcout << (pt_entry[pte_idx] & 0x04 ? "Page User." : "Page Not User.") << endl; + kcout << (pt_entry[0] & 0x01 ? "Page Present." : "Page Not Present.") << endl; + kcout << (pt_entry[0] & 0x02 ? "Page RW." : "Page Not RW.") << endl; + kcout << (pt_entry[0] & 0x04 ? "Page User." : "Page Not User.") << endl; switch ((UIntPtr)phys_addr) { case kBadAddress: { - phys_addr = (VoidPtr)((pt_entry[pte_idx] & ~0xFFF) + ((UIntPtr)virt_addr & 0xFFF)); + phys_addr = (VoidPtr)((pt_entry[0] & ~0xFFF) + ((UIntPtr)virt_addr & 0xFFF)); break; } default: { @@ -57,7 +57,15 @@ namespace Kernel::HAL } } - pt_entry[pte_idx] = ((UIntPtr)phys_addr) | (flags & 0xFFF) | 0x01; + if (!(pt_entry[0] & 0x01)) + { + pt_entry[0] = ((UIntPtr)phys_addr) | (flags & 0xFFF) | 0x01; + hal_write_cr3(pml4_base); + + return 0; + } + + pt_entry[0] = ((UIntPtr)phys_addr) | (flags & 0xFFF); return 0; } diff --git a/dev/ZKA/Sources/ExeMain.cxx b/dev/ZKA/Sources/ExeMain.cxx index e1b6afc1..ff2bad02 100644 --- a/dev/ZKA/Sources/ExeMain.cxx +++ b/dev/ZKA/Sources/ExeMain.cxx @@ -110,17 +110,6 @@ namespace Kernel::Detail }; } // namespace Kernel::Detail -EXTERN_C ATTRIBUTE(naked) Kernel::Void HangCPU(Kernel::Void) -{ - asm volatile( - ".intel_syntax;" - "start:" - "syscall;" - "jmp start;" - ".att_syntax;" - ); -} - namespace Kernel { EXTERN UserProcessScheduler* cProcessScheduler; @@ -157,9 +146,8 @@ EXTERN_C Kernel::Void ke_dll_entrypoint(Kernel::Void) CG::CGDrawStringToWnd(cKernelWnd, "Running: ", 10, 10, RGB(0, 0, 0)); CG::CGDrawStringToWnd(cKernelWnd, kSysLdr, 10, 10 + (FONT_SIZE_X * Kernel::rt_string_len("Running: ")), RGB(0, 0, 0)); - Kernel::UserProcessHelper::StartScheduling(); - - Kernel::sched_execute_thread(HangCPU, kSysLdr); - - Kernel::UserProcessHelper::StartScheduling(); + while (Yes) + { + Kernel::UserProcessHelper::StartScheduling(); + } } diff --git a/doc/ZXD.drawio b/doc/ZXD.drawio new file mode 100644 index 00000000..540a70b6 --- /dev/null +++ b/doc/ZXD.drawio @@ -0,0 +1,22 @@ +<mxfile host="app.diagrams.net" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36" version="24.7.12"> + <diagram name="Page-1" id="PApGwmLcT2JRCILoETeI"> + <mxGraphModel dx="1368" dy="717" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0"> + <root> + <mxCell id="0" /> + <mxCell id="1" parent="0" /> + <mxCell id="5xbXWvOdvmnQnRAweQaM-1" value="<h1 style="margin-top: 0px;">ZXD</h1><p>ZKA eXtended Driver Format.</p><p>An Extended PE32+</p><p>With additional headers and such.</p>" style="text;html=1;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1"> + <mxGeometry x="40" y="40" width="210" height="130" as="geometry" /> + </mxCell> + <mxCell id="5xbXWvOdvmnQnRAweQaM-2" value="ZKA HEADER" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="40" y="180" width="310" height="60" as="geometry" /> + </mxCell> + <mxCell id="5xbXWvOdvmnQnRAweQaM-3" value="PE32+ ZONE" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="40" y="260" width="310" height="60" as="geometry" /> + </mxCell> + <mxCell id="5xbXWvOdvmnQnRAweQaM-4" value="ZXD STUB [1..N]" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1"> + <mxGeometry x="40" y="340" width="310" height="60" as="geometry" /> + </mxCell> + </root> + </mxGraphModel> + </diagram> +</mxfile> |
