diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..a8a91fd05 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,26 @@ +--- +name: Bug Report +about: Create a report to help us improve XenevaOS +title: 'Bug: ' +labels: 'bug' +assignees: '' +--- + +## Summary + + +## Steps to Reproduce +1. +2. +3. + +## Expected Behavior + + +## Actual Behavior + + +## Environment +- **Compiler/Toolchain:** +- **Testing Environment:** +- **OS Build/Branch:** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..bc98273f6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature Request +about: Suggest an idea for XenevaOS +title: 'Feature: ' +labels: 'enhancement' +assignees: '' +--- + +## Summary + + +## Motivation + + +## Proposed Implementation + + +## Related + diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..bf5f396ba --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,17 @@ +## Summary + + +## Changes +### [Module/Component Name] +- **Before:** +- **What:** +- **Why:** + +## Compatibility +- [ ] Existing functionality is unchanged (or breaking changes are explicitly documented). +- [ ] MSVC/Windows build toolchain remains fully compatible. +- [ ] GCC/Linux build toolchain remains fully compatible. +- [ ] No regression in bootloader, kernel, or user-space runtime logic. + +## Related + diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml index 185b7c3f9..2632e1f27 100644 --- a/.github/workflows/build-check.yml +++ b/.github/workflows/build-check.yml @@ -55,8 +55,10 @@ jobs: Expand-Archive -Path Resources/nasmprops.zip -DestinationPath nasmprops -Force $vsPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath $vcPath = Join-Path $vsPath "MSBuild\Microsoft\VC" - $customizationsPath = Get-ChildItem -Path $vcPath -Filter "BuildCustomizations" -Directory -Recurse | Select-Object -ExpandProperty FullName -First 1 - Copy-Item nasmprops\* -Destination $customizationsPath -Force -Recurse + $customizationsPaths = Get-ChildItem -Path $vcPath -Filter "BuildCustomizations" -Directory -Recurse | Select-Object -ExpandProperty FullName + foreach ($path in $customizationsPaths) { + Copy-Item nasmprops\* -Destination $path -Force -Recurse + } - name: Build Solution (Aurora.sln) run: | diff --git a/.gitignore b/.gitignore index 1f4cc386e..89ada595b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,17 +11,23 @@ gnu-efi/ *.Build.CppClean.log *.recipe *.exp +*.db #Intellisense and precompiled headers .vs/ ipch/ *.ipch + # Visual Studio specific files .vs/ *.sdf *.suo *.user +*.ipch +*.VC.db +*.log +.vs/Aurora/v16/*.db x64/ ARM64/ Debug/ @@ -35,3 +41,11 @@ initrd2.img qemu.pid dump.s *.so +*.a +Process/**/*.elf +Process/**/*.exe +Libs/**/*.a + +# Exclude compiled user-space applications +Resources/resources/*.exe +Resources/resources/ARCH_ARM64/*.exe diff --git a/.vs/Aurora/v16/Browse.VC.db b/.vs/Aurora/v16/Browse.VC.db new file mode 100644 index 000000000..0d44c41a1 Binary files /dev/null and b/.vs/Aurora/v16/Browse.VC.db differ diff --git a/.vs/Aurora/v16/Solution.VC.db b/.vs/Aurora/v16/Solution.VC.db new file mode 100644 index 000000000..2f1254b96 Binary files /dev/null and b/.vs/Aurora/v16/Solution.VC.db differ diff --git a/.vs/Aurora/v16/ipch/AutoPCH/757ad2bbe97081d4/BUTTON.ipch b/.vs/Aurora/v16/ipch/AutoPCH/757ad2bbe97081d4/BUTTON.ipch new file mode 100644 index 000000000..a60f10b76 Binary files /dev/null and b/.vs/Aurora/v16/ipch/AutoPCH/757ad2bbe97081d4/BUTTON.ipch differ diff --git a/.vs/Aurora/v16/ipch/AutoPCH/ba8d67e3b70c3d5b/UART0.ipch b/.vs/Aurora/v16/ipch/AutoPCH/ba8d67e3b70c3d5b/UART0.ipch new file mode 100644 index 000000000..68121accb Binary files /dev/null and b/.vs/Aurora/v16/ipch/AutoPCH/ba8d67e3b70c3d5b/UART0.ipch differ diff --git a/.vs/Aurora/v16/ipch/AutoPCH/c49da8d5028221e5/CHITRALEKHA.ipch b/.vs/Aurora/v16/ipch/AutoPCH/c49da8d5028221e5/CHITRALEKHA.ipch new file mode 100644 index 000000000..c667d47b5 Binary files /dev/null and b/.vs/Aurora/v16/ipch/AutoPCH/c49da8d5028221e5/CHITRALEKHA.ipch differ diff --git a/.vs/Aurora/v16/ipch/AutoPCH/d2b1a8c2fcf8466e/AUCON.ipch b/.vs/Aurora/v16/ipch/AutoPCH/d2b1a8c2fcf8466e/AUCON.ipch new file mode 100644 index 000000000..bd841110f Binary files /dev/null and b/.vs/Aurora/v16/ipch/AutoPCH/d2b1a8c2fcf8466e/AUCON.ipch differ diff --git a/.vs/Aurora/v16/ipch/AutoPCH/f725405ac9a5380/INIT.ipch b/.vs/Aurora/v16/ipch/AutoPCH/f725405ac9a5380/INIT.ipch new file mode 100644 index 000000000..e6f4fc0f3 Binary files /dev/null and b/.vs/Aurora/v16/ipch/AutoPCH/f725405ac9a5380/INIT.ipch differ diff --git a/Acpica/Acpica.vcxproj b/Acpica/Acpica.vcxproj index 5f4106c0d..e6e105a10 100644 --- a/Acpica/Acpica.vcxproj +++ b/Acpica/Acpica.vcxproj @@ -104,7 +104,7 @@ false ..\Build\acpica.dll - ..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false diff --git a/Aurora.sln b/Aurora.sln index 456c59951..0aa885208 100644 --- a/Aurora.sln +++ b/Aurora.sln @@ -5,35 +5,6 @@ VisualStudioVersion = 16.0.34729.46 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Kernel", "Kernel\Kernel.vcxproj", "{BED35751-DD14-4197-9081-D61F574C0847}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Acpica", "Acpica\Acpica.vcxproj", "{EAF15281-D090-4519-88B4-F770E10FF50C}" - ProjectSection(ProjectDependencies) = postProject - {BED35751-DD14-4197-9081-D61F574C0847} = {BED35751-DD14-4197-9081-D61F574C0847} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Init", "Process\Init\Init.vcxproj", "{B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Usb3", "Drivers\Usb3\Usb3.vcxproj", "{8F9021E7-02A2-4827-BD34-71175D1DD3EE}" - ProjectSection(ProjectDependencies) = postProject - {BED35751-DD14-4197-9081-D61F574C0847} = {BED35751-DD14-4197-9081-D61F574C0847} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IntelHDA", "Drivers\Sound\IntelHDA\IntelHDA.vcxproj", "{F6062DC1-AD86-4384-AAB0-3562A0FCFA51}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEClib", "Libs\XEClib\XEClib.vcxproj", "{38A7B436-745B-4193-A5F3-4FE14D682F8A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XELoader", "XELoader\XELoader.vcxproj", "{FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Deodhai", "Process\Deodhai\Deodhai.vcxproj", "{8363E128-4810-4036-B0C9-3537A3CDB90D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XECrt", "Libs\XECrt\XECrt.vcxproj", "{7E566DB6-F1A9-4C46-B769-79915CB9B182}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Chitralekha", "Libs\Chitralekha\Chitralekha.vcxproj", "{13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "E1000", "Drivers\E1000\E1000.vcxproj", "{60C723A8-AED4-4689-B960-F0091B16466F}" - ProjectSection(ProjectDependencies) = postProject - {BED35751-DD14-4197-9081-D61F574C0847} = {BED35751-DD14-4197-9081-D61F574C0847} - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9B3819FC-B327-4C42-A93D-E842CC5E498A}" ProjectSection(SolutionItems) = preProject Resources\resources\audrv.cnf = Resources\resources\audrv.cnf @@ -42,1417 +13,154 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution soundapp_demo.txt = soundapp_demo.txt EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetype", "..\..\os_dev\freetype2-master\freetype2-master\builds\windows\vc2010\freetype.vcxproj", "{78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Terminal", "Process\Terminal\Terminal.vcxproj", "{9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VMSvga", "Drivers\VMSvga\VMSvga.vcxproj", "{F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XNLDR", "..\UEFI\XNLDR\XNLDR\XNLDR.vcxproj", "{D2E47D80-2231-4757-B3BC-E96E593CF0E3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmware", "Drivers\vmware\vmware.vcxproj", "{3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vbox", "Drivers\vbox\vbox.vcxproj", "{DE288211-D073-4253-A9AA-8A3B4A69BA6D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEShell", "Process\XEShell\XEShell.vcxproj", "{B2711B30-AE9C-4015-AF37-8795C0EC9064}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "play", "Process\play\play.vcxproj", "{2DA5FF1E-745A-4C30-A73E-53849F22D18A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Namdapha", "Process\Namdapha\Namdapha.vcxproj", "{E423E38B-E351-4151-895D-5336D27C9A2F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XELnch", "Process\XELnch\XELnch.vcxproj", "{400E59EB-6E4C-461A-91B2-202F85F33D41}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Calculator", "Process\Calculator\Calculator.vcxproj", "{CAE7FB4D-2145-4D85-96FB-734576BA5F07}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Files", "Process\Files\Files.vcxproj", "{CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioPlayer", "Process\AudioPlayer\AudioPlayer.vcxproj", "{01D9EF82-5076-4E5C-95FF-C027864A8302}" - ProjectSection(ProjectDependencies) = postProject - {38A7B436-745B-4193-A5F3-4FE14D682F8A} = {38A7B436-745B-4193-A5F3-4FE14D682F8A} - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} = {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} - {7E566DB6-F1A9-4C46-B769-79915CB9B182} = {7E566DB6-F1A9-4C46-B769-79915CB9B182} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NVMe", "Drivers\NVMe\NVMe.vcxproj", "{B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}" - ProjectSection(ProjectDependencies) = postProject - {BED35751-DD14-4197-9081-D61F574C0847} = {BED35751-DD14-4197-9081-D61F574C0847} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NETMngr", "Process\NETMngr\NETMngr.vcxproj", "{567DA5F4-5B2E-4993-9370-C4A4F022C928}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeodhaiAudio", "Process\DeodhaiAudio\DeodhaiAudio.vcxproj", "{6CEF9127-6B8C-4885-BA8D-C2B206EA7134}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Piano", "Process\Piano\Piano.vcxproj", "{7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}" - ProjectSection(ProjectDependencies) = postProject - {38A7B436-745B-4193-A5F3-4FE14D682F8A} = {38A7B436-745B-4193-A5F3-4FE14D682F8A} - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} = {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} - {7E566DB6-F1A9-4C46-B769-79915CB9B182} = {7E566DB6-F1A9-4C46-B769-79915CB9B182} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Control", "Process\Control\Control.vcxproj", "{20D3BAD1-1583-44C2-8625-46DAF5F0E975}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AHCI", "Drivers\AHCI\AHCI.vcxproj", "{C4794DDD-B777-49DF-8600-ED1D71F96EBE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Calender", "Process\Calender\Calender.vcxproj", "{156536F4-42E1-4125-A964-DB92D386E706}" - ProjectSection(ProjectDependencies) = postProject - {38A7B436-745B-4193-A5F3-4FE14D682F8A} = {38A7B436-745B-4193-A5F3-4FE14D682F8A} - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} = {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} - {7E566DB6-F1A9-4C46-B769-79915CB9B182} = {7E566DB6-F1A9-4C46-B769-79915CB9B182} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ping", "Process\ping\ping.vcxproj", "{D106EC5D-389E-45A6-92FB-6E79550B0519}" - ProjectSection(ProjectDependencies) = postProject - {38A7B436-745B-4193-A5F3-4FE14D682F8A} = {38A7B436-745B-4193-A5F3-4FE14D682F8A} - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} = {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nslook", "Process\nslook\nslook.vcxproj", "{4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cat", "Process\cat\cat.vcxproj", "{7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rm", "Process\rm\rm.vcxproj", "{7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}" - ProjectSection(ProjectDependencies) = postProject - {38A7B436-745B-4193-A5F3-4FE14D682F8A} = {38A7B436-745B-4193-A5F3-4FE14D682F8A} - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} = {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC} - {7E566DB6-F1A9-4C46-B769-79915CB9B182} = {7E566DB6-F1A9-4C46-B769-79915CB9B182} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xHCI", "Drivers\xHCI\xHCI.vcxproj", "{D6BF34CD-F14A-49D0-A075-AB2024FF0A62}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hid", "Drivers\USB\hid\hid.vcxproj", "{5D58F57E-75D1-483E-BBCD-C203BCB35D50}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Boot", "Boot\Boot.vcxproj", "{1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msc", "Drivers\USB\msc\msc.vcxproj", "{B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "usbhci", "Drivers\USB\usbhci\usbhci.vcxproj", "{69F8AABD-ABEF-475C-88EB-AA69B2C4231C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mp4plr", "Process\mp4plr\mp4plr.vcxproj", "{8C9C714F-B369-4625-A9D4-CA461DA4335A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "systray", "Process\systray\systray.vcxproj", "{AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BootAA64", "BootAA64\BootAA64.vcxproj", "{FEA7A458-0E08-4754-AD51-57FDD680BEEB}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KernelAA64", "KernelAA64\KernelAA64.vcxproj", "{2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeodhaiXR", "Process\DeodhaiXR\DeodhaiXR.vcxproj", "{22A06C2D-60BB-4040-8214-30EA17701F94}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtionet", "Drivers\Net\virtionet\virtionet.vcxproj", "{51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtiogpu", "Drivers\GPU\virtiogpu\virtiogpu.vcxproj", "{7CDDFA23-2897-4297-B245-ACDE5031E9F3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lcdif", "Drivers\fbset\lcdif\lcdif.vcxproj", "{F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdmi", "Drivers\hdmi\hdmi.vcxproj", "{AD7FE42E-814F-4DC7-86DF-B6AD041251DB}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dwc2-otg", "Drivers\USB\dwc2-otg\dwc2-otg.vcxproj", "{E121230A-7D08-42F0-966B-D96349EF976F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glimpse", "Process\glimpse\glimpse.vcxproj", "{B44F1C3D-F499-49F4-940D-227B5D5F5DD2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dwc2", "Drivers\linux\dwc2\dwc2.vcxproj", "{0130DFA1-9BCA-4108-9065-62FE5495CDA2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dwc2-uspi", "Drivers\USB\dwc2-uspi\dwc2-uspi.vcxproj", "{B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtiosnd", "Drivers\Sound\virtiosnd\virtiosnd.vcxproj", "{B5055A6B-3AF7-443B-9A60-5068D7A10D4A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtioblk", "Drivers\virtioblk\virtioblk.vcxproj", "{219C18BE-21F7-4653-A0A5-710DA04F1F9A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Static|ARM64 = Debug Static|ARM64 Debug Static|Mixed Platforms = Debug Static|Mixed Platforms Debug Static|Win32 = Debug Static|Win32 Debug Static|x64 = Debug Static|x64 + Debug|ARM64 = Debug|ARM64 Debug|Mixed Platforms = Debug|Mixed Platforms Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Release Static|ARM64 = Release Static|ARM64 Release Static|Mixed Platforms = Release Static|Mixed Platforms Release Static|Win32 = Release Static|Win32 Release Static|x64 = Release Static|x64 + Release|ARM64 = Release|ARM64 Release|Mixed Platforms = Release|Mixed Platforms Release|Win32 = Release|Win32 Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BED35751-DD14-4197-9081-D61F574C0847}.Debug Static|ARM64.ActiveCfg = Debug|ARM64 + {BED35751-DD14-4197-9081-D61F574C0847}.Debug Static|ARM64.Build.0 = Debug|ARM64 {BED35751-DD14-4197-9081-D61F574C0847}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Debug Static|Win32.ActiveCfg = Debug|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Debug Static|Win32.Build.0 = Debug|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Debug Static|x64.ActiveCfg = Debug|x64 {BED35751-DD14-4197-9081-D61F574C0847}.Debug Static|x64.Build.0 = Debug|x64 + {BED35751-DD14-4197-9081-D61F574C0847}.Debug|ARM64.ActiveCfg = Debug|ARM64 {BED35751-DD14-4197-9081-D61F574C0847}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {BED35751-DD14-4197-9081-D61F574C0847}.Debug|Mixed Platforms.Build.0 = Debug|x64 {BED35751-DD14-4197-9081-D61F574C0847}.Debug|Win32.ActiveCfg = Debug|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Debug|Win32.Build.0 = Debug|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Debug|x64.ActiveCfg = Debug|x64 {BED35751-DD14-4197-9081-D61F574C0847}.Debug|x64.Build.0 = Debug|x64 + {BED35751-DD14-4197-9081-D61F574C0847}.Release Static|ARM64.ActiveCfg = Release|ARM64 + {BED35751-DD14-4197-9081-D61F574C0847}.Release Static|ARM64.Build.0 = Release|ARM64 {BED35751-DD14-4197-9081-D61F574C0847}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Release Static|Mixed Platforms.Build.0 = Release|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Release Static|Win32.ActiveCfg = Release|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Release Static|Win32.Build.0 = Release|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Release Static|x64.ActiveCfg = Release|x64 {BED35751-DD14-4197-9081-D61F574C0847}.Release Static|x64.Build.0 = Release|x64 + {BED35751-DD14-4197-9081-D61F574C0847}.Release|ARM64.ActiveCfg = Release|ARM64 {BED35751-DD14-4197-9081-D61F574C0847}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Release|Mixed Platforms.Build.0 = Release|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Release|Win32.ActiveCfg = Release|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Release|Win32.Build.0 = Release|Win32 {BED35751-DD14-4197-9081-D61F574C0847}.Release|x64.ActiveCfg = Release|x64 {BED35751-DD14-4197-9081-D61F574C0847}.Release|x64.Build.0 = Release|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug Static|Win32.Build.0 = Debug|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug Static|x64.ActiveCfg = Debug|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug Static|x64.Build.0 = Debug|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug|Win32.ActiveCfg = Debug|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug|Win32.Build.0 = Debug|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug|x64.ActiveCfg = Debug|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Debug|x64.Build.0 = Debug|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release Static|Win32.ActiveCfg = Release|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release Static|Win32.Build.0 = Release|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release Static|x64.ActiveCfg = Release|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release Static|x64.Build.0 = Release|x64 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release|Mixed Platforms.Build.0 = Release|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release|Win32.ActiveCfg = Release|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release|Win32.Build.0 = Release|Win32 - {EAF15281-D090-4519-88B4-F770E10FF50C}.Release|x64.ActiveCfg = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug Static|Win32.Build.0 = Debug|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug Static|x64.ActiveCfg = Debug|x64 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug Static|x64.Build.0 = Debug|x64 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|Win32.ActiveCfg = Debug|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|Win32.Build.0 = Debug|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|x64.ActiveCfg = Debug|x64 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|x64.Build.0 = Debug|x64 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release Static|Win32.ActiveCfg = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release Static|Win32.Build.0 = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release Static|x64.ActiveCfg = Release|x64 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release Static|x64.Build.0 = Release|x64 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|Win32.ActiveCfg = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|Win32.Build.0 = Release|Win32 - {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|x64.ActiveCfg = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug Static|Win32.Build.0 = Debug|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug Static|x64.ActiveCfg = Debug|x64 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug Static|x64.Build.0 = Debug|x64 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug|Win32.ActiveCfg = Debug|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug|Win32.Build.0 = Debug|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Debug|x64.ActiveCfg = Debug|x64 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release Static|Win32.ActiveCfg = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release Static|Win32.Build.0 = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release Static|x64.ActiveCfg = Release|x64 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release Static|x64.Build.0 = Release|x64 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release|Mixed Platforms.Build.0 = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release|Win32.ActiveCfg = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release|Win32.Build.0 = Release|Win32 - {8F9021E7-02A2-4827-BD34-71175D1DD3EE}.Release|x64.ActiveCfg = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug Static|Win32.Build.0 = Debug|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug Static|x64.ActiveCfg = Debug|x64 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug Static|x64.Build.0 = Debug|x64 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|Win32.ActiveCfg = Debug|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|Win32.Build.0 = Debug|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|x64.ActiveCfg = Debug|x64 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release Static|Win32.ActiveCfg = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release Static|Win32.Build.0 = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release Static|x64.ActiveCfg = Release|x64 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release Static|x64.Build.0 = Release|x64 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|Mixed Platforms.Build.0 = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|Win32.ActiveCfg = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|Win32.Build.0 = Release|Win32 - {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|x64.ActiveCfg = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug Static|Win32.Build.0 = Debug|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug Static|x64.ActiveCfg = Debug|x64 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug Static|x64.Build.0 = Debug|x64 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug|Win32.ActiveCfg = Debug|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug|Win32.Build.0 = Debug|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Debug|x64.ActiveCfg = Debug|x64 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release Static|Win32.ActiveCfg = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release Static|Win32.Build.0 = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release Static|x64.ActiveCfg = Release|x64 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release Static|x64.Build.0 = Release|x64 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release|Win32.ActiveCfg = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release|Win32.Build.0 = Release|Win32 - {38A7B436-745B-4193-A5F3-4FE14D682F8A}.Release|x64.ActiveCfg = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug Static|Win32.Build.0 = Debug|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug Static|x64.ActiveCfg = Debug|x64 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug Static|x64.Build.0 = Debug|x64 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug|Win32.ActiveCfg = Debug|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug|Win32.Build.0 = Debug|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Debug|x64.ActiveCfg = Debug|x64 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release Static|Win32.ActiveCfg = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release Static|Win32.Build.0 = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release Static|x64.ActiveCfg = Release|x64 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release Static|x64.Build.0 = Release|x64 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release|Mixed Platforms.Build.0 = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release|Win32.ActiveCfg = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release|Win32.Build.0 = Release|Win32 - {FD948B35-2AB4-4AB3-88EF-7CC30E4A7B56}.Release|x64.ActiveCfg = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug Static|Win32.Build.0 = Debug|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug Static|x64.ActiveCfg = Debug|x64 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug Static|x64.Build.0 = Debug|x64 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|Win32.Build.0 = Debug|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|x64.ActiveCfg = Debug|x64 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release Static|Win32.ActiveCfg = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release Static|Win32.Build.0 = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release Static|x64.ActiveCfg = Release|x64 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release Static|x64.Build.0 = Release|x64 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|Mixed Platforms.Build.0 = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|Win32.ActiveCfg = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|Win32.Build.0 = Release|Win32 - {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|x64.ActiveCfg = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug Static|Win32.Build.0 = Debug|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug Static|x64.ActiveCfg = Debug|x64 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug Static|x64.Build.0 = Debug|x64 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug|Win32.ActiveCfg = Debug|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug|Win32.Build.0 = Debug|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Debug|x64.ActiveCfg = Debug|x64 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release Static|Win32.ActiveCfg = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release Static|Win32.Build.0 = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release Static|x64.ActiveCfg = Release|x64 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release Static|x64.Build.0 = Release|x64 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release|Mixed Platforms.Build.0 = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release|Win32.ActiveCfg = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release|Win32.Build.0 = Release|Win32 - {7E566DB6-F1A9-4C46-B769-79915CB9B182}.Release|x64.ActiveCfg = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug Static|Win32.Build.0 = Debug|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug Static|x64.ActiveCfg = Debug|x64 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug Static|x64.Build.0 = Debug|x64 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug|Win32.ActiveCfg = Debug|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug|Win32.Build.0 = Debug|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Debug|x64.ActiveCfg = Debug|x64 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release Static|Win32.ActiveCfg = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release Static|Win32.Build.0 = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release Static|x64.ActiveCfg = Release|x64 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release Static|x64.Build.0 = Release|x64 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release|Mixed Platforms.Build.0 = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release|Win32.ActiveCfg = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release|Win32.Build.0 = Release|Win32 - {13366E8F-2DBF-4E21-A7A7-52D8B788F4BC}.Release|x64.ActiveCfg = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug Static|Win32.Build.0 = Debug|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug Static|x64.ActiveCfg = Debug|x64 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug Static|x64.Build.0 = Debug|x64 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|Win32.ActiveCfg = Debug|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|Win32.Build.0 = Debug|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|x64.ActiveCfg = Debug|x64 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release Static|Win32.ActiveCfg = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release Static|Win32.Build.0 = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release Static|x64.ActiveCfg = Release|x64 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release Static|x64.Build.0 = Release|x64 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release|Mixed Platforms.Build.0 = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release|Win32.ActiveCfg = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release|Win32.Build.0 = Release|Win32 - {60C723A8-AED4-4689-B960-F0091B16466F}.Release|x64.ActiveCfg = Release|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Mixed Platforms.ActiveCfg = Debug Static|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Mixed Platforms.Build.0 = Debug Static|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.ActiveCfg = Debug Static|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|Win32.Build.0 = Debug Static|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.ActiveCfg = Debug Static|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug Static|x64.Build.0 = Debug Static|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.ActiveCfg = Debug|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|Win32.Build.0 = Debug|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.ActiveCfg = Debug|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Debug|x64.Build.0 = Debug|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Mixed Platforms.ActiveCfg = Release Static|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Mixed Platforms.Build.0 = Release Static|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.ActiveCfg = Release Static|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|Win32.Build.0 = Release Static|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.ActiveCfg = Release Static|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release Static|x64.Build.0 = Release Static|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Mixed Platforms.Build.0 = Release|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.ActiveCfg = Release|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|Win32.Build.0 = Release|Win32 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.ActiveCfg = Release|x64 - {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B}.Release|x64.Build.0 = Release|x64 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug Static|Win32.Build.0 = Debug|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug Static|x64.ActiveCfg = Debug|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|Win32.ActiveCfg = Debug|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|Win32.Build.0 = Debug|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|x64.ActiveCfg = Debug|x64 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release Static|Win32.ActiveCfg = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release Static|Win32.Build.0 = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release Static|x64.ActiveCfg = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|Mixed Platforms.Build.0 = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|Win32.ActiveCfg = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|Win32.Build.0 = Release|Win32 - {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|x64.ActiveCfg = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug Static|Win32.Build.0 = Debug|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug Static|x64.ActiveCfg = Debug|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug|Win32.ActiveCfg = Debug|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug|Win32.Build.0 = Debug|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Debug|x64.ActiveCfg = Debug|x64 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release Static|Win32.ActiveCfg = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release Static|Win32.Build.0 = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release Static|x64.ActiveCfg = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release|Mixed Platforms.Build.0 = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release|Win32.ActiveCfg = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release|Win32.Build.0 = Release|Win32 - {F863B74F-B85F-4D17-BCF4-D3716A8C0D7F}.Release|x64.ActiveCfg = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug Static|Win32.Build.0 = Debug|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug Static|x64.ActiveCfg = Debug|x64 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug Static|x64.Build.0 = Debug|x64 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug|Win32.ActiveCfg = Debug|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug|Win32.Build.0 = Debug|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug|x64.ActiveCfg = Debug|x64 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Debug|x64.Build.0 = Debug|x64 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release Static|Win32.ActiveCfg = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release Static|Win32.Build.0 = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release Static|x64.ActiveCfg = Release|x64 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release Static|x64.Build.0 = Release|x64 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release|Mixed Platforms.Build.0 = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release|Win32.ActiveCfg = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release|Win32.Build.0 = Release|Win32 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release|x64.ActiveCfg = Release|x64 - {D2E47D80-2231-4757-B3BC-E96E593CF0E3}.Release|x64.Build.0 = Release|x64 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug Static|Win32.Build.0 = Debug|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug Static|x64.ActiveCfg = Debug|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug|Win32.ActiveCfg = Debug|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug|Win32.Build.0 = Debug|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Debug|x64.ActiveCfg = Debug|x64 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release Static|Win32.ActiveCfg = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release Static|Win32.Build.0 = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release Static|x64.ActiveCfg = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release|Mixed Platforms.Build.0 = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release|Win32.ActiveCfg = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release|Win32.Build.0 = Release|Win32 - {3C8EB62C-FB88-4BAE-81E6-A6FE98B43885}.Release|x64.ActiveCfg = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug Static|Win32.Build.0 = Debug|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug Static|x64.ActiveCfg = Debug|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug|Win32.ActiveCfg = Debug|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug|Win32.Build.0 = Debug|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Debug|x64.ActiveCfg = Debug|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release Static|Win32.ActiveCfg = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release Static|Win32.Build.0 = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release Static|x64.ActiveCfg = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release|Mixed Platforms.Build.0 = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release|Win32.ActiveCfg = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release|Win32.Build.0 = Release|Win32 - {DE288211-D073-4253-A9AA-8A3B4A69BA6D}.Release|x64.ActiveCfg = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug Static|Win32.Build.0 = Debug|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug Static|x64.ActiveCfg = Debug|x64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug Static|x64.Build.0 = Debug|x64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|Win32.ActiveCfg = Debug|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|Win32.Build.0 = Debug|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|x64.ActiveCfg = Debug|x64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|x64.Build.0 = Debug|x64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release Static|Win32.ActiveCfg = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release Static|Win32.Build.0 = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release Static|x64.ActiveCfg = Release|x64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release Static|x64.Build.0 = Release|x64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|Win32.ActiveCfg = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|Win32.Build.0 = Release|Win32 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|x64.ActiveCfg = Release|x64 - {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|x64.Build.0 = Release|x64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug Static|Win32.Build.0 = Debug|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug Static|x64.ActiveCfg = Debug|x64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug Static|x64.Build.0 = Debug|x64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|Win32.ActiveCfg = Debug|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|Win32.Build.0 = Debug|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|x64.ActiveCfg = Debug|x64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|x64.Build.0 = Debug|x64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release Static|Win32.ActiveCfg = Release|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release Static|Win32.Build.0 = Release|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release Static|x64.ActiveCfg = Release|x64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release Static|x64.Build.0 = Release|x64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|Win32.ActiveCfg = Release|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|Win32.Build.0 = Release|Win32 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|x64.ActiveCfg = Release|x64 - {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|x64.Build.0 = Release|x64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug Static|Win32.Build.0 = Debug|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug Static|x64.ActiveCfg = Debug|x64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug Static|x64.Build.0 = Debug|x64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|Win32.ActiveCfg = Debug|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|Win32.Build.0 = Debug|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|x64.ActiveCfg = Debug|x64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|x64.Build.0 = Debug|x64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release Static|Win32.ActiveCfg = Release|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release Static|Win32.Build.0 = Release|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release Static|x64.ActiveCfg = Release|x64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release Static|x64.Build.0 = Release|x64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|Mixed Platforms.Build.0 = Release|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|Win32.ActiveCfg = Release|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|Win32.Build.0 = Release|Win32 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|x64.ActiveCfg = Release|x64 - {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|x64.Build.0 = Release|x64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug Static|Win32.Build.0 = Debug|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug Static|x64.ActiveCfg = Debug|x64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug Static|x64.Build.0 = Debug|x64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|Win32.ActiveCfg = Debug|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|Win32.Build.0 = Debug|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|x64.ActiveCfg = Debug|x64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|x64.Build.0 = Debug|x64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release Static|Win32.ActiveCfg = Release|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release Static|Win32.Build.0 = Release|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release Static|x64.ActiveCfg = Release|x64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release Static|x64.Build.0 = Release|x64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|Mixed Platforms.Build.0 = Release|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|Win32.ActiveCfg = Release|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|Win32.Build.0 = Release|Win32 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|x64.ActiveCfg = Release|x64 - {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|x64.Build.0 = Release|x64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug Static|Win32.Build.0 = Debug|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug Static|x64.ActiveCfg = Debug|x64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug Static|x64.Build.0 = Debug|x64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|Win32.ActiveCfg = Debug|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|Win32.Build.0 = Debug|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|x64.ActiveCfg = Debug|x64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|x64.Build.0 = Debug|x64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release Static|Win32.ActiveCfg = Release|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release Static|Win32.Build.0 = Release|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release Static|x64.ActiveCfg = Release|x64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release Static|x64.Build.0 = Release|x64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|Mixed Platforms.Build.0 = Release|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|Win32.ActiveCfg = Release|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|Win32.Build.0 = Release|Win32 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|x64.ActiveCfg = Release|x64 - {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|x64.Build.0 = Release|x64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug Static|Win32.Build.0 = Debug|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug Static|x64.ActiveCfg = Debug|x64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug Static|x64.Build.0 = Debug|x64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|Win32.ActiveCfg = Debug|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|Win32.Build.0 = Debug|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|x64.ActiveCfg = Debug|x64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|x64.Build.0 = Debug|x64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release Static|Win32.ActiveCfg = Release|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release Static|Win32.Build.0 = Release|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release Static|x64.ActiveCfg = Release|x64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release Static|x64.Build.0 = Release|x64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|Mixed Platforms.Build.0 = Release|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|Win32.ActiveCfg = Release|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|Win32.Build.0 = Release|Win32 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|x64.ActiveCfg = Release|x64 - {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|x64.Build.0 = Release|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug Static|Win32.Build.0 = Debug|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug Static|x64.ActiveCfg = Debug|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug Static|x64.Build.0 = Debug|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|Win32.ActiveCfg = Debug|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|Win32.Build.0 = Debug|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|x64.ActiveCfg = Debug|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|x64.Build.0 = Debug|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release Static|Win32.ActiveCfg = Release|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release Static|Win32.Build.0 = Release|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release Static|x64.ActiveCfg = Release|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release Static|x64.Build.0 = Release|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|Mixed Platforms.Build.0 = Release|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|Win32.ActiveCfg = Release|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|Win32.Build.0 = Release|Win32 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|x64.ActiveCfg = Release|x64 - {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|x64.Build.0 = Release|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug Static|Win32.Build.0 = Debug|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug Static|x64.ActiveCfg = Debug|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug Static|x64.Build.0 = Debug|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|Win32.ActiveCfg = Debug|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|Win32.Build.0 = Debug|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|x64.ActiveCfg = Debug|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|x64.Build.0 = Debug|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release Static|Win32.ActiveCfg = Release|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release Static|Win32.Build.0 = Release|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release Static|x64.ActiveCfg = Release|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release Static|x64.Build.0 = Release|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|Win32.ActiveCfg = Release|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|Win32.Build.0 = Release|Win32 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|x64.ActiveCfg = Release|x64 - {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|x64.Build.0 = Release|x64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug Static|Win32.Build.0 = Debug|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug Static|x64.ActiveCfg = Debug|x64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug Static|x64.Build.0 = Debug|x64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|Win32.ActiveCfg = Debug|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|Win32.Build.0 = Debug|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|x64.ActiveCfg = Debug|x64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|x64.Build.0 = Debug|x64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release Static|Win32.ActiveCfg = Release|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release Static|Win32.Build.0 = Release|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release Static|x64.ActiveCfg = Release|x64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release Static|x64.Build.0 = Release|x64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|Mixed Platforms.Build.0 = Release|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|Win32.ActiveCfg = Release|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|Win32.Build.0 = Release|Win32 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|x64.ActiveCfg = Release|x64 - {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|x64.Build.0 = Release|x64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug Static|Win32.Build.0 = Debug|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug Static|x64.ActiveCfg = Debug|x64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug Static|x64.Build.0 = Debug|x64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|Win32.ActiveCfg = Debug|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|Win32.Build.0 = Debug|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|x64.ActiveCfg = Debug|x64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|x64.Build.0 = Debug|x64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release Static|Win32.ActiveCfg = Release|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release Static|Win32.Build.0 = Release|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release Static|x64.ActiveCfg = Release|x64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release Static|x64.Build.0 = Release|x64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|Mixed Platforms.Build.0 = Release|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|Win32.ActiveCfg = Release|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|Win32.Build.0 = Release|Win32 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|x64.ActiveCfg = Release|x64 - {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|x64.Build.0 = Release|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug Static|Win32.Build.0 = Debug|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug Static|x64.ActiveCfg = Debug|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug Static|x64.Build.0 = Debug|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug|Win32.ActiveCfg = Debug|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug|Win32.Build.0 = Debug|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug|x64.ActiveCfg = Debug|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Debug|x64.Build.0 = Debug|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release Static|Win32.ActiveCfg = Release|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release Static|Win32.Build.0 = Release|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release Static|x64.ActiveCfg = Release|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release Static|x64.Build.0 = Release|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release|Mixed Platforms.Build.0 = Release|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release|Win32.ActiveCfg = Release|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release|Win32.Build.0 = Release|Win32 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release|x64.ActiveCfg = Release|x64 - {7727F0D3-F3B1-4BB6-A563-90C9FE19A0A7}.Release|x64.Build.0 = Release|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug Static|Win32.Build.0 = Debug|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug Static|x64.ActiveCfg = Debug|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug Static|x64.Build.0 = Debug|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|Win32.ActiveCfg = Debug|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|Win32.Build.0 = Debug|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|x64.ActiveCfg = Debug|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|x64.Build.0 = Debug|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release Static|Win32.ActiveCfg = Release|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release Static|Win32.Build.0 = Release|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release Static|x64.ActiveCfg = Release|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release Static|x64.Build.0 = Release|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|Mixed Platforms.Build.0 = Release|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|Win32.ActiveCfg = Release|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|Win32.Build.0 = Release|Win32 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|x64.ActiveCfg = Release|x64 - {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|x64.Build.0 = Release|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug Static|Win32.Build.0 = Debug|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug Static|x64.ActiveCfg = Debug|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug Static|x64.Build.0 = Debug|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|Win32.ActiveCfg = Debug|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|Win32.Build.0 = Debug|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|x64.ActiveCfg = Debug|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|x64.Build.0 = Debug|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release Static|Win32.ActiveCfg = Release|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release Static|Win32.Build.0 = Release|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release Static|x64.ActiveCfg = Release|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release Static|x64.Build.0 = Release|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|Mixed Platforms.Build.0 = Release|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|Win32.ActiveCfg = Release|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|Win32.Build.0 = Release|Win32 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|x64.ActiveCfg = Release|x64 - {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|x64.Build.0 = Release|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug Static|Win32.Build.0 = Debug|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug Static|x64.ActiveCfg = Debug|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug Static|x64.Build.0 = Debug|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug|Win32.ActiveCfg = Debug|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug|Win32.Build.0 = Debug|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug|x64.ActiveCfg = Debug|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Debug|x64.Build.0 = Debug|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Release Static|Win32.ActiveCfg = Release|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Release Static|Win32.Build.0 = Release|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Release Static|x64.ActiveCfg = Release|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Release Static|x64.Build.0 = Release|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Release|Mixed Platforms.Build.0 = Release|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Release|Win32.ActiveCfg = Release|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Release|Win32.Build.0 = Release|Win32 - {156536F4-42E1-4125-A964-DB92D386E706}.Release|x64.ActiveCfg = Release|x64 - {156536F4-42E1-4125-A964-DB92D386E706}.Release|x64.Build.0 = Release|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug Static|Win32.Build.0 = Debug|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug Static|x64.ActiveCfg = Debug|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug Static|x64.Build.0 = Debug|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|Win32.ActiveCfg = Debug|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|Win32.Build.0 = Debug|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|x64.ActiveCfg = Debug|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|x64.Build.0 = Debug|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release Static|Win32.ActiveCfg = Release|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release Static|Win32.Build.0 = Release|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release Static|x64.ActiveCfg = Release|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release Static|x64.Build.0 = Release|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|Mixed Platforms.Build.0 = Release|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|Win32.ActiveCfg = Release|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|Win32.Build.0 = Release|Win32 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|x64.ActiveCfg = Release|x64 - {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|x64.Build.0 = Release|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug Static|Win32.Build.0 = Debug|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug Static|x64.ActiveCfg = Debug|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug Static|x64.Build.0 = Debug|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|Win32.ActiveCfg = Debug|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|Win32.Build.0 = Debug|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|x64.ActiveCfg = Debug|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|x64.Build.0 = Debug|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release Static|Win32.ActiveCfg = Release|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release Static|Win32.Build.0 = Release|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release Static|x64.ActiveCfg = Release|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release Static|x64.Build.0 = Release|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|Mixed Platforms.Build.0 = Release|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|Win32.ActiveCfg = Release|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|Win32.Build.0 = Release|Win32 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|x64.ActiveCfg = Release|x64 - {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|x64.Build.0 = Release|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug Static|Win32.Build.0 = Debug|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug Static|x64.ActiveCfg = Debug|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug Static|x64.Build.0 = Debug|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|Win32.ActiveCfg = Debug|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|Win32.Build.0 = Debug|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|x64.ActiveCfg = Debug|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|x64.Build.0 = Debug|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release Static|Win32.ActiveCfg = Release|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release Static|Win32.Build.0 = Release|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release Static|x64.ActiveCfg = Release|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release Static|x64.Build.0 = Release|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|Mixed Platforms.Build.0 = Release|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|Win32.ActiveCfg = Release|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|Win32.Build.0 = Release|Win32 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|x64.ActiveCfg = Release|x64 - {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|x64.Build.0 = Release|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug Static|Win32.Build.0 = Debug|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug Static|x64.ActiveCfg = Debug|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug Static|x64.Build.0 = Debug|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug|Win32.ActiveCfg = Debug|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug|Win32.Build.0 = Debug|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug|x64.ActiveCfg = Debug|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Debug|x64.Build.0 = Debug|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release Static|Win32.ActiveCfg = Release|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release Static|Win32.Build.0 = Release|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release Static|x64.ActiveCfg = Release|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release Static|x64.Build.0 = Release|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release|Mixed Platforms.Build.0 = Release|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release|Win32.ActiveCfg = Release|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release|Win32.Build.0 = Release|Win32 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release|x64.ActiveCfg = Release|x64 - {7E852587-A5BD-4E6C-A0AB-ED1D38A65BEF}.Release|x64.Build.0 = Release|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug Static|Win32.Build.0 = Debug|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug Static|x64.ActiveCfg = Debug|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug Static|x64.Build.0 = Debug|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|Win32.ActiveCfg = Debug|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|Win32.Build.0 = Debug|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|x64.ActiveCfg = Debug|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|x64.Build.0 = Debug|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release Static|Win32.ActiveCfg = Release|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release Static|Win32.Build.0 = Release|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release Static|x64.ActiveCfg = Release|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release Static|x64.Build.0 = Release|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|Mixed Platforms.Build.0 = Release|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|Win32.ActiveCfg = Release|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|Win32.Build.0 = Release|Win32 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|x64.ActiveCfg = Release|x64 - {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|x64.Build.0 = Release|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug Static|Win32.Build.0 = Debug|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug Static|x64.ActiveCfg = Debug|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug Static|x64.Build.0 = Debug|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|Win32.ActiveCfg = Debug|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|Win32.Build.0 = Debug|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|x64.ActiveCfg = Debug|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|x64.Build.0 = Debug|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release Static|Win32.ActiveCfg = Release|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release Static|Win32.Build.0 = Release|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release Static|x64.ActiveCfg = Release|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release Static|x64.Build.0 = Release|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|Mixed Platforms.Build.0 = Release|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|Win32.ActiveCfg = Release|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|Win32.Build.0 = Release|Win32 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|x64.ActiveCfg = Release|x64 - {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|x64.Build.0 = Release|x64 + {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug Static|ARM64.ActiveCfg = Debug|ARM64 + {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug Static|ARM64.Build.0 = Debug|ARM64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug Static|Win32.ActiveCfg = Debug|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug Static|Win32.Build.0 = Debug|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug Static|x64.ActiveCfg = Debug|x64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug Static|x64.Build.0 = Debug|x64 + {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug|ARM64.ActiveCfg = Debug|ARM64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug|Win32.ActiveCfg = Debug|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug|Win32.Build.0 = Debug|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug|x64.ActiveCfg = Debug|x64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Debug|x64.Build.0 = Debug|x64 + {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release Static|ARM64.ActiveCfg = Release|ARM64 + {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release Static|ARM64.Build.0 = Release|ARM64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release Static|Mixed Platforms.Build.0 = Release|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release Static|Win32.ActiveCfg = Release|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release Static|Win32.Build.0 = Release|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release Static|x64.ActiveCfg = Release|x64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release Static|x64.Build.0 = Release|x64 + {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release|ARM64.ActiveCfg = Release|ARM64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release|Mixed Platforms.Build.0 = Release|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release|Win32.ActiveCfg = Release|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release|Win32.Build.0 = Release|Win32 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release|x64.ActiveCfg = Release|x64 {1998E8D0-DF15-4A59-B9C1-0728EC4ACA15}.Release|x64.Build.0 = Release|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug Static|Win32.Build.0 = Debug|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug Static|x64.ActiveCfg = Debug|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug Static|x64.Build.0 = Debug|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|Win32.ActiveCfg = Debug|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|Win32.Build.0 = Debug|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|x64.ActiveCfg = Debug|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|x64.Build.0 = Debug|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release Static|Win32.ActiveCfg = Release|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release Static|Win32.Build.0 = Release|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release Static|x64.ActiveCfg = Release|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release Static|x64.Build.0 = Release|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|Win32.ActiveCfg = Release|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|Win32.Build.0 = Release|Win32 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|x64.ActiveCfg = Release|x64 - {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|x64.Build.0 = Release|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug Static|Win32.Build.0 = Debug|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug Static|x64.ActiveCfg = Debug|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug Static|x64.Build.0 = Debug|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|Win32.ActiveCfg = Debug|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|Win32.Build.0 = Debug|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|x64.ActiveCfg = Debug|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|x64.Build.0 = Debug|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release Static|Win32.ActiveCfg = Release|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release Static|Win32.Build.0 = Release|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release Static|x64.ActiveCfg = Release|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release Static|x64.Build.0 = Release|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|Mixed Platforms.Build.0 = Release|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|Win32.ActiveCfg = Release|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|Win32.Build.0 = Release|Win32 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|x64.ActiveCfg = Release|x64 - {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|x64.Build.0 = Release|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug Static|Win32.Build.0 = Debug|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug Static|x64.ActiveCfg = Debug|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug Static|x64.Build.0 = Debug|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug|Win32.ActiveCfg = Debug|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug|Win32.Build.0 = Debug|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug|x64.ActiveCfg = Debug|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Debug|x64.Build.0 = Debug|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release Static|Win32.ActiveCfg = Release|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release Static|Win32.Build.0 = Release|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release Static|x64.ActiveCfg = Release|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release Static|x64.Build.0 = Release|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release|Win32.ActiveCfg = Release|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release|Win32.Build.0 = Release|Win32 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release|x64.ActiveCfg = Release|x64 - {8C9C714F-B369-4625-A9D4-CA461DA4335A}.Release|x64.Build.0 = Release|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug Static|Win32.Build.0 = Debug|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug Static|x64.ActiveCfg = Debug|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug Static|x64.Build.0 = Debug|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug|Mixed Platforms.ActiveCfg = Debug|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug|Mixed Platforms.Build.0 = Debug|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug|Win32.ActiveCfg = Debug|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug|Win32.Build.0 = Debug|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug|x64.ActiveCfg = Debug|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Debug|x64.Build.0 = Debug|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release Static|Win32.ActiveCfg = Release|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release Static|Win32.Build.0 = Release|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release Static|x64.ActiveCfg = Release|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release Static|x64.Build.0 = Release|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release|Win32.ActiveCfg = Release|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release|Win32.Build.0 = Release|Win32 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release|x64.ActiveCfg = Release|x64 - {AF79F28C-7E9C-4B35-8559-E18EF40C5E2A}.Release|x64.Build.0 = Release|x64 + {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug Static|ARM64.ActiveCfg = Debug|ARM64 + {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug Static|ARM64.Build.0 = Debug|ARM64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug Static|Win32.ActiveCfg = Debug|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug Static|Win32.Build.0 = Debug|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug Static|x64.ActiveCfg = Debug|x64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug Static|x64.Build.0 = Debug|x64 + {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug|ARM64.Build.0 = Debug|ARM64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug|Win32.ActiveCfg = Debug|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug|Win32.Build.0 = Debug|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug|x64.ActiveCfg = Debug|x64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Debug|x64.Build.0 = Debug|x64 + {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release Static|ARM64.ActiveCfg = Release|ARM64 + {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release Static|ARM64.Build.0 = Release|ARM64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release Static|Mixed Platforms.Build.0 = Release|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release Static|Win32.ActiveCfg = Release|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release Static|Win32.Build.0 = Release|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release Static|x64.ActiveCfg = Release|x64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release Static|x64.Build.0 = Release|x64 + {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release|ARM64.ActiveCfg = Release|ARM64 + {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release|ARM64.Build.0 = Release|ARM64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release|Mixed Platforms.Build.0 = Release|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release|Win32.ActiveCfg = Release|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release|Win32.Build.0 = Release|Win32 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release|x64.ActiveCfg = Release|x64 {FEA7A458-0E08-4754-AD51-57FDD680BEEB}.Release|x64.Build.0 = Release|x64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug Static|ARM64.ActiveCfg = Debug|ARM64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug Static|ARM64.Build.0 = Debug|ARM64 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug Static|Win32.ActiveCfg = Debug|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug Static|Win32.Build.0 = Debug|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug Static|x64.ActiveCfg = Debug|x64 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug Static|x64.Build.0 = Debug|x64 - {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|ARM64.ActiveCfg = Release|ARM64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|ARM64.Build.0 = Release|ARM64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|Mixed Platforms.ActiveCfg = Release|ARM64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|Mixed Platforms.Build.0 = Release|ARM64 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|Win32.ActiveCfg = Debug|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|Win32.Build.0 = Debug|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|x64.ActiveCfg = Debug|x64 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Debug|x64.Build.0 = Debug|x64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release Static|ARM64.ActiveCfg = Release|ARM64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release Static|ARM64.Build.0 = Release|ARM64 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release Static|Mixed Platforms.Build.0 = Release|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release Static|Win32.ActiveCfg = Release|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release Static|Win32.Build.0 = Release|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release Static|x64.ActiveCfg = Release|x64 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release Static|x64.Build.0 = Release|x64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release|ARM64.ActiveCfg = Release|ARM64 + {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release|ARM64.Build.0 = Release|ARM64 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release|Mixed Platforms.Build.0 = Release|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release|Win32.ActiveCfg = Release|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release|Win32.Build.0 = Release|Win32 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release|x64.ActiveCfg = Release|x64 {2DA020D0-9C8A-4879-A2CA-9829BFF52BD8}.Release|x64.Build.0 = Release|x64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug Static|Win32.Build.0 = Debug|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug Static|x64.ActiveCfg = Debug|x64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug Static|x64.Build.0 = Debug|x64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|Win32.ActiveCfg = Debug|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|Win32.Build.0 = Debug|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|x64.ActiveCfg = Debug|x64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|x64.Build.0 = Debug|x64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release Static|Win32.ActiveCfg = Release|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release Static|Win32.Build.0 = Release|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release Static|x64.ActiveCfg = Release|x64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release Static|x64.Build.0 = Release|x64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|Mixed Platforms.Build.0 = Release|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|Win32.ActiveCfg = Release|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|Win32.Build.0 = Release|Win32 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|x64.ActiveCfg = Release|x64 - {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|x64.Build.0 = Release|x64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug Static|Win32.Build.0 = Debug|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug Static|x64.ActiveCfg = Debug|x64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug Static|x64.Build.0 = Debug|x64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|Win32.ActiveCfg = Debug|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|Win32.Build.0 = Debug|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|x64.ActiveCfg = Debug|x64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|x64.Build.0 = Debug|x64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release Static|Win32.ActiveCfg = Release|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release Static|Win32.Build.0 = Release|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release Static|x64.ActiveCfg = Release|x64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release Static|x64.Build.0 = Release|x64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|Mixed Platforms.Build.0 = Release|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|Win32.ActiveCfg = Release|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|Win32.Build.0 = Release|Win32 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|x64.ActiveCfg = Release|x64 - {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|x64.Build.0 = Release|x64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug Static|Win32.Build.0 = Debug|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug Static|x64.ActiveCfg = Debug|x64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug Static|x64.Build.0 = Debug|x64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|Win32.ActiveCfg = Debug|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|Win32.Build.0 = Debug|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|x64.ActiveCfg = Debug|x64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|x64.Build.0 = Debug|x64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release Static|Win32.ActiveCfg = Release|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release Static|Win32.Build.0 = Release|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release Static|x64.ActiveCfg = Release|x64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release Static|x64.Build.0 = Release|x64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|Mixed Platforms.Build.0 = Release|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|Win32.ActiveCfg = Release|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|Win32.Build.0 = Release|Win32 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|x64.ActiveCfg = Release|x64 - {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|x64.Build.0 = Release|x64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug Static|Win32.Build.0 = Debug|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug Static|x64.ActiveCfg = Debug|x64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug Static|x64.Build.0 = Debug|x64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|Win32.ActiveCfg = Debug|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|Win32.Build.0 = Debug|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|x64.ActiveCfg = Debug|x64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|x64.Build.0 = Debug|x64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release Static|Win32.ActiveCfg = Release|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release Static|Win32.Build.0 = Release|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release Static|x64.ActiveCfg = Release|x64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release Static|x64.Build.0 = Release|x64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|Mixed Platforms.Build.0 = Release|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|Win32.ActiveCfg = Release|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|Win32.Build.0 = Release|Win32 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|x64.ActiveCfg = Release|x64 - {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|x64.Build.0 = Release|x64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug Static|Win32.Build.0 = Debug|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug Static|x64.ActiveCfg = Debug|x64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug Static|x64.Build.0 = Debug|x64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|Win32.ActiveCfg = Debug|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|Win32.Build.0 = Debug|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|x64.ActiveCfg = Debug|x64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|x64.Build.0 = Debug|x64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release Static|Win32.ActiveCfg = Release|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release Static|Win32.Build.0 = Release|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release Static|x64.ActiveCfg = Release|x64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release Static|x64.Build.0 = Release|x64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|Mixed Platforms.Build.0 = Release|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|Win32.ActiveCfg = Release|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|Win32.Build.0 = Release|Win32 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|x64.ActiveCfg = Release|x64 - {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|x64.Build.0 = Release|x64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug Static|Win32.Build.0 = Debug|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug Static|x64.ActiveCfg = Debug|x64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug Static|x64.Build.0 = Debug|x64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|Win32.ActiveCfg = Debug|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|Win32.Build.0 = Debug|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|x64.ActiveCfg = Debug|x64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|x64.Build.0 = Debug|x64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release Static|Win32.ActiveCfg = Release|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release Static|Win32.Build.0 = Release|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release Static|x64.ActiveCfg = Release|x64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release Static|x64.Build.0 = Release|x64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release|Mixed Platforms.Build.0 = Release|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release|Win32.ActiveCfg = Release|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release|Win32.Build.0 = Release|Win32 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release|x64.ActiveCfg = Release|x64 - {E121230A-7D08-42F0-966B-D96349EF976F}.Release|x64.Build.0 = Release|x64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug Static|Win32.Build.0 = Debug|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug Static|x64.ActiveCfg = Debug|x64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug Static|x64.Build.0 = Debug|x64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|Win32.ActiveCfg = Debug|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|Win32.Build.0 = Debug|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|x64.ActiveCfg = Debug|x64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|x64.Build.0 = Debug|x64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release Static|Win32.ActiveCfg = Release|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release Static|Win32.Build.0 = Release|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release Static|x64.ActiveCfg = Release|x64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release Static|x64.Build.0 = Release|x64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|Win32.ActiveCfg = Release|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|Win32.Build.0 = Release|Win32 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|x64.ActiveCfg = Release|x64 - {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|x64.Build.0 = Release|x64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug Static|Win32.Build.0 = Debug|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug Static|x64.ActiveCfg = Debug|x64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug Static|x64.Build.0 = Debug|x64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug|Win32.ActiveCfg = Debug|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug|Win32.Build.0 = Debug|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug|x64.ActiveCfg = Debug|x64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Debug|x64.Build.0 = Debug|x64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release Static|Win32.ActiveCfg = Release|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release Static|Win32.Build.0 = Release|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release Static|x64.ActiveCfg = Release|x64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release Static|x64.Build.0 = Release|x64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release|Mixed Platforms.Build.0 = Release|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release|Win32.ActiveCfg = Release|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release|Win32.Build.0 = Release|Win32 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release|x64.ActiveCfg = Release|x64 - {0130DFA1-9BCA-4108-9065-62FE5495CDA2}.Release|x64.Build.0 = Release|x64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug Static|Win32.Build.0 = Debug|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug Static|x64.ActiveCfg = Debug|x64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug Static|x64.Build.0 = Debug|x64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug|Win32.ActiveCfg = Debug|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug|Win32.Build.0 = Debug|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug|x64.ActiveCfg = Debug|x64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Debug|x64.Build.0 = Debug|x64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release Static|Win32.ActiveCfg = Release|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release Static|Win32.Build.0 = Release|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release Static|x64.ActiveCfg = Release|x64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release Static|x64.Build.0 = Release|x64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release|Win32.ActiveCfg = Release|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release|Win32.Build.0 = Release|Win32 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release|x64.ActiveCfg = Release|x64 - {B8BF3983-424E-4915-AAA5-FA90DFFEB7C8}.Release|x64.Build.0 = Release|x64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug Static|Win32.Build.0 = Debug|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug Static|x64.ActiveCfg = Debug|x64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug Static|x64.Build.0 = Debug|x64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|Win32.ActiveCfg = Debug|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|Win32.Build.0 = Debug|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|x64.ActiveCfg = Debug|x64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|x64.Build.0 = Debug|x64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release Static|Win32.ActiveCfg = Release|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release Static|Win32.Build.0 = Release|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release Static|x64.ActiveCfg = Release|x64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release Static|x64.Build.0 = Release|x64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|Win32.ActiveCfg = Release|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|Win32.Build.0 = Release|Win32 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|x64.ActiveCfg = Release|x64 - {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|x64.Build.0 = Release|x64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug Static|Mixed Platforms.ActiveCfg = Debug|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug Static|Mixed Platforms.Build.0 = Debug|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug Static|Win32.ActiveCfg = Debug|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug Static|Win32.Build.0 = Debug|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug Static|x64.ActiveCfg = Debug|x64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug Static|x64.Build.0 = Debug|x64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|Mixed Platforms.ActiveCfg = Debug|ARM64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|Mixed Platforms.Build.0 = Debug|ARM64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|Win32.ActiveCfg = Debug|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|Win32.Build.0 = Debug|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|x64.ActiveCfg = Debug|x64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|x64.Build.0 = Debug|x64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release Static|Mixed Platforms.ActiveCfg = Release|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release Static|Mixed Platforms.Build.0 = Release|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release Static|Win32.ActiveCfg = Release|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release Static|Win32.Build.0 = Release|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release Static|x64.ActiveCfg = Release|x64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release Static|x64.Build.0 = Release|x64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|Mixed Platforms.Build.0 = Release|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|Win32.ActiveCfg = Release|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|Win32.Build.0 = Release|Win32 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|x64.ActiveCfg = Release|x64 - {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/BaseHdr/Board/board.h b/BaseHdr/Board/board.h index ce151594e..5c5b47f76 100644 --- a/BaseHdr/Board/board.h +++ b/BaseHdr/Board/board.h @@ -60,4 +60,10 @@ extern void AuAA64BoardPowerDown(); */ extern void AuAA64BoardReboot(); +/** + * @brief AuAA64BoardGetBootEpoch -- returns the + * boot epoch time from board + */ +extern uint64_t AuAA64BoardGetBootEpoch(); + #endif \ No newline at end of file diff --git a/BaseHdr/Board/imx8mp/imx8mp_clk.h b/BaseHdr/Board/imx8mp/imx8mp_clk.h index 35abfae37..6515e9fdd 100644 --- a/BaseHdr/Board/imx8mp/imx8mp_clk.h +++ b/BaseHdr/Board/imx8mp/imx8mp_clk.h @@ -88,6 +88,227 @@ typedef enum _clock_root_select_ { HDMI_REF_266M_ROOT, /* incomplete */ }imx8mp_clock_root_select; + +typedef enum _root_id_ { + IMX8MP_CLK_GPC_ROOT = 183, + IMX8MP_CLK_ANAMIX_ROOT, + IMX8MP_CLK_CPU_ROOT, + IMX8MP_CLK_CSU_ROOT, + IMX8MP_CLK_DEBUG_ROOT, + IMX8MP_CLK_DRAM1_ROOT, + IMX8MP_CLK_ECSPI1_ROOT, + IMX8MP_CLK_ECSPI2_ROOT, + IMX8MP_CLK_ECSPI3_ROOT, + IMX8MP_CLK_ENET1_ROOT, + IMX8MP_CLK_GPIO1_ROOT, + IMX8MP_CLK_GPIO2_ROOT, + IMX8MP_CLK_GPIO3_ROOT, + IMX8MP_CLK_GPIO4_ROOT, + IMX8MP_CLK_GPIO5_ROOT, + IMX8MP_CLK_GPT1_ROOT, + IMX8MP_CLK_GPT2_ROOT, + IMX8MP_CLK_GPT3_ROOT, + IMX8MP_CLK_GPT4_ROOT, + IMX8MP_CLK_GPT5_ROOT, + IMX8MP_CLK_GPT6_ROOT, + IMX8MP_CLK_HS_ROOT, + IMX8MP_CLK_I2C1_ROOT, + IMX8MP_CLK_I2C2_ROOT, + IMX8MP_CLK_I2C3_ROOT, + IMX8MP_CLK_I2C4_ROOT, + IMX8MP_CLK_IOMUX_ROOT, + IMX8MP_CLK_IPMUX1_ROOT, + IMX8MP_CLK_IPMUX2_ROOT, + IMX8MP_CLK_MU_ROOT, + IMX8MP_CLK_OCOTP_ROOT, + IMX8MP_CLK_OCRAM_ROOT, + IMX8MP_CLK_PCIE_ROOT, + IMX8MP_CLK_PERFMON1_ROOT, + IMX8MP_CLK_PERFMON2_ROOT, + IMX8MP_CLK_PWM1_ROOT, + IMX8MP_CLK_PWM2_ROOT, + IMX8MP_CLK_PWM3_ROOT, + IMX8MP_CLK_PWM4_ROOT, + IMX8MP_CLK_QOS_ROOT, + IMX8MP_CLK_QOS_ENET_ROOT, + IMX8MP_CLK_QSPI_ROOT, + IMX8MP_CLK_NAND_ROOT, + IMX8MP_CLK_NAND_USDHC_BUS_RAWNAND_CLK, + IMX8MP_CLK_RDC_ROOT, + IMX8MP_CLK_ROM_ROOT, + IMX8MP_CLK_I2C5_ROOT, + IMX8MP_CLK_I2C6_ROOT, + IMX8MP_CLK_CAN1_ROOT, + IMX8MP_CLK_CAN2_ROOT, + IMX8MP_CLK_SCTR_ROOT, + IMX8MP_CLK_SDMA1_ROOT, + IMX8MP_CLK_ENET_QOS_ROOT, + IMX8MP_CLK_SEC_DEBUG_ROOT, + IMX8MP_CLK_SEMA1_ROOT, + IMX8MP_CLK_SEMA2_ROOT, + IMX8MP_CLK_IRQ_STEER_ROOT, + IMX8MP_CLK_SIM_ENET_ROOT, + IMX8MP_CLK_SIM_M_ROOT, + IMX8MP_CLK_SIM_MAIN_ROOT, + IMX8MP_CLK_SIM_S_ROOT, + IMX8MP_CLK_SIM_WAKEUP_ROOT, + IMX8MP_CLK_GPU2D_ROOT, + IMX8MP_CLK_GPU3D_ROOT, + IMX8MP_CLK_SNVS_ROOT, + IMX8MP_CLK_TRACE_ROOT, + IMX8MP_CLK_UART1_ROOT, + IMX8MP_CLK_UART2_ROOT, + IMX8MP_CLK_UART3_ROOT, + IMX8MP_CLK_UART4_ROOT, + IMX8MP_CLK_USB_ROOT, + IMX8MP_CLK_USB_PHY_ROOT, + IMX8MP_CLK_USDHC1_ROOT, + IMX8MP_CLK_USDHC2_ROOT, + IMX8MP_CLK_WDOG1_ROOT, + IMX8MP_CLK_WDOG2_ROOT, + IMX8MP_CLK_WDOG3_ROOT, + IMX8MP_CLK_VPU_G1_ROOT, + IMX8MP_CLK_GPU_ROOT, + IMX8MP_CLK_NOC_WRAPPER_ROOT, + IMX8MP_CLK_VPU_VC8KE_ROOT, + IMX8MP_CLK_VPU_G2_ROOT, + IMX8MP_CLK_NPU_ROOT, + IMX8MP_CLK_HSIO_ROOT, + IMX8MP_CLK_MEDIA_APB_ROOT, + IMX8MP_CLK_MEDIA_AXI_ROOT, + IMX8MP_CLK_MEDIA_CAM1_PIX_ROOT, + IMX8MP_CLK_MEDIA_CAM2_PIX_ROOT, + IMX8MP_CLK_MEDIA_DISP1_PIX_ROOT, + IMX8MP_CLK_MEDIA_DISP2_PIX_ROOT, + IMX8MP_CLK_MEDIA_MIPI_PHY1_REF_ROOT, + IMX8MP_CLK_MEDIA_ISP_ROOT, + IMX8MP_CLK_USDHC3_ROOT, + IMX8MP_CLK_HDMI_ROOT, + IMX8MP_CLK_XTAL_ROOT, + IMX8MP_CLK_PLL_ROOT, + IMX8MP_CLK_TSENSOR_ROOT, + IMX8MP_CLK_VPU_ROOT, + IMX8MP_CLK_MRPR_ROOT, + IMX8MP_CLK_AUDIO_ROOT, + IMX8MP_CLK_DRAM_ALT_ROOT, + IMX8MP_CLK_MEDIA_LDB_ROOT, + IMX8MP_CLK_AUDIO_AHB_ROOT, + IMX8MP_CLK_AUDIO_AXI_ROOT, + IMX8MP_CLK_SAI1_ROOT, + IMX8MP_CLK_SAI2_ROOT, + IMX8MP_CLK_SAI3_ROOT, + IMX8MP_CLK_SAI5_ROOT, + IMX8MP_CLK_SAI6_ROOT, + IMX8MP_CLK_SAI7_ROOT, + IMX8MP_CLK_PDM_ROOT, + IMX8MP_CLK_USB_SUSP, +}imx8mp_clk_root_id; + +#define DT_IMX8MP_CLK_GPC_ROOT 183 +#define DT_IMX8MP_CLK_ANAMIX_ROOT 184 +#define DT_IMX8MP_CLK_CPU_ROOT 185 +#define DT_IMX8MP_CLK_CSU_ROOT 186 +#define DT_IMX8MP_CLK_DEBUG_ROOT 187 +#define DT_IMX8MP_CLK_DRAM1_ROOT 188 +#define DT_IMX8MP_CLK_ECSPI1_ROOT 189 +#define DT_IMX8MP_CLK_ECSPI2_ROOT 190 +#define DT_IMX8MP_CLK_ECSPI3_ROOT 191 +#define DT_IMX8MP_CLK_ENET1_ROOT 192 +#define DT_IMX8MP_CLK_GPIO1_ROOT 193 +#define DT_IMX8MP_CLK_GPIO2_ROOT 194 +#define DT_IMX8MP_CLK_GPIO3_ROOT 195 +#define DT_IMX8MP_CLK_GPIO4_ROOT 196 +#define DT_IMX8MP_CLK_GPIO5_ROOT 197 +#define DT_IMX8MP_CLK_GPT1_ROOT 198 +#define DT_IMX8MP_CLK_GPT2_ROOT 199 +#define DT_IMX8MP_CLK_GPT3_ROOT 200 +#define DT_IMX8MP_CLK_GPT4_ROOT 201 +#define DT_IMX8MP_CLK_GPT5_ROOT 202 +#define DT_IMX8MP_CLK_GPT6_ROOT 203 +#define DT_IMX8MP_CLK_HS_ROOT 204 +#define DT_IMX8MP_CLK_I2C1_ROOT 205 +#define DT_IMX8MP_CLK_I2C2_ROOT 206 +#define DT_IMX8MP_CLK_I2C3_ROOT 207 +#define DT_IMX8MP_CLK_I2C4_ROOT 208 +#define DT_IMX8MP_CLK_IOMUX_ROOT 209 +#define DT_IMX8MP_CLK_IPMUX1_ROOT 210 +#define DT_IMX8MP_CLK_IPMUX2_ROOT 211 +#define DT_IMX8MP_CLK_IPMUX3_ROOT 212 +#define DT_IMX8MP_CLK_MU_ROOT 213 +#define DT_IMX8MP_CLK_OCUTP_ROOT 214 +#define DT_IMX8MP_CLK_OCRAM_ROOT 215 +#define DT_IMX8MP_CLK_OCRAM_S_ROOT 216 +#define DT_IMX8MP_CLK_PCIE_ROOT 217 +#define DT_IMX8MP_CLK_PERFMON1_ROOT 218 +#define DT_IMX8MP_CLK_PERFMON2_ROOT 219 +#define DT_IMX8MP_CLK_PWM1_ROOT 220 +#define DT_IMX8MP_CLK_PWM2_ROOT 221 +#define DT_IMX8MP_CLK_PWM3_ROOT 222 +#define DT_IMX8MP_CLK_PWM4_ROOT 223 +#define DT_IMX8MP_CLK_QOS_ROOT 224 +#define DT_IMX8MP_CLK_QOS_ENET_ROOT 225 +#define DT_IMX8MP_CLK_QSPI_ROOT 226 +#define DT_IMX8MP_CLK_NAND_ROOT 227 +#define DT_IMX8MP_CLK_NAND_USDHC_BUS_RAWNAND_CLK 228 +#define DT_IMX8MP_CLK_RDC_ROOT 229 +#define DT_IMX8MP_CLK_ROM_ROOT 230 +#define DT_IMX8MP_CLK_I2C5_ROOT 231 +#define DT_IMX8MP_CLK_I2C6_ROOT 232 +#define DT_IMX8MP_CLK_CAN1_ROOT 233 +#define DT_IMX8MP_CLK_CAN2_ROOT 234 +#define DT_IMX8MP_CLK_SCTR_ROOT 235 +#define DT_IMX8MP_CLK_SDMA1_ROOT 236 +#define DT_IMX8MP_CLK_ENET_QOS_ROOT 237 +#define DT_IMX8MP_CLK_SEC_DEBUG_ROOT 238 +#define DT_IMX8MP_CLK_SEMA1_ROOT 239 +#define DT_IMX8MP_CLK_SEMA2_ROOT 240 +#define DT_IMX8MP_CLK_IRQ_STEER_ROOT 241 +#define DT_IMX8MP_CLK_SIM_ENET_ROOT 242 +#define DT_IMX8MP_CLK_SIM_M_ROOT 243 +#define DT_IMX8MP_CLK_SIM_MAIN_ROOT 244 +#define DT_IMX8MP_CLK_SIM_S_ROOT 245 +#define DT_IMX8MP_CLK_SIM_WAKEUP_ROOT 246 +#define DT_IMX8MP_CLK_GPU2D_ROOT 247 +#define DT_IMX8MP_CLK_GPU3D_ROOT 248 +#define DT_IMX8MP_CLK_SNVS_ROOT 249 +#define DT_IMX8MP_CLK_TRACE_ROOT 250 +#define DT_IMX8MP_CLK_UART1_ROOT 251 +#define DT_IMX8MP_CLK_UART2_ROOT 252 +#define DT_IMX8MP_CLK_UART3_ROOT 253 +#define DT_IMX8MP_CLK_UART4_ROOT 254 +#define DT_IMX8MP_CLK_USB_ROOT 255 +#define DT_IMX8MP_CLK_USB_PHY_ROOT 256 +#define DT_IMX8MP_CLK_USDHC1_ROOT 257 +#define DT_IMX8MP_CLK_USDHC2_ROOT 258 +#define DT_IMX8MP_CLK_WDOG1_ROOT 259 +#define DT_IMX8MP_CLK_WDOG2_ROOT 260 +#define DT_IMX8MP_CLK_WDOG3_ROOT 261 +#define DT_IMX8MP_CLK_VPU_G1_ROOT 262 +#define DT_IMX8MP_CLK_GPU_ROOT 263 +#define DT_IMX8MP_CLK_NOC_WRAPPER_ROOT 264 +#define DT_IMX8MP_CLK_VPU_VC8KE_ROOT 265 +#define DT_IMX8MP_CLK_VPU_G2_ROOT 266 +#define DT_IMX8MP_CLK_NPU_ROOT 267 +#define DT_IMX8MP_CLK_HSIO_ROOT 268 +#define DT_IMX8MP_CLK_MEDIA_APB_ROOT 269 +#define DT_IMX8MP_CLK_MEDIA_AXI_ROOT 270 +#define DT_IMX8MP_CLK_MEDIA_CAM1_PIX_ROOT 271 +#define DT_IMX8MP_CLK_MEDIA_CAM2_PIX_ROOT 272 +#define DT_IMX8MP_CLK_MEDIA_DISP1_PIX_ROOT 273 +#define DT_IMX8MP_CLK_MEDIA_DISP2_PIX_ROOT 274 +#define DT_IMX8MP_CLK_MEDIA_MIPI_PHY1_REF_ROOT 275 +#define DT_IMX8MP_CLK_MEDIA_ISP_ROOT 276 +#define DT_IMX8MP_CLK_USDHC3_ROOT 277 +#define DT_IMX8MP_CLK_HDMI_ROOT 278 +#define DT_IMX8MP_CLK_XTAL_ROOT 279 +#define DT_IMX8MP_CLK_PLL_ROOT 280 +#define DT_IMX8MP_CLK_TSENSOR_ROOT 281 +#define DT_IMX8MP_CLK_VPU_ROOT 282 +#define DT_IMX8MP_CLK_MRPR_ROOT 283 +#define DT_IMX8MP_CLK_AUDIO_ROOT 284 +#define DT_IMX8MP_CLK_DRAM_ALT_ROOT 285 +#define DT_IMX8MP_CLK_DRAM_CORE 286 + /** * formula to get specific peripheral clock source */ diff --git a/BaseHdr/Board/imx8mp/imx8mp_clk_div.h b/BaseHdr/Board/imx8mp/imx8mp_clk_div.h new file mode 100644 index 000000000..657f1deef --- /dev/null +++ b/BaseHdr/Board/imx8mp/imx8mp_clk_div.h @@ -0,0 +1,38 @@ +/** +* @file imx8mp_clk_div.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __IMX8MP_CLK_DIV_H__ +#define __IMX8MP_CLK_DIV_H__ + +#include + + +#endif diff --git a/BaseHdr/Board/imx8mp/imx8mp_clk_gate.h b/BaseHdr/Board/imx8mp/imx8mp_clk_gate.h new file mode 100644 index 000000000..2f7752d0e --- /dev/null +++ b/BaseHdr/Board/imx8mp/imx8mp_clk_gate.h @@ -0,0 +1,53 @@ +/** +* @file imx8mp_gate.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __IMX8MP_CLK_GATE_H__ +#define __IMX8MP_CLK_GATE_H__ + +#include + +typedef struct _imx8mp_gate_ { + uint32_t root_id; //defined by the kernel + uint64_t base_addr; + bool _gate4; +}_imx8mp_gate_t; + + +/** + * @brief imx8mp_gate_init -- initialize gate data registry + */ +extern void imx8mp_gate_init(); + +extern int imx8mp_clk_gate_enable(uint32_t clk_root_id); + +extern int imx8mp_clk_gate_disable(uint32_t clk_root_id); + +#endif diff --git a/BaseHdr/Board/imx8mp/imx8mp_gpc.h b/BaseHdr/Board/imx8mp/imx8mp_gpc.h new file mode 100644 index 000000000..a5c49fd50 --- /dev/null +++ b/BaseHdr/Board/imx8mp/imx8mp_gpc.h @@ -0,0 +1,56 @@ +/** +* @file imx8mp_gpc.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __IMX8MP_GPC_H__ +#define __IMX8MP_GPC_G__ + +enum _power_domain_id_ { + IMX8MP_POWER_DOMAIN_MIPI_PHY1, + IMX8MP_POWER_DOMAIN_PCIE_PHY, + IMX8MP_POWER_DOMAIN_USB1_PHY, + IMX8MP_POWER_DOMAIN_USB2_PHY, + IMX8MP_POWER_DOMAIN_MLMIX, + IMX8MP_POWER_DOMAIN_AUDIOMIX, + IMX8MP_POWER_DOMAIN_GPU2D, + IMX8MP_POWER_DOMAIN_GPUMIX, + IMX8MP_POWER_DOMAIN_VPUMIX, + IMX8MP_POWER_DOMAIN_GPU3D, + IMX8MP_POWER_DOMAIN_MEDIAMIX, + IMX8MP_POWER_DOMAIN_VPU_G1, + IMX8MP_POWER_DOMAIN_VPU_G2, + IMX8MP_POWER_DOMAIN_VPU_VC8000E, + IMX8MP_POWER_DOMAIN_HDMIMIX, + IMX8MP_POWER_DOMAIN_HDMI_PHY, + IMX8MP_POWER_DOMAIN_MIPI_PHY2, + IMX8MP_POWER_DOMAIN_HSIOMIX, + IMX8MP_POWER_DOMAIN_MEDIAMIX_ISPDWP +}; +#endif diff --git a/BaseHdr/Board/imx8mp/imx8mp_pll.h b/BaseHdr/Board/imx8mp/imx8mp_pll.h new file mode 100644 index 000000000..d197dfbcb --- /dev/null +++ b/BaseHdr/Board/imx8mp/imx8mp_pll.h @@ -0,0 +1,144 @@ +/** +* @file imx8mp_pll.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __IMX8MP_PLL_H__ +#define __IMX8MP_PLL_H__ + +#include + +/** This file is all about PLL interface, which is used to + * change or modify PLL clock source from CCM module, + * by default, values are set according to the suitable environment + * so directly PLL can be used on target registers + */ +#define __IMX8MP_CCM_BASE__ 0x30360000 //hardcoded from IMX8MP reference PRM, CCM_ANALOG_BASE +/** GROUP A table **/ +#define __IMX8MP_AUDIO_PLL1_GEN_CTRL __IMX8MP_CCM_BASE__ +#define __IMX8MP_AUDIO_PLL1_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x4) +#define __IMX8MP_AUDIO_PLL1_FDIV_CTL1 (__IMX8MP_CCM_BASE__ + 0x8) +#define __IMX8MP_AUDIO_PLL1_SSCG_CTRL (__IMX8MP_CCM_BASE__ + 0xC) +#define __IMX8MP_AUDIO_PLL1_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x10) + + +#define __IMX8MP_AUDIO_PLL2_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x14) +#define __IMX8MP_AUDIO_PLL2_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x18) +#define __IMX8MP_AUDIO_PLL2_FDIV_CTL1 (__IMX8MP_CCM_BASE__ + 0x1C) +#define __IMX8MP_AUDIO_PLL2_SSCG_CTRL (__IMX8MP_CCM_BASE__ + 0x20) +#define __IMX8MP_AUDIO_PLL2_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x24) + +#define __IMX8MP_VIDEO_PLL1_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x28) +#define __IMX8MP_VIDEO_PLL1_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x2C) +#define __IMX8MP_VIDEO_PLL1_FDIV_CTL1 (__IMX8MP_CCM_BASE__ + 0x30) +#define __IMX8MP_VIDEO_PLL1_SSCG_CTRL (__IMX8MP_CCM_BASE__ + 0x34) +#define __IMX8MP_VIDEO_PLL1_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x38) + +#define __IMX8MP_DRAM_PLL_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x50) +#define __IMX8MP_DRAM_PLL_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x54) +#define __IMX8MP_DRAM_PLL_FDIV_CTL1 (__IMX8MP_CCM_BASE__ + 0x58) +#define __IMX8MP_DRAM_PLL_SSCG_CTRL (__IMX8MP_CCM_BASE__ + 0x5C) +#define __IMX8MP_DRAM_PLL_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x60) + +#define __IMX8MP_GPU_PLL_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x64) +#define __IMX8MP_GPU_PLL_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x68) +#define __IMX8MP_GPU_PLL_LOCKD_CTRL (__IMX8MP_CCM_BASE__ + 0x6C) +#define __IMX8MP_GPU_PLL_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x70) + +#define __IMX8MP_VPU_PLL_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x74) +#define __IMX8MP_VPU_PLL_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x78) +#define __IMX8MP_VPU_PLL_LOCKD_CTRL (__IMX8MP_CCM_BASE__ + 0x7C) +#define __IMX8MP_VPU_PLL_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x80) + +#define __IMX8MP_ARM_PLL_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x84) +#define __IMX8MP_ARM_PLL_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x88) +#define __IMX8MP_ARM_PLL_LOCKD_CTRL (__IMX8MP_CCM_BASE__ + 0x8C) +#define __IMX8MP_ARM_PLL_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x90) + +#define __IMX8MP_SYS_PLL1_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x94) +#define __IMX8MP_SYS_PLL1_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x98) +#define __IMX8MP_SYS_PLL1_LOCKD_CTRL (__IMX8MP_CCM_BASE__ + 0x9C) +#define __IMX8MP_SYS_PLL1_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x100) + +#define __IMX8MP_SYS_PLL2_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x104) +#define __IMX8MP_SYS_PLL2_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x108) +#define __IMX8MP_SYS_PLL2_LOCKD_CTRL (__IMX8MP_CCM_BASE__ + 0x10C) +#define __IMX8MP_SYS_PLL2_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x110) + +#define __IMX8MP_SYS_PLL3_GEN_CTRL (__IMX8MP_CCM_BASE__ + 0x114) +#define __IMX8MP_SYS_PLL3_FDIV_CTL0 (__IMX8MP_CCM_BASE__ + 0x118) +#define __IMX8MP_SYS_PLL3_LOCKD_CTRL (__IMX8MP_CCM_BASE__ + 0x11C) +#define __IMX8MP_SYS_PLL3_MNIT_CTRL (__IMX8MP_CCM_BASE__ + 0x120) + +#define __IMX8MP_OSC_MISC_CFG (__IMX8MP_CCM_BASE__ + 0x124) +#define __IMX8MP_ANAMIX_PLL_MNIT_CTL (__IMX8MP_CCM_BASE__ + 0X128) +#define __IMX8MP_CCM_ANALOG_DIGPROG 0x800 + + +/** imx8mp uses PLL14xx modern analog hardware ip block **/ +#define IMX8MP_PLL14XX_MDIV_SHIFT 12 +#define IMX8MP_PLL14XX_MDIV_MASK BORDOISILA_GENMASK(21,12) +#define IMX8MP_PLL14XX_PDIV_SHIFT 4 +#define IMX8MP_PLL14XX_PDIV_MASK BORDOISILA_GENMASK(9,4) +#define IMX8MP_PLL14XX_SDIV_SHIFT 0 +#define IMX8MP_PLL14XX_SDIV_MASK BORDOISILA_GENMASK(2, 0) +#define IMX8MP_PLL14XX_KDIV_SHIFT 0 +#define IMX8MP_PLL14XX_KDIV_MASK BORDOISILA_GENMASK(15, 0) + +#define LOCK_STATUS BORDOISILA_BIT(31) +#define LOCK_SEL_MASK BORDOISILA_BIT(29) +#define CLKE_MASK BORDOISILA_BIT(11) +#define RST_MASK BORDOISILA_BIT(9) +#define BYPASS_MASK BORDOISILA_BIT(4) + + +struct imx_pll14xx_rate_table { + unsigned int rate; + unsigned int pdiv; + unsigned int mdiv; + unsigned int sdiv; + unsigned int kdiv; +}; + + +extern void imx8mp_pll_init(); + +/** + * @brief imx8mp_pll_recalc_rate -- recalculate pll rate + * @param pllbase -- pll base source or entry + * @param parent_rate -- clock rate, if the target root is high powered + * device, it uses osc_24m sel otherwise osc_32k is used for low powered + * device + */ +extern unsigned long imx8mp_pll_recalc_rate(uint64_t pllbase, unsigned long parent_rate); + + +extern uint32_t imx8mp_pll_get_parent_rate(uint64_t pll_base); + +#endif diff --git a/BaseHdr/Cap/capability.h b/BaseHdr/Cap/capability.h new file mode 100644 index 000000000..7efc814bb --- /dev/null +++ b/BaseHdr/Cap/capability.h @@ -0,0 +1,71 @@ +#ifndef CAPABILITY_H +#define CAPABILITY_H + + + +#include +#include +#include +//#include + + + +#define CAP_READ (1 << 0) +#define CAP_WRITE (1 << 1) + +#define CAP_EXECUTE (1 << 2) +#define CAP_SEEK (1 << 3) +#define CAP_IOCTL (1 << 4) + +#define CAP_DUP (1 << 5) + +#define CAP_TRANSFER (1 << 6) + +#define CAP_RIGHTS_NONE 0 + +#define CAP_FILE_RIGHTS_MASK (CAP_READ | CAP_WRITE | CAP_SEEK | CAP_IOCTL | CAP_DUP | CAP_TRANSFER) + +/* Return codes */ +#define CAP_OK 0 +#define CAP_ERR_INVALID -1 +#define CAP_ERR_PERM -2 + +#define CAP_OBJ_FILE 1 + +#define CAP_FLAG_NONE 0 + +#define CAP_FLAG_NO_INHERIT (1 << 0) + + + +/* Capability entry */ +typedef struct _au_capability_ { + + void* object; + + + uint8_t object_type; + + + CapRights rights; + + + UID_NUM owner; + + + uint16_t flags; + + + unsigned char valid; +}AuCapability; + +extern int BordoisilaCapCreate(void* proc, int fd, void* object, uint8_t type, CapRights rights); +extern AuCapability* BordoisilaCapLookup(void* proc, int fd); +extern bool BordoisilaCapCheckRights(void* proc, int fd, CapRights required); +extern int BordoisilaCapDup(void* proc, int oldfd, int newfd); +extern int BordoisilaCapRestrict(void* proc, int fd, CapRights new_rights); +extern void BordoisilaCapDestroy(void* proc, int fd); +extern void BordoisilaCapCleanupProcess(void* proc); +extern void BordoisilaCapInheritTable(void* parent, void* child); + +#endif diff --git a/BaseHdr/Drivers/core.h b/BaseHdr/Drivers/core.h new file mode 100644 index 000000000..6ab8558c8 --- /dev/null +++ b/BaseHdr/Drivers/core.h @@ -0,0 +1,134 @@ +/** +* @file core.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __CORE_H__ +#define __CORE_H__ + +#include +#include + +/* core system with all device driver registration + * and data structures + */ + +#define BORDOISILA_DRIVER_RES_CLK 0 +#define BORDOISILA_DRIVER_RES_GATE 1 +#define BORDOISILA_DRIVER_RES_POWER 2 +#define BORDOISILA_DRIVER_RES_REGULATOR 3 +#define BORDOISILA_DRIVER_RES_PIN 4 +#define BORDOISILA_DRIVER_RES_BUS 5 + +#define BORDOISILA_DRIVER_ALREADY_REGISTERED -2 + +typedef struct _bordoisila_drvcore_res_ { + const char* name; + uint8_t res_type; + void* data; + int ref_count; + bool is_running; + struct _bordoisila_drvcore_res_* next; +}BordoisilaDriverResource; + +#define B_DRIVER_STATE_PROBED 0 +#define B_DRIVER_STATE_FAILED 1 +#define B_DRIVER_STATE_UNBOUND 2 + +enum driver_type { + BORDOISILA_DRIVER_NORMAL, + BORDOISILA_DRIVER_BUS_I2C, + BORDOISILA_DRIVER_BUS_SPI, + BORDOISILA_DRIVER_BUS_USB, +}; + + +typedef struct _bordoisila_driver_ { + const char* name; + const char* compat; //match list in DT/acpi bindings + BordoisilaDriverResource* resources; + int num_resource; + enum driver_type type; + + /* Ops*/ + int (*scan)(struct _bordoisila_driver_* dev); + int (*probe)(struct _bordoisila_driver_* dev); + int (*remove)(struct _bordoisila_driver_* dev); + int (*suspend)(struct _bordoisila_driver_* dev); + int (*resume)(struct _bordoisila_driver_* dev); + + void* priv; + uint8_t driver_state; + int refcount; + struct _bordoisila_driver_* parent; + struct _bordoisila_driver_* next; +}BordoisilaDriver; + + +/** + * @brief BordoisilaDriverRegister -- register a driver + * to core registry + */ +AU_EXTERN AU_EXPORT int BordoisilaDriverRegister(BordoisilaDriver* driver); + +/** + * @brief BordoisilaGetDriverByCompat -- match a driver by its + * compat string + * @param compat -- compatibility string, matches to DT/ACPI bindings + */ +AU_EXTERN AU_EXPORT BordoisilaDriver* BordoisilaGetDriverByCompat(char* compat); + +/** + * @brief BordoisilaGetDriverByName -- match a driver by its name + * @param name - name of the driver + */ +AU_EXTERN AU_EXPORT BordoisilaDriver* BordoisilaGetDriverByName(char* name); + +/** + * @brief BordoisilaDriverProbeAll -- start probing all driver registered + */ +extern void BordoisilaDriverProbeAll(); + +/** + * @brief BordoisilaDriverScan -- scan a bus, only applicable + * if the driver is a bus + * @param driver -- pointer to driver + */ +AU_EXTERN AU_EXPORT int BordoisilaDriverScan(BordoisilaDriver* driver); + +AU_EXTERN AU_EXPORT int BordoisilaDriverProbe(BordoisilaDriver* driver); + +AU_EXTERN AU_EXPORT int BordoisilaDriverRemove(BordoisilaDriver* driver); + +AU_EXTERN AU_EXPORT int BordoisilaDriverSuspend(BordoisilaDriver* driver); + +AU_EXTERN AU_EXPORT int BordoisilaDriverResume(BordoisilaDriver* driver); + + +#endif diff --git a/BaseHdr/Drivers/res.h b/BaseHdr/Drivers/res.h new file mode 100644 index 000000000..d2e24685b --- /dev/null +++ b/BaseHdr/Drivers/res.h @@ -0,0 +1,85 @@ +/** +* @file res.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __RESOURCE_H__ +#define __RESOURCE_H__ + +#include +#include +#include + + +typedef struct _clk_ { + BordoisilaDriverResource res; + uint64_t rate_hz; + + int (*enable)(struct _clk_* clk); + int (*disable)(struct _clk_* clk); + int (*set_rate)(struct _clk_* clk); + uint64_t(*get_rate)(struct _clk_* clk); +}BordoisilaClk; + + +typedef struct _regulator_ { + BordoisilaDriverResource res; + + uint32_t microvoltz; + int (*enable)(struct _regulator_* reg); + int (*disable)(struct _regulator_* r); + int (*set_volt)(struct _regulator_* r, uint32_t mv); + int (*get_volt)(struct _regulator_* r); +}BordoisilaRegulator; + + +typedef struct _pmdomain_ { + BordoisilaDriverResource res; + int (*power_on)(struct _pmdomain_* pmd); + int (*power_down)(struct _pmdomain_* pmd); + BordoisilaClk* clk[100]; + BordoisilaRegulator* regulators[100]; +}; + + +/** + * @brief BordoisilaDriverResourceRegister -- register a resource driver + * @param res_ -- pointer to resource driver struct + */ +AU_EXTERN AU_EXPORT int BordoisilaDriverResourceRegister(BordoisilaDriverResource* res_); + +/** + * @brief BordoisilaGetDriverResource -- get a driver resource from global resource + * list + * @param name -- resource name coresponding to DT/ACPI name + * @param type -- type of the resource + */ +AU_EXTERN AU_EXPORT BordoisilaDriverResource* BordoisilaGetDriverResource(const char* name, uint8_t type); + +#endif \ No newline at end of file diff --git a/BaseHdr/Drivers/uart.h b/BaseHdr/Drivers/uart.h index 1f3309429..5453ed4d5 100644 --- a/BaseHdr/Drivers/uart.h +++ b/BaseHdr/Drivers/uart.h @@ -30,6 +30,11 @@ #ifndef __UART_H__ #define __UART_H__ +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include #include #include diff --git a/BaseHdr/Drivers/virtio.h b/BaseHdr/Drivers/virtio.h index 2df7f642a..565330743 100644 --- a/BaseHdr/Drivers/virtio.h +++ b/BaseHdr/Drivers/virtio.h @@ -126,6 +126,7 @@ typedef struct _virtio_net_hdr_ { uint16_t gso_size; uint16_t csum_start; uint16_t csum_offset; + uint16_t padding; }virtio_net_hdr_t; diff --git a/BaseHdr/Fs/Ext2/ext2.h b/BaseHdr/Fs/Ext2/ext2.h index cfbd86c91..91587c68b 100644 --- a/BaseHdr/Fs/Ext2/ext2.h +++ b/BaseHdr/Fs/Ext2/ext2.h @@ -213,4 +213,10 @@ typedef struct _ext2_fs_ { */ AuVFSNode* Ext2Initialise(AuVDisk* vdisk, char* mountname); +uint32_t Ext2ReadBlockIndex(Ext2Fs* fs, uint32_t block_id, uint32_t index); + +uint32_t Ext2FindEntry(Ext2Fs* fs, Ext2Inode* dir_inode, const char* name); + +AuVFSNode* Ext2Open(AuVFSNode* fsys, char* path); + #endif \ No newline at end of file diff --git a/BaseHdr/Fs/Ext2/ext2dir.h b/BaseHdr/Fs/Ext2/ext2dir.h new file mode 100644 index 000000000..455cf0b3a --- /dev/null +++ b/BaseHdr/Fs/Ext2/ext2dir.h @@ -0,0 +1,4 @@ +#include +#include + +AuVFSNode* Ext2CreateDir(AuVFSNode* parent, char* name); \ No newline at end of file diff --git a/BaseHdr/Fs/Ext2/ext2file.h b/BaseHdr/Fs/Ext2/ext2file.h new file mode 100644 index 000000000..f9a55f2b7 --- /dev/null +++ b/BaseHdr/Fs/Ext2/ext2file.h @@ -0,0 +1,12 @@ +#include +#include + +size_t Ext2Write(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t length); + +void Ext2FlushSuperblock(Ext2Fs* fs); + +void Ext2FlushBgdt(Ext2Fs* fs); + +uint32_t Ext2AllocBlock(Ext2Fs* fs); + +int Ext2InodeWrite(Ext2Fs* fs, uint32_t inode_num, Ext2Inode* inode); \ No newline at end of file diff --git a/BaseHdr/Fs/vfs.h b/BaseHdr/Fs/vfs.h index 900dc2404..8ee179661 100644 --- a/BaseHdr/Fs/vfs.h +++ b/BaseHdr/Fs/vfs.h @@ -101,7 +101,7 @@ typedef struct __VFS_NODE__ { uint8_t eof; uint32_t pos; uint32_t parent_block; - uint64_t first_block; + uint32_t first_block; uint64_t current; uint16_t flags; uint8_t status; diff --git a/BaseHdr/Hal/AA64/aa64cpu.h b/BaseHdr/Hal/AA64/aa64cpu.h index 85f915b88..32c995172 100644 --- a/BaseHdr/Hal/AA64/aa64cpu.h +++ b/BaseHdr/Hal/AA64/aa64cpu.h @@ -34,6 +34,7 @@ #include #include +#include #define CPU_IMPLEMENTER_ARM 0x41 #define CPU_IMPLEMENTER_BROADCOM 0x42 @@ -112,4 +113,13 @@ AU_EXTERN AU_EXPORT void AA64SleepMS(uint32_t ms); * @param regs -- Register information passed by sync_exception */ extern void AuAA64SyscallHandler(AA64Registers* regs); + +/** + * @brief aa64_calculate_ticks -- calculate the number of ticks from given milliseconds + * @param seconds -- amount of seconds + * @param out_milliseconds -- where to store the number of ticks + */ +extern void aa64_calculate_ticks(uint64_t seconds, uint64_t subsec, uint64_t* out_seconds, uint64_t* out_subsec); + +extern uint64_t AA64CPUGetFreqencyHz(); #endif diff --git a/BaseHdr/Hal/AA64/aa64lowlevel.h b/BaseHdr/Hal/AA64/aa64lowlevel.h index f292897c4..c9ec4d891 100644 --- a/BaseHdr/Hal/AA64/aa64lowlevel.h +++ b/BaseHdr/Hal/AA64/aa64lowlevel.h @@ -140,6 +140,7 @@ extern void set_cntp_ctl_el0(uint64_t val); extern void setupTimerIRQ(); extern void suspendTimer(); +extern void resetTimer(); extern uint64_t readTimerCtl(); extern uint64_t read_spsr_el1(); diff --git a/BaseHdr/Hal/AA64/sched.h b/BaseHdr/Hal/AA64/sched.h index b4b3690e8..8288001b4 100644 --- a/BaseHdr/Hal/AA64/sched.h +++ b/BaseHdr/Hal/AA64/sched.h @@ -41,6 +41,9 @@ #define THREAD_STATE_BLOCKED 3 #define THREAD_STATE_SLEEP 4 #define THREAD_STATE_KILLABLE 5 +#define THREAD_STATE_LEFT_IN_KERNEL 6 +#define THREAD_STATE_PENDING_SIGNAL 7 +#define THREAD_STATE_RUNNING 8 //! Thread levels ========================================================= //! THREAD_LEVEL_KERNEL -- This bit is set when the thread given is kernel mode @@ -59,13 +62,30 @@ typedef struct _uentry_ { uint64_t cs; uint64_t ss; int num_args; - uint64_t argvaddr; + uint64_t argvaddr; /* user-space VA of argv[] page (for crt0 via stack) */ + uint64_t argvkernel; /* kernel-space VA of argv[] page (for EL1 writes) */ char** argvs; uint64_t stackBase; }AuUserEntry; //#pragma pack(pop) +#define MAX_SIGNAL_ENTRY 10 + + +typedef struct _gp_context_ { + uint64_t x[31]; + uint64_t sp_el0; + uint64_t elr_el1; + uint64_t spsr_el1; +}_gp_context_t; + +typedef struct _signal_frame_ { + AA64Registers regs; + uint64_t elr_el1; + uint64_t sigret_address; +}_signal_frame_t; + //#pragma pack(push,1) typedef struct _aa64_task_ { @@ -110,10 +130,15 @@ typedef struct _aa64_task_ { uint64_t fpcr; uint64_t fpsr; uint32_t syscallNum; + uint64_t sig_pending; + _signal_frame_t signal; + uint64_t start_time_us; + uint64_t* sigs[21]; struct _aa64_task_* next; struct _aa64_task_* prev; }AA64Thread; + //#pragma pack(pop) extern void AuSchedulerInitialize(); extern uint64_t AuCreateKernelStack(uint64_t* pml); @@ -127,7 +152,9 @@ AU_EXTERN AU_EXPORT AA64Thread* AuCreateKthread(void(*entry) (uint64_t),uint64_t * @return Pointer to newly created thread */ AU_EXTERN AU_EXPORT AA64Thread* AuCreateSubKthread(void(*entry) (uint64_t), uint64_t stack, uint64_t* pml, char* name); + extern void AuScheduleThread(AA64Registers*regs); +extern void AuScheduleNext(); extern void AuSchedulerStart(); extern AA64Thread* AuGetIdleThread(); extern AA64Thread* AuGetCurrentThread(); @@ -190,6 +217,19 @@ extern void AuThreadCleanTrash(AA64Thread* t); */ extern uint64_t AuGetSystemTimerTick(); +/** + * @brief AuHandleSleepThreads -- handle sleep thread, + * rearrange all sleep threads + */ +extern void AuHandleSleepThreads(); + +/** + * @brief AuThreadMakeReady -- make a thread forcefully + * ready for next + * @param thread -- pointer to thread struct + */ +extern void AuThreadMakeReady(AA64Thread* thread); + #endif #endif \ No newline at end of file diff --git a/BaseHdr/Hal/basicacpi.h b/BaseHdr/Hal/basicacpi.h index 86e4cb625..1631ccac7 100644 --- a/BaseHdr/Hal/basicacpi.h +++ b/BaseHdr/Hal/basicacpi.h @@ -32,6 +32,11 @@ #include #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif //APIC structure types #define ACPI_APICTYPE_LAPIC 0 diff --git a/BaseHdr/Hal/x86_64_gdt.h b/BaseHdr/Hal/x86_64_gdt.h index fbf797a32..cfef95060 100644 --- a/BaseHdr/Hal/x86_64_gdt.h +++ b/BaseHdr/Hal/x86_64_gdt.h @@ -31,7 +31,7 @@ #define __X86_64_GDT_H__ #include - +#include #define GDT_ENTRY_NULL 0 #define GDT_ENTRY_KERNEL_CODE 1 diff --git a/BaseHdr/Ipc/postbox.h b/BaseHdr/Ipc/postbox.h index 20bfbc7f1..4b9b02fab 100644 --- a/BaseHdr/Ipc/postbox.h +++ b/BaseHdr/Ipc/postbox.h @@ -33,6 +33,11 @@ #define __POSTBOX_H__ #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #ifdef ARCH_X64 #include #elif ARCH_ARM64 diff --git a/BaseHdr/Log/_print.h b/BaseHdr/Log/_print.h new file mode 100644 index 000000000..7d2e6c54a --- /dev/null +++ b/BaseHdr/Log/_print.h @@ -0,0 +1,50 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __PRINT_H__ +#define __PRINT_H__ + +#include + +/** + * @brief _xeprint -- copied from XEClib implementation + * @param output -- pointer to memory buffer, where to put formatted + * string + * @param outputLen -- output len + * @param format -- formatted string + * @param list -- pointer to variable argument list + */ +extern int _xeprint(char* output, int outputlen, const char* format, va_list list); + +extern int _vsnprintf(char* output, size_t sz, const char* format, va_list ap); + +extern int _sprintf(char* output, const char* format, ...); + +extern int _snprintf(char* output, size_t sz, const char* format, ...); +#endif \ No newline at end of file diff --git a/BaseHdr/Log/klog.h b/BaseHdr/Log/klog.h new file mode 100644 index 000000000..9c446503b --- /dev/null +++ b/BaseHdr/Log/klog.h @@ -0,0 +1,62 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2023-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __KERNEL_LOG_H__ +#define __KERNEL_LOG_H__ + +#include +#include + +#define BORDOISILA_DEBUG_LEVEL_COUNT 5 +/** + * Loggin level of bordoisila + */ +typedef enum { + BORDOISILA_EMERG = 0, + BORDOISILA_ERROR, + BORDOISILA_WARN, + BORDOISILA_INFO, + BORDOISILA_DEBUG, +}BLogLevel; + +typedef void (*BLogSinkFunc)(const char* data, uint32_t len, void* ctx); + +/** + * @brief B_KLogInit -- initialize bordoisila + * logging system + */ +extern void B_KLogInit(); +/** + * @brief BPrintK -- print formatted string to circular buffer + * @param level -- logging level + * @param fmt -- formatted string + */ +AU_EXTERN AU_EXPORT void BPrintK(BLogLevel level, const char* fmt, ...); + +#endif diff --git a/BaseHdr/Mm/kmalloc.h b/BaseHdr/Mm/kmalloc.h index a1d49b37a..d903e17b2 100644 --- a/BaseHdr/Mm/kmalloc.h +++ b/BaseHdr/Mm/kmalloc.h @@ -31,6 +31,11 @@ #define _KMALLOC_H #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include diff --git a/BaseHdr/Mm/vmmngr.h b/BaseHdr/Mm/vmmngr.h index 6ab58bdd6..bc343c05f 100644 --- a/BaseHdr/Mm/vmmngr.h +++ b/BaseHdr/Mm/vmmngr.h @@ -40,6 +40,11 @@ */ #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include #ifdef ARCH_X64 diff --git a/BaseHdr/Net/udp.h b/BaseHdr/Net/udp.h index 7f515c4c1..dcd9c4d95 100644 --- a/BaseHdr/Net/udp.h +++ b/BaseHdr/Net/udp.h @@ -63,4 +63,6 @@ extern void UDPProtocolInstall(); */ extern list_t* UDPProtocolGetSockList(); +extern void UDPHandlePacket(char* packet); + #endif \ No newline at end of file diff --git a/BaseHdr/Serv/sysserv.h b/BaseHdr/Serv/sysserv.h index 081b98c2c..67af9b304 100644 --- a/BaseHdr/Serv/sysserv.h +++ b/BaseHdr/Serv/sysserv.h @@ -32,10 +32,12 @@ #include #include +#include #include #ifdef ARCH_ARM64 #include +#include #endif #ifdef ARCH_X64 @@ -44,7 +46,7 @@ #include /* maximum supported system calls */ -#define AURORA_MAX_SYSCALL 58 +//#define AURORA_MAX_SYSCALL 58 #define AURORA_SYSCALL_MAGIC 0x15062023 /* ========================================== @@ -122,6 +124,13 @@ extern void SignalReturn(int num); * @param handler -- handler to register */ extern int SetSignal(int signo, AuSigHandler handler); +#elif ARCH_ARM64 +/* +* SetSignal -- register a signal handler +* @param signo -- signal number +* @param handler -- handler to register +*/ +extern int SetSignal(int signo, AuSignalHandler handler); #endif /** * @brief CreateSharedMem -- create a shared memory chunk @@ -292,6 +301,7 @@ extern int StopTimer(int threadID); */ extern int DestroyTimer(int threadID); + /** * @brief ProcessGetFileDesc -- Searches all process file * descriptor entries for @@ -333,6 +343,16 @@ extern int NetListen(int sockfd, int backlog); */ extern size_t GetEnvironmenBlock(); +/** + * @brief Alarm -- schedules a timer for next one-shot + * @param seconds -- amount of second to consider + */ +extern int Alarm(uint64_t seconds); + +extern int SetITimer(int which, const itimerval_t* new_value, itimerval_t* old_value); + +extern int GetITimer(int which, const itimerval_t* curr_value); + #ifdef ARCH_ARM64 extern AA64Registers* AA64GetCurrentRegCtx(); #endif diff --git a/BaseHdr/aucon.h b/BaseHdr/aucon.h index ede1e6267..74de1b5e1 100644 --- a/BaseHdr/aucon.h +++ b/BaseHdr/aucon.h @@ -31,6 +31,11 @@ #define __AU_CONSOLE_H__ #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #define SCREEN_SETMODE 200 #define SCREEN_GETWIDTH 201 @@ -67,6 +72,19 @@ extern void AuConsoleInitialize(PKERNEL_BOOT_INFO info, bool early); */ extern void AuConsolePostInitialise(PKERNEL_BOOT_INFO info); + +/** + * @brief Prints string to console output + * @param str -- string to print + */ +extern void AuPutS(char* str); + +/** + * @brief Prints string to console output + * @param str -- string to print + * @param col -- foreground color + */ +extern void AuPutS_Color(char* str, uint32_t color); /* * AuTextOut -- standard text printing function * for entire kernel diff --git a/BaseHdr/audrv.h b/BaseHdr/audrv.h index 1b9b2d262..369dadf5e 100644 --- a/BaseHdr/audrv.h +++ b/BaseHdr/audrv.h @@ -31,6 +31,11 @@ #define __AU_DRV_H__ #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #ifdef ARCH_X64 #include #include diff --git a/BaseHdr/aurora.h b/BaseHdr/aurora.h index 509293f4e..9a323cd01 100644 --- a/BaseHdr/aurora.h +++ b/BaseHdr/aurora.h @@ -30,7 +30,6 @@ #ifndef __AURORA_H__ #define __AURORA_H__ - #include @@ -56,6 +55,7 @@ #define AU_EXTERN extern #endif +typedef uint32_t CapRights; #ifdef ARCH_X64 #define KERNEL_STACK_LOCATION 0xFFFFFB0000000000 @@ -65,6 +65,17 @@ #define KERNEL_STACK_SIZE 40960//16384 //16KiB +// macro for llvm compatibility +#ifndef ALIGNED +#if defined(_MSC_VER) + #define ALIGNED(x) __declspec(align(x)) +#elif defined(__GNUC__) || defined(__clang__) + #define ALIGNED(x) __attribute__((aligned(x))) +#else + #define ALIGNED(x) +#endif +#endif + typedef struct _lbprotocol_ { uint64_t initrd_start; diff --git a/BaseHdr/bordoisila_bits.h b/BaseHdr/bordoisila_bits.h new file mode 100644 index 000000000..1b92441f9 --- /dev/null +++ b/BaseHdr/bordoisila_bits.h @@ -0,0 +1,61 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __BORDOISILA_BITS_H__ +#define __BORDOISILA_BITS_H__ + +#include + +#define BITS_PER_BYTE 8 +#define BITS_PER_LONG (sizeof(long) * BITS_PER_BYTE) + +#define BORDOISILA_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +#define BITS_TO_LONGS(nr) BORDOISILA_DIV_ROUND_UP(nr, BITS_PER_LONG) +#define BORDOISILA_BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) + + +#define BORDOISILA_BIT(nr) (1UL << (nr)) +#define BORDOISILA_GENMASK(h, l) (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) + +static inline int __bf_shf(uint32_t mask) { + if (mask == 0) return 0; + int shift = 0; + while ((mask & 1) == 0) { + mask >>= 1; + shift++; + } + return shift; +} + +#define BORDOISILA_GET_FIELD(_mask, _reg) (((_reg) & (_mask)) >> __bf_shf(_mask)) + +#define BORDOISILA_PREP_FIELD(_mask, _val) \ + (((_val) << __bf_shf(_mask)) & (_mask)) + +#endif \ No newline at end of file diff --git a/BaseHdr/bordoisila_io.h b/BaseHdr/bordoisila_io.h new file mode 100644 index 000000000..db814857b --- /dev/null +++ b/BaseHdr/bordoisila_io.h @@ -0,0 +1,113 @@ +/** +* @file bordoisila_io.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __BORDOISILA_IO_H__ +#define __BORDOISILA_IO_H__ + +#include +#include +#include +#include + +#define _bordoisila_readb(addr) (*(volatile uint8_t*)(addr)) +#define _bordoisila_writeb(val, addr) \ + (*(volatile uint8_t*)(addr) = (val));\ + dsb_sy_barrier(); \ + dsb_ish();\ + isb_flush(); + +#define _bordoisila_readw(addr) (*(volatile uint16_t*)(addr)) +#define _bordoisila_writew(addr) \ + (*(volatile uint16_t*)(addr) = (val));\ + dsb_sy_barrier(); \ + dsb_ish();\ + isb_flush(); + +#define _bordoisila_readl(addr) (*(volatile uint32_t*)(addr)) +#define _bordoisila_writel(val,addr) (*(volatile uint32_t*)(addr) = (val));\ + dsb_sy_barrier(); \ + dsb_ish();\ + isb_flush(); + + +static inline int _bordoisila_readl_poll_timeout(uintptr_t addr, uint32_t* val, + uint32_t sleep_us, uint32_t timeout_us) { + uint32_t elapsed = 0; + volatile uint32_t* reg = (volatile uint32_t*)addr; + for (;;) { + *val = *reg; + if (timeout_us && elapsed >= timeout_us) { + return -1; + } + + if (sleep_us) { + AuAA64BoardSleepUS(sleep_us); + elapsed += sleep_us; + } + else { + elapsed++; + } + } +} + +static inline void _bordoisila_update_bits(uintptr_t addr, uint32_t mask, uint32_t val) { + uint32_t current_val = *(volatile uint32_t*)addr; + current_val &= ~mask; + current_val |= (val & mask); + *(volatile uint32_t*)addr = current_val; +} + + +#define _bordoisila_read_poll_timeout(addr, val, cond, sleep_us, timeout_us) ({\ + uint32_t __timeout_us = (timeout_us);\ + uint32_t __elapsed_us = 0; \ + int __ret = 0; \ + while(1){ \ + (val) = *(volatile uint32_t*)(addr);\ + if (cond)\ + break;\ + if (__elapsed_us >= __timeout_us) {\ + __ret = -1; \ + break;\ + } \ + if (sleep_us) { \ + AuAA64BoardSleepUS(sleep_us); \ + __elapsed_us += (sleep_us); \ + }else {\ + __elapsed_us++; \ + }\ + }\ + __ret; \ +}) + + + +#endif diff --git a/BaseHdr/circbuf.h b/BaseHdr/circbuf.h index 4fb5caf27..6d1684e37 100644 --- a/BaseHdr/circbuf.h +++ b/BaseHdr/circbuf.h @@ -32,7 +32,7 @@ #include -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #include #ifndef __cplusplus #include diff --git a/BaseHdr/dtb.h b/BaseHdr/dtb.h index 2d3683d36..18ac3c704 100644 --- a/BaseHdr/dtb.h +++ b/BaseHdr/dtb.h @@ -114,6 +114,13 @@ AU_EXTERN AU_EXPORT uint64_t AuDeviceTreeGetRegAddress(uint32_t* node, uint32_t * @param sizeCell -- value of size cell */ AU_EXTERN AU_EXPORT uint64_t AuDeviceTreeGetRegSize(uint32_t* node, uint32_t addressCell, uint32_t sizeCell); + +AU_EXTERN AU_EXPORT uint32_t AuDeviceTreeGetU32Property(uint32_t* node, const char* property, uint32_t default_val); + +AU_EXTERN AU_EXPORT uint32_t* AuDeviceTreeGetPropCells(uint32_t* node, const char* property, uint32_t* out_num_cells); + +extern void AuDeviceTreeDumpAll(); +extern void AuDeviceTreeDumpAllProps(const char* node_name); /** * @brief AuDeviceTreeInitialize -- initialize the device tree * @param fdt_address -- device tree address passed by diff --git a/BaseHdr/pcie.h b/BaseHdr/pcie.h index f98e2c6cb..05cf4aa2e 100644 --- a/BaseHdr/pcie.h +++ b/BaseHdr/pcie.h @@ -33,6 +33,11 @@ #include #include #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #define PCI_VENDOR_ID 0x00 diff --git a/BaseHdr/pe.h b/BaseHdr/pe.h index 10f000efb..e7cc5577d 100644 --- a/BaseHdr/pe.h +++ b/BaseHdr/pe.h @@ -32,8 +32,7 @@ #include - -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #ifndef __cplusplus #include #endif diff --git a/BaseHdr/process.h b/BaseHdr/process.h index f6f08b5b1..7dce1a414 100644 --- a/BaseHdr/process.h +++ b/BaseHdr/process.h @@ -30,11 +30,16 @@ #ifndef __PROCESS_H__ #define __PROCESS_H__ - +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include #include #include #include +#include #ifdef ARCH_ARM64 #include @@ -100,6 +105,21 @@ typedef struct _au_proc_cred_ { uint16_t num_sgid; }AuProcCredentials; +/** + * _sys_proc_list -- a way to report current status + * of information about all processes + */ +typedef struct _sys_proc_list_ { + int proc_id; + char name[16]; + uint64_t total_runtime_us; + uint64_t window_runtime_us; + uint32_t num_threads; + uint32_t num_file_opened; + uint32_t cpu_usage; +}AuProcessList; + + //#pragma pack(push,1) typedef struct _au_proc_ { char name[16]; @@ -115,7 +135,11 @@ typedef struct _au_proc_ { size_t _user_stack_index_; size_t _kstack_index_; uint64_t _envp_block_; - + uint64_t total_runtime_us; + uint64_t window_runtime_us; + uint32_t cpu_usage; + uint64_t prev_sample_runtime_us; + uint64_t prev_sample_time_us; #ifdef ARCH_X64 /* threading section */ AuThread* main_thread; @@ -134,6 +158,8 @@ typedef struct _au_proc_ { /* file descriptors */ AuVFSNode* fds[FILE_DESC_PER_PROCESS]; + /* capability table -- parallel to fds[]*/ + AuCapability caps[FILE_DESC_PER_PROCESS]; /*loader related data*/ AuVFSNode *file; AuVFSNode *fsys; @@ -279,7 +305,7 @@ extern int AuProcessGetFileDesc(AuProcess* proc); * @param pid -- pid of the process, if -1 then any child * process */ -extern void AuProcessWaitForTermination(AuProcess *proc, int pid); +extern int AuProcessWaitForTermination(AuProcess *proc, int pid); #ifdef ARCH_X64 extern AuMutex* AuProcessGetMutex(); @@ -311,4 +337,18 @@ extern uint64_t* CreateSubUserStack(AuProcess* proc, uint64_t* cr3); */ extern int AuCreateUserthread(AuProcess* proc, void(*entry) (), char *name); +/** + * @brief AuProcGetNumProcessCount -- returns the total number + * of process created + */ +extern int AuProcGetNumProcessCount(); + +/** + * @brief AuProcessFetch -- fetch current process table + * status + * @param list -- Pointer to AuProcessList + * @param num_proc_count -- number of process count + */ +extern int AuProcessFetch(AuProcessList* list, int num_proc_count); + #endif \ No newline at end of file diff --git a/BaseHdr/signal.h b/BaseHdr/signal.h new file mode 100644 index 000000000..4f0ad59f9 --- /dev/null +++ b/BaseHdr/signal.h @@ -0,0 +1,95 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __SIGNAL_H__ +#define __SIGNAL_H__ + +#include +#include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif + +typedef enum _signal_num_ { + SIGHUP = 1, /* Terminal closed or hangup*/ + SIGINT, /* Interrupt (CTRL+C) */ + SIGQUIT, /* Quit (CTRL+), generate core dump */ + SIGILL, /* Illegal instruction*/ + SIGTRAP, /* Breakpoint or trace trap */ + SIGABRT, /* Abort a process */ + SIGBUS, /* Bus error */ + SIGFPE, /* Floating-point exception */ + SIGKILL, /* Forcefully terminate */ + SIGUSR1, /* User-defined signal 1*/ + SIGSEGV, /* Invalid memory access (segmentation fault) */ + SIGUSR2, /* user-defined signal 2*/ + SIGPIPE, /* Write to a broken pipe */ + SIGALRM, /* Alarm timer expired */ + SIGTERM, /* Graceful termination request */ + SIGCHLD = 17, /*Child process stopped or exited */ + SIGCONT, /* Continue a stopped process */ + SIGSTOP, /* Stop process */ + SIGTSTP, /* Terminal stop */ + SIGTTIN, /* Background process attempted terminal input */ + SIGTTOU, /* Background process attempted terminal output */ +}AuSignalNumber; + +typedef void(*AuSignalHandler)(int signum); +/** + * @brief AuAllocSignal -- allocate a signal onto the + * signal queue of thread + * @param thread -- Pointer to destination thread + * @param sigNum -- signal number + */ +extern int AuAllocSignal(AA64Thread* thread, int sigNum); + + +/** + * @brief AuSignalDeliver -- deliver the current thread's + * signal + * @param current_thread -- pointer to thread + */ +extern bool AuSignalDeliver(AA64Thread* current_thread); + +/** + * @brief AuSignalDispatch -- dispatch a signal + * @param thr -- pointer to thread + */ +extern int AuSignalDispatch(AA64Thread* thr); + +/** + * @brief AuSignalInitializeTrampoline -- installs + * return trampoline code to threads sig return address + * @param t -- pointer to thread struct + */ +extern void AuSignalInitializeTrampoline(AA64Thread* t); + +#endif diff --git a/BaseHdr/stack.h b/BaseHdr/stack.h index ef292263b..710dec007 100644 --- a/BaseHdr/stack.h +++ b/BaseHdr/stack.h @@ -40,6 +40,7 @@ typedef struct _stack_item_ { typedef struct _stack_{ AuStackItem* top; + AuStackItem* bottom; int itemCount; }AuStack; diff --git a/BaseHdr/stdarg.h b/BaseHdr/stdarg.h index c7766635b..167dd9aa4 100644 --- a/BaseHdr/stdarg.h +++ b/BaseHdr/stdarg.h @@ -38,8 +38,12 @@ extern "C" #endif +#ifdef __GNUC__ + typedef __builtin_va_list va_list; +#else /* va list parameter list */ typedef unsigned char* va_list; +#endif /* width of stack == width of int */ @@ -51,7 +55,7 @@ extern "C" ((sizeof(TYPE)+sizeof(STACKITEM)-1) \ & ~(sizeof(STACKITEM)-1)) -#ifdef ARCH_X64 +#if defined(ARCH_X64) || defined(__x86_64__) /* &(LASTARG) points to the LEFTMOST argument of the function call (before the ...) */ #define va_start(AP, LASTARG) \ @@ -62,7 +66,12 @@ extern "C" #define va_arg(AP, TYPE) \ (AP += VA_SIZE(TYPE), *((TYPE *)(AP - VA_SIZE(TYPE)))) -#elif ARCH_ARM64 +#elif defined(ARCH_ARM64) || defined(__aarch64__) +#ifdef __GNUC__ +#define va_start(ap, last) __builtin_va_start(ap, last) +#define va_arg(ap, type) __builtin_va_arg(ap, type) +#define va_end(ap) __builtin_va_end(ap) +#else #define va_start(ap,last) \ ((ap) = (va_list)(&(last)) + 8) @@ -72,6 +81,7 @@ extern "C" #define va_end(ap) \ ((ap) = (va_list)0) #endif +#endif #ifdef __cplusplus } diff --git a/BaseHdr/stdbool.h b/BaseHdr/stdbool.h new file mode 100644 index 000000000..b95f73f73 --- /dev/null +++ b/BaseHdr/stdbool.h @@ -0,0 +1,43 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2023-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __STDBOOL_H__ +#define __STDBOOL_H__ + +#ifndef __cplusplus + +#define bool _Bool +#define true 1 +#define false 0 + +#endif + +#define __bool_true_false_are_defined 1 + +#endif \ No newline at end of file diff --git a/BaseHdr/stddef.h b/BaseHdr/stddef.h new file mode 100644 index 000000000..9d1058e94 --- /dev/null +++ b/BaseHdr/stddef.h @@ -0,0 +1,44 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2023-2025, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __STDDEF_H__ +#define __STDDEF_H__ + +#include <_null.h> +#include + + +typedef int64_t ptrdiff_t; +typedef int64_t ssize_t; +typedef unsigned int wint_t; + +#if !defined(__cplusplus) +typedef unsigned wchar_t; +#endif +#endif diff --git a/BaseHdr/stdint.h b/BaseHdr/stdint.h index 2f25b6ef7..3bb0bd5c2 100644 --- a/BaseHdr/stdint.h +++ b/BaseHdr/stdint.h @@ -38,9 +38,7 @@ typedef unsigned char BOOL; #ifdef ARCH_ARM64 #if !defined(bool) -#define bool BOOL -#define true 1 -#define false 0 +#include #endif #endif @@ -88,12 +86,11 @@ typedef unsigned int uint_fast32_t; typedef long long int_fast64_t; typedef unsigned long long uint_fast64_t; -/* 7.18.1.4 Integer types capable of holding object pointers */ -typedef int intptr_t; - -#if defined(ARCH_ARM64) || defined(ARCH_X64) -typedef __int64 uintptr_t; +#if defined(ARCH_ARM64) || defined(__aarch64__) || defined(ARCH_X64) || defined(__x86_64__) +typedef long long intptr_t; +typedef unsigned long long uintptr_t; #else +typedef int intptr_t; typedef unsigned int uintptr_t; #endif @@ -101,8 +98,11 @@ typedef unsigned int uintptr_t; typedef long long intmax_t; typedef unsigned long long uintmax_t; +#ifdef __SIZE_TYPE__ +typedef __SIZE_TYPE__ size_t; +#else typedef uint64_t size_t; - +#endif /* 7.18.2 Limits of specified-width integer types */ #if defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) @@ -171,9 +171,13 @@ object pointers */ #define SIG_ATOMIC_MIN INT32_MIN #define SIG_ATOMIC_MAX INT32_MAX - -#define SIZE_MAX 0xFFFFF //UINT32_MAX - +#ifndef SIZE_MAX +#if defined(ARCH_ARM64) || defined(__aarch64__) || defined(ARCH_X64) || defined(__x86_64__) +#define SIZE_MAX UINT64_MAX +#else +#define SIZE_MAX UINT32_MAX +#endif +#endif #ifndef WCHAR_MIN /* also in wchar.h */ #define WCHAR_MIN 0 #define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */ @@ -235,4 +239,50 @@ extern "C++" { #define ALIGN_UP(x, y) (DIV_ROUND_UP(x,y)*y) +#ifndef do_div +#define do_div(n, base) { \ + uint64_t __base = (base); \ + uint64_t __rem = n % __base; \ + n = n / __base; \ + __rem; \ + } +#endif + +#define clamp_t(type, val, lo, hi) \ + ((type)(val) < (type)(lo) ? (type)(lo) : ((type)(val) > (type)(hi)? (type)(hi) : (type)(val))) + +static inline int64_t div_round_closest_s64(int64_t x, int64_t divisor) { + if ((x > 0) == (divisor > 0)) + return (x + divisor / 2) / divisor; + else + return (x - divisor / 2) / divisor; +} + +static inline uint64_t div_round_closest_u64(uint64_t x, uint64_t divisor) { + return (x + divisor / 2) / divisor; +} + +static inline int32_t div_round_closest_s32(int32_t x, int32_t divisor) { + if ((x > 0) == (divisor > 0)) + return (x + divisor / 2) / divisor; + else + return (x - divisor / 2) / divisor; +} + + +static inline uint32_t div_round_closest_u32(uint32_t x, uint32_t divisor) { + return (x + divisor / 2) / divisor; +} + +#define DIV_ROUND_CLOSEST(x, divisor) _Generic((x), \ + int64_t: div_round_closest_s64, \ + uint64_t: div_round_closest_u64, \ + int32_t: div_round_closest_s32, \ + uint32_t: div_round_closest_u32, \ + default: div_round_closest_s32 \ +)(x,divisor) + +#define CLAMP(val, lo, hi) ((val) < (lo) ? (lo) : ((val) > (hi) ? (hi) : (val))) + +#define ABS(x) ((x) < 0 ? -(x) : (x)) #endif \ No newline at end of file diff --git a/BaseHdr/string.h b/BaseHdr/string.h index 19711266f..c1a6ab048 100644 --- a/BaseHdr/string.h +++ b/BaseHdr/string.h @@ -37,6 +37,7 @@ AU_EXTERN{ #endif + /* * Global Functions !! */ @@ -47,10 +48,11 @@ AU_EXTERN{ AU_EXPORT int strncmp(const char* s1, const char *s2, size_t n); AU_EXPORT char *strncpy(char *destString, const char* sourceString, size_t maxLength); AU_EXPORT char* strchr(char* str, int character); + AU_EXPORT char* strrchr(const char* str, int c); AU_EXPORT char *strcat(char *destString, const char *sourceString); AU_EXPORT char *strncat(char *destString, const char *sourceString, size_t maxLength); AU_EXPORT void memset(void *targ, int val, uint32_t len); - AU_EXPORT void memcpy(void *targ, void *src, size_t len); + AU_EXPORT void* memcpy(void *targ, void *src, size_t len); AU_EXPORT int memcmp(const void *first, const void *second, size_t length); AU_EXPORT void* memmove(void*, const void*, size_t); AU_EXPORT char* strdup(const char* c); diff --git a/BaseHdr/timer.h b/BaseHdr/timer.h index 08bbb9a88..32aab266a 100644 --- a/BaseHdr/timer.h +++ b/BaseHdr/timer.h @@ -33,6 +33,12 @@ #define __TIMER_H__ #include +#include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif typedef void (*AuroraTimerCallback)(void* param); @@ -42,6 +48,7 @@ typedef struct _kernel_timer_ { AuroraTimerCallback handler; void* param; uint8_t active; + AA64Thread* owner; }AuKernelTimer; #define AURORA_MAX_TIMER 32 @@ -92,5 +99,34 @@ AU_EXTERN AU_EXPORT uint64_t AuGetCurrentMS(); AU_EXTERN AU_EXPORT uint64_t AuGetCurrentUS(); +/** + * @brief AuTimerCalculateAlarm -- schedule a timer to one-shot mode + * respective to given seconds + * @param thr -- pointer to thread which requires one-shot timer + * @param seconds -- amount of second to wait + */ +extern int AuTimerCalculateAlarm(AA64Thread* thr, uint64_t seconds); + +/* POSIX Timer API */ +typedef struct _itimerval_ { + timeval it_interval; + timeval it_value; +}itimerval_t; + +typedef struct _timeval_t_ { + long tv_sec; + long tv_usec; +}timeval_t; + + + +/** + *@brief AuTimerSetITimer -- posix standard implementation of + * setting periodic timer + */ +extern int AuTimerSetITimer(AA64Thread* thr, int which, const itimerval_t* newval, itimerval_t* oldval); +extern int AuTimerGetITimer(AA64Thread* thr, int which, itimerval_t* curr_value); +extern void AuSetWalltime(int64_t sec, int64_t nsec); +extern void AuGetWalltime(int64_t* out_sec, int64_t* out_ns); #endif diff --git a/BaseHdr/va_list.h b/BaseHdr/va_list.h index 3ff4f2c75..872247e85 100644 --- a/BaseHdr/va_list.h +++ b/BaseHdr/va_list.h @@ -50,6 +50,7 @@ extern "C" #endif +#ifndef __GNUC__ #define STACKITEM int #define VA_SIZE(TYPE) \ @@ -63,6 +64,7 @@ extern "C" #define va_arg(AP, TYPE) \ (AP += VA_SIZE(TYPE), *((TYPE *)(AP - VA_SIZE(TYPE)))) +#endif #endif diff --git a/Boot/Boot.vcxproj b/Boot/Boot.vcxproj index d76ba94d9..17e2590dc 100644 --- a/Boot/Boot.vcxproj +++ b/Boot/Boot.vcxproj @@ -187,7 +187,7 @@ efi_main - copy "$(SolutionDir)Build\EFI\BOOT\$(TargetName).efi" M:\EFI\BOOT\$(TargetName).efi" + if exist M:\ ( copy "$(SolutionDir)Build\EFI\BOOT\$(TargetName).efi" "M:\EFI\BOOT\$(TargetName).efi" ) else ( echo M: drive not found, skipping copy ) diff --git a/BootAA64/BootAA64.vcxproj b/BootAA64/BootAA64.vcxproj index 0257ccbb4..56a389313 100644 --- a/BootAA64/BootAA64.vcxproj +++ b/BootAA64/BootAA64.vcxproj @@ -220,7 +220,7 @@ false - copy "$(SolutionDir)Build\EFI\BOOT\$(TargetName).efi" "M:\EFI\BOOT\$(TargetName).efi" + if exist M:\ ( copy "$(SolutionDir)Build\EFI\BOOT\$(TargetName).efi" "M:\EFI\BOOT\$(TargetName).efi" ) else ( echo M: drive not found, skipping copy ) diff --git a/BootAA64/Makefile b/BootAA64/Makefile index 219b704f4..4b3306a48 100644 --- a/BootAA64/Makefile +++ b/BootAA64/Makefile @@ -2,8 +2,13 @@ TARGET_EFI = BOOTAA64.efi TARGET_SO = BOOTAA64.so -# Setting OBJCOPY -OBJCOPY = aarch64-linux-gnu-objcopy +# Default toolchain is GCC +TOOLCHAIN ?= gcc + +# Triggered when you run "make llvm" +.PHONY: all clean llvm +llvm: + @$(MAKE) TOOLCHAIN=llvm all # Source files CPP_SRCS = clib.cpp devicetree.cpp file.cpp mem.cpp paging.cpp pe.cpp physm.cpp uart0.cpp vector.cpp video.cpp xnldr.cpp xnout.cpp @@ -26,23 +31,6 @@ else BOARD_FLAG = -D__TARGET_BOARD_QEMU_VIRT__ endif -# Compiler flags -CXXFLAGS = -Wno-error=pragmas -fPIE \ - -Wall -Wextra -funsigned-char -fshort-wchar \ - -fno-strict-aliasing -ffreestanding -fno-stack-protector -fno-stack-check \ - -fno-merge-all-constants -std=c++17 -DGNU_EFI_USE_MS_ABI $(BOARD_FLAG) $(INCLUDES) - -# GNU-EFI link setup -LDSCRIPT = ${GNU_EFI_DIR}/gnuefi/elf_aarch64_efi.lds -CRT0 = ${GNU_EFI_DIR}/aarch64/gnuefi/crt0-efi-aarch64.o -LIBS = -lgnuefi -lefi -LIBDIRS = -L${GNU_EFI_DIR}/aarch64/gnuefi -L${GNU_EFI_DIR}/aarch64/lib - -# Tools -CXX = aarch64-linux-gnu-g++ -CC = aarch64-linux-gnu-gcc -LD = aarch64-linux-gnu-ld - # Output paths SO_OUTPUT = $(TARGET_SO) EFI_OUTPUT = Build/EFI/BOOT/$(TARGET_EFI) @@ -52,11 +40,49 @@ CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) ASM_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(ASM_SRCS)) OBJS = $(CPP_OBJS) $(ASM_OBJS) -.PHONY: all clean +ifeq ($(TOOLCHAIN),llvm) + +#* llvm configuration + CC =clang + CXX =clang++ + + LLVM_TARGET = -target aarch64-unknown-windows + + CXXFLAGS = $(LLVM_TARGET) -Wno-error=pragmas \ + -Wall -Wextra -funsigned-char -fshort-wchar \ + -ffreestanding -fno-stack-protector \ + -std=c++17 $(BOARD_FLAG) $(INCLUDES) + + LDFLAGS = $(LLVM_TARGET) -fuse-ld=lld -nostdlib -Wl,-entry:efi_main -Wl,-subsystem:efi_application +else + +#* original gcc configuration + CC = aarch64-linux-gnu-gcc + CXX = aarch64-linux-gnu-g++ + LD = aarch64-linux-gnu-ld + OBJCOPY = aarch64-linux-gnu-objcopy + + CXXFLAGS = -Wno-error=pragmas -fPIE \ + -Wall -Wextra -funsigned-char -fshort-wchar \ + -fno-strict-aliasing -ffreestanding -fno-stack-protector -fno-stack-check \ + -fno-merge-all-constants -std=c++17 -DGNU_EFI_USE_MS_ABI $(BOARD_FLAG) $(INCLUDES) + + LDSCRIPT = ${GNU_EFI_DIR}/gnuefi/elf_aarch64_efi.lds + CRT0 = ${GNU_EFI_DIR}/aarch64/gnuefi/crt0-efi-aarch64.o + LIBS = -lgnuefi -lefi + LIBDIRS = -L${GNU_EFI_DIR}/aarch64/gnuefi -L${GNU_EFI_DIR}/aarch64/lib +endif + +# build rules all: $(EFI_OUTPUT) -# Link aarch64 EFI binary +ifeq ($(TOOLCHAIN), llvm) +$(EFI_OUTPUT): $(OBJS) + @mkdir -p $(dir $@) + $(CXX) $(LDFLAGS) $(OBJS) -o $@ +else +# Original GCC compilation $(SO_OUTPUT): $(CRT0) $(OBJS) $(LD) -nostdlib --warn-common --no-undefined --build-id=sha1 -z noexecstack -z max-page-size=4096 \ -shared -Bsymbolic $(LIBDIRS) -T$(LDSCRIPT) $(CRT0) $(OBJS) -o $@ $(LIBS) @@ -64,8 +90,9 @@ $(SO_OUTPUT): $(CRT0) $(OBJS) $(EFI_OUTPUT): $(SO_OUTPUT) @mkdir -p $(dir $@) $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .rodata -j .rel -j .rela \ - -j .rel.* -j .rela.* -j .rel* -j .rela* -j .areloc \ + -j .rel.* -j .rela.* -j .rel* -j .rela* -j .areloc \ -j .reloc --target=efi-app-aarch64 --subsystem=10 $< $@ +endif # Compile C++ source files $(OBJDIR)/%.o: %.cpp @@ -78,4 +105,4 @@ $(OBJDIR)/%.o: %.s $(CC) $(CXXFLAGS) -c $< -o $@ clean: - rm -rf $(OBJDIR) Build $(SO_OUTPUT) $(EFI_OUTPUT) + rm -rf $(OBJDIR) Build $(TARGET_SO) \ No newline at end of file diff --git a/BootAA64/clib.cpp b/BootAA64/clib.cpp index 1038064cc..1ada31d47 100644 --- a/BootAA64/clib.cpp +++ b/BootAA64/clib.cpp @@ -31,36 +31,47 @@ #include "clib.h" -void memset(void* targ, uint8_t val, uint32_t len) { - uint8_t* t = (uint8_t*)targ; - while (len--) - *t++ = val; -} +#ifdef _MSC_VER +#pragma function(memcpy, memset, strlen) +#endif -void _memcpy(void* targ, void* src, uint32_t len) { - uint8_t* t = (uint8_t*)targ; - uint8_t* s = (uint8_t*)src; - if (len > 0) { - // check to see if target is in the range of src and if so, do a memmove() instead - if ((t > s) && (t < (s + len))) { - t += (len - 1); - s += (len - 1); - while (len--) - *t-- = *s++; - } - else { - while (len--) - *t++ = *s++; + +extern "C" { + void* memset(void* targ, uint8_t val, uint32_t len) { + uint8_t* t = (uint8_t*)targ; + while (len--) + *t++ = val; + return targ; + } + + void* _memcpy(void* targ, void* src, uint32_t len) { + uint8_t* t = (uint8_t*)targ; + uint8_t* s = (uint8_t*)src; + if (len > 0) { + // check to see if target is in the range of src and if so, do a memmove() instead + if ((t > s) && (t < (s + len))) { + t += (len - 1); + s += (len - 1); + while (len--) + *t-- = *s--; + } + else { + while (len--) + *t++ = *s++; + } } + return targ; } -} -void memcpy(void* targ, void* src, uint32_t len) { -#ifdef EFI_1_10_SYSTEM_TABLE_REVISION - gBS->CopyMem(targ, src, len); -#else - _memcpy(targ, src, len); -#endif + void* memcpy(void* targ, void* src, uint32_t len) { + return _memcpy(targ, src, len); + } + + size_t strlen(const char* s) { + size_t l = 0; + while (*s++)++l; + return l; + } } wchar_t* wstrchr(wchar_t* s, int c) { @@ -122,10 +133,3 @@ char* sztoa(size_t value, char* str, int base) { } return str; } - - -size_t strlen(const char* s) { - size_t l = 0; - while (*s++)++l; - return l; -} diff --git a/BootAA64/clib.h b/BootAA64/clib.h index a5e08b6a8..0812adb64 100644 --- a/BootAA64/clib.h +++ b/BootAA64/clib.h @@ -32,21 +32,24 @@ #include -#include +//#include #ifdef __cplusplus extern "C" { #endif +void* memset(void* targ, uint8_t val, uint32_t len); +void* memcpy(void* targ, void* src, uint32_t len); +size_t strlen(const char* s); #ifdef __cplusplus } #endif -extern void memset(void* targ, uint8_t val, uint32_t len); -extern void memcpy(void* targ, void* src, uint32_t len); +// extern void memset(void* targ, uint8_t val, uint32_t len); +// extern void memcpy(void* targ, void* src, uint32_t len); extern wchar_t* wstrchr(wchar_t* s, int c); extern int wstrlen(wchar_t* s); extern uint32_t wstrsize(wchar_t* s); @@ -54,7 +57,7 @@ extern int to_upper(int c); extern int to_lower(int c); extern int is_digit(int c); extern char* sztoa(size_t value, char* str, int base); -extern size_t strlen(const char* s); +// extern size_t strlen(const char* s); #endif diff --git a/BootAA64/file.cpp b/BootAA64/file.cpp index 511adf045..338be3fd8 100644 --- a/BootAA64/file.cpp +++ b/BootAA64/file.cpp @@ -111,26 +111,26 @@ XEFile* XEOpenAndReadFile(EFI_HANDLE ImageHandle, CHAR16* Filename) { XEGuiPrint("Failed to locate image handle \n"); return 0; } - - + + Status = gBS->HandleProtocol(loadedImage->DeviceHandle, &sfsprotocol, (VOID**)&SimpleFileSystem); if (EFI_ERROR(Status)) { XEGuiPrint("Failed to locate file system protocol \n"); return 0; } - + Status = SimpleFileSystem->OpenVolume(SimpleFileSystem, &Root); if (EFI_ERROR(Status)) { XEGuiPrint("Failed to open the root directory \n"); return 0; } - + Status = Root->Open(Root, &File, Filename, EFI_FILE_MODE_READ, 0); if (EFI_ERROR(Status)) { XEGuiPrint("Failed to open file \n"); return 0; } - + Status = File->GetInfo(File, &GenericFileInfo, &FileInfoSize, NULL); if (Status == EFI_BUFFER_TOO_SMALL) { Status = gBS->AllocatePool(EfiBootServicesData, FileInfoSize, (VOID**)&FileInfo); @@ -140,7 +140,7 @@ XEFile* XEOpenAndReadFile(EFI_HANDLE ImageHandle, CHAR16* Filename) { return 0; } } - + Status = File->GetInfo(File, &GenericFileInfo, &FileInfoSize, FileInfo); if (EFI_ERROR(Status)) { XEGuiPrint("Failed to get file metadata \n"); @@ -148,7 +148,6 @@ XEFile* XEOpenAndReadFile(EFI_HANDLE ImageHandle, CHAR16* Filename) { File->Close(File); return 0; } - FileSize = FileInfo->FileSize; gBS->FreePool(FileInfo); diff --git a/BootAA64/lowlevel.s b/BootAA64/lowlevel.s index 6449fa668..3bf40da2a 100644 --- a/BootAA64/lowlevel.s +++ b/BootAA64/lowlevel.s @@ -159,9 +159,9 @@ callKernel: //x1 -- stack //x2 -- stacksz //x3 -- entry - add x1, x1, x2 - bic x1, x1, #15 //align it to 16-byte boundary - mov sp, x1 + //add x1, x1, x2 + //bic x1, x1, #15 //align it to 16-byte boundary + //mov sp, x1 //sub sp, sp, #0x28 stp x29, x30, [sp, #-16]! diff --git a/BootAA64/paging.cpp b/BootAA64/paging.cpp index 4c3b6a435..7491cd1eb 100644 --- a/BootAA64/paging.cpp +++ b/BootAA64/paging.cpp @@ -87,10 +87,8 @@ void XEPagingInitialize() { else previousBase = read_ttbr0_el2(); - XEGuiPrint("ttbr0: %x \n", previousBase); bool required_sctrl = 0; l0_table_base = (uint64_t*)previousBase; - XEGuiPrint("el value : %d \r\n", _getCurrentEL()); if (previousBase == 0) { previousBase = XEPmmngrAllocate(); XEGuiPrint("pREVIOUS Base : %x \r\n", previousBase); diff --git a/BootAA64/pe.cpp b/BootAA64/pe.cpp index 3477f16af..4700ea9e3 100644 --- a/BootAA64/pe.cpp +++ b/BootAA64/pe.cpp @@ -105,4 +105,4 @@ void XEPELoadImage(void* filebuff) { if (sectionHeader[i].VirtualSize > sectionHeader[i].SizeOfRawData) zero_mem(raw_offset(sect_addr, sectionHeader[i].SizeOfRawData), sectionHeader[i].VirtualSize - sectionHeader[i].SizeOfRawData); } -} +} \ No newline at end of file diff --git a/BootAA64/pe.h b/BootAA64/pe.h index 67657fdee..075ef60f5 100644 --- a/BootAA64/pe.h +++ b/BootAA64/pe.h @@ -56,7 +56,7 @@ typedef struct _IMAGE_DOS_HEADER_ { uint16_t e_oemid; uint16_t e_oeminfo; uint16_t e_res2[10]; - uint16_t e_lfanew; + uint32_t e_lfanew; } IMAGE_DOS_HEADER, * PIMAGE_DOS_HEADER; typedef struct _IMAGE_NT_HEADERS_PE32_ IMAGE_NT_HEADERS_PE32, * PIMAGE_NT_HEADERS_PE32; diff --git a/BootAA64/physm.cpp b/BootAA64/physm.cpp index 888410178..5fac63046 100644 --- a/BootAA64/physm.cpp +++ b/BootAA64/physm.cpp @@ -58,9 +58,10 @@ void XEInitialisePmmngr(const struct EfiMemoryMap memmap, void* buffer, size_t b bufsize /= 2; allocatedPtr = allocatedStack = raw_offset(buffer, bufsize); allocatedCount = 1; + EFI_MEMORY_DESCRIPTOR* current = memmap.memmap; - while (raw_diff(current, memmap.memmap) < memmap.MemMapSize) + while ((size_t)raw_diff(current, memmap.memmap) < memmap.MemMapSize) { ramSize += current->NumberOfPages * 4096; diff --git a/BootAA64/uart0.cpp b/BootAA64/uart0.cpp index 48ee30a6b..f876ff018 100644 --- a/BootAA64/uart0.cpp +++ b/BootAA64/uart0.cpp @@ -28,6 +28,7 @@ **/ #include "uart0.h" +#include #include "rpi3b/mbox.h" #include "clib.h" #include diff --git a/BootAA64/video.cpp b/BootAA64/video.cpp index 8186508e3..a1bee8c94 100644 --- a/BootAA64/video.cpp +++ b/BootAA64/video.cpp @@ -79,7 +79,7 @@ EFI_STATUS XEInitialiseGraphics(EFI_GRAPHICS_OUTPUT_PROTOCOL* GraphicsOutput) { pixel.Green = 115; pixel.Red = 0; - // GraphicsOutput->Blt(GraphicsOutput, &pixel, EfiBltVideoFill, 0, 0, 0, 0, info->HorizontalResolution, info->VerticalResolution, 0); + //GraphicsOutput->Blt(GraphicsOutput, &pixel, EfiBltVideoFill, 0, 0, 0, 0, info->HorizontalResolution, info->VerticalResolution, 0); // QEMU ramfb Blt can be buggy, so manually fill the framebuffer with the background color uint32_t bg_color = RGB(0, 115, 164); diff --git a/BootAA64/video.h b/BootAA64/video.h index d7a6fd7fd..e8a2dad55 100644 --- a/BootAA64/video.h +++ b/BootAA64/video.h @@ -38,16 +38,16 @@ #define RGB(r, g, b) \ - ((r & 0xFF) | ((g << 8)&0xFF00) | ((b << 16)&0xFF0000)) + (((b) & 0xFF) | (((g) << 8) & 0xFF00) | (((r) << 16) & 0xFF0000)) // ((r & 0xFF) | ((g << 8)&0xFF00) | ((b << 16)&0xFF0000)) #define RED(col)\ - (col & 0xFF) + ((col >> 16) & 0xFF) #define GREEN(col)\ ((col>>8) & 0xFF) #define BLUE(col) \ - ((col>>16) & 0xFF) + (col & 0xFF) /* * XEInitialiseGraphics -- Initialise the screen and store graphics diff --git a/BootAA64/xnldr.cpp b/BootAA64/xnldr.cpp index ca3f6f869..df4842b83 100644 --- a/BootAA64/xnldr.cpp +++ b/BootAA64/xnldr.cpp @@ -128,9 +128,6 @@ MENU_ITEM MenuItem[] = { * @param SystemTable -- Pointer to EFI SYSTEM TABLE */ int XEGetScreenResolutionMode(EFI_SYSTEM_TABLE* SystemTable) { -#ifdef __TARGET_BOARD_QEMU_VIRT__ - return 1; -#endif EFI_STATUS Status; UINTN SelectedIndex = 0; EFI_INPUT_KEY Key; @@ -142,7 +139,7 @@ int XEGetScreenResolutionMode(EFI_SYSTEM_TABLE* SystemTable) { XEPrintf(const_cast(L"Copyright (C) Manas Kamal Choudhury 2020-2025 \r\n")); XEPrintf(const_cast(L"Select a screen resolution:\r\n")); XEPrintf(const_cast(L"\r\n")); - for (UINTN i = 0; i < MENU_SIZE; i++) { + for (UINTN i = 0; i < 4; i++) { if (i == SelectedIndex) { SystemTable->ConOut->SetAttribute(SystemTable->ConOut, EFI_WHITE | EFI_BACKGROUND_BLUE); } @@ -195,15 +192,19 @@ UINTN XESetGraphicsMode(EFI_SYSTEM_TABLE* SystemTable, int index) { switch (index) { case 1: + XEPrintf(const_cast(L"index 1 selected \r\n")); dwidth = 1024, dheight = 768; break; case 2: + XEPrintf(const_cast(L"index 2 selected \r\n")); dwidth = 1280, dheight = 1024; break; case 3: + XEPrintf(const_cast(L"index 3 selected \r\n")); dwidth = 1920, dheight = 1080; break; default: + XEPrintf(const_cast(L"index 0 selected \r\n")); dwidth = 640, dheight = 480; break; } @@ -219,11 +220,12 @@ UINTN XESetGraphicsMode(EFI_SYSTEM_TABLE* SystemTable, int index) { MaxMode = GraphicsOutput->Mode->MaxMode; XEPrintf(const_cast(L"Available Screen Resolution:\r\n")); for (UINTN i = 0; i < MaxMode; i++) { - EFI_GRAPHICS_OUTPUT_MODE_INFORMATION* Info; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; UINTN Size; Status = GraphicsOutput->QueryMode(GraphicsOutput, i, &Size, &Info); - if (Info->HorizontalResolution == dwidth && Info->VerticalResolution == dheight) + if (Info->HorizontalResolution == dwidth && Info->VerticalResolution == dheight) { Mode = i; + } } Status = GraphicsOutput->SetMode(GraphicsOutput, Mode); @@ -356,10 +358,11 @@ extern "C" EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemT XEGuiPrint("Copyright (C) Manas Kamal Choudhury 2020-2025\n"); XEGuiPrint("Loading system files.. please wait !! \n"); - + + uint64_t adddr = 0x50000000; EFI_CONFIGURATION_TABLE* configuration_tables = SystemTable->ConfigurationTable; - + /* load all important files */ XEFile* krnl = XEOpenAndReadFile(ImageHandle, (CHAR16*)L"\\EFI\\XENEVA\\xnkrnl.exe"); uint8_t* alignedKBuf = (uint8_t*)krnl->kBuffer; diff --git a/BootAA64/xnldr.h b/BootAA64/xnldr.h index 805f48279..3e1a33b8a 100644 --- a/BootAA64/xnldr.h +++ b/BootAA64/xnldr.h @@ -1,4 +1,3 @@ - /** * BSD 2-Clause License * @@ -35,6 +34,14 @@ #include #include #include +#ifndef SIZE_MAX +#if defined(ARCH_ARM64) || defined(ARCH_X64) || defined(_M_AMD64) || defined(_M_ARM64) || defined(__x86_64__) || defined(__aarch64__) +#define SIZE_MAX 0xFFFFFFFFFFFFFFFFULL +#else +#define SIZE_MAX 0xFFFFFFFFULL +#endif +#endif +//#include #define SIZE_MAX 0xFFFFFFFF diff --git a/BootAA64/xnout.cpp b/BootAA64/xnout.cpp index 69d629ab5..700a5cee5 100644 --- a/BootAA64/xnout.cpp +++ b/BootAA64/xnout.cpp @@ -88,14 +88,25 @@ void XEPutChar(const int ch) { #include +#ifdef _MSC_VER +extern "C" void store_x0_x7(uint64_t * buff); +#endif + /* * XEPrintf -- print function that will * show output to the screen * @param fmt -- format to print */ int XEPrintf(wchar_t* fmt, ...) { + +#if defined(__GNUC__) || defined(__GNUG__) va_list vl; va_start(vl, fmt); +#elif defined(_MSC_VER) + uint64_t buffer[7]; + store_x0_x7(buffer); + va_list vl = (va_list)buffer; +#endif unsigned short out[256]; int o = 0; @@ -288,12 +299,12 @@ int XEPrintf(wchar_t* fmt, ...) { if (c != 'd') { if (lmodifier == 'H') v = (uint8_t)v; - else if (lmodifier = 'h') + else if (lmodifier == 'h') v = (unsigned short)v; sign = 0; } else { - if (lmodifier = 'H') + if (lmodifier == 'H') v = (signed char)v; else if (lmodifier == 'h') v = (short)v; @@ -377,8 +388,16 @@ void XEGuiPrint(const char* format, ...) { XEUARTPrint(format); return; } + +#if defined(__GNUC__) || defined(__GNUG__) va_list args; va_start(args, format); +#elif defined(_MSC_VER) + uint64_t buffer[7]; + store_x0_x7(buffer); + va_list args = (va_list)buffer; +#endif + //va_start(args, format); while (*format != '\0') { if (*format == '%') { diff --git a/DCL/includes/linux/bitmap.h b/DCL/includes/linux/bitmap.h new file mode 100644 index 000000000..add994602 --- /dev/null +++ b/DCL/includes/linux/bitmap.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_BITMAP_H_ +#define _LINUX_BITMAP_H_ + +#include +#include + +#define set_bit(nr, addr) \ + ((addr)[(nr) / BITS_PER_LONG] |= (1UL << ((nr) % BITS_PER_LONG))) + +#define clear_bit(nr, addr) \ + ((addr)[(nr) / BITS_PER_LONG] &= ~(1UL << ((nr) % BITS_PER_LONG))) + +#define test_bit(nr, addr) \ + (!!((addr)[(nr) / BITS_PER_LONG] & (1UL << ((nr) % BITS_PER_LONG)))) + +#define test_and_set_bit(nr, addr) \ + ({int __old = test_bit(nr, addr); set_bit(nr, addr); __old; }) + +#define test_and_clear_bit(nr,addr) \ + ({ int __old = test_bit(nr, addr); clear_bit(nr,addr); __old;}) + +#define bitmap_zero(dst, nbits) \ + memset(dst, 0, BITS_TO_LONGS(nbits) * sizeof(unsigned long)) + +#define bitmap_copy(dst, src, nbits) \ + memcpy(dst, src, BITS_TO_LONGS(nbits) * sizeof(unsigned long)) + + + #endif \ No newline at end of file diff --git a/DCL/includes/linux/bitops.h b/DCL/includes/linux/bitops.h new file mode 100644 index 000000000..c89225592 --- /dev/null +++ b/DCL/includes/linux/bitops.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_BITOPS_H_ +#define _LINUX_BITOPS_H_ + +#include +#include + + +#define BITS_TO_LONGS(nr) BORDOISILA_DIV_ROUND_UP(nr, BORDOISILA_BITS_PER_TYPE(long)) +#define BITS_TO_U64(nr) BORDOISILA_DIV_ROUND_UP(nr, BORDOISILA_BITS_PER_TYPE(uint64_t)) +#define BITS_TO_U32(nr) BORDOISILA_DIV_ROUND_UP(nr, BORDOISILA_BITS_PER_TYPE(uint32_t)) +#define BITS_TO_BYTES(nr) BORDOISILA_DIV_ROUND_UP(nr, BORDOISILA_BITS_PER_TYPE(char)) +#define BYTES_TO_BITS(nb) ((nb)* BITS_PER_BYTE) + +#endif \ No newline at end of file diff --git a/DCL/includes/linux/types.h b/DCL/includes/linux/types.h new file mode 100644 index 000000000..8ad25468c --- /dev/null +++ b/DCL/includes/linux/types.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_TYPES_H_ +#define _LINUX_TYPES_H_ + +#define DECLARE_BITMAP(name,bits) \ + unsigned long name[BITS_TO_LONGS(bits)] + + + + +#endif \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 000000000..4a9084330 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,13 @@ + + + + $(SolutionDir)Build\ + $(SolutionDir)Build\Intermediate\$(ProjectName)\$(Platform)\$(Configuration)\ + + + + + $(SolutionDir)Build\;%(AdditionalLibraryDirectories) + + + diff --git a/Docs/BuildInstructions(ARM64).md b/Docs/BuildInstructions(ARM64).md index caacc7ee6..d3db699d1 100644 --- a/Docs/BuildInstructions(ARM64).md +++ b/Docs/BuildInstructions(ARM64).md @@ -42,6 +42,9 @@ format M: /FS:FAT32 /A:4096 /Q /V:BOOTIMG /Y - Now that the image is usable, you can build XenevaOS projects directly, which will copy the required files to _M:_ automatically. +> [!NOTE] +> The MSVC project configurations (e.g., `Boot`, `BootAA64`, `XELoader`) utilize post-build copy scripts to deploy binaries to `M:\`. To prevent build failures on machines without a mounted `M:` drive, these copy steps are defensively guarded using conditional checks (`if exist M:\ ...`). Building the solutions will succeed regardless of whether the drive is mounted. + ## Directory Structure of XenevaOS XenevaOS follows a fixed boot directory structure:
Your Boot partition :
diff --git a/Docs/BuildInstructions(Linux).md b/Docs/BuildInstructions(Linux).md index 0a16565f0..38e21d11f 100644 --- a/Docs/BuildInstructions(Linux).md +++ b/Docs/BuildInstructions(Linux).md @@ -5,6 +5,18 @@ To build XenevaOS natively on Linux without relying on MSVC, ensure you have the - For x86_64 Kernel: `g++` and `make` (multilib support may be required). - For ARM64 (KernelAA64): `aarch64-linux-gnu-gcc` and `aarch64-linux-gnu-binutils`. +## Compiling GNU-EFI (Required for Bootloader) +The `BootAA64` bootloader relies on `gnu-efi` libraries and object files. Because this directory is ignored in `.gitignore`, you must manually clone and build it first. +1. Navigate to the root of the `XenevaOS` repository. +2. Clone the official `gnu-efi` repository: + `git clone https://github.com/vathpela/gnu-efi.git` +3. Build the library for AArch64: + ```bash + cd gnu-efi + make ARCH=aarch64 CROSS_COMPILE=aarch64-linux-gnu- + cd .. + ``` + ## Building the ARM64 Kernel (KernelAA64) 1. Open a terminal and navigate to the `KernelAA64/` directory. 2. Run `make clean` to clear any old MSVC objects or stale binaries. diff --git a/Docs/Contributing.md b/Docs/Contributing.md index 4a9f44fde..b35bf42d7 100644 --- a/Docs/Contributing.md +++ b/Docs/Contributing.md @@ -15,7 +15,7 @@ XenevaOS historically used Microsoft Visual Studio as the primary development pl - Always test kernel modifications in a controlled environment like QEMU or VirtualBox before pushing changes. -- Follow memory management, system calls and other subsystem guidelines as outlined in the documentation. +- Follow memory management, system calls, and other subsystem guidelines as outlined in the documentation. For details on virtual filesystem development, refer to the [Virtual File System Guide](Kernel/VirtualFileSystem.md). - Before making major changes, open an issue or discussion in the repository or on Discord to align with the project's direction and avoid duplicate work. @@ -32,24 +32,33 @@ The XenevaOS project follows a consistent coding style to maintain readability a ### *Cross-Platform & GCC Compatibility* To ensure that XenevaOS remains portable across Windows (MSVC) and Linux (GCC) environments, all contributors must adhere to strict C/C++ ISO standards. - **Explicit Headers:** Do not rely on implicit headers. Always explicitly include standard headers (e.g., `#include ` for `size_t` and `#include ` for `bool` in C). +- **Compiler-Provided Definitions:** Prefer using compiler-provided or standard-library-provided macro definitions (such as standard constants like `SIZE_MAX` or NEON/SIMD built-ins) where available. However, when project-specific or custom definitions are required for target platforms or freestanding environments (such as UEFI bootloader paths on MSVC), define them defensively using `#ifndef` guards to prevent macro redefinition conflicts under GCC. - **Include Path Formatting (Forward Slashes):** Never use Windows-style backslashes (`\`) in include paths. Always use forward slashes (`/`) for cross-platform compatibility (e.g., `#include "BaseHdr/aurora.h"`). - **Case-Sensitive Include Paths:** Unlike Windows/MSVC, Linux/GCC is strictly case-sensitive. The casing in your `#include` statement must exactly match the actual folder and file names (e.g., use `Fs/` instead of `fs/`). -- **Variadic Arguments (`va_list`):** Never use manual pointer arithmetic to parse variadic arguments. Always use the standard `` macros (`va_start`, `va_arg`, `va_end`) to ensure compatibility with AAPCS (ARM64) and GCC. +- **Variadic Arguments (`va_list`):** Never use manual pointer arithmetic to parse variadic arguments. Always use the standard `` macros (`va_start`, `va_arg`, `va_end`) to ensure compatibility with AAPCS (ARM64) and GCC. - **Strict Data Typing:** GCC is highly explicit about data types. Avoid MSVC-specific quirks. - **Variable Shadowing:** Do not name a structure member the same as a `typedef` in the same scope, as GCC strictly rejects this (`-Wchanges-meaning`). - **Standard Syntax:** Avoid MSVC-specific calling conventions like `__cdecl` directly in source code; use custom macros if needed. Ensure scope resolutions are standard (e.g., `operator new` instead of `::operator new`). - **Strict Returns:** Every non-void function must explicitly return a value. Missing returns result in undefined behavior under GCC. - **Pragma Packing:** Always mathematically balance `#pragma pack(push, 1)` with `#pragma pack(pop)`. - **Export Macros:** Do not hardcode `__declspec(dllexport)`. Always use cross-platform macros (e.g., `AU_EXPORT` and `AU_IMPORT`). +- **Minimal Fixes & TODO Offloading:** When fixing GCC/LLVM compatibility issues, apply only the strict minimum changes required to successfully compile and run the code without panics. Do not implement optional safeguards or heavy defensive guardrails immediately, as this expands the diff and risks breaking MSVC compatibility. Instead, defer these improvements by leaving a clear, capitalized `// TODO:` comment. This keeps PRs small and offloads non-critical enhancements to future contributors. Code modifications must be verified for GCC compatibility before being merged. ### *Bug Reports & Feature Requests* -- Open an issue to report bugs or suggest new features. +- Open an issue to report bugs or suggest new features using the provided GitHub Issue templates. - When reporting a bug, provide clear details about the issue, including system debug messages from the serial terminal, the processor state, and register values. If possible, describe the conditions under which the bug occurs. - Mention your testing environment. - For feature requests, explain the purpose and potential benefits to the project. +## Pull Request (PR) Guidelines +To ensure code quality and maintainability, all contributors must format their Pull Requests using the repository's standardized layout. A template is automatically provided on GitHub when opening a PR, and requires: +1. **Summary:** A concise explanation of the PR's high-level objectives. +2. **Changes:** A detailed bulleted list of modified modules, specifying exactly **Before** (previous behavior or issue), **What** changed, and **Why** it was changed. +3. **Compatibility:** Verification checkboxes indicating that the changes do not break MSVC/Windows and GCC/Linux builds or cause runtime regressions. +4. **Related:** Reference to any corresponding issue numbers (e.g., `Part of #44`). + ### *Conclusion* Thank you for your interest in contributing to XenevaOS! Your contributions — whether in code, documentation, bug reports, or discussions — help shape the future of this project. If you have any questions or need guidance, feel free to open an issue or join the discussions on GitHub or Discord. Let's work together to make a powerful and efficient operating system! diff --git a/Docs/Development/ProjectArchitecture(MSVC).md b/Docs/Development/ProjectArchitecture(MSVC).md new file mode 100644 index 000000000..8129d30d0 --- /dev/null +++ b/Docs/Development/ProjectArchitecture(MSVC).md @@ -0,0 +1,41 @@ +# Project Architecture (MSVC) +XenevaOS codebase is compatible with both GCC and MSVC toolchain. Although both toochain uses different build style and build artifact but build the same Operating System. This document will try to provide the project dependency, build outputs and importance of one project to build the other. + +By understanding this architecture, developers can: +- Identify the responsibility of each project. +- Understand how projects depend on one another +- Locate the generated build artifacts. +- Modify or extend existing components without breaking the build process + +# Kernel vs KernelAA64 +"Kernel" is targeted for x86_64 architecture but "KernelAA64" is targeted for ARM64 architecture. + +# .lib vs .exe/.dll artifact +When a project is built within the solution, Visual Studio typically generates two output artifaces: the executable binary ('.exe'/'.dll') and an import library ('.lib').

+For example, the 'KernelAA64' project produces both 'xnkrnl.exe' and 'xnkrnl.lib'. The executable contains the actual kernel image, while the import library provides symbol information required by other projects during the linking stage.

+ +Kernel-mode drivers and other components that depend on kernel-exported functions link against 'xnkrnl.lib (or 'Kernel.lib') to resolve external symbols at build time. At runtime, symbol resolution is performed by the XenevaOS kernel loader, which parses the import and export tables of loaded binaries and establishes the required symbol bindings. + + +# Binary output and their Dependencies table + +| Project Name | Build Output | Dependency | +|--------------|--------------|-------------| +| Boot | .efi /.lib | _None_ | +| BootAA64 | .efi/.lib | _None_ | +| Kernel | xnkrnl.exe/Kernel.lib | _None_ | +| KernelAA64 | xnkrnl.exe/xnkrnl.lib | _None_ | +| AHCI(Driver) | .dll/.lib | _xnkrnl.lib/Kernel.lib_ | +| E1000(Driver) | .dll/.lib | _xnkrnl.lib/Kernel.lib_ | +| All Drivers.. | .dll/.lib | _xnkrnl.lib/Kernel.lib_ | +| init | .exe/.lib | _None (static binary)_ | +| DeodhaiXR | .exe/.lib | _chlkha.lib/ftype.lib/xecrt.lib/xeclib.lib_| +|Glimpse | .exe/.lib | _chlkha.lib/ftype.lib/xecrt.lib/xeclib.lib_| +| Chitralekha(Userspace Library) | .dll/.lib| _xecrt.lib/xeclib.lib_| +| XEClib(Userspace Clibrary) | .dll/.lib | _None_ | +| XECrt(Userspace static library) | .lib | _None_ | + +## Static Library vs Dynamic Library in XenevaOS +Both static and dynamic library has important role in XenevaOS runtime environment. Static libraries are mostly used for standalone binary build while Dynamic libraries are used for Dynamically linked binary and can be used as shared library among all binaries that depend on the same library. + + diff --git a/Docs/Index.md b/Docs/Index.md new file mode 100644 index 000000000..a8d3f758c --- /dev/null +++ b/Docs/Index.md @@ -0,0 +1,37 @@ +# Welcome to XenevaOS Documentation + +Welcome to the official documentation for **XenevaOS**, a modern operating system built from scratch. This documentation portal provides all the resources needed to understand the OS architecture, compile the source code, set up virtual machines, and contribute to both kernel and user-space development. + +Use the Table of Contents below to navigate through the project's documentation. + +--- + +## Getting Started +- [**Introduction**](Introduction.md) — An overview of XenevaOS, its architecture, and its primary goals. +- [**Contributing Guidelines**](Contributing.md) — Rules and procedures for contributing to the repository. +- [**Preprocessor Macros**](Development/PreprocessorMacros.md) — Important compiler flags and definitions used across the codebase. + +## ️ Build & Setup +- [**Build Instructions (Windows/MSVC)**](BuildInstructions.md) — How to build XenevaOS on Windows using Visual Studio. +- [**Build Instructions (Linux/GCC)**](BuildInstructions(Linux).md) — How to compile the OS on Linux environments. +- [**Build Instructions (ARM64)**](BuildInstructions(ARM64).md) — Specific instructions for cross-compiling the ARM64 port. +- [**Populating Config**](PopulatingConfig.md) — Setting up the bootloader and kernel configuration files. +- [**VM Setup**](VMSetup.md) — Guide to configuring VirtualBox, VMWare, or QEMU manually. +- [**QEMU Automation**](QemuAutomation.md) — Using scripts for automated boot and testing on QEMU. +- [**Serial Terminal Attach**](SerialTerminalAttach.md) — How to attach to UART for low-level kernel debugging. + +## Kernel Internals +- [**About Kernel**](Kernel/AboutKernel.md) — Deep dive into the core architecture of the XenevaOS kernel. +- [**Boot Process**](Kernel/BootProcess.md) — Explanation of the hardware boot flow from UEFI to Kernel main. +- [**Memory Management**](Kernel/MemoryMangement.md) — Details on Physical, Virtual, and Heap memory allocation. +- [**Kernel Services (SCI)**](Kernel/KernelServices.md) — Overview of the System Call Interface (SCI) for user-space bridging. +- [**Virtual File System (VFS)**](Kernel/VirtualFileSystem.md) — Abstraction layer for file access, FAT32, and initrd parsing. +- [**Threads & Processes**](Kernel/Thread.md) — Internal workings of kernel threads and user processes. +- [**Drivers Subsystem**](Kernel/Drivers.md) — Core principles of the XenevaOS hardware driver model. +- [**USB Stack**](Kernel/usb.md) — How USB buses and controllers are initialized. + +## Development & User-Space +- [**XELoader (Dynamic Linker)**](XELoader.md) — The XenevaOS user-space PE linker and dynamic loading mechanism. +- [**Application Development**](Development/ApplicationDevelopment.md) — Writing user-space applications (GUI, Terminal) for XenevaOS. +- [**Driver Development**](Development/DriverDevelopment.md) — Developing dynamic drivers and interacting with kernel APIs. +- [**Project Architecture(MSVC)**](Development/ProjectArchitecture(MSVC).md)- Discusses various artifacts and project inter dependencies. diff --git a/Docs/Introduction.md b/Docs/Introduction.md index f5679fbb1..ea1544efe 100644 --- a/Docs/Introduction.md +++ b/Docs/Introduction.md @@ -49,4 +49,4 @@ __Components__ : __Development__ : - [Writing Drivers for XenevaOS](Development/DriverDevelopment.md) - [Writing User Applications for XenevaOS](Development/ApplicationDevelopment.md) - +- [Project Architecture (MSVC)](Development/ProjectArchitecture(MSVC).md) diff --git a/Docs/Kernel/MemoryMangement.md b/Docs/Kernel/MemoryMangement.md index a51fbb7b0..54fe4e069 100644 --- a/Docs/Kernel/MemoryMangement.md +++ b/Docs/Kernel/MemoryMangement.md @@ -18,7 +18,7 @@ For each process, an entirely new virtual address space is created. The kernel c __Clearing the Lower Half Section__: Clearing the lower half is only safe if the kernel is using linear addresses for allocating physical memory. For example, if a driver allocates physical memory through the `AuPmmngrAlloc` function, the function must use a linear address to allocate the physical block. When the Virtual Memory Manager initializes itself, it stores whether the memory manager has linearly mapped all physical memory. This helps the Physical Memory Manager decide whether to allocate a physical block from linear or non-linear space. If a physical block is allocated from non-linear space, clearing the lower half would cause an immediate crash.
The `AuVmmngrBootFree` function clears out the lower half section and loads the new paging structure into the CR3 register. -__MMIO Memory Area__: The Virtual Address starting from _0xFFFFFF1000000000_. This region is reserved for Hardware to map its device registers into the virtual address space. This region is also marked as non-cacheable region. The __'AuMapMMIO'__ function is used to map device memories into _MMIO Region_. +__MMIO Memory Area__: The Virtual Address starting from _0xFFFFFF1000000000_. This region is reserved for Hardware to map its device registers into the virtual address space. This region is also marked as non-cacheable region. The __'AuMapMMIO'__ function is used to map device memories into _MMIO Region_. *Note: Redundant and unused MMIO mappings have been removed from the AArch64 kernel core to reduce translation table walk overhead and minimize boot latency.* __The External Functions of Virtual Memory Manager__: External functions in Virtual Memory Manager are marked with _'Ex'_ suffix with their function name. There are only two external function currently available, __AuMapPageEx__ and __AuGetPhysicalAddressEx__. __External Functions of the Virtual Memory Manager__: External functions in the Virtual Memory Manager are suffixed with `Ex`. There are currently two external functions available: `AuMapPageEx` and `AuGetPhysicalAddressEx`. diff --git a/Docs/Kernel/Thread.md b/Docs/Kernel/Thread.md index c9f5e39c9..624c3db87 100644 --- a/Docs/Kernel/Thread.md +++ b/Docs/Kernel/Thread.md @@ -1,7 +1,54 @@ -# Threading in XenevaOS +# Threading and Processes in XenevaOS -In XenevaOS, multitasking is entirely built on the concept of threads. XenevaOS does not identify processes or user applications directly; instead, it only schedules and executes individual threads using CPU resources. In simple terms, a thread is the smallest unit of execution in XenevaOS. The scheduler is the heart of XenevaOS and is responsible for managing threads, handling creation, blocking/unblocking (synchronization), context switching, and terminating threads when required. +In XenevaOS, multitasking is entirely built on the concept of threads. XenevaOS does not identify processes or user applications directly; instead, it schedules and executes individual threads using CPU resources. The scheduler is the heart of XenevaOS and is responsible for managing threads, handling creation, blocking/unblocking (synchronization), context switching, and terminating threads when required. -Each thread is defined by a structure that stores its current CPU registers/state, stack pointer, memory information, and scheduling state. +--- -_coming soon_... \ No newline at end of file +## Thread Representation in Kernel + +Each thread is represented by the `AA64Thread` structure (under AArch64) or `AuThread` structure (under x86_64), which stores: +- **Thread Context:** Saved CPU registers (e.g., `x19-x30`, `sp`, `elr_el1`, `spsr_el1` for AArch64). +- **Scheduling State:** Ready, Blocked, Sleep, or Killable. +- **Execution Level:** Kernel-mode thread (`THREAD_LEVEL_KERNEL`) or User-mode thread (`THREAD_LEVEL_USER`). +- **User Mode Reference:** A pointer to the `AuUserEntry` structure (if the thread belongs to a user-space process). + +--- + +## User Mode Entry & Transitions (`AuUserEntry`) + +When a thread is scheduled to execute in user mode (EL0), the kernel uses the `AuUserEntry` structure to pass execution context, stack pointers, and command-line arguments to the user program's entry runtime (`crt0`). + +### The `AuUserEntry` Structure +```c +typedef struct _uentry_ { + uint64_t entrypoint; /* EL0 entry point address */ + uint64_t rsp; /* User-space stack pointer */ + uint64_t cs; /* Code segment descriptor / EL0 selector */ + uint64_t ss; /* Stack segment descriptor / EL0 selector */ + int num_args; /* Number of arguments (argc) */ + uint64_t argvaddr; /* User-space VA of the argv[] page (for crt0) */ + uint64_t argvkernel; /* Kernel-space VA of the same argv[] page (for EL1 writes) */ + char** argvs; /* Raw string pointers array */ + uint64_t stackBase; /* Bottom of the user stack */ +} AuUserEntry; +``` + +--- + +## Argument Passing Architecture (`argvaddr` vs `argvkernel`) + +A critical challenge during process creation is writing the command-line arguments (like `/calc.exe --debug`) from kernel space (EL1) into the newly created user-space process space (EL0) stack or data page. + +### The Problem +During process setup (e.g., in `AuLoadExecToProcess`), the CPU is running in EL1, using the kernel's active translation tables (TTBR1). The user-space virtual mapping (specified by `argvaddr`, e.g., `0x0000_xxxx_xxxx`) is defined in the target process's page tables (TTBR0). +- If the kernel attempts to write directly to `argvaddr`, it will fail with a page fault or a translation fault because the kernel is either not operating under the target process's address space context yet, or the user pages are marked with restrictions. + +### The Solution: Double Mapping +To bypass this limitation, XenevaOS uses a double-mapping scheme: +1. **Physical Page Allocation:** The kernel allocates a physical memory page to host the arguments. +2. **User-Space Mapping (`argvaddr`):** This physical page is mapped to a virtual address in the target process's user-space virtual memory (e.g., `0x0000_xxxx_xxxx`). This address is stored in `argvaddr` and is passed to `crt0` so user-space can read the arguments. +3. **Kernel-Space Alias (`argvkernel`):** The same physical page is simultaneously mapped to a virtual address in the kernel's higher-half address space (e.g., `0xFFFF_xxxx_xxxx`). This virtual address is stored in `argvkernel`. +4. **Writing Arguments:** The kernel safely writes the argument strings and the array of pointers using `argvkernel`. Since it is mapped to the same physical backing memory, the data is written directly to the page that the user process will access. +5. **Control Hand-off:** When the thread enters user mode (EL0) and switches to the process's page tables, it reads the arguments using `argvaddr` natively. + +This decoupled memory mapping design eliminates dependency on EL0 page table accessibility during process initialization, ensuring robust and crash-safe process bringup. \ No newline at end of file diff --git a/Docs/Kernel/VirtualFileSystem.md b/Docs/Kernel/VirtualFileSystem.md index 8dd7c2360..929a47f5a 100644 --- a/Docs/Kernel/VirtualFileSystem.md +++ b/Docs/Kernel/VirtualFileSystem.md @@ -41,7 +41,7 @@ typedef struct __VFS_NODE__ { | ``parent_block`` | Used in files, describes the parent block address of the file, for example - directory cluster of the file in FAT32 fs | | ``first_block`` | Used in files, describes the very first block address of the file, for example - first cluster of the file in FAT32 fs | | ``current`` | Used in files, describes the current block address of the file, for example - current read cluster of the file in FAT32 fs | -| ``flags`` | Used both in files and file systems, describing the type of File or file system | +| ``flags`` | Node flags defining the node type and properties. See the **Node Flags** section below for details. | | ``status`` | Used in files, describing current condition of the file | | ``device`` | Used both in files and filesystems, used for pointing file system's private data structure or file's private data structure | | ``fileCopyCount`` | Used in files; describes the total copies of this file. The file is not closed until this reaches zero. | @@ -58,9 +58,36 @@ typedef struct __VFS_NODE__ { | ``get_blockfor`` | Used in filesystems; retrieves the desired block address corresponding to a given file position in bytes. | | ``iocontrol`` | Used both in filesystems and files for controlling the filesystem or file | +### Node Flags (`flags`) +Ensure you set the appropriate flags so the VFS handles the node correctly. The following are the available VFS node flags: +* `FS_FLAG_DIRECTORY` `(1<<1)` : Indicates the node is a directory. (Temporary/Freeable) +* `FS_FLAG_GENERAL` `(1<<2)` : General purpose file node. (Temporary/Freeable) +* `FS_FLAG_DEVICE` `(1<<3)` : Virtual device node (e.g., inside `/dev`). (Permanent/Non-freeable) +* `FS_FLAG_DELETED` `(1<<4)` : State flag indicating the node has been deleted. +* `FS_FLAG_INVALID` `(1<<5)` : State flag indicating the node is invalid. +* `FS_FLAG_FILE_SYSTEM` `(1<<6)` : Indicates a file system mount node. (Permanent/Non-freeable). **Mainly needed when registering a file system module.** +* `FS_FLAG_PIPE` `(1<<7)` : Inter-process communication pipe. (Temporary/Freeable) +* `FS_FLAG_TTY` `(1<<8)` : Teletype/terminal node. (Temporary/Freeable with count) +* `FS_FLAG_SOCKET` `(1<<9)` : Network socket node. (Temporary/Freeable) +* `FS_FLAG_FILE_SYSTEM_GENERAL` `(1<<10)` : Identifies a standard general-purpose block file system. Can be used in conjunction with `FS_FLAG_FILE_SYSTEM`. +* `FS_FLAG_CACHED` `(1<<11)` : Indicates that the file is being cached and has been added to the file cache manager. + +## VFS Mount Point Rules +XenevaOS differentiates between **General (Block-based) Filesystems** (such as FAT32, Ext2) and **Virtual/Memory-based Filesystems** (such as `/dev`, `/proc`, `/tty`). + +### Mount Point Letter Reservation +For general, block-backed filesystems that require mounting to a specific drive/volume hierarchy: +* **Function:** Always call `AuVFSReserveMountPointLetter()` during mounting to reserve a mount letter. +* **Limitation:** This function is **only** applicable to general filesystems. +* **Prohibition:** Do **NOT** use `AuVFSReserveMountPointLetter()` for virtual or memory-based filesystems like `/proc`, `/tty`, or `/dev`. These are mounted directly to fixed virtual paths within the VFS structure during early kernel boot and do not require volume letter mapping. + + ## Implementing File System Driver for XenevaOS -In XenevaOS, filesystem drivers can be implemented in two ways: either as external kernel modules or built directly into the kernel code. However, the current version of the kernel lacks the mechanism to load filesystem drivers as external kernel modules. The current version of XenevaOS only uses a built-in FAT32 driver for the root filesystem. Supporting filesystem drivers from external modules is work in progress.
+In XenevaOS, filesystem drivers can be implemented in two ways: either as external kernel modules or built directly into the kernel code. However, the current version of the kernel lacks the mechanism to load filesystem drivers dynamically as external modules. Instead, the kernel includes built-in filesystem drivers for **FAT32** (typically used for the root boot filesystem) and **Ext2** (used for secondary storage access). Supporting filesystem drivers from dynamic external modules is work in progress.
+ +### Ext2 File System Support +The Ext2 file system module integrates directly into the VFS layer by providing the standard filesystem callback handlers. It is registered during kernel initialization and allows standard operations such as finding, opening, and reading files and directories on Ext2 partitions. ### Mounting the file system during initialization Mounting a new filesystem involves extracting all necessary information from the disk's root sector, creating the necessary data structures, and allocating a new `AuVFSNode` structure. Filesystem drivers can use the `AuVDisk` service to read disk sectors. XenevaOS first detects the storage medium using the appropriate driver, extracts the partition details, calls `AuCreateVDisk` to register a virtual disk, mounts it to the device filesystem, and finally mounts the target filesystem on it. diff --git a/Docs/XELoader.md b/Docs/XELoader.md index a4010e5c1..b0bcfaada 100644 --- a/Docs/XELoader.md +++ b/Docs/XELoader.md @@ -30,8 +30,8 @@ Transferring control to the main executable is only performed after the loading XELoader uses the PE image format for executables and libraries (meaning it is currently limited to loading PE binaries). ELF format support could be added in the future. XELoader itself is a statically linked binary, meaning it does not depend on shared libraries; everything is built statically inside XELoader. There are two levels of loaders built into XenevaOS: -- The kernel-level loader (_Kernel-space static executable loader_) -- The XELoader (_User-space dynamic linker and loader_) +- The kernel-level loader (_Kernel-space static executable loader_): Loads pure static binaries directly (e.g., `init.exe`, `xeldr.exe`). +- The XELoader (_User-space dynamic linker and loader_): Loads dynamically linked binaries (e.g., terminals, GUI applications) and shares libraries using the Copy-On-Write (COW) mechanism. Whenever XenevaOS encounters the system call _```_KeProcessLoadExec```_ with the executable file path and name, it immediately loads the executable and verifies that it is a PE-formatted executable and not a library. The kernel-level loader is only capable of loading statically linked executable files, not dynamically linked executables or libraries. If it is an executable file, the loader checks if it is dynamically or statically linked. Static executable files are executed directly by the kernel-level loader, which maps each section of the executable to the process's address space and transfers control to the entry point. For dynamically linked files, XELoader acts as an intermediary. The kernel-level loader loads XELoader (_which is statically linked_), populates its argument list with the desired filename and path, and transfers control to it. XELoader then runs in user space, starts loading the executable provided by the kernel, and resolves external symbols by loading and linking the required shared libraries. For example here are the steps how it works: diff --git a/Drivers/AHCI/AHCI.vcxproj b/Drivers/AHCI/AHCI.vcxproj index ebfd632d3..6698d781b 100644 --- a/Drivers/AHCI/AHCI.vcxproj +++ b/Drivers/AHCI/AHCI.vcxproj @@ -133,7 +133,7 @@ Native false ..\..\Build\ahci.dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -150,7 +150,7 @@ - copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy )
diff --git a/Drivers/Clock/Clock.sln b/Drivers/Clock/Clock.sln new file mode 100644 index 000000000..aa8e8ad55 --- /dev/null +++ b/Drivers/Clock/Clock.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.36107.64 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imx", "Clock\Clock.vcxproj", "{27361F54-5EF1-4E07-922F-C1CC8EB38ACA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Debug|ARM64.Build.0 = Debug|ARM64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Debug|x64.ActiveCfg = Debug|x64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Debug|x64.Build.0 = Debug|x64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Debug|x86.ActiveCfg = Debug|ARM64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Debug|x86.Build.0 = Debug|ARM64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Release|ARM64.ActiveCfg = Release|ARM64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Release|ARM64.Build.0 = Release|ARM64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Release|x64.ActiveCfg = Release|x64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Release|x64.Build.0 = Release|x64 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Release|x86.ActiveCfg = Release|Win32 + {27361F54-5EF1-4E07-922F-C1CC8EB38ACA}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {117A1BAF-DB42-47EC-9B4C-BC2ED91F7328} + EndGlobalSection +EndGlobal diff --git a/Drivers/Clock/Clock/Clock.vcxproj b/Drivers/Clock/Clock/Clock.vcxproj new file mode 100644 index 000000000..891722d46 --- /dev/null +++ b/Drivers/Clock/Clock/Clock.vcxproj @@ -0,0 +1,214 @@ + + + + + Debug + ARM64 + + + Debug + Win32 + + + Release + ARM64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {27361f54-5ef1-4e07-922f-c1cc8eb38aca} + Clock + 10.0 + imx + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + true + + + false + + + false + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)..\..\BaseHdr + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/Drivers/Clock/Clock/Clock.vcxproj.filters b/Drivers/Clock/Clock/Clock.vcxproj.filters new file mode 100644 index 000000000..63839bade --- /dev/null +++ b/Drivers/Clock/Clock/Clock.vcxproj.filters @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Drivers/Clock/Clock/clk_imx8mp.c b/Drivers/Clock/Clock/clk_imx8mp.c new file mode 100644 index 000000000..e69de29bb diff --git a/Drivers/Clock/Clock/clk_imx_reg.h b/Drivers/Clock/Clock/clk_imx_reg.h new file mode 100644 index 000000000..67f2c9640 --- /dev/null +++ b/Drivers/Clock/Clock/clk_imx_reg.h @@ -0,0 +1,62 @@ +/** +* @file clk_imx8mp_reg.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __CLK_IMX_H__ +#define __CLK_IMX_H__ + +enum imx_pllv1_type { + IMX_PLLV1_IMX1, + IMX_PLLV1_IMX21, + IMX_PLLV1_IMX25, + IMX_PLLV1_IMX27, + IMX_PLLV1_IMX31, + IMX_PLLV1_IMX35, +}; + +enum imx_sscg_pll_type { + SCCG_PLL1, + SCCG_PLL2, +}; + +enum imx_pll14xx_type { + PLL_1416X, + PLL_1443X, +}; + +enum imx_pllv4_type { + IMX_PLLV4_IMX7ULP, + IMX_PLLV4_IMX8ULP, + IMX_PLLV4_IMX8ULP_1GHZ, +}; + + + +#endif diff --git a/Drivers/E1000/E1000.vcxproj b/Drivers/E1000/E1000.vcxproj index d7cf662be..409f883b6 100644 --- a/Drivers/E1000/E1000.vcxproj +++ b/Drivers/E1000/E1000.vcxproj @@ -1,4 +1,4 @@ - + @@ -101,7 +101,7 @@ false ..\..\Build\e1000.dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -120,7 +120,7 @@ /ALIGN:512 - copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/GPU/virtiogpu/virtiogpu.vcxproj b/Drivers/GPU/virtiogpu/virtiogpu.vcxproj index 6738b3ddc..531cc3efc 100644 --- a/Drivers/GPU/virtiogpu/virtiogpu.vcxproj +++ b/Drivers/GPU/virtiogpu/virtiogpu.vcxproj @@ -132,7 +132,7 @@ false F:/vmware.dll - E:\Xeneva Project\Aurora\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;E:\Xeneva Project\Aurora\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -170,7 +170,7 @@ false $(SolutionDir)\Build\$(TargetName).dll - $(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;$(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib true false @@ -187,7 +187,7 @@ false - copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/NVMe/NVMe.vcxproj b/Drivers/NVMe/NVMe.vcxproj index e7b359318..75269cdc9 100644 --- a/Drivers/NVMe/NVMe.vcxproj +++ b/Drivers/NVMe/NVMe.vcxproj @@ -101,7 +101,7 @@ false ..\..\Build\nvme.dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -117,7 +117,7 @@ false - copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/Net/virtionet/virtionet.cpp b/Drivers/Net/virtionet/virtionet.cpp index 1bdc026a8..48323b0c7 100644 --- a/Drivers/Net/virtionet/virtionet.cpp +++ b/Drivers/Net/virtionet/virtionet.cpp @@ -84,12 +84,14 @@ struct VirtioNetCfg { uint32_t supportedTunnelTypes; }; -typedef struct _ethernet_ { +#pragma pack(push,1) +__declspec(align(2)) typedef struct _ethernet_ { uint8_t dest[6]; uint8_t src[6]; uint16_t typeLen; uint8_t payload[]; }Ethernet; +#pragma pack(pop) #define ETHERNET_TYPE_IPV4 0x0800 #define ETHERNET_TYPE_ARP 0x0806 @@ -107,15 +109,27 @@ typedef struct _ethernet_ { void AuVirtioNetHandler(int spiNum) { uint16_t them = rxqueue->used.index; for (; index < them; index++) { + UARTDebugOut("Index : %d, them : %d \r\n", index, them); + uint32_t ringSlot = index % RX_BUFFER_COUNT; + + uint32_t trueBufferID = rxqueue->used.ring[ringSlot].index; + UARTDebugOut("True Buffer ID : %d \r\n", trueBufferID); //dc_ivac((uint64_t)&rx_hdrs[index % queueSz]); //dsb_sy_barrier(); - virtio_net_hdr_t* evt = &rx_hdrs[index % queueSz]; - Ethernet* eth = (Ethernet*)((uint8_t*)evt + sizeof(virtio_net_hdr_t) + 2); + uint8_t* buffer = (uint8_t*)rx_hdrs + (index % RX_BUFFER_COUNT) * RX_BUFFER_SIZE; + virtio_net_hdr_t* evt = (virtio_net_hdr_t*)buffer; + Ethernet* eth = (Ethernet*)((uint8_t*)evt + sizeof(virtio_net_hdr_t)); + UARTDebugOut("[virtionet++]:ndev->ipvaddr: %x \r\n", ndev->ipv4addr); + UARTDebugOut("eth->typeLen: %x and destination mac : \r\n", ntohs(eth->typeLen)); + UARTDebugOut("virtio buffer : %x, eth : %x \r\n", buffer, eth); if (nic) - AuEthernetHandle(eth, rxqueue->used.ring[index % queueSz].length, nic); + AuEthernetHandle(eth, rxqueue->used.ring[index % RX_BUFFER_COUNT].length, nic); + rxqueue->available.ring[rxqueue->available.index % RX_BUFFER_COUNT] = index; isb_flush(); rxqueue->available.index++; + isb_flush(); + dsb_ish(); } } /** @@ -190,6 +204,10 @@ void AuVirtioNetRxinitialize(struct VirtioCommonCfg* common) { uint16_t qsize = common->QueueSize; queueSz = qsize; UARTDebugOut("[aurora]: rx queue size : %d \r\n", qsize); + common->QueueSize = RX_BUFFER_COUNT; + isb_flush(); + dsb_ish(); + uint64_t queuePhys = (uint64_t)AuPmmngrAlloc();//AuPmmngrAllocBlocks(((sizeof(struct VirtioQueue) * queueSz)) / 0x1000); rxqueue = (struct VirtioQueue*)AuMapMMIO(queuePhys, 1); @@ -233,6 +251,9 @@ void AuVirtioNetTxinitialize(struct VirtioCommonCfg* common) { dsb_ish(); uint16_t qsize = common->QueueSize; UARTDebugOut("[aurora]: tx queue size : %d \r\n", qsize); + common->QueueSize = TX_BUFFER_COUNT; + isb_flush(); + dsb_ish(); uint64_t queuePhys = (uint64_t)AuPmmngrAlloc(); txqueue = (struct VirtioQueue*)AuMapMMIO(queuePhys, 1); common->QueueDesc = queuePhys; @@ -253,7 +274,7 @@ void AuVirtioNetTxinitialize(struct VirtioCommonCfg* common) { txqueue->buffers[i].Next = 0; txqueue->available.ring[i] = i; } - txqueue->available.index = TX_BUFFER_COUNT; + txqueue->available.index = 0; common->QueueEnable = 1; dsb_ish(); @@ -281,19 +302,33 @@ void AuVirtioTransmit(void* packet, uint16_t len) { hdr->gso_size = 0; hdr->csum_start = 0; hdr->csum_offset = 0; - hdr->hdr_len = 0; + hdr->hdr_len = 0; //s sizeof(Ethernet) + 8; + UARTDebugOut("mem len : %d \r\n", len); + //memcpy(buff + (sizeof(virtio_net_hdr_t) + 2), packet, len); memcpy(buff1, packet, len); + //aa64_data_cache_clean_range(buff, 2048); + //aa64_data_cache_clean_range(buff1, 2048); + + Ethernet* eth = (Ethernet*)buff1; + for (int i = 0; i < 6; i++) + UARTDebugOut("%x ", eth->src[i]); + UARTDebugOut("\r\n"); + for (int i = 0; i < 6; i++) + UARTDebugOut("%x ", eth->dest[i]); + UARTDebugOut("\r\n"); + UARTDebugOut("EthernetTypeLen : %d \r\n", eth->typeLen); + uint16_t total_len = len + sizeof(virtio_net_hdr_t); - txqueue->buffers[idx].Length = total_len; + txqueue->buffers[idx].Length = sizeof(virtio_net_hdr_t); txqueue->buffers[idx].Flags = 1; txqueue->buffers[idx].Next = idx1; - txqueue->buffers[idx1].Length = total_len; + txqueue->buffers[idx1].Length = len; txqueue->buffers[idx1].Flags = 0; txqueue->buffers[idx1].Next = 0; - txqueue->available.ring[idx % queueSz] = idx; + txqueue->available.ring[idx % TX_BUFFER_COUNT] = idx; dsb_ish(); isb_flush(); @@ -303,12 +338,15 @@ void AuVirtioTransmit(void* packet, uint16_t len) { isb_flush(); AuVirtioNetNotifyQueue(_cfg, 1); - tx_index+= 2; + tx_index += 1; } AU_EXTERN AU_EXPORT size_t AuVirtioWrite(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t len) { UARTDebugOut("VirtioNetWrite \r\n"); + /** here we need to have virtio_net_hdr, because this is called by + * raw sockets + */ AuVirtioTransmit(buffer, len); return len; } @@ -352,6 +390,9 @@ AU_EXTERN AU_EXPORT int VirtioNetIOCtl(AuVFSNode* file, int code, void* arg) { } return 1; } + +#define MAKE_IP(a,b,c,d) \ + ((uint32_t)(d) << 24 | (uint32_t)(c) << 16 | (uint32_t)(b) << 8 | (uint32_t)(a)) /** * @brief AuVirtioNetInitialize -- initialize the virtio network device * @param device -- device address passed by PCIe @@ -448,9 +489,14 @@ void AuVirtioNetInitialize(uint64_t device) { ndev->type = NETDEV_TYPE_ETHERNET; ndev->linkStatus = 1; - AuTextOut("[aurora]: virtio-net-dev mac : "); + + + ndev->ipv4addr = MAKE_IP(10, 0, 2, 15); + UARTDebugOut("[aurora]: ndev->ipv4addr: %x \r\n", ndev->ipv4addr); + + UARTDebugOut("[aurora]: virtio-net-dev mac : "); for (int i = 0; i < 6; i++) { - AuTextOut("%x::", netcfg->mac[i]); + UARTDebugOut("%x::", netcfg->mac[i]); ndev->mac[i] = netcfg->mac[i]; } diff --git a/Drivers/Net/virtionet/virtionet.vcxproj b/Drivers/Net/virtionet/virtionet.vcxproj index 38edd910f..ab32bb241 100644 --- a/Drivers/Net/virtionet/virtionet.vcxproj +++ b/Drivers/Net/virtionet/virtionet.vcxproj @@ -134,7 +134,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\..\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\..\ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib true false @@ -162,7 +162,7 @@ ..\..\..\BaseHdr;%(AdditionalIncludeDirectories) true - ARCH_X64;USE_APIC;%(PreprocessorDefinitions) + ARCH_ARM64;USE_APIC;%(PreprocessorDefinitions) true false Default @@ -175,7 +175,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\..\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\..\ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib true false @@ -192,7 +192,7 @@ false - copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/Sound/IntelHDA/IntelHDA.vcxproj b/Drivers/Sound/IntelHDA/IntelHDA.vcxproj index 6bdb64d6f..1e55c08bc 100644 --- a/Drivers/Sound/IntelHDA/IntelHDA.vcxproj +++ b/Drivers/Sound/IntelHDA/IntelHDA.vcxproj @@ -100,7 +100,7 @@ false ..\..\..\Build\hda.dll - ..\..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -119,7 +119,7 @@ /ALIGN:512 - copy "..\..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "..\..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/Sound/virtiosnd/virtiosnd.vcxproj b/Drivers/Sound/virtiosnd/virtiosnd.vcxproj index a28537215..50a8bba16 100644 --- a/Drivers/Sound/virtiosnd/virtiosnd.vcxproj +++ b/Drivers/Sound/virtiosnd/virtiosnd.vcxproj @@ -134,7 +134,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -175,7 +175,7 @@ false $(SolutionDir)Build\$(TargetName).dll - $(SolutionDir)ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;$(SolutionDir)ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib; true false @@ -192,7 +192,7 @@ false - copy "$(SolutionDir)Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "$(SolutionDir)Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/USB/dwc2-otg/dwc2-otg.vcxproj b/Drivers/USB/dwc2-otg/dwc2-otg.vcxproj index c85f37317..0e0c61207 100644 --- a/Drivers/USB/dwc2-otg/dwc2-otg.vcxproj +++ b/Drivers/USB/dwc2-otg/dwc2-otg.vcxproj @@ -134,7 +134,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -157,7 +157,7 @@ Level3 - Disabled + MaxSpeed $(SolutionDir)\BaseHdr;%(AdditionalIncludeDirectories) @@ -175,7 +175,7 @@ false $(SolutionDir)\Build\$(TargetName).dll - $(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;$(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib true false @@ -192,7 +192,7 @@ false - copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/USB/dwc2-uspi/dwc2-uspi.vcxproj b/Drivers/USB/dwc2-uspi/dwc2-uspi.vcxproj index 171732bc0..0fed8f8ca 100644 --- a/Drivers/USB/dwc2-uspi/dwc2-uspi.vcxproj +++ b/Drivers/USB/dwc2-uspi/dwc2-uspi.vcxproj @@ -134,7 +134,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -175,7 +175,7 @@ true $(SolutionDir)\Build\$(TargetName).dll - $(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;$(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib true false @@ -192,7 +192,7 @@ false - copy "$(SolutionDir)Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "$(SolutionDir)Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/USB/hid/hid.vcxproj b/Drivers/USB/hid/hid.vcxproj index 2f97f10bd..224914a8d 100644 --- a/Drivers/USB/hid/hid.vcxproj +++ b/Drivers/USB/hid/hid.vcxproj @@ -1,4 +1,4 @@ - + @@ -101,7 +101,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -118,7 +118,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/USB/msc/msc.vcxproj b/Drivers/USB/msc/msc.vcxproj index 1efbd127a..9a1f15d14 100644 --- a/Drivers/USB/msc/msc.vcxproj +++ b/Drivers/USB/msc/msc.vcxproj @@ -1,4 +1,4 @@ - + @@ -101,7 +101,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -118,7 +118,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/USB/usbhci/usbhci.vcxproj b/Drivers/USB/usbhci/usbhci.vcxproj index a7e498e6a..8b06e40dc 100644 --- a/Drivers/USB/usbhci/usbhci.vcxproj +++ b/Drivers/USB/usbhci/usbhci.vcxproj @@ -1,4 +1,4 @@ - + @@ -101,7 +101,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -118,7 +118,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/Usb3/Usb3.vcxproj b/Drivers/Usb3/Usb3.vcxproj index 69c78447d..0874c0ebe 100644 --- a/Drivers/Usb3/Usb3.vcxproj +++ b/Drivers/Usb3/Usb3.vcxproj @@ -100,7 +100,7 @@ false ..\..\Build\usb.dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false diff --git a/Drivers/VMSvga/VMSvga.vcxproj b/Drivers/VMSvga/VMSvga.vcxproj index 1742d44d2..dcf071804 100644 --- a/Drivers/VMSvga/VMSvga.vcxproj +++ b/Drivers/VMSvga/VMSvga.vcxproj @@ -100,7 +100,7 @@ false F:/vmsvga.dll - E:\Xeneva Project\Aurora\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;E:\Xeneva Project\Aurora\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false diff --git a/Drivers/fbset/lcdif/lcdif.vcxproj b/Drivers/fbset/lcdif/lcdif.vcxproj index e8d8bcb32..485edac59 100644 --- a/Drivers/fbset/lcdif/lcdif.vcxproj +++ b/Drivers/fbset/lcdif/lcdif.vcxproj @@ -134,7 +134,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -175,7 +175,7 @@ false $(SolutionDir)\Build\$(TargetName).dll - $(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;$(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib; true false @@ -192,7 +192,7 @@ false - copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/hdmi/hdmi.vcxproj b/Drivers/hdmi/hdmi.vcxproj index bd8908464..77b6eb02f 100644 --- a/Drivers/hdmi/hdmi.vcxproj +++ b/Drivers/hdmi/hdmi.vcxproj @@ -134,7 +134,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -175,7 +175,7 @@ false $(SolutionDir)\Build\$(TargetName).dll - $(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;$(SolutionDir)\ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib; true false @@ -192,7 +192,7 @@ false - copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/virtioblk/virtioblk.vcxproj b/Drivers/virtioblk/virtioblk.vcxproj index 607d77bd8..3b07a40aa 100644 --- a/Drivers/virtioblk/virtioblk.vcxproj +++ b/Drivers/virtioblk/virtioblk.vcxproj @@ -132,7 +132,7 @@ false F:/vmware.dll - E:\Xeneva Project\Aurora\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;E:\Xeneva Project\Aurora\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false @@ -170,7 +170,7 @@ false $(SolutionDir)Build\$(TargetName).dll - $(SolutionDir)ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;$(SolutionDir)ARM64\Debug;%(AdditionalLibraryDirectories) xnkrnl.lib; true false @@ -187,7 +187,7 @@ false - copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "$(SolutionDir)\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) diff --git a/Drivers/vmware/vmware.vcxproj b/Drivers/vmware/vmware.vcxproj index 815da6360..067bbf746 100644 --- a/Drivers/vmware/vmware.vcxproj +++ b/Drivers/vmware/vmware.vcxproj @@ -100,7 +100,7 @@ false F:/vmware.dll - E:\Xeneva Project\Aurora\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;E:\Xeneva Project\Aurora\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false diff --git a/Drivers/xHCI/xHCI.vcxproj b/Drivers/xHCI/xHCI.vcxproj index 2a08360ef..dffd47af4 100644 --- a/Drivers/xHCI/xHCI.vcxproj +++ b/Drivers/xHCI/xHCI.vcxproj @@ -102,7 +102,7 @@ false ..\..\Build\$(TargetName).dll - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) Kernel.lib; true false diff --git a/Kernel/Cap/capability.cpp b/Kernel/Cap/capability.cpp new file mode 100644 index 000000000..173dc5f31 --- /dev/null +++ b/Kernel/Cap/capability.cpp @@ -0,0 +1,224 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#include +#include +#include +#include <_null.h> + +#ifdef ARCH_X64 +#include +#elif defined(ARCH_ARM64) +#include +#endif + +/* + * NOTE on concurrency: every existing syscall entry point in + * Kernel/Serv/fileserv.cpp already runs with interrupts disabled + * (x64_cli()) for the duration of the call, and XenevaOS's + * multiprocessor scheduler is not active yet (see readme.md). That is + * the same assumption these functions rely on -- callers are expected + * to hold that same single-CPU-in-kernel invariant. Once SMP + * scheduling lands this table will need its own lock (Phase 8 of the + * roadmap calls this out explicitly under "race conditions" / + * "concurrent capability lookup/removal") and every function below + * should take it before touching proc->caps. + */ + +/* internal helper: is `fd` a valid index into the capability table? */ +static unsigned char cap_slot_in_range(int rq) { + return (rq >= 0) && (rq < 63); +} + +/* internal helper: slot pointer, or NULL if fd is out of range */ +static AuCapability* cap_slot(AuProcess* proc, int fd) { + if (!proc || !cap_slot_in_range(fd)) + return NULL; + return &proc->caps[fd]; +} + +int BordoisilaCapCreate(AuProcess* proc, int fd, void* object, uint8_t type, CapRights rights) { + AuCapability* cap = cap_slot(proc, fd); + if (!cap) + return CAP_ERR_INVALID; + if (!object) + return CAP_ERR_INVALID; + + cap->object = object; + cap->object_type = type; + /* a freshly minted capability may never exceed CAP_FILE_RIGHTS_MASK + * for the file object type in V0; this keeps a caller from handing + * in a bogus/garbage mask and getting more than the model allows */ + if (type == CAP_OBJ_FILE) + cap->rights = rights & CAP_FILE_RIGHTS_MASK; + else + cap->rights = CAP_RIGHTS_NONE; + + cap->owner = proc->creds.uid; + cap->flags = CAP_FLAG_NONE; + cap->valid = true; + return CAP_OK; +} + +AuCapability* BordoisilaCapLookup(AuProcess* proc, int fd) { + AuCapability* cap = cap_slot(proc, fd); + if (!cap) + return NULL; + if (!cap->valid) + return NULL; + return cap; +} + +bool BordoisilaCapCheckRights(AuProcess* proc, int fd, CapRights required) { + AuCapability* cap = BordoisilaCapLookup(proc, fd); + + if (!cap) { +#ifdef ARCH_X64 + SeTextOut("[CAP] No capability fd=%d\r\n", fd); +#elif defined(ARCH_ARM64) + UARTDebugOut("[CAP] No capability fd=%d\r\n", fd); +#endif + return false; + } + +#ifdef ARCH_X64 + SeTextOut("[CAP] Check fd=%d req=%x have=%x\r\n", + fd, required, cap->rights); +#elif defined(ARCH_ARM64) + UARTDebugOut("[CAP] Check fd=%d req=%x have=%x\r\n", + fd, required, cap->rights); +#endif + + return (cap->rights & required) == required; +} + +int BordoisilaCapDup(AuProcess* proc, int oldfd, int newfd) { + + AuCapability* src = BordoisilaCapLookup(proc, oldfd); + if (!src) + return CAP_ERR_INVALID; + + if (!cap_slot_in_range(newfd)) + return CAP_ERR_INVALID; + + if (proc->caps[newfd].valid) + return CAP_ERR_INVALID; + + if (proc->fds[newfd]) + return CAP_ERR_INVALID; + + proc->fds[newfd] = proc->fds[oldfd]; + + if (proc->fds[newfd]) + proc->fds[newfd]->fileCopyCount++; + + AuCapability* dst = &proc->caps[newfd]; + + dst->object = src->object; + dst->object_type = src->object_type; + dst->rights = src->rights; + dst->owner = src->owner; + dst->flags = src->flags; + dst->valid = true; + + return CAP_OK; +} + +int BordoisilaCapRestrict(AuProcess* proc, int fd, CapRights new_rights) { + AuCapability* cap = BordoisilaCapLookup(proc, fd); + if (!cap) + return CAP_ERR_INVALID; + + /* rights may only shrink: intersect rather than assign, so this + * can never be used to grant a bit the capability didn't already + * have (section 5: "rights can only become more restrictive") */ + cap->rights = cap->rights & new_rights; + return CAP_OK; +} + +void BordoisilaCapDestroy(AuProcess* proc, int fd) { + AuCapability* cap = cap_slot(proc, fd); + if (!cap || !cap->valid) + return; + + cap->object = NULL; + cap->object_type = 0; + cap->rights = CAP_RIGHTS_NONE; + cap->owner = 0; + cap->flags = CAP_FLAG_NONE; + cap->valid = false; +} + +void BordoisilaCapCleanupProcess(AuProcess* proc) { + if (!proc) + return; + for (int i = 0; i < FILE_DESC_PER_PROCESS; i++) { + AuCapability* cap = &proc->caps[i]; + if (cap->valid) { + cap->object = NULL; + cap->object_type = 0; + cap->rights = CAP_RIGHTS_NONE; + cap->owner = 0; + cap->flags = CAP_FLAG_NONE; + cap->valid = false; + } + } +} + +void BordoisilaCapInheritTable(AuProcess* parent, AuProcess* child) { + if (!parent || !child) + return; + + /* NOTE: as of this writing AuCreateProcessSlot()/AuCreateProcess() + * zero-initialize fds[] rather than copying the parent's open + * files, so there is currently nothing for capabilities to mirror + * at fork/spawn time -- this mirrors section 7 of the design doc + * ("similar to how file descriptors are already inherited") for + * whenever fd inheritance itself is implemented. Until then this + * only matters for slots the caller populates manually. Flagging + * this gap for design review rather than papering over it. */ + for (int i = 0; i < FILE_DESC_PER_PROCESS; i++) { + AuCapability* src = &parent->caps[i]; + if (!src->valid) + continue; + if (src->flags & CAP_FLAG_NO_INHERIT) + continue; + if (!child->fds[i]) + continue; + + AuCapability* dst = &child->caps[i]; + dst->object = src->object; + dst->object_type = src->object_type; + /* rights never increase across inheritance */ + dst->rights = src->rights; + dst->owner = child->creds.uid; + dst->flags = src->flags; + dst->valid = true; + } +} \ No newline at end of file diff --git a/Kernel/Kernel.vcxproj b/Kernel/Kernel.vcxproj index eb8b9aa34..0d74dd64e 100644 --- a/Kernel/Kernel.vcxproj +++ b/Kernel/Kernel.vcxproj @@ -150,7 +150,7 @@ false - ..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\x64\Debug;%(AdditionalLibraryDirectories) /filealign:0x1000 %(AdditionalOptions) @@ -200,7 +200,7 @@ false - ..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\x64\Debug;%(AdditionalLibraryDirectories) /filealign:0x1000 %(AdditionalOptions) @@ -250,6 +250,7 @@ + diff --git a/Kernel/Kernel.vcxproj.filters b/Kernel/Kernel.vcxproj.filters index 18984cba0..a9ccd4ac8 100644 --- a/Kernel/Kernel.vcxproj.filters +++ b/Kernel/Kernel.vcxproj.filters @@ -551,6 +551,7 @@ Fs + diff --git a/Kernel/Serv/fileserv.cpp b/Kernel/Serv/fileserv.cpp index 0de4c9303..7b071a30b 100644 --- a/Kernel/Serv/fileserv.cpp +++ b/Kernel/Serv/fileserv.cpp @@ -39,13 +39,14 @@ #include <_null.h> #include #include +#include /* * OpenFile -- opens a file for user process * @param file -- file path * @param mode -- mode of the file */ -int OpenFile(char* filename, int mode) { +int OpenFile(char* filename, int mode) { SeTextOut("<<<<<<<<<< OPENFILE HIT >>>>>>>>>>\r\n"); x64_cli(); AuThread* current_thr = AuGetCurrentThread(); if (!current_thr) @@ -85,8 +86,33 @@ int OpenFile(char* filename, int mode) { file->open(file, NULL); current_proc->fds[fd] = file; + + /* + * Bind a capability to the newly allocated fd. + */ + CapRights rights = CAP_SEEK; + + if (mode & FILE_OPEN_READ_ONLY) + rights |= CAP_READ; + + if (mode & (FILE_OPEN_WRITE | FILE_OPEN_CREAT)) + rights |= CAP_WRITE; + + /* Preserve existing default behaviour. */ + if (mode == 0) + rights |= CAP_READ; + + BordoisilaCapCreate( + current_proc, + fd, + file, + CAP_OBJ_FILE, + rights); + + SeTextOut("[CAP] Capability created fd=%d rights=%x\r\n", fd, rights); + return fd; -} + } /* * FileSetOffset -- set a offset inorder to read the @@ -151,9 +177,12 @@ size_t ReadFile(int fd, void* buffer, size_t length) { //SeTextOut("Reading from file -> %d -> %x \r\n", fd, file); if (!file) - return 0; - size_t ret_bytes = 0; - + return 0; + + if (!BordoisilaCapCheckRights(current_proc, fd, CAP_READ)) + return 0; + + size_t ret_bytes = 0; /* every general file will contain its * file system node as device */ AuVFSNode* fsys = (AuVFSNode*)file->device; @@ -207,10 +236,12 @@ size_t WriteFile(int fd, void* buffer, size_t length) { uint8_t* aligned_buffer = (uint8_t*)buffer; if (!file) return 0; - size_t write_bytes = 0; - size_t ret_bytes; + + if (!BordoisilaCapCheckRights(current_proc, fd, CAP_WRITE)) + return 0; + /* every general file will contain its - * file system node as device */ + * file system node as device */ AuVFSNode* fsys = (AuVFSNode*)file->device; if (file->flags & FS_FLAG_GENERAL && !(file->flags & FS_FLAG_TTY)) { @@ -308,9 +339,10 @@ int CloseFile(int fd) { AuVFSNode* file = current_proc->fds[fd]; if (file->flags & FS_FLAG_FILE_SYSTEM){ - SeTextOut("Closing fs -> %s \r\n", file->filename); - current_proc->fds[fd] = 0; - return -1; + SeTextOut("Closing fs -> %s \r\n", file->filename); + BordoisilaCapDestroy(current_proc, fd); + current_proc->fds[fd] = 0; + return -1; } if (file->flags & FS_FLAG_GENERAL){ kfree(file); @@ -326,6 +358,7 @@ int CloseFile(int fd) { file->close(file, file); } + BordoisilaCapDestroy(current_proc, fd); current_proc->fds[fd] = 0; return 0; } diff --git a/Kernel/process.cpp b/Kernel/process.cpp index b529061e5..802068f59 100644 --- a/Kernel/process.cpp +++ b/Kernel/process.cpp @@ -275,7 +275,9 @@ AuProcess* AuCreateRootProc() { proc->proc_mmap_len = 0; proc->waitlist = initialize_list(); for (int i = 0; i < FILE_DESC_PER_PROCESS; i++) - proc->fds[i] = 0; + proc->fds[i] = 0; + memset(proc->caps, 0, sizeof(proc->caps)); + /* create the main thread after loading the * image file to process, because just after @@ -322,7 +324,14 @@ AuProcess* AuCreateProcessSlot(AuProcess* parent, char* name) { proc->proc_mmap_len = 0; proc->waitlist = initialize_list(); for (int i = 0; i < FILE_DESC_PER_PROCESS; i++) - proc->fds[i] = 0; + proc->fds[i] = 0; + + memset(proc->caps, 0, sizeof(proc->caps)); + + /* + * TODO: re-enable BordoisilaCapInheritTable(parent, proc) + * once fd inheritance is implemented. + */ proc->main_thread = NULL; @@ -384,7 +393,7 @@ AuProcess* AuGetKillableProcess() { * @param pid -- pid of the process, if -1 then any child * process */ -void AuProcessWaitForTermination(AuProcess *proc, int pid) { +int AuProcessWaitForTermination(AuProcess *proc, int pid) { if (pid == -1) { do { AuProcess *killable = AuGetKillableProcess(); @@ -529,6 +538,8 @@ void AuProcessExit(AuProcess* proc, bool schedulable) { } } + BordoisilaCapCleanupProcess(proc); + for (int i = 0; i < proc->waitlist->pointer; i++) { AuThread* thr = (AuThread*)list_remove(proc->waitlist, i); if (thr) { diff --git a/KernelAA64/Board/Rpi3bp/rpi3bpIRQ.c b/KernelAA64/Board/Rpi3bp/rpi3bpIRQ.c index e92f29248..f2bde1446 100644 --- a/KernelAA64/Board/Rpi3bp/rpi3bpIRQ.c +++ b/KernelAA64/Board/Rpi3bp/rpi3bpIRQ.c @@ -65,12 +65,11 @@ void RPI3_IRQ_handler(AA64Registers* regs) { UARTDebugOut("[aurora]:******* rpi3 timer irq++ %d\r\n", bit); /* if (bit == 1) for (;;);*/ - suspendTimer(); - setupTimerIRQ(); - + // suspendTimer(); + // setupTimerIRQ(); + resetTimer(); /** handle kernel expired kernel timers */ AuroraTimerTick(); - AuScheduleThread(regs); } if (pending & INT_SRC_CNTPSIRQ) { @@ -80,11 +79,11 @@ void RPI3_IRQ_handler(AA64Registers* regs) { UARTDebugOut("[aurora]: rpi timer HPIRQ++ \r\n"); } if (pending & (1ULL << 3)) { - suspendTimer(); - setupTimerIRQ(); - + //suspendTimer(); + //setupTimerIRQ(); + resetTimer(); /** handle kernel's expired timers */ - AuroraTimerTick(); + AuroraTimerTick(); AuScheduleThread(regs); } diff --git a/KernelAA64/Board/Rpi3bp/rpi_ili9486.c b/KernelAA64/Board/Rpi3bp/rpi_ili9486.c index 5ea57bf7e..24c83cd72 100644 --- a/KernelAA64/Board/Rpi3bp/rpi_ili9486.c +++ b/KernelAA64/Board/Rpi3bp/rpi_ili9486.c @@ -27,7 +27,7 @@ * **/ -#ifdef __TARGET_BOARD_RPI3__ +#if 0 #include #include diff --git a/KernelAA64/Board/Rpi3bp/vc4dsi.c b/KernelAA64/Board/Rpi3bp/vc4dsi.c index 77f069f1b..778b49883 100644 --- a/KernelAA64/Board/Rpi3bp/vc4dsi.c +++ b/KernelAA64/Board/Rpi3bp/vc4dsi.c @@ -34,6 +34,8 @@ #include #include +#if 0 // __TARGET_BOARD_RPI3__ + #define MAILBOX_BASE (RPI_MMIO_BASE + 0x00b880) #define DSI0_BASE (RPI_MMIO_BASE + 0x209000) #define DSI1_BASE (RPI_MMIO_BASE + 0x700000) @@ -764,4 +766,6 @@ void AuVC4DSIInit() { LCDPutPixel(30, 40, rgb_to_rgb565(255, 255, 255)); AuTextOut("[aurora]: VC4 DSI Display initialized \r\n"); -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/KernelAA64/Board/Virt/virt.c b/KernelAA64/Board/Virt/virt.c index 01805cc39..f6a78496a 100644 --- a/KernelAA64/Board/Virt/virt.c +++ b/KernelAA64/Board/Virt/virt.c @@ -35,6 +35,7 @@ #include #include #include +#include #define VIRTIO_INPUT_KEYBOARD 1 #define VIRTIO_INPUT_TABLET 2 @@ -43,7 +44,14 @@ uint8_t AuVirtIOInputCheck(uint64_t device, int bus,int dev,int func) { uint64_t barLo = AuPCIERead(device, PCI_BAR4, bus, dev, func); uint64_t barHi = AuPCIERead(device, PCI_BAR5, bus, dev, func); uint64_t bar = ((uint64_t)barHi << 32) | (barLo & ~0xFULL); - uint64_t finalAddr = (uint64_t)AuMapMMIO(bar, 16); + + /* we don't need to map the bar to MMIO range, because this function + * is temporary one, won't be used later in the system. We have + * long way to go when lower half address range is cleared. Till then + * kernel has lower half of address range present, so taking advantage + * of lower half till then + */ + uint64_t finalAddr = bar; struct VirtioDeviceConfig* cfg = (struct VirtioDeviceConfig*)(finalAddr + 0x2000); cfg->select = 1; cfg->subsel = 0; @@ -78,7 +86,8 @@ void AuVirtIOInputInitialize() { uint8_t sub_ClassCode = AuPCIERead(address, PCI_SUBCLASS, bus, dev, func); uint16_t vendID = AuPCIERead(address, PCI_VENDOR_ID, bus, dev, func); uint16_t devID = AuPCIERead(address, PCI_DEVICE_ID, bus, dev, func); - UARTDebugOut("Vendor ID attached : %x devID : %x \r\n", vendID, devID); + // UARTDebugOut("Vendor ID attached : %x devID : %x \r\n", vendID, devID); + //UARTDebugOut("Vendor ID attached : %x devID : %x \r\n", vendID, devID); if (vendID == 0x1AF4 && devID == 0x1052) { uint8_t devType = AuVirtIOInputCheck(address, bus, dev, func); if (devType == VIRTIO_INPUT_KEYBOARD) { @@ -99,4 +108,15 @@ void AuVirtIOInputInitialize() { } } UARTDebugOut("Virtio Input initialized \r\n"); +} + +#define GOOGLE_GOLDFISH_RTC_BASE 0x09010000 +#define RTC_TIME_LOW ((volatile uint32_t*)(GOOGLE_GOLDFISH_RTC_BASE + 0x00)) +#define RTC_TIME_HIGH ((volatile uint32_t*)(GOOGLE_GOLDFISH_RTC_BASE + 0x04)) + + +uint64_t AuVirtGetBootEpoch() { + uint32_t low = *RTC_TIME_LOW; + uint32_t high = *RTC_TIME_HIGH; + return (((uint64_t)high << 32) | low); } \ No newline at end of file diff --git a/KernelAA64/Board/board.c b/KernelAA64/Board/board.c index de5ed7715..e473406d3 100644 --- a/KernelAA64/Board/board.c +++ b/KernelAA64/Board/board.c @@ -30,11 +30,15 @@ **/ #include #include +#include +#include #include #include #include #include #include +#include +#include extern void imx8mp_gpc_init(); @@ -42,6 +46,7 @@ extern void imx8mp_gpc_init(); #ifdef __TARGET_BOARD_QEMU_VIRT__ extern void virt_power_down(uint64_t code); extern void virt_power_reboot(uint64_t code); +extern uint64_t AuVirtGetBootEpoch(); #endif @@ -55,7 +60,9 @@ void AuAA64BoardInitialize() { #elif __TARGET_BOARD_IMX8MP_VERDIN_DAHLIA__ || (__TARGET_BOARD_IMX8MP_SOC__) /** initialize the ccm module **/ imx8mp_gpc_init(); - imx8mp_ccm_init(); + imx8mp_pll_init(); + imx8mp_gate_init(); + imx8mp_ccm_init(); #endif } @@ -64,8 +71,14 @@ void AuAA64BoardInitialize() { */ void AuAA64BoardSleepUS(uint32_t us) { #ifdef __TARGET_BOARD_RPI3__ - AuRPI3DelayUS(us); + return AuRPI3DelayUS(us); #endif + uint64_t freq = get_cntfrq_el0(); + uint64_t ticks = (freq / 1000000ULL) * us; + uint64_t start = get_cntpct_el0(); + while ((get_cntpct_el0() - start) < ticks) { + _wfi(); + } } /** @@ -76,6 +89,7 @@ void AuAA64BoardSleepMS(uint32_t ms) { #ifdef __TARGET_BOARD_RPI3__ AuRPIDelayMS(ms); #endif + AuAA64BoardSleepUS(ms * 1000ULL); } /** @@ -96,4 +110,14 @@ void AuAA64BoardReboot() { UARTDebugOut("[aurora]: restarting your system \r\n"); virt_power_reboot(0x84000009); #endif +} + +/** + * @brief AuAA64BoardGetBootEpoch -- returns the + * boot epoch time from board + */ +uint64_t AuAA64BoardGetBootEpoch() { +#ifdef __TARGET_BOARD_QEMU_VIRT__ + return AuVirtGetBootEpoch(); +#endif } \ No newline at end of file diff --git a/KernelAA64/Board/imx8mp/imx8mp_clk.c b/KernelAA64/Board/imx8mp/imx8mp_clk.c index 2c5214f7e..7b3a62f7a 100644 --- a/KernelAA64/Board/imx8mp/imx8mp_clk.c +++ b/KernelAA64/Board/imx8mp/imx8mp_clk.c @@ -35,9 +35,307 @@ #include #include #include +#include +#include +#include <_null.h> +#include +#include +#include +#include static uint64_t _ccm_base; +typedef struct _clk_node_ { + char* name; + uint32_t(*recalc_rate)(struct _clk_node_* self); + int num_parent; + struct _clk_node_** parent; + uint32_t reg_offset; + uint32_t clk_slice; + uint32_t pre_podf; + uint32_t post_podf; + int is_composite; + uint32_t anatop_base; + bool _pll_read; + int current_parent_idx; +}imx8mp_clk; + +typedef struct _dt_clk_bindings_ { + uint32_t clk_id; + int has_parent; + uint32_t parent_clk_id; + uint32_t rate_hz; +}imx8mp_dt_clk; + +static imx8mp_clk _clk_node[100]; +static imx8mp_dt_clk _assigned_clk[100]; +static int _clk_node_count = 0; +static int _assigned_clk_cnt = 0; + +static void imx8mp_write_target_root(uint32_t clk_root_idx, uint32_t offset, + uint32_t mux_val, uint32_t pre_podf, uint32_t post_podf); + +static imx8mp_clk* _imx8mp_clk_alloc(const char* name) { + if (_clk_node_count == 100) { + BPrintK(BORDOISILA_ERROR, "imx8mp failed to allocate clock, max clock exceeds \r\n"); + return NULL; + } + imx8mp_clk* n = &_clk_node[_clk_node_count++]; + n->name = name; + n->parent = NULL; + n->current_parent_idx = 0; + n->is_composite = 0; + return n; +} + + + +static uint32_t _imx8mp_fixed_recalc(imx8mp_clk* clk) { + return clk->pre_podf; +} + +static imx8mp_clk* imx8mp_clk_fixed(const char* name, uint32_t fixed_hz) { + imx8mp_clk* n = _imx8mp_clk_alloc(name); + n->recalc_rate = _imx8mp_fixed_recalc; + n->pre_podf = fixed_hz; + return n; +} + +static uint32_t imx8mp_composite_recalc(imx8mp_clk* self) { + imx8mp_clk* parent = self->parent[self->current_parent_idx]; + uint32_t parent_rate = parent->recalc_rate(parent); + uint32_t total_div = (self->pre_podf + 1) * (self->post_podf + 1); + return parent_rate / total_div; +} + +static imx8mp_clk* imx8mp_clk_composite(const char* name, imx8mp_clk** parent, int n_parents) { + imx8mp_clk* n = _imx8mp_clk_alloc(name); + n->recalc_rate = imx8mp_composite_recalc; + n->num_parent = n_parents; + n->parent = parent; + n->is_composite = 1; + n->pre_podf = 0; + n->post_podf = 0; + n->anatop_base = 0; + n->_pll_read = 0; + return n; +} + + +static imx8mp_clk* imx8mp_clk_pll(const char* name, imx8mp_clk** parent, int n_parents, uint32_t anatop) { + imx8mp_clk* n = _imx8mp_clk_alloc(name); + n->recalc_rate = 0; + n->num_parent = n_parents; + n->parent = parent; + n->is_composite = 1; + n->pre_podf = 0; + n->post_podf = 0; + n->anatop_base = anatop; + n->_pll_read = 1; + return n; +} + +static uint32_t AuDeviceTreeGetFixedClockRate(const char* node_name) { + uint32_t* node = AuDeviceTreeGetNode(node_name); + if (!node) { + BPrintK(BORDOISILA_ERROR, "imx8mp dtp node: %s not found \r\n", node_name); + return 0; + } + + uint32_t rate = AuDeviceTreeGetU32Property(node, "clock-frequency", 0); + BPrintK(BORDOISILA_INFO, "clock rate for node : %s is %u \r\n", node_name, rate); + return rate; +} + + +#define IMX8MP_SYS_PLL1_RATE_HZ 800000000UL +#define IMX8MP_SYS_PLL2_RATE_HZ 1000000000UL + +static imx8mp_clk* g_sys_pll1_40m; +static imx8mp_clk* g_sys_pll1_80m; +static imx8mp_clk* g_sys_pll1_100m; +static imx8mp_clk* g_sys_pll1_133m; +static imx8mp_clk* g_sys_pll1_160m; +static imx8mp_clk* g_sys_pll1_200m; +static imx8mp_clk* g_sys_pll1_266m; +static imx8mp_clk* g_sys_pll1_400m; +static imx8mp_clk* g_sys_pll1_800m; + +static imx8mp_clk* g_sys_pll2_50m; +static imx8mp_clk* g_sys_pll2_100m; +static imx8mp_clk* g_sys_pll2_125m; +static imx8mp_clk* g_sys_pll2_166m; +static imx8mp_clk* g_sys_pll2_200m; +static imx8mp_clk* g_sys_pll2_250m; +static imx8mp_clk* g_sys_pll2_333m; +static imx8mp_clk* g_sys_pll2_500m; +static imx8mp_clk* g_sys_pll2_1000m; +static imx8mp_clk* g_osc_24m; + +static imx8mp_clk* g_clk_ext1; +static imx8mp_clk* g_clk_ext2; +static imx8mp_clk* g_clk_ext3; +static imx8mp_clk* g_clk_ext4; + +static imx8mp_clk* g_video_pll1_out; +static imx8mp_clk* g_audio_pll1_out; +static imx8mp_clk* g_gpu_pll_out; + +static imx8mp_clk* g_audio_pll2_out; +static imx8mp_clk* g_sys_pll3_out; + +static void imx8mp_config_fixed_clock() { + uint64_t parent = imx8mp_pll_get_parent_rate(__IMX8MP_SYS_PLL1_GEN_CTRL); + + uint64_t pll1_rate = imx8mp_pll_recalc_rate(__IMX8MP_SYS_PLL1_GEN_CTRL, parent); + parent = imx8mp_pll_get_parent_rate(__IMX8MP_SYS_PLL2_GEN_CTRL); + uint64_t pll2_rate = imx8mp_pll_recalc_rate(__IMX8MP_SYS_PLL2_GEN_CTRL, parent); + + parent = imx8mp_pll_get_parent_rate(__IMX8MP_SYS_PLL3_GEN_CTRL); + uint64_t pll3_rate = imx8mp_pll_recalc_rate(__IMX8MP_SYS_PLL3_GEN_CTRL, parent); + BPrintK(BORDOISILA_INFO, "imx8mp: configuring clock rate database, pll1 rate: %u, pll3 rate: %u \r\n", + pll1_rate, pll3_rate); + + /** + * DO NOTE: video pll1 rate and audio pll1 rate are in P-O-R (Power on Reset) values + * maybe, we need to configure that using CCM analog base + */ + parent = imx8mp_pll_get_parent_rate(__IMX8MP_VIDEO_PLL1_GEN_CTRL); + uint64_t video_pll1_rate = imx8mp_pll_recalc_rate(__IMX8MP_VIDEO_PLL1_GEN_CTRL, parent); + + parent = imx8mp_pll_get_parent_rate(__IMX8MP_AUDIO_PLL1_GEN_CTRL); + uint64_t audio_pll1_rate = imx8mp_pll_recalc_rate(__IMX8MP_AUDIO_PLL1_GEN_CTRL, parent); + + parent = imx8mp_pll_get_parent_rate(__IMX8MP_AUDIO_PLL2_GEN_CTRL); + uint64_t audio_pll2_rate = imx8mp_pll_recalc_rate(__IMX8MP_AUDIO_PLL2_GEN_CTRL, parent); + + parent = imx8mp_pll_get_parent_rate(__IMX8MP_GPU_PLL_GEN_CTRL); + uint64_t gpu_pll_rate = imx8mp_pll_recalc_rate(__IMX8MP_GPU_PLL_GEN_CTRL, parent); + + BPrintK(BORDOISILA_INFO, "imx8mp gpu pll rate : %u \r\n", gpu_pll_rate); + + g_osc_24m = imx8mp_clk_fixed("osc_24m", 24000000); + g_sys_pll1_800m = imx8mp_clk_fixed("sys_pll1_800m", pll1_rate); + g_sys_pll1_400m = imx8mp_clk_fixed("sys_pll1_400m", pll1_rate / 2); + g_sys_pll1_266m = imx8mp_clk_fixed("sys_pll1_266m", pll1_rate / 3); + g_sys_pll1_200m = imx8mp_clk_fixed("sys_pll1_200m", pll1_rate / 4); + g_sys_pll1_160m = imx8mp_clk_fixed("sys_pll1_160m", pll1_rate / 5); + g_sys_pll1_133m = imx8mp_clk_fixed("sys_pll1_133m", pll1_rate / 6); + g_sys_pll1_100m = imx8mp_clk_fixed("sys_pll1_100m", pll1_rate / 8); + g_sys_pll1_80m = imx8mp_clk_fixed("sys_pll1_80m", pll1_rate / 10); + g_sys_pll1_40m = imx8mp_clk_fixed("sys_pll1_40m", pll1_rate / 20); + + g_sys_pll2_1000m = imx8mp_clk_fixed("sys_pll2_1000m", pll2_rate / 1); + g_sys_pll2_500m = imx8mp_clk_fixed("sys_pll2_500m", pll2_rate / 2); + g_sys_pll2_333m = imx8mp_clk_fixed("sys_pll2_333m", pll2_rate / 3); + g_sys_pll2_250m = imx8mp_clk_fixed("sys_pll2_250m", pll2_rate / 4); + g_sys_pll2_200m = imx8mp_clk_fixed("sys_pll2_200m", pll2_rate / 5); + g_sys_pll2_166m = imx8mp_clk_fixed("sys_pll2_166m", pll2_rate / 6); + g_sys_pll2_125m = imx8mp_clk_fixed("sys_pll_125m", pll2_rate / 8); + g_sys_pll2_100m = imx8mp_clk_fixed("sys_pll2_100m", pll2_rate / 10); + g_sys_pll2_50m = imx8mp_clk_fixed("sys_pll2_50m", pll2_rate / 20); + + uint32_t ext1_hz = AuDeviceTreeGetFixedClockRate("clock-ext1"); + uint32_t ext2_hz = AuDeviceTreeGetFixedClockRate("clock-ext2"); + uint32_t ext3_hz = AuDeviceTreeGetFixedClockRate("clock-ext3"); + uint32_t ext4_hz = AuDeviceTreeGetFixedClockRate("clock-ext4"); + + g_clk_ext1 = imx8mp_clk_fixed("clk_ext1", ext1_hz); + g_clk_ext2 = imx8mp_clk_fixed("clk_ext2", ext2_hz); + g_clk_ext3 = imx8mp_clk_fixed("clk_ext3", ext3_hz); + g_clk_ext4 = imx8mp_clk_fixed("clk_ext4", ext4_hz); + + g_audio_pll1_out = imx8mp_clk_fixed("audio_pll1_out", audio_pll1_rate); + g_video_pll1_out = imx8mp_clk_fixed("video_pll1_out", video_pll1_rate); + g_audio_pll2_out = imx8mp_clk_fixed("audio_pll2_out", audio_pll2_rate); + g_sys_pll3_out = imx8mp_clk_fixed("sys_pll3_out", pll3_rate); + g_gpu_pll_out = imx8mp_clk_fixed("gpu_pll_out", gpu_pll_rate); +} + + +static void imx8mp_clk_set_rate(imx8mp_clk* self, uint32_t target_hz) { + uint32_t best_err = UINT32_MAX; + int best_parent = 0, best_pre = 0, best_post = 0; + + for (int p = 0; p < self->num_parent; p++) { + uint32_t parent_rate = self->parent[p]->recalc_rate(self->parent[p]); + for (uint32_t div = 1; div <= 512; div++) { + uint32_t rate = parent_rate / div; + uint32_t err = (rate > target_hz) ? rate - target_hz : target_hz - rate; + if (err < best_err) { + best_err = err; + best_parent = p; + + for (uint32_t pre = 1; pre <= 8; pre++) { + if (div % pre == 0 && div / pre <= 64) { + best_pre = pre - 1; + best_post = (div / pre) - 1; + break; + } + } + if (err == 0) goto done; + } + } + } +done: + self->current_parent_idx = best_parent; + self->pre_podf = best_pre; + self->post_podf = best_post; + BPrintK(BORDOISILA_INFO, "using parent index : %d for clock : %s \r\n", self->current_parent_idx, self->name); + BPrintK(BORDOISILA_INFO, "pre podf: %d, post podf : %d \r\n", self->pre_podf, self->post_podf); + imx8mp_write_target_root(self->clk_slice, 0x0, self->current_parent_idx, self->pre_podf, self->post_podf); + +} + + +void imx8mp_parse_assigned_clk(const char* nodename) { + uint32_t* node = AuDeviceTreeGetNode(nodename); + if (!node) { + BPrintK(BORDOISILA_INFO, "imx8mp dtb node not found : %s \r\n", nodename); + return; + } + + uint32_t n_clk, n_parent, n_rate; + uint32_t* clk_cells = AuDeviceTreeGetPropCells(node, "assigned-clocks", &n_clk); + uint32_t* parent_cells = AuDeviceTreeGetPropCells(node, "assigned-clock-parents", &n_parent); + uint32_t* rate_cells = AuDeviceTreeGetPropCells(node, "assigned-clock-rates", &n_rate); + + if (!clk_cells) { + BPrintK(BORDOISILA_ERROR, "imx8mp assigned-clocks: property absent on : %s \r\n", nodename); + return; + } + + uint32_t num_entries = n_clk / 2; + uint32_t parent_idx = 0, rate_idx = 0; + + for (uint32_t i = 0; i < num_entries && i < 100; i++) { + imx8mp_dt_clk* e = &_assigned_clk[_assigned_clk_cnt]; + + e->clk_id = AuDTBSwap32(clk_cells[i * 2 + 1]); + e->rate_hz = (rate_idx < n_rate) ? AuDTBSwap32(rate_cells[rate_idx]) : 0; + rate_idx++; + + if (parent_idx < n_parent) { + uint32_t first = AuDTBSwap32(parent_cells[parent_idx]); + if (first == 0) { + e->has_parent = 0; + parent_idx += 1; + } + else { + e->has_parent = 1; + e->parent_clk_id = AuDTBSwap32(parent_cells[parent_idx + 1]); + parent_idx += 2; + } + } + else { + e->has_parent = 0; + } + + BPrintK(BORDOISILA_INFO, "assigned-clock[%u]: id=%u, parent=%s \r\n", i, e->clk_id, e->has_parent ? "yes" : "no"); + BPrintK(BORDOISILA_INFO, "= parent id : %u, rate=%u Hz \r\n", e->parent_clk_id, e->rate_hz); + _assigned_clk_cnt++; + } +} /** * imx8mp_hdmi_ccm_init -- initialize hdmi root clocks */ @@ -84,25 +382,182 @@ void imx8mp_lcdif_ccm_init() { imx8mp_ccm_write(MEDIA_DISP2_CLK_ROOT, 0x00, setval);*/ } + +static bool is_imx8mp_clk_enabled(uint32_t clk_idx) { + volatile uint32_t* root = (volatile uint32_t*)CCM_ROOT_REG(_ccm_base, clk_idx); + bool is_true = false; + uint32_t rval = *root; + if ((rval & (1u << 28)) != 0) + is_true = true; + + return is_true; +} + +static uint32_t imx8mp_clk_get_mux(uint32_t clk_idx) { + volatile uint32_t* root = (volatile uint32_t*)CCM_ROOT_REG(_ccm_base, clk_idx); + uint32_t rval = *root; + return (rval >> 24) & 0x7u; +} + + +#define FORM_CLK_COMPOSITE(name,parent,n_parent) imx8mp_clk_composite(name,parent,n_parent) + + /** *imx8mp_void_ccm_init -- map the ccm module */ void imx8mp_ccm_init() { AuTextOut("[imx8mp_board]: initializing clock control module (ccm) \r\n"); - _ccm_base = (uint64_t)AuMapMMIO(CCM_BASE, 16); + _ccm_base = (uint64_t)CCM_BASE; // AuMapMMIO(CCM_BASE, 16); + imx8mp_config_fixed_clock(); + + /** + * Reference: Linux source code, clk-imx8mp.c + */ + + static imx8mp_clk* media_axi_parents[8]; + media_axi_parents[0] = g_osc_24m; + media_axi_parents[1] = g_sys_pll2_1000m; + media_axi_parents[2] = g_sys_pll1_800m; + media_axi_parents[3] = g_sys_pll3_out; + media_axi_parents[4] = g_sys_pll1_40m; + media_axi_parents[5] = g_audio_pll2_out; + media_axi_parents[6] = g_clk_ext1; + media_axi_parents[7] = g_sys_pll2_500m; + imx8mp_clk* media_axi_clk = FORM_CLK_COMPOSITE("media_axi_axi", media_axi_parents, 8); + media_axi_clk->clk_slice = MEDIA_AXI_CLK_ROOT; + + + static imx8mp_clk* media_apb_parents[8]; + media_apb_parents[0] = g_osc_24m; + media_apb_parents[1] = g_sys_pll2_125m; + media_apb_parents[2] = g_sys_pll1_800m; + media_apb_parents[3] = g_sys_pll3_out; + media_apb_parents[4] = g_sys_pll1_40m; + media_apb_parents[5] = g_audio_pll2_out; + media_apb_parents[6] = g_clk_ext1; + media_apb_parents[7] = g_sys_pll1_133m; + imx8mp_clk* media_apb_clk = FORM_CLK_COMPOSITE("media_apb_axi", media_apb_parents, 8); + media_apb_clk->clk_slice = MEDIA_APB_CLK_ROOT; + + + static imx8mp_clk* gpu3d_sels[8]; + gpu3d_sels[0] = g_osc_24m; + gpu3d_sels[1] = g_gpu_pll_out; + gpu3d_sels[2] = g_sys_pll1_800m; + gpu3d_sels[3] = g_sys_pll3_out; + gpu3d_sels[4] = g_sys_pll2_1000m; + gpu3d_sels[5] = g_audio_pll1_out; + gpu3d_sels[6] = g_video_pll1_out; + gpu3d_sels[7] = g_audio_pll2_out; + imx8mp_clk* gpu3d_clk = FORM_CLK_COMPOSITE("gpu3d_core", gpu3d_sels, 8); + gpu3d_clk->clk_slice = GPU3D_CORE_CLK_ROOT; + + + static imx8mp_clk* gpu3d_shader[8]; + gpu3d_shader[0] = g_osc_24m; + gpu3d_shader[1] = g_gpu_pll_out; + gpu3d_shader[2] = g_sys_pll1_800m; + gpu3d_shader[3] = g_sys_pll3_out; + gpu3d_shader[4] = g_sys_pll2_1000m; + gpu3d_shader[5] = g_audio_pll1_out; + gpu3d_shader[6] = g_video_pll1_out; + gpu3d_shader[7] = g_audio_pll2_out; + imx8mp_clk* gpu3d_sel = FORM_CLK_COMPOSITE("gpu3d_shader", gpu3d_shader, 8); + gpu3d_sel->clk_slice = GPU3D_SHADER_CLK_ROOT; + + + /** by default let's only enable HDMI + LCDIF, because we need * framebuffer output :) */ - imx8mp_hdmi_ccm_init(); - AuTextOut("[imx8mp_board]: hdmi apb and axi clock root enabled \r\n"); - imx8mp_lcdif_ccm_init(); + + // let's enable some clock roots by default, by setting mux/pre-podf/post-podf + if (is_imx8mp_clk_enabled(AHB_CLK_ROOT)) { + BPrintK(BORDOISILA_WARN, "ccm ahb clock root enabled mux: %d\r\n", imx8mp_clk_get_mux(AHB_CLK_ROOT)); + } + else + BPrintK(BORDOISILA_WARN, "ccm ahb clock is not enabled \r\n"); + + if (is_imx8mp_clk_enabled(HDMI_APB_CLK_ROOT)) { + BPrintK(BORDOISILA_WARN, "hdmi apb clock root enabled, mux: %d \r\n", imx8mp_clk_get_mux(HDMI_APB_CLK_ROOT)); + } + else + BPrintK(BORDOISILA_WARN, "hdmi apb clock is not enabled \r\n"); + + if (is_imx8mp_clk_enabled(GPU_AHB_CLK_ROOT)) { + BPrintK(BORDOISILA_WARN, "GPU ahb clock root enabled , mux: %d\r\n", imx8mp_clk_get_mux(GPU_AHB_CLK_ROOT)); + } + else + BPrintK(BORDOISILA_WARN, "GPU AHB Clock is not enabled \r\n"); + + if (is_imx8mp_clk_enabled(GPU_AXI_CLK_ROOT)) { + BPrintK(BORDOISILA_WARN, "GPU AXI clock root enabled, mux: %d\r\n", imx8mp_clk_get_mux(GPU_AXI_CLK_ROOT)); + } + else + BPrintK(BORDOISILA_WARN, "GPU AXI Clock not enabled\r\n"); + + if (is_imx8mp_clk_enabled(MEDIA_APB_CLK_ROOT)) { + BPrintK(BORDOISILA_WARN, "MEDIA APB clock root enabled, mux: %d \r\n", imx8mp_clk_get_mux(MEDIA_APB_CLK_ROOT)); + } + else + BPrintK(BORDOISILA_WARN, "MEDIA APB clock not enabled \r\n"); + + if (is_imx8mp_clk_enabled(MEDIA_AXI_CLK_ROOT)) { + BPrintK(BORDOISILA_WARN, "MEDIA AXI clock enabled, mux : %d \r\n", imx8mp_clk_get_mux(MEDIA_AXI_CLK_ROOT)); + } + else + BPrintK(BORDOISILA_WARN, "MEDIA AXI clock not enabled \r\n"); + + + //and gate them /** todo try setting the clr bits also */ - AuTextOut("[imx8mp_board]: ldcif clock root enabled \r\n"); - AuTextOut("[imx8mp_board]: clock control module (ccm) initialized \r\n"); + imx8mp_clk_set_rate(media_axi_clk, 500000000); + imx8mp_clk_gate_enable(IMX8MP_CLK_MEDIA_AXI_ROOT); } + +static void imx8mp_write_target_root(uint32_t clk_root_idx, uint32_t offset, + uint32_t mux_val, uint32_t pre_podf, uint32_t post_podf) { + volatile uint32_t* root = (volatile uint32_t*)(CCM_ROOT_REG(_ccm_base, clk_root_idx) + offset); + + uint32_t val = *root; + + val &= ~(1U << 28); + *root = val; + + dsb_ish(); + isb_flush(); + + val &= ~(0x7u << 24); + val |= (mux_val & 0x7u) << 24; + val &= ~(0x7u << 16); + val |= (pre_podf & 0x7u) << 16; + val &= ~(0x3Fu << 0); + val |= (post_podf & 0x3Fu) << 0; + *root = val; + + // enable the clock + val |= (1u << 28); + *root = val; + + dsb_ish(); + isb_flush(); + + BPrintK(BORDOISILA_WARN, "imx8mp target root written successfully address : %x \r\n", root); + //for safety :-) hihi + for (int i = 0; i < 100; i++) + ; + + uint32_t confirm = *root; + if (((confirm >> 24) & 0x7u) != mux_val || + ((confirm >> 28) & 0x1u) != 1u) { + BPrintK(BORDOISILA_WARN, "imx8mp target root write mismatch at offset : %x, wanted mux = %x got = %x \r\n", + root, mux_val, ((confirm >> 24) & 0x7u)); + } +} /** * imx8mp_ccm_write -- write value to clock indexed register */ diff --git a/KernelAA64/Board/imx8mp/imx8mp_clk_gate.c b/KernelAA64/Board/imx8mp/imx8mp_clk_gate.c new file mode 100644 index 000000000..d2fb58f2b --- /dev/null +++ b/KernelAA64/Board/imx8mp/imx8mp_clk_gate.c @@ -0,0 +1,263 @@ +/** +* @file imx8mp_clk_gate.c +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#if defined(__TARGET_BOARD_IMX8MP_VERDIN_DAHLIA__) || defined(__TARGET_BOARD_IMX8MP_SOC__) + + +#include +#include +#include <_null.h> +#include +#include +#include + +static _imx8mp_gate_t _gate_registry[UINT8_MAX]; + +/** we are ignoring GATE4 entries for DDR and other devices */ +#define GATE2_SET_ENTRY(n,_id,_offset) \ + _gate_registry[n].root_id = _id; \ + _gate_registry[n].base_addr = _offset; \ + _gate_registry[n]._gate4 = 0; + +#define GATE4_SET_ENTRY(n,_id,_offset) \ + _gate_registry[n].root_id = _id; \ + _gate_registry[n].base_addr = _offset; \ + _gate_registry[n]._gate4 = 1; + + +/** + * @brief imx8mp_gate_init -- initialize gate data registry + */ +void imx8mp_gate_init() { + int n = 0; + + GATE4_SET_ENTRY(n, IMX8MP_CLK_DRAM1_ROOT, 0x4050); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_ECSPI1_ROOT, 0x4070); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_ECSPI3_ROOT, 0x4090); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_ENET1_ROOT, 0x40a0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPIO1_ROOT, 0x40b0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPIO2_ROOT, 0x40c0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPIO3_ROOT, 0x40d0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPIO4_ROOT, 0x40e0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPIO5_ROOT, 0x40f0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPT1_ROOT, 0x4100); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPT2_ROOT, 0x4110); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPT3_ROOT, 0X4120); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPT4_ROOT, 0x4130); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPT5_ROOT, 0x4140); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_I2C1_ROOT, 0x4170); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_I2C2_ROOT, 0x4180); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_I2C3_ROOT, 0x4190); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_I2C4_ROOT, 0x41a0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_MU_ROOT, 0x4210); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_OCOTP_ROOT, 0x4220); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_PCIE_ROOT, 0x4250); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_PWM1_ROOT, 0x4280); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_PWM2_ROOT, 0x4290); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_PWM3_ROOT, 0x42a0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_PWM4_ROOT, 0x42b0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_QOS_ROOT, 0x42c0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_QOS_ENET_ROOT, 0x42e0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_QSPI_ROOT, 0x42f0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_NAND_ROOT, 0x4300); //shared + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_NAND_USDHC_BUS_RAWNAND_CLK, 0x4300); //shared2 + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_I2C5_ROOT, 0x4330); //shared + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_I2C6_ROOT, 0x4340); //shared + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_CAN1_ROOT, 0x4350); //shared + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_CAN2_ROOT, 0x4360); //shared + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_SDMA1_ROOT, 0x43a0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_SIM_ENET_ROOT, 0x4400); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_ENET_QOS_ROOT, 0x43b0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPU2D_ROOT, 0x4450); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPU3D_ROOT, 0x4460); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_UART1_ROOT, 0x4490); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_UART2_ROOT, 0x44a0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_UART3_ROOT, 0x44b0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_UART4_ROOT, 0x44c0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_USB_ROOT, 0x44d0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_USB_SUSP, 0x44d0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_USB_PHY_ROOT, 0x44f0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_USDHC1_ROOT, 0x4510); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_USDHC2_ROOT, 0x4520); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_WDOG1_ROOT, 0x4530); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_WDOG2_ROOT, 0x4540); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_WDOG3_ROOT, 0x4550); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_VPU_G1_ROOT, 0x4560); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_GPU_ROOT, 0x4570); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_VPU_VC8KE_ROOT, 0x4590); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_VPU_G2_ROOT, 0x45a0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_NPU_ROOT, 0x45b0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_HSIO_ROOT, 0x45c0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_MEDIA_APB_ROOT, 0x45d0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_MEDIA_AXI_ROOT, 0x45d0); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_MEDIA_CAM1_PIX_ROOT, 0x45d0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_MEDIA_CAM2_PIX_ROOT, 0x45d0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_MEDIA_DISP1_PIX_ROOT, 0x45d0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_MEDIA_DISP2_PIX_ROOT, 0x45d0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_MEDIA_MIPI_PHY1_REF_ROOT, 0x45d0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_MEDIA_LDB_ROOT, 0x45d0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_MEDIA_ISP_ROOT, 0x45d0); + n++; + + GATE2_SET_ENTRY(n, IMX8MP_CLK_USDHC3_ROOT, 0x45e0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_HDMI_ROOT, 0x45f0); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_TSENSOR_ROOT, 0x4620); + n++; + GATE4_SET_ENTRY(n, IMX8MP_CLK_VPU_ROOT, 0x4630); + n++; + + GATE2_SET_ENTRY(n, IMX8MP_CLK_AUDIO_AHB_ROOT, 0x4650); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_AUDIO_AXI_ROOT, 0x4650); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_SAI1_ROOT, 0x4650); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_SAI2_ROOT, 0x4650); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_SAI3_ROOT, 0x4650); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_SAI5_ROOT, 0x4650); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_SAI6_ROOT, 0x4650); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_SAI7_ROOT, 0x4650); + n++; + GATE2_SET_ENTRY(n, IMX8MP_CLK_PDM_ROOT, 0x4650); + + BPrintK(BORDOISILA_INFO,"gate registry initialized \r\n"); +} + +_imx8mp_gate_t* imx8mp_find_gate(uint32_t id) { + for (int i = 0; i < UINT8_MAX; i++) { + if (_gate_registry[i].root_id == id) { + return &_gate_registry[i]; + } + } + return NULL; +} + +#define CGC_MASK 0x3; + +int imx8mp_clk_gate_enable(uint32_t clk_root_id) { + _imx8mp_gate_t* gate = imx8mp_find_gate(clk_root_id); + if (!gate) { + AuTextOut("[imx8mp clk-gate]: didn't find dedicated gate to enable root : %d \r\n", clk_root_id); + return -1; + } + + uintptr_t reg = CCM_BASE + gate->base_addr; + uint32_t val = _bordoisila_readl(reg); + val |= CGC_MASK; + _bordoisila_writel(val, reg); + BPrintK(BORDOISILA_INFO, "imx8mp clk gate enabled for root offset : %x \r\n", reg); +} + +int imx8mp_clk_gate_disable(uint32_t clk_root_id) { + _imx8mp_gate_t* gate = imx8mp_find_gate(clk_root_id); + if (!gate) { + AuTextOut("[imx8mp clk-gate]: didn't find dedicated gate to enable root : %d \r\n", clk_root_id); + return -1; + } + + uintptr_t reg = CCM_BASE + gate->base_addr; + uint32_t val = _bordoisila_readl(reg); + val &= ~CGC_MASK; + _bordoisila_writel(val, reg); +} + +#endif \ No newline at end of file diff --git a/KernelAA64/Board/imx8mp/imx8mp_gpc.c b/KernelAA64/Board/imx8mp/imx8mp_gpc.c index 1069285e0..f7883a0f4 100644 --- a/KernelAA64/Board/imx8mp/imx8mp_gpc.c +++ b/KernelAA64/Board/imx8mp/imx8mp_gpc.c @@ -29,39 +29,298 @@ * **/ -#ifdef __TARGET_BOARD_IMX8MP_VERDIN_DAHLIA__ || (__TARGET_BOARD_IMX8MP_SOC__) +#if defined(__TARGET_BOARD_IMX8MP_VERDIN_DAHLIA__) || defined(__TARGET_BOARD_IMX8MP_SOC__) #include +#include #include #include #include +#include +#include #include +#include <_null.h> +#include static uint64_t _gpc_base; #define GPC_BASE 0x303A0000UL -#define GPC_PGC_CPU_MAPPING 0x1CC -#define GPC_PU_PGC_SW_PUP_REQ 0x0F8 +#define IMX8MP_GPC_PGC_CPU_MAPPING 0x1CC +#define IMX8MP_GPC_PU_PGC_SW_PUP_REQ 0x0D8 +#define IMX8MP_GPC_PU_PGC_SW_PDN_REQ 0x0E4 #define GPC_PGC_CTRL(n) (0x800 + n * 0x40) #define GPC_PGC_SR(n) (GPC_PGC_CTRL(n) + 0x0C) -#define IMX8MP_PGC_MEDIAMIX 22 #define IMX8MP_MEDIAMIX_A53_DOMAIN (1ul << 12) +#define IMX8MP_PGC_NOC 9 +#define IMX8MP_PGC_MIPI1 12 +#define IMX8MP_PGC_PCIE 13 +#define IMX8MP_PGC_USB1 14 +#define IMX8MP_PGC_USB2 15 +#define IMX8MP_PGC_MLMIX 16 +#define IMX8MP_PGC_AUDIOMIX 17 +#define IMX8MP_PGC_GPU2D 18 +#define IMX8MP_PGC_GPUMIX 19 +#define IMX8MP_PGC_VPUMIX 20 +#define IMX8MP_PGC_GPU3D 21 +#define IMX8MP_PGC_MEDIAMIX 22 +#define IMX8MP_PGC_VPU_G1 23 +#define IMX8MP_PGC_VPU_G2 24 +#define IMX8MP_PGC_VPU_VC8000E 25 +#define IMX8MP_PGC_HDMIMIX 26 +#define IMX8MP_PGC_HDMI 27 +#define IMX8MP_PGC_MIPI2 28 +#define IMX8MP_PGC_HSIOMIX 29 +#define IMX8MP_PGC_MEDIA_ISP_DWP 30 +#define IMX8MP_PGC_DDRMIX 31 + +#define IMX8MP_MEDIA_ISPDWP_A53_DOMAIN BORDOISILA_BIT(20) +#define IMX8MP_HSIOMIX_A53_DOMAIN BORDOISILA_BIT(19) +#define IMX8MP_MIPI_PHY2_A53_DOMAIN BORDOISILA_BIT(18) +#define IMX8MP_HDMI_PHY_A53_DOMAIN BORDOISILA_BIT(17) + + +/* SW Pup/Pdwn Request bits*/ +#define IMX8MP_DDRMIX_PXX_REQ BORDOISILA_BIT(19) +#define IMX8MP_MEDIA_ISP_DWP_PXX_REQ BORDOISILA_BIT(18) +#define IMX8MP_HSIOMIX_PXX_REQ BORDOISILA_BIT(17) +#define IMX8MP_MIPI_PHY2_PXX_REQ BORDOISILA_BIT(16) +#define IMX8MP_HDMI_PHY_PXX_REQ BORDOISILA_BIT(15) +#define IMX8MP_HDMIMIX_PXX_REQ BORDOISILA_BIT(14) +#define IMX8MP_VPU_VC8K_PXX_REQ BORDOISILA_BIT(13) +#define IMX8MP_VPU_G2_PXX_REQ BORDOISILA_BIT(12) +#define IMX8MP_VPU_G1_PXX_REQ BORDOISILA_BIT(11) +#define IMX8MP_MEDIMIX_PXX_REQ BORDOISILA_BIT(10) +#define IMX8MP_GPU_3D_PXX_REQ BORDOISILA_BIT(9) +#define IMX8MP_VPU_MIX_SHARE_LOGIC_PXX_REQ BORDOISILA_BIT(8) +#define IMX8MP_GPU_SHARE_LOGIC_PXX_REQ BORDOISILA_BIT(7) +#define IMX8MP_GPU_2D_PXX_REQ BORDOISILA_BIT(6) +#define IMX8MP_AUDIOMIX_PXX_REQ BORDOISILA_BIT(5) +#define IMX8MP_MLMIX_PXX_REQ BORDOISILA_BIT(4) +#define IMX8MP_USB2_PHY_PXX_REQ BORDOISILA_BIT(3) +#define IMX8MP_USB1_PHY_PXX_REQ BORDOISILA_BIT(2) +#define IMX8MP_PCIE_PHY_SW_PXX_REQ BORDOISILA_BIT(1) +#define IMX8MP_MIPI_PHY1_SW_PXX_REQ BORDOISILA_BIT(0) + +#define IMX8MP_MEDIAMIX_PWRDNACKN BORDOISILA_BIT(30) +#define IMX8MP_HDMIMIX_PWRDNACKN BORDOISILA_BIT(29) +#define IMX8MP_HSIOMIX_PWRDNACKN BORDOISILA_BIT(28) +#define IMX8MP_VPUMIX_PWRDNACKN BORDOISILA_BIT(26) +#define IMX8MP_GPUMIX_PWRDNACKN BORDOISILA_BIT(25) +#define IMX8MP_MLMIX_PWRDNACKN (BORDOISILA_BIT(23) | BORDOISILA_BIT(24)) +#define IMX8MP_AUDIOMIX_PWRDNACKN BORDOISILA_BIT(20) | BORDOISILA_BIT(31) +#define IMX8MP_MEDIAMIX_PWRDNREQN BORDOISILA_BIT(14) +#define IMX8MP_HDMIMIX_PWRDNREQN BORDOISILA_BIT(13) +#define IMX8MP_HSIOMIX_PWRDNREQN BORDOISILA_BIT(12) +#define IMX8MP_VPUMIX_PWRDNREQN BORDOISILA_BIT(10) +#define IMX8MP_GPUMIX_PWRDNREQN BORDOISILA_BIT(9) +#define IMX8MP_MLMIX_PWRDNREQN (BORDOISILA_BIT(7) | BORDOISILA_BIT(8)) +#define IMX8MP_AUDIOMIX_PWRDNREQN (BORDOISILA_BIT(4) | BORDOISILA_BIT(15)) + + +#define IMX8MP_MEDIA_ISPDWP_A53_DOMAIN BORDOISILA_BIT(20) +#define IMX8MP_HSIOMIX_A53_DOMAIN BORDOISILA_BIT(19) +#define IMX8MP_MIPI_PHY2_A53_DOMAIN BORDOISILA_BIT(18) +#define IMX8MP_HDMI_PHY_A53_DOMAIN BORDOISILA_BIT(17) +#define IMX8MP_HDMIMIX_A53_DOMAIN BORDOISILA_BIT(16) +#define IMX8MP_VPU_VC8000E_A53_DOMAIN BORDOISILA_BIT(15) +#define IMX8MP_VPU_G2_A53_DOMAIN BORDOISILA_BIT(14) +#define IMX8MP_VPU_G1_A53_DOMAIN BORDOISILA_BIT(13) +#define IMX8MP_MEDIAMIX_A53_DOMAIN BORDOISILA_BIT(12) +#define IMX8MP_GPU3D_A53_DOMAIN BORDOISILA_BIT(11) +#define IMX8MP_VPUMIX_A53_DOMAIN BORDOISILA_BIT(10) +#define IMX8MP_GPUMIX_A53_DOMAIN BORDOISILA_BIT(9) +#define IMX8MP_GPU2D_A53_DOMAIN BORDOISILA_BIT(8) +#define IMX8MP_AUDIOMIX_A53_DOMAIN BORDOISILA_BIT(7) +#define IMX8MP_MLMIX_A53_DOMAIN BORDOISILA_BIT(6) +#define IMX8MP_USB2_PHY_A53_DOMAIN BORDOISILA_BIT(5) +#define IMX8MP_USB1_PHY_A53_DOMAIN BORDOISILA_BIT(4) +#define IMX8MP_PCIE_PHY_A53_DOMAIN BORDOISILA_BIT(3) +#define IMX8MP_MIPI_PHY1_A53_DOMAIN BORDOISILA_BIT(2) + + +#define GPC_PGC_CTRL_PCR BORDOISILA_BIT(0) + +typedef struct _gpc_pdomain_ { + uint8_t pdomain_id; + uint32_t pxx_req; + uint32_t map_mask; + uint32_t pgc_offset; +}_imx8mp_gpc_pdomain_t; + + #define GPC_WRITE(base, offset, val) (*(volatile uint32_t*)(base + offset) = val) #define GPC_READ(base, offset) (*(volatile uint32_t*)(base + offset)) +static _imx8mp_gpc_pdomain_t _pdomains[32]; + + +#define IMX8MP_PDOMAIN_REGISTER(n,_id,_pxx_req, _map_mask, _pgc_offset) \ + _pdomains[n].pdomain_id = _id; \ + _pdomains[n].pxx_req = _pxx_req; \ + _pdomains[n].map_mask = _map_mask; \ + _pdomains[n].pgc_offset = _pgc_offset; + + +/** + * @brief imx8mp_gpc_init -- register each power domain + * to the database + */ void imx8mp_gpc_init() { - _gpc_base = (uint64_t)AuMapMMIO(GPC_BASE, 2); - GPC_WRITE(_gpc_base, GPC_PGC_CTRL(IMX8MP_PGC_MEDIAMIX), 0x1); - AuTextOut("Base offset : %x \r\n", (GPC_BASE + GPC_PGC_CTRL(IMX8MP_PGC_MEDIAMIX))); + int n = 0; + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_MIPI_PHY1, + IMX8MP_MIPI_PHY1_SW_PXX_REQ, IMX8MP_MIPI_PHY1_A53_DOMAIN, GPC_PGC_CTRL(IMX8MP_PGC_MIPI1)); + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_PCIE_PHY, + IMX8MP_PCIE_PHY_SW_PXX_REQ, + IMX8MP_PCIE_PHY_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_PCIE)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_USB1_PHY, + IMX8MP_USB1_PHY_PXX_REQ, + IMX8MP_USB1_PHY_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_USB1)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_USB2_PHY, + IMX8MP_USB2_PHY_PXX_REQ, + IMX8MP_USB2_PHY_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_USB2)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_MLMIX, + IMX8MP_MLMIX_PXX_REQ, + IMX8MP_MLMIX_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_MLMIX)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_AUDIOMIX, + IMX8MP_AUDIOMIX_PXX_REQ, + IMX8MP_AUDIOMIX_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_AUDIOMIX)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_GPU2D, + IMX8MP_GPU_2D_PXX_REQ, + IMX8MP_GPU2D_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_GPU2D)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_GPUMIX, + IMX8MP_GPU_SHARE_LOGIC_PXX_REQ, + IMX8MP_GPUMIX_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_GPUMIX)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_VPUMIX, + IMX8MP_VPU_MIX_SHARE_LOGIC_PXX_REQ, + IMX8MP_VPUMIX_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_VPUMIX)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_GPU3D, + IMX8MP_GPU_3D_PXX_REQ, + IMX8MP_GPU3D_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_GPU3D)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_MEDIAMIX, + IMX8MP_MEDIMIX_PXX_REQ, + IMX8MP_MEDIAMIX_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_MEDIAMIX)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_VPU_G1, + IMX8MP_VPU_G1_PXX_REQ, + IMX8MP_VPU_G1_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_VPU_G1)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_VPU_G2, + IMX8MP_VPU_G2_PXX_REQ, + IMX8MP_VPU_G2_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_VPU_G2)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_VPU_VC8000E, + IMX8MP_VPU_VC8K_PXX_REQ, + IMX8MP_VPU_VC8000E_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_VPU_VC8000E)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_HDMIMIX, + IMX8MP_HDMIMIX_PXX_REQ, + IMX8MP_HDMIMIX_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_HDMIMIX)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_HDMI_PHY, + IMX8MP_HDMI_PHY_PXX_REQ, + IMX8MP_HDMI_PHY_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_HDMI)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_MIPI_PHY2, + IMX8MP_MIPI_PHY2_PXX_REQ, + IMX8MP_MIPI_PHY2_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_MIPI2)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_HSIOMIX, + IMX8MP_HSIOMIX_PXX_REQ, + IMX8MP_HSIOMIX_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_HSIOMIX)); + + n++; + + IMX8MP_PDOMAIN_REGISTER(n, IMX8MP_POWER_DOMAIN_MEDIAMIX_ISPDWP, + IMX8MP_MEDIA_ISP_DWP_PXX_REQ, + IMX8MP_MEDIA_ISPDWP_A53_DOMAIN, + GPC_PGC_CTRL(IMX8MP_PGC_MEDIA_ISP_DWP)); + + BPrintK(BORDOISILA_INFO, "gpc registry initialized \r\n"); +} + + +static _imx8mp_gpc_pdomain_t *imx8mp_pdomain_find(uint8_t id) { + for (int i = 0; i < 32; i++) { + if (_pdomains[i].pdomain_id == id) + return &_pdomains[i]; + } + + return NULL; +} + +int imx8mp_gpc_powerup(uint8_t id) { - GPC_WRITE(_gpc_base, GPC_PGC_CPU_MAPPING, IMX8MP_MEDIAMIX_A53_DOMAIN); + _imx8mp_gpc_pdomain_t* domain = imx8mp_pdomain_find(id); + if (!domain) + return -1; - GPC_WRITE(_gpc_base, GPC_PU_PGC_SW_PUP_REQ, (1ULL << (IMX8MP_PGC_MEDIAMIX - 8))); + /**TODO: we need to enable parent clock in CCM **/ - while (GPC_READ(_gpc_base, GPC_PGC_SR(IMX8MP_PGC_MEDIAMIX)) & 0x2) - ; - AuTextOut("[imx8mp_board]: gpc powered up mediamix \r\n"); + //set the cpu mapping + _bordoisila_update_bits(GPC_BASE + IMX8MP_GPC_PGC_CPU_MAPPING, domain->map_mask, domain->map_mask); + _bordoisila_update_bits(GPC_BASE + domain->pgc_offset, GPC_PGC_CTRL_PCR, GPC_PGC_CTRL_PCR); + _bordoisila_update_bits(GPC_BASE + IMX8MP_GPC_PU_PGC_SW_PUP_REQ, domain->pxx_req, domain->pxx_req); } #endif \ No newline at end of file diff --git a/KernelAA64/Board/imx8mp/imx8mp_pll.c b/KernelAA64/Board/imx8mp/imx8mp_pll.c new file mode 100644 index 000000000..27bc4f5fb --- /dev/null +++ b/KernelAA64/Board/imx8mp/imx8mp_pll.c @@ -0,0 +1,456 @@ +/** +* @file imx8mp_pll.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#include +#include +#include +#include <_null.h> +#include + +#if defined(__TARGET_BOARD_IMX8MP_VERDIN_DAHLIA__) || defined(__TARGET_BOARD_IMX8MP_SOC__) + +#define PLL_1443X_RATE(_rate, _m, _p, _d, _k)\ + { (_rate), (_m), (_p), (_s), (_k)} + +#define PLL_1416X_RATE(_rate, _m, _p, _s) \ +{ (_rate), (_m), (_p), (_s), 0} + +#define DIV_CTL0 0x4 +#define DIV_CTL1 0x8 +#define GNRL_CTL 0x0 +#define KDIV_MIN INT16_MIN +#define KDIV_MAX INT16_MAX + +/* hardcoded clock source */ +#define IMX8MP_CLK_OSC_24M 24000000UL +/* low powered devices use this oscillation */ +#define IMX8MP_CLK_OSC_32K 32768UL + +#define LOCK_TIMEOUT_US 10000 + +enum plltype { + IMX_1416_PLL, + IMX_1443_PLL, + IMX_1443_DRAM_PLL +}; + +struct imx_pll14xx_rate_table _imx_pll1416x_tbl[14]; +struct imx_pll14xx_rate_table _imx_pll1443x_tbl[4]; + +#define _IMX_PLL1416X_FILLUP(n, _rate, _pdiv, _mdiv, _sdiv, _kdiv) \ + _imx_pll1416x_tbl[n].rate = _rate; \ + _imx_pll1416x_tbl[n].pdiv = _pdiv; \ + _imx_pll1416x_tbl[n].mdiv = _mdiv; \ + _imx_pll1416x_tbl[n].sdiv = _sdiv; \ + _imx_pll1416x_tbl[n].kdiv = _kdiv; + +#define _IMX_PLL1443X_FILLUP(n, _rate, _pdiv, _mdiv, _sdiv, _kdiv) \ + _imx_pll1443x_tbl[n].rate = _rate; \ + _imx_pll1443x_tbl[n].pdiv = _pdiv; \ + _imx_pll1443x_tbl[n].mdiv = _mdiv; \ + _imx_pll1443x_tbl[n].sdiv = _sdiv; \ + _imx_pll1443x_tbl[n].kdiv = _kdiv; + + +/** + * @brief _imx_pll14xx_fill_table -- fill up predefined + * values, @reference uboot, linux + */ +void _imx_pll14xx_fill_table() { + + _IMX_PLL1416X_FILLUP(0, 1800000000U, 225, 3, 0, 0); + _IMX_PLL1416X_FILLUP(1, 1600000000U, 200, 3, 0, 0); + _IMX_PLL1416X_FILLUP(2, 1500000000U, 375, 3, 1, 0); + _IMX_PLL1416X_FILLUP(3, 1400000000U, 350, 3, 1, 0); + _IMX_PLL1416X_FILLUP(4, 1200000000U, 300, 3, 1, 0); + _IMX_PLL1416X_FILLUP(5, 1000000000U, 250, 3, 1, 0); + _IMX_PLL1416X_FILLUP(6, 800000000U, 200, 3, 1, 0); + _IMX_PLL1416X_FILLUP(7, 750000000U, 250, 2, 2, 0); + _IMX_PLL1416X_FILLUP(8, 700000000U, 350, 3, 2, 0); + _IMX_PLL1416X_FILLUP(9, 640000000U, 320, 3, 2, 0); + _IMX_PLL1416X_FILLUP(10, 600000000U, 300, 3, 2, 0); + _IMX_PLL1416X_FILLUP(11, 416000000U, 208, 3, 2, 0); + _IMX_PLL1416X_FILLUP(12, 320000000U, 160, 3, 2, 0); + _IMX_PLL1416X_FILLUP(13, 208000000U, 208, 3, 3, 0); + + + _IMX_PLL1443X_FILLUP(0, 1039500000U, 173, 2, 1, 16384); + _IMX_PLL1443X_FILLUP(1, 650000000U, 325, 3, 2, 0); + _IMX_PLL1443X_FILLUP(2, 594000000U, 198, 2, 2, 0); + _IMX_PLL1443X_FILLUP(3, 519750000U, 13, 2, 2, 16384); +} + + +void imx8mp_pll_init() { + _imx_pll14xx_fill_table(); + BPrintK(BORDOISILA_INFO, "PLL registry initialized can be used for manual configuration of PLLs \r\n"); +} + +/** + * @brief imx8mp_get_pll_type -- hard coded pll type values, + * nxp imx8mp soc uses two type of PLL for precised value. + * this function take the pll entry and return which type + * of pll it uses. + * @reference : linux source tree + */ +uint8_t imx8mp_get_pll_type(uint64_t pllbase) { + switch (pllbase) { + case __IMX8MP_AUDIO_PLL1_GEN_CTRL: + return IMX_1443_PLL; + case __IMX8MP_AUDIO_PLL2_GEN_CTRL: + return IMX_1443_PLL; + case __IMX8MP_VIDEO_PLL1_GEN_CTRL: + return IMX_1443_PLL; + case __IMX8MP_DRAM_PLL_GEN_CTRL: + return IMX_1443_DRAM_PLL; + case __IMX8MP_GPU_PLL_GEN_CTRL: + return IMX_1416_PLL; + case __IMX8MP_VPU_PLL_GEN_CTRL: + return IMX_1416_PLL; + case __IMX8MP_SYS_PLL1_GEN_CTRL: + return IMX_1416_PLL; + case __IMX8MP_SYS_PLL2_GEN_CTRL: + return IMX_1416_PLL; + case __IMX8MP_SYS_PLL3_GEN_CTRL: + return IMX_1416_PLL; + } +} + +static struct imx_pll14xx_rate_table * imx_get_pll_settings(uint64_t base, unsigned long rate) { + uint8_t type = imx8mp_get_pll_type(base); + if (type == IMX_1416_PLL) { + for (int i = 0; i < 14; i++) { + if (rate == _imx_pll1416x_tbl[i].rate) + return &_imx_pll1416x_tbl[i]; + } + } + else { + for (int i = 0; i < 4; i++) { + if (rate == _imx_pll1443x_tbl[i].rate) + return &_imx_pll1443x_tbl[i]; + } + } + return NULL; +} + + +static long imx8mp_pll14xx_calc_rate(int mdiv, int pdiv, int sdiv, int kdiv, unsigned long prate) { + uint64_t fout = prate; + + fout *= (mdiv * 65536 + kdiv); + pdiv *= 65536; + + do_div(fout, pdiv << sdiv); + + return fout; +} + +static long imx8mp_pll1443x_calc_kdiv(int mdiv, int pdiv, int sdiv, unsigned long rate, unsigned long prate) { + long kdiv; + kdiv = ((rate * ((pdiv * 65536) << sdiv) + prate / 2) / prate) - (mdiv * 65536); + return clamp_t(short, kdiv, KDIV_MIN, KDIV_MAX); +} + +/** + * @brief imx8mp_pll_recalc_rate -- recalculate pll rate + * @param pllbase -- pll base source or entry + * @param parent_rate -- clock rate, if the target root is high powered + * device, it uses osc_24m sel otherwise osc_32k is used for low powered + * device + */ +unsigned long imx8mp_pll_recalc_rate(uint64_t pllbase, unsigned long parent_rate) { + uint32_t mdiv, pdiv, sdiv, plldiv, plldiv_ctl1, kdiv; + + plldiv = _bordoisila_readl(pllbase + DIV_CTL0); + mdiv = BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_MDIV_MASK, plldiv); + pdiv = BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_PDIV_MASK, plldiv); + sdiv = BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_SDIV_MASK, plldiv); + + uint8_t type = imx8mp_get_pll_type(pllbase); + if (type == IMX_1443_PLL) { + plldiv_ctl1 = _bordoisila_readl(pllbase + DIV_CTL1); + kdiv = (int16_t)BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_KDIV_MASK, plldiv_ctl1); + } + else + kdiv = 0; + + return imx8mp_pll14xx_calc_rate(mdiv, pdiv, sdiv, kdiv, parent_rate); + +} + + +static inline bool imx8mp_pll14xx_mp_change(const struct imx_pll14xx_rate_table* rate, uint32_t plldiv) { + uint32_t old_mdiv, old_pdiv; + + old_mdiv = BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_MDIV_MASK, plldiv); + old_pdiv = BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_PDIV_MASK, plldiv); + + return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv; +} + +static void imx_pll14xx_calc_settings(uint64_t base, unsigned long rate, unsigned long prate, struct imx_pll14xx_rate_table* t) { + uint32_t pll_div_ctl0, pll_div_ctl1; + int mdiv, pdiv, sdiv, kdiv; + + long fout, rate_min, rate_max, dist, best = INT64_MAX; + + const struct imx_pll14xx_rate_table* tt; + tt = imx_get_pll_settings(base, rate); + if (tt) { + AuTextOut("[imx_pll14xx_calc_settings]: in=%d, want = %d, using pll settings from table \r\n", + prate, rate); + t->rate = tt->rate; + t->mdiv = tt->mdiv; + t->pdiv = tt->pdiv; + t->sdiv = tt->sdiv; + t->kdiv = tt->kdiv; + return; + } + + pll_div_ctl0 = _bordoisila_readl(base + DIV_CTL0); + mdiv = BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_MDIV_MASK, pll_div_ctl0); + pdiv = BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_PDIV_MASK, pll_div_ctl0); + sdiv = BORDOISILA_GET_FIELD(IMX8MP_PLL14XX_SDIV_MASK, pll_div_ctl0); + pll_div_ctl1 = _bordoisila_readl(base + DIV_CTL1); + + rate_min = imx8mp_pll14xx_calc_rate(mdiv, pdiv, sdiv, KDIV_MIN, prate); + rate_max = imx8mp_pll14xx_calc_rate(mdiv, pdiv, sdiv, KDIV_MAX, prate); + + if (rate >= rate_min && rate <= rate_max) { + kdiv = imx8mp_pll1443x_calc_kdiv(mdiv, pdiv, sdiv, rate, prate); + fout = imx8mp_pll14xx_calc_rate(mdiv, pdiv, sdiv, kdiv, prate); + t->rate = (unsigned int)fout; + t->mdiv = mdiv; + t->pdiv = pdiv; + t->sdiv = sdiv; + t->kdiv = kdiv; + return; + } + + /* finally calculate best values */ + for (pdiv = 1; pdiv <= 63; pdiv++) { + for (sdiv = 0; sdiv <= 6; sdiv++) { + mdiv = DIV_ROUND_CLOSEST(rate * (pdiv << sdiv), prate); + mdiv = CLAMP(mdiv, 64, 1023); + + kdiv = imx8mp_pll1443x_calc_kdiv(mdiv, pdiv, sdiv, rate, prate); + fout = imx8mp_pll14xx_calc_rate(mdiv, pdiv, sdiv, kdiv, prate); + + dist = ABS((long)rate - (long)fout); + if (dist < best) { + best = dist; + t->rate = (unsigned int)fout; + t->mdiv = mdiv; + t->pdiv = pdiv; + t->sdiv = sdiv; + t->kdiv = kdiv; + + if (!dist) + goto found; + } + } + } +found: + AuTextOut("imx8mp_pll1416x rate found \r\n"); + +} + +int imx8mp_pll1416x_determine_rate(uint64_t base, unsigned long rate) { + uint8_t type = imx8mp_get_pll_type(base); + if (type == IMX_1416_PLL) { + for (int i = 0; i < 14; i++) { + if (rate >= _imx_pll1416x_tbl[i].rate) { + rate = _imx_pll1416x_tbl[i].rate; + return rate; + } + } + rate = _imx_pll1416x_tbl[14 - 1].rate; + return rate; + } + else { + for (int i = 0; i < 4; i++) { + if (rate >= _imx_pll1443x_tbl[i].rate) { + rate = _imx_pll1443x_tbl[i].rate; + return 0; + } + } + + rate = _imx_pll1443x_tbl[14 - 1].rate; + return rate; + } + return 0; +} + +int imx8mp_pll1416x_set_rate(uint64_t base, unsigned long drate, unsigned long prate) { + uint32_t tmp, div_val; + + struct imx_pll14xx_rate_table* rate = imx_get_pll_settings(base, drate); + if (!rate) { + AuTextOut("[bordoisila]: imx8mp pll invalid rate %d \r\n", drate); + return; + } + + tmp = _bordoisila_readl(base + DIV_CTL0); + + if (!imx8mp_pll14xx_mp_change(rate, tmp)) { + tmp &= ~IMX8MP_PLL14XX_SDIV_MASK; + tmp |= BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_SDIV_MASK, rate->sdiv); + _bordoisila_writel(tmp, base + DIV_CTL0); + return 0; + } + + /* bypass clock and set lock to pll output lock*/ + tmp = _bordoisila_readl(base + GNRL_CTL); + tmp |= LOCK_SEL_MASK; + _bordoisila_writel(tmp, base + GNRL_CTL); + + /* enable RST */ + tmp &= ~RST_MASK; + _bordoisila_writel(tmp, base + GNRL_CTL); + + /* enable bypass*/ + tmp |= BYPASS_MASK; + _bordoisila_writel(tmp, base + GNRL_CTL); + + div_val = BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_MDIV_MASK, rate->mdiv) | BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_PDIV_MASK, rate->pdiv) | + BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_SDIV_MASK, rate->sdiv); + _bordoisila_writel(div_val, base + DIV_CTL0); + + AuAA64BoardSleepUS(3); + + /* disable RST */ + tmp |= RST_MASK; + _bordoisila_writel(tmp, base + GNRL_CTL); + + int ret = imx8mp_wait_lock(base); + if (ret) + return ret; + + tmp &= ~BYPASS_MASK; + _bordoisila_writel(tmp, base + GNRL_CTL); + + return 0; +} + +int imx8mp_pll1443x_set_rate(uint64_t base, unsigned long drate, unsigned long prate) { + struct imx_pll14xx_rate_table rate; + uint32_t gnrl_ctl, div_ctl0; + imx_pll14xx_calc_settings(base, drate, prate, &rate); + + div_ctl0 = _bordoisila_readl(base + DIV_CTL0); + + if (!imx8mp_pll14xx_mp_change(&rate, div_ctl0)) { + div_ctl0 &= ~IMX8MP_PLL14XX_SDIV_MASK; + div_ctl0 |= BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_SDIV_MASK, rate.sdiv); + _bordoisila_writel(div_ctl0, base + DIV_CTL0); + _bordoisila_writel(BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_KDIV_MASK, rate.kdiv), base + DIV_CTL1); + return 0; + } + + /* enable rst */ + gnrl_ctl = _bordoisila_readl(base + GNRL_CTL); + gnrl_ctl &= ~RST_MASK; + _bordoisila_writel(gnrl_ctl, base + GNRL_CTL); + + /* enable bypass */ + gnrl_ctl |= BYPASS_MASK; + _bordoisila_writel(gnrl_ctl, base + GNRL_CTL); + + div_ctl0 = BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_MDIV_MASK, rate.mdiv) | + BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_PDIV_MASK, rate.pdiv) | + BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_SDIV_MASK, rate.sdiv); + _bordoisila_writel(div_ctl0, base + DIV_CTL0); + + _bordoisila_writel(BORDOISILA_PREP_FIELD(IMX8MP_PLL14XX_KDIV_MASK, rate.kdiv), base + DIV_CTL0); + + AuAA64BoardSleepUS(3); + + /* disable rst*/ + gnrl_ctl |= RST_MASK; + _bordoisila_writel(gnrl_ctl, base + GNRL_CTL); + + int ret = imx8mp_wait_lock(base); + if (ret) + return ret; + + /* bypass */ + gnrl_ctl &= ~BYPASS_MASK; + _bordoisila_writel(gnrl_ctl, base + GNRL_CTL); + + return 0; + +} + +#define PLL_REF_SEL_MASK 0x3 +#define PLL_REF_SEL_SHIFT 0 + +uint32_t imx8mp_pll_get_parent_rate(uint64_t pll_base) { + uint32_t gnrl_ctl = _bordoisila_readl(pll_base + GNRL_CTL); + uint32_t ref_sel = BORDOISILA_GET_FIELD(PLL_REF_SEL_MASK, gnrl_ctl); + + switch (ref_sel) { + case 0: + return IMX8MP_CLK_OSC_24M; + default: + BPrintK(BORDOISILA_WARN, "imx8mp pll_ref selection unexpected value : %u for base : %x \r\n", + ref_sel, pll_base); + return IMX8MP_CLK_OSC_24M; + } +} + +int imx8mp_wait_lock(uint64_t base){ + uint32_t val; + return _bordoisila_readl_poll_timeout(base + GNRL_CTL, val, val & LOCK_STATUS, 0, LOCK_TIMEOUT_US); +} + +void imx8mp_pll_prepare(uint64_t base) { + uint32_t val; + + val = _bordoisila_readl(base + GNRL_CTL); + if (val & RST_MASK) { + AuTextOut("[aurora]: imx8mp_pll_prepare: reset mask is already set for base : %x \r\n", base); + return; + } + val |= BYPASS_MASK; + _bordoisila_writel(val, base + GNRL_CTL); + val |= RST_MASK; + _bordoisila_writel(val, base + GNRL_CTL); + + // wait lock + imx8mp_wait_lock(base); + + val &= ~BYPASS_MASK; + _bordoisila_writel(val, base + GNRL_CTL); +} + + + +#endif \ No newline at end of file diff --git a/KernelAA64/Board/imx8mp/imx8mp_uart.c b/KernelAA64/Board/imx8mp/imx8mp_uart.c index dcee5f833..2efe9104a 100644 --- a/KernelAA64/Board/imx8mp/imx8mp_uart.c +++ b/KernelAA64/Board/imx8mp/imx8mp_uart.c @@ -29,7 +29,7 @@ * **/ -#ifdef __TARGET_BOARD_IMX8MP_VERDIN_DAHLIA__ || (__TARGET_BOARD_IMX8MP_SOC__) +#if defined(__TARGET_BOARD_IMX8MP_VERDIN_DAHLIA__) || defined(__TARGET_BOARD_IMX8MP_SOC__) #include diff --git a/KernelAA64/Cap/capability.c b/KernelAA64/Cap/capability.c new file mode 100644 index 000000000..e00fbbfdb --- /dev/null +++ b/KernelAA64/Cap/capability.c @@ -0,0 +1,222 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#include +#include +#include +#include +#include <_null.h> +#include +#include + +/* + * NOTE on concurrency: every existing syscall entry point in + * Kernel/Serv/fileserv.cpp already runs with interrupts disabled + * (x64_cli()) for the duration of the call, and XenevaOS's + * multiprocessor scheduler is not active yet (see readme.md). That is + * the same assumption these functions rely on -- callers are expected + * to hold that same single-CPU-in-kernel invariant. Once SMP + * scheduling lands this table will need its own lock (Phase 8 of the + * roadmap calls this out explicitly under "race conditions" / + * "concurrent capability lookup/removal") and every function below + * should take it before touching proc->caps. + */ + + /* internal helper: is `fd` a valid index into the capability table? */ +static unsigned char cap_slot_in_range(int rq) { + return (rq >= 0) && (rq < FILE_DESC_PER_PROCESS); +} + +/* internal helper: slot pointer, or NULL if fd is out of range */ +static AuCapability* cap_slot(AuProcess* proc, int fd) { + if (!proc || !cap_slot_in_range(fd)) + return NULL; + return &proc->caps[fd]; +} + +int BordoisilaCapCreate(void* procptr, int fd, void* object, uint8_t type, CapRights rights) { + AuProcess* proc = (AuProcess*)procptr; + AuCapability* cap = cap_slot(proc, fd); + if (!cap) + return CAP_ERR_INVALID; + if (!object) + return CAP_ERR_INVALID; + + cap->object = object; + cap->object_type = type; + /* a freshly minted capability may never exceed CAP_FILE_RIGHTS_MASK + * for the file object type in V0; this keeps a caller from handing + * in a bogus/garbage mask and getting more than the model allows */ + if (type == CAP_OBJ_FILE) + cap->rights = rights & CAP_FILE_RIGHTS_MASK; + else + cap->rights = CAP_RIGHTS_NONE; + + cap->owner = proc->creds.uid; + cap->flags = CAP_FLAG_NONE; + cap->valid = true; + return CAP_OK; +} + +AuCapability* BordoisilaCapLookup(void* procptr, int fd) { + AuProcess* proc = (AuProcess*)procptr; + AuCapability* cap = cap_slot(proc, fd); + if (!cap) + return NULL; + if (!cap->valid) + return NULL; + return cap; +} + +bool BordoisilaCapCheckRights(void* procptr, int fd, CapRights required) { + AuProcess* proc = (AuProcess*)procptr; + AuCapability* cap = BordoisilaCapLookup(proc, fd); + + if (!cap) + return false; + + + /*AuTextOut("[CAP] Check fd=%d req=%x have=%x\r\n", + fd, required, cap->rights);*/ + //UARTDebugOut("[CAP] Check fd=%d req=%x have=%x \r\n", fd, required, cap->rights); + + return (cap->rights & required) == required; +} + +int BordoisilaCapDup(void* procptr, int oldfd, int newfd) { + AuProcess* proc = (AuProcess*)procptr; + AuCapability* src = BordoisilaCapLookup(proc, oldfd); + if (!src) + return CAP_ERR_INVALID; + + if (!cap_slot_in_range(newfd)) + return CAP_ERR_INVALID; + + if (proc->caps[newfd].valid) + return CAP_ERR_INVALID; + + if (proc->fds[newfd]) + return CAP_ERR_INVALID; + + proc->fds[newfd] = proc->fds[oldfd]; + + if (proc->fds[newfd]) + proc->fds[newfd]->fileCopyCount++; + + AuCapability* dst = &proc->caps[newfd]; + + dst->object = src->object; + dst->object_type = src->object_type; + dst->rights = src->rights; + dst->owner = src->owner; + dst->flags = src->flags; + dst->valid = true; + + return CAP_OK; +} + +int BordoisilaCapRestrict(void* procptr, int fd, CapRights new_rights) { + AuProcess* proc = (AuProcess*)procptr; + AuCapability* cap = BordoisilaCapLookup(proc, fd); + if (!cap) + return CAP_ERR_INVALID; + + /* rights may only shrink: intersect rather than assign, so this + * can never be used to grant a bit the capability didn't already + * have (section 5: "rights can only become more restrictive") */ + cap->rights = cap->rights & new_rights; + return CAP_OK; +} + +void BordoisilaCapDestroy(void* procptr, int fd) { + AuProcess* proc = (AuProcess*)procptr; + + AuCapability* cap = cap_slot(proc, fd); + if (!cap || !cap->valid) + return; + + cap->object = NULL; + cap->object_type = 0; + cap->rights = CAP_RIGHTS_NONE; + cap->owner = 0; + cap->flags = CAP_FLAG_NONE; + cap->valid = false; +} + +void BordoisilaCapCleanupProcess(void* procptr) { + AuProcess* proc = (AuProcess*)procptr; + if (!proc) + return; + for (int i = 0; i < FILE_DESC_PER_PROCESS; i++) { + AuCapability* cap = &proc->caps[i]; + if (cap->valid) { + cap->object = NULL; + cap->object_type = 0; + cap->rights = CAP_RIGHTS_NONE; + cap->owner = 0; + cap->flags = CAP_FLAG_NONE; + cap->valid = false; + } + } +} + +void BordoisilaCapInheritTable(void* parentptr , void* childptr) { + + if (!parentptr || !childptr) + return; + AuProcess* parent = (AuProcess*)parentptr; + AuProcess* child = (AuProcess*)childptr; + + /* NOTE: as of this writing AuCreateProcessSlot()/AuCreateProcess() + * zero-initialize fds[] rather than copying the parent's open + * files, so there is currently nothing for capabilities to mirror + * at fork/spawn time -- this mirrors section 7 of the design doc + * ("similar to how file descriptors are already inherited") for + * whenever fd inheritance itself is implemented. Until then this + * only matters for slots the caller populates manually. Flagging + * this gap for design review rather than papering over it. */ + for (int i = 0; i < FILE_DESC_PER_PROCESS; i++) { + AuCapability* src = &parent->caps[i]; + if (!src->valid) + continue; + if (src->flags & CAP_FLAG_NO_INHERIT) + continue; + if (!child->fds[i]) + continue; + + AuCapability* dst = &child->caps[i]; + dst->object = src->object; + dst->object_type = src->object_type; + /* rights never increase across inheritance */ + dst->rights = src->rights; + dst->owner = child->creds.uid; + dst->flags = src->flags; + dst->valid = true; + } +} \ No newline at end of file diff --git a/KernelAA64/Drivers/core.c b/KernelAA64/Drivers/core.c new file mode 100644 index 000000000..546b73e19 --- /dev/null +++ b/KernelAA64/Drivers/core.c @@ -0,0 +1,211 @@ +/** +* @file core.c +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#include +#include +#include <_null.h> +#include + +/* must also contain locking/unlocking */ +static BordoisilaDriver* _bdrivers; + +/** + * @brief BordoisilaDriverGetStateString -- return the driver state + * in string + * @param driver -- pointer to driver struct + */ +static char* BordoisilaDriverGetStateString(BordoisilaDriver* driver) { + switch (driver->driver_state) { + case B_DRIVER_STATE_UNBOUND: + return "UNBOUND"; + case B_DRIVER_STATE_PROBED: + return "PROBED"; + case B_DRIVER_STATE_FAILED: + return "FAILED"; + default: + return "NULL"; + } +} + + +/** + * @brief BordoisilaDriverRegister -- register a driver + * to core registry + */ +int BordoisilaDriverRegister(BordoisilaDriver* driver) { + if (!driver) + return 1; + /** check for pre-registered driver with same compat string */ + if (BordoisilaGetDriverByCompat(driver->compat)) { + BPrintK(BORDOISILA_WARN, "driver : %s is already registered, current state : %s \r\n", driver->name, + BordoisilaDriverGetStateString(driver)); + return BORDOISILA_DRIVER_ALREADY_REGISTERED; + } + driver->driver_state = B_DRIVER_STATE_UNBOUND; + driver->next = _bdrivers; + _bdrivers = driver; + return 0; +} + +/** + * @brief BordoisilaGetDriverByCompat -- match a driver by its + * compat string + * @param compat -- compatibility string, matches to DT/ACPI bindings + */ +BordoisilaDriver* BordoisilaGetDriverByCompat(char* compat) { + for (BordoisilaDriver* drv = _bdrivers; drv != NULL; drv = drv->next) + if (strcmp(drv->compat, compat) == 0) + return drv; + + return NULL; +} + + +/** + * @brief BordoisilaGetDriverByName -- match a driver by its name + * @param name - name of the driver + */ +BordoisilaDriver* BordoisilaGetDriverByName(char* name) { + for (BordoisilaDriver* drv = _bdrivers; drv != NULL; drv = drv->next) { + if (strcmp(drv->name, name) == 0) + return drv; + } + + return NULL; +} + +/** + * @brief BordoisilaDriverProbeAll -- start probing all driver registered + */ +void BordoisilaDriverProbeAll() { + int ret = 0; + for (BordoisilaDriver* drv = _bdrivers; drv != NULL; drv = drv->next) { + if (drv->driver_state != B_DRIVER_STATE_UNBOUND) + continue; + + if (drv->probe) { + BPrintK(BORDOISILA_INFO, "probing bordoisila driver : %s, compat : %s \r\n", _bdrivers->name, _bdrivers->compat); + ret = drv->probe(drv); + BPrintK(BORDOISILA_WARN, "driver %s probe completed with return value : %d \r\n",_bdrivers->name, ret); + } + } +} + +/** +* =================================================== + * Interface + * ================================================== + */ + +/** + * @brief BordoisilaDriverScan -- scan a bus, only applicable + * if the driver is a bus + * @param driver -- pointer to driver + */ +int BordoisilaDriverScan(BordoisilaDriver* driver) { + if (!driver) + return 1; + if (driver->type == BORDOISILA_DRIVER_NORMAL) + return -1; + + int rc = 0; + if (driver->scan) + rc = driver->scan(driver); + + return rc; + +} + + +int BordoisilaDriverProbe(BordoisilaDriver* driver) { + if (!driver) + return 1; + if (driver->probe) + return driver->probe(driver); + return 0; + +} + +/** + * @brief BordoisilaDriverRemove -- remove a driver doesn't mean + *it could be removed from memory, calling remove cleans up + * driver's allocated resources, and decreaments internal + * reference count of driver resources it was using like + * (Clk, Regulator, Pin etc), also if the driver is + * shared between different module, before calling remove + * just decrement reference count + */ +int BordoisilaDriverRemove(BordoisilaDriver* driver) { + if (!driver) + return 1; + + if (driver->driver_state != B_DRIVER_STATE_PROBED) + return -1; + + /* check if reference count is already more than zero */ + bool ref = (driver->refcount > 0) ? 1 : 0; + + if (ref) { + driver->refcount--; + return 0; + } + + + int ret = 0; + if (driver->remove) + ret = driver->remove(driver); + + if (ret == 0) driver->driver_state = B_DRIVER_STATE_UNBOUND; + + return 0; +} + +int BordoisilaDriverSuspend(BordoisilaDriver* driver) { + if (!driver) + return 1; + + if (driver->driver_state != B_DRIVER_STATE_PROBED) + return -1; + + if (driver->suspend) + return driver->suspend(driver); + return 0; +} + +int BordoisilaDriverResume(BordoisilaDriver* driver) { + if (!driver) + return 1; + if (driver->driver_state != B_DRIVER_STATE_PROBED) + return -1; + if (driver->resume) + return driver->resume(driver); + return 0; +} \ No newline at end of file diff --git a/KernelAA64/Drivers/res.c b/KernelAA64/Drivers/res.c new file mode 100644 index 000000000..8c3796f24 --- /dev/null +++ b/KernelAA64/Drivers/res.c @@ -0,0 +1,65 @@ +/** +* @file res.c +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#include +#include +#include <_null.h> +#include + +static BordoisilaDriverResource* _gres; + +/** + * @brief BordoisilaDriverResourceRegister -- register a resource driver + * @param res_ -- pointer to resource driver struct + */ +int BordoisilaDriverResourceRegister(BordoisilaDriverResource* res_) { + for (BordoisilaDriverResource* res = _gres; res != NULL; res = res->next) + if (strcmp(res->name, res_->name) == 0) + return 1; + + res_->next = _gres; + _gres = res_; + return 0; +} + +/** + * @brief BordoisilaGetDriverResource -- get a driver resource from global resource + * list + * @param name -- resource name coresponding to DT/ACPI name + * @param type -- type of the resource + */ +BordoisilaDriverResource* BordoisilaGetDriverResource(const char* name, uint8_t type) { + for (BordoisilaDriverResource* res = _gres; res != NULL; res = res->next) + if ((strcmp(res->name, name) == 0) && res->res_type == type) + return res; + + return NULL; +} \ No newline at end of file diff --git a/KernelAA64/Drivers/uart.c b/KernelAA64/Drivers/uart.c index b878570ec..fbca8591a 100644 --- a/KernelAA64/Drivers/uart.c +++ b/KernelAA64/Drivers/uart.c @@ -29,6 +29,11 @@ * **/ +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include #include #include diff --git a/KernelAA64/Drivers/virtiokbd.c b/KernelAA64/Drivers/virtiokbd.c index 01ee8aad9..b223350fa 100644 --- a/KernelAA64/Drivers/virtiokbd.c +++ b/KernelAA64/Drivers/virtiokbd.c @@ -39,6 +39,7 @@ #include #include #include +#include struct VirtioQueue* queue; @@ -92,7 +93,12 @@ void AuVirtioKbdHandler(int spinum) { AuDevWriteKybrd(&msg); } else if (ext_key_map[evt.code]) { - uint32_t scancode = (0xE0 & 0xFF) << 16 | (ext_key_map[evt.code] & 0xFF) << 8 | (((evt.value == 0) ? 0x80 : 0) & 0xFF); + uint8_t make_code = ext_key_map[evt.code] & 0xFF; + + if (evt.value == 0) { + make_code |= 0x80; + } + uint32_t scancode = (0xE0 << 8) | make_code; // 0xE0 (extended code) upper 16 bits | key code middle 8 bits | value: 0x80 for release, 0 press /* write to xeneva key input msg box */ AuInputMessage msg; @@ -100,7 +106,6 @@ void AuVirtioKbdHandler(int spinum) { msg.type = AU_INPUT_KEYBOARD; msg.code = scancode; AuDevWriteKybrd(&msg); - UARTDebugOut("Extended key press \n"); } else { UARTDebugOut("virtio-kybrd: unmapped key code : %d \n", evt.code); @@ -113,6 +118,9 @@ void AuVirtioKbdHandler(int spinum) { } void AuVirtioKbdDown() { + if (!_kybrdCfg) + return; + /* Reset the device */ _kybrdCfg->DeviceStatus = 0; @@ -184,6 +192,7 @@ void AuVirtioKbdInitialize(uint64_t device) { dsb_ish(); struct VirtioCommonCfg* common = (struct VirtioCommonCfg*)finalAddr; + _kybrdCfg = common; common->DeviceStatus = 0; isb_flush(); diff --git a/KernelAA64/Drivers/virtionet.c b/KernelAA64/Drivers/virtionet.c index f83067567..389c38620 100644 --- a/KernelAA64/Drivers/virtionet.c +++ b/KernelAA64/Drivers/virtionet.c @@ -210,6 +210,7 @@ void AuVirtioNetTxinitialize(struct VirtioCommonCfg* common) { */ void AuVirtioNetInitialize(uint64_t device) { UARTDebugOut("[aurora]: virtio network device found \r\n"); + UARTDebugOut("ok\r\n"); int bus = 0; int func = 0; int dev = 0; diff --git a/KernelAA64/Drivers/virtiotablet.c b/KernelAA64/Drivers/virtiotablet.c index 5148eb98f..378bad208 100644 --- a/KernelAA64/Drivers/virtiotablet.c +++ b/KernelAA64/Drivers/virtiotablet.c @@ -39,6 +39,7 @@ #include #include #include +#include struct VirtioQueue* TabletQueue; uint16_t tabletIndex; @@ -73,7 +74,7 @@ void AuVirtioTabletHandler(int spiNum) { uint16_t them = TabletQueue->used.index; for (; tabletIndex < them; tabletIndex++) { - dc_ivac(&TabletInput[tabletIndex % tabletQueueSz]); + dc_ivac((uint64_t)&TabletInput[tabletIndex % tabletQueueSz]); dsb_sy_barrier(); struct VirtioInputEvent evt = TabletInput[tabletIndex % tabletQueueSz]; while (evt.type == 0xFF) { @@ -128,6 +129,9 @@ void AuVirtioTabletHandler(int spiNum) { } void AuVirtioTabletDown() { + if (!_tabletCfg) + return; + /* Reset the device */ _tabletCfg->DeviceStatus = 0; @@ -152,7 +156,7 @@ void AuVirtioTabletInitialize(uint64_t device) { int func = 0; int dev = 0; if (device == 0xFFFFFFFF) - return 1; + return; uint16_t command = AuPCIERead(device, PCI_COMMAND, bus, dev, func); command |= 4; @@ -211,6 +215,7 @@ void AuVirtioTabletInitialize(uint64_t device) { GICRegisterSPIHandler(&AuVirtioTabletHandler, spiID); struct VirtioCommonCfg* common = (struct VirtioCommonCfg*)finalAddr; + _tabletCfg = common; common->DeviceStatus = 0; isb_flush(); diff --git a/KernelAA64/Fs/Dev/devfs.c b/KernelAA64/Fs/Dev/devfs.c index d4627490b..7346963e4 100644 --- a/KernelAA64/Fs/Dev/devfs.c +++ b/KernelAA64/Fs/Dev/devfs.c @@ -28,7 +28,7 @@ **/ #include -//#include +#include #include #include #include diff --git a/KernelAA64/Fs/Ext2/Ext2.c b/KernelAA64/Fs/Ext2/Ext2.c index 8fa55aafe..dbfc993ed 100644 --- a/KernelAA64/Fs/Ext2/Ext2.c +++ b/KernelAA64/Fs/Ext2/Ext2.c @@ -1,11 +1,13 @@ #include -#include +#include #include #include #include #include #include -#include +#include +#include +#include #include <_null.h> /** @@ -15,7 +17,11 @@ * @param name -- the target string we are matching */ uint32_t Ext2FindEntry(Ext2Fs* fs, Ext2Inode* dir_inode, const char* name) { - if (!fs || !dir_inode || !name) return 0; + if (!fs || !dir_inode || !name) { + const char* missing = !fs ? "fs" : !dir_inode ? "dir_inode" : "name"; + AuTextOut("[Ext2]: %s parameter missing for directory scanning.\r\n", missing); + return 0; + } uint32_t block_size = fs->block_size; uint32_t sector_per_block = block_size / 512; @@ -23,7 +29,7 @@ uint32_t Ext2FindEntry(Ext2Fs* fs, Ext2Inode* dir_inode, const char* name) { uint64_t* buffer = (uint64_t*)P2V((uint64_t)AuPmmngrAlloc()); if (!buffer) { - UARTDebugOut("[ext2]: out of memory during directory scanning.\r\n"); + AuTextOut("[Ext2]: out of memory during directory scanning.\r\n"); return 0; } @@ -41,10 +47,12 @@ uint32_t Ext2FindEntry(Ext2Fs* fs, Ext2Inode* dir_inode, const char* name) { while (current_pos < block_size) { Ext2Dir* entry = (Ext2Dir*)((uint8_t*)buffer + current_pos); - if (entry->rec_len == 0) return 0; - + if (entry->rec_len == 0) { + AuPmmngrFree((void*)V2P((uint64_t)buffer)); + return 0; + } if (entry->inode != 0 && entry->name_len == target_len) { - if (strncmp(entry->name, name, entry->name_len)) { + if (strncmp(entry->name, name, entry->name_len)==0) { uint32_t found_inode = entry->inode; AuPmmngrFree((void*)V2P((uint64_t)buffer)); return found_inode; @@ -67,7 +75,16 @@ uint32_t Ext2FindEntry(Ext2Fs* fs, Ext2Inode* dir_inode, const char* name) { * @param out_inode -- inode to place the readings */ int Ext2ReadInode(Ext2Fs* fs, uint32_t inode_num, Ext2Inode* out_inode) { - if (!fs || !out_inode || inode_num == 0) return -1; + if (!fs || !out_inode) { + const char* missing = !fs ? "fs" : "out_inode"; + AuTextOut("[Ext2]: %s parameter missing for inode reading.\r\n", missing); + return -1; + } + + if (inode_num == 0) { + AuTextOut("[Ext2]: inode number is zero"); + return -1; + } Ext2Superblock* sb = fs->superblock; @@ -84,7 +101,7 @@ int Ext2ReadInode(Ext2Fs* fs, uint32_t inode_num, Ext2Inode* out_inode) { uint64_t* buffer = (uint64_t*)P2V((uint64_t)AuPmmngrAlloc()); if (!buffer) { - UARTDebugOut("[ext2]: Inode is out of physical memory pages.\r\n"); + AuTextOut("[Ext2]: out of memory during inode reading.\r\n"); return -1; } @@ -100,16 +117,63 @@ int Ext2ReadInode(Ext2Fs* fs, uint32_t inode_num, Ext2Inode* out_inode) { return 0; }; +/** +* Ext2ReadBlockIndex -- reads the block index from a given block +* @param fs -- the filesystem +* @param block_id -- the block id to read from +* @param index -- the index within the block to read +*/ +uint32_t Ext2ReadBlockIndex(Ext2Fs* fs, uint32_t block_id, uint32_t index) { + if (!fs) { + AuTextOut("[Ext2]: fs missing for block index reading.\r\n"); + return 0; + } + + if (block_id == 0) { + AuTextOut("[Ext2]: block_id is zero"); + } + + uint32_t sector_per_block = fs->block_size / 512; + uint64_t target_lba = (uint64_t)block_id * sector_per_block; + + uint32_t* buffer = (uint32_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!buffer) { + AuTextOut("[Ext2]: out of memory during block index reading.\r\n"); + return 0; + } + memset(buffer, 0, 4096); + + AuVDiskRead((AuVDisk*)fs->vdisk, target_lba, sector_per_block, (uint64_t*)buffer); + uint32_t resolved_physical_block = buffer[index]; + + AuPmmngrFree((void*)V2P((uint64_t)buffer)); + + return resolved_physical_block; +}; + +/** +* Ext2Read -- reads data from a file in the ext2 filesystem +* @param node -- the filesystem node +* @param file -- the file node to read from +* @param buffer -- the buffer to store read data +* @param length -- the number of bytes to read +*/ size_t Ext2Read(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t length) { - if (!node || !file || !buffer || !length) return 0; + if (!node || !file || !buffer || !length) { + const char* missing = !node ? "node" : !file ? "file" : !buffer ? "buffer" : "length"; + AuTextOut("[Ext2]: %s parameter missing for file reading.\r\n", missing); + return 0; + } Ext2Fs* fs = (Ext2Fs*)node->device; Ext2Inode* inode = (Ext2Inode*)file->private_data; uint64_t current_pos = file->pos; - if (current_pos >= file->size) return 0; - + if (current_pos >= file->size) { + AuTextOut("[Ext2]: System reached EOF.\r\n"); + return 0; + } if (current_pos + length > file->size) length = file->size - current_pos; uint32_t block_size = fs->block_size; @@ -117,7 +181,10 @@ size_t Ext2Read(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t len uint32_t bytes_read = 0; uint64_t* bounce_page = (uint64_t*)P2V((uint64_t)AuPmmngrAlloc()); - if (!bounce_page)return 0; + if (!bounce_page) { + AuTextOut("[Ext2]: out of memory during file reading.\r\n"); + return 0; + } while (bytes_read < length) { uint64_t current_pos_offset = current_pos + bytes_read; @@ -127,9 +194,42 @@ size_t Ext2Read(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t len uint32_t physical_block = 0; if (logical_block < 12) physical_block = inode->block[logical_block]; + else if (logical_block < (12 + fs->pointers_per_block)) { + uint32_t singly_block_id = inode->block[12]; + if (singly_block_id == 0) physical_block = 0; + else { + uint32_t single_index = logical_block - 12; + physical_block = Ext2ReadBlockIndex(fs, singly_block_id, single_index); + } + } + else if(logical_block < (12 + fs->pointers_per_block + (fs->pointers_per_block * fs->pointers_per_block))) { + uint32_t doubly_block_id = inode->block[13]; + if (doubly_block_id == 0) physical_block = 0; + else { + uint32_t double_index = logical_block - (12 + fs->pointers_per_block); + uint32_t first_level_index = double_index / fs->pointers_per_block; + uint32_t second_level_index = double_index % fs->pointers_per_block; + uint32_t first_level_physical = Ext2ReadBlockIndex(fs, doubly_block_id, first_level_index); + if (first_level_physical == 0) physical_block = 0; + else physical_block = Ext2ReadBlockIndex(fs, first_level_physical, second_level_index); + } + } else { - // @TODO: indirect table routines - break; + uint32_t triply_block_id = inode->block[14]; + if (triply_block_id == 0) physical_block = 0; + else { + uint32_t triple_index = logical_block - (12 + fs->pointers_per_block + (fs->pointers_per_block * fs->pointers_per_block)); + uint32_t first_level_index = triple_index / (fs->pointers_per_block * fs->pointers_per_block); + uint32_t second_level_index = (triple_index / fs->pointers_per_block) % fs->pointers_per_block; + uint32_t third_level_index = triple_index % fs->pointers_per_block; + uint32_t first_level_physical = Ext2ReadBlockIndex(fs, triply_block_id, first_level_index); + if (first_level_physical == 0) physical_block = 0; + else { + uint32_t second_level_physical = Ext2ReadBlockIndex(fs, first_level_physical, second_level_index); + if (second_level_physical == 0) physical_block = 0; + else physical_block = Ext2ReadBlockIndex(fs, second_level_physical, third_level_index); + } + } } if (physical_block == 0) { @@ -163,14 +263,22 @@ size_t Ext2Read(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t len * @param path -- path to the file */ AuVFSNode* Ext2Open(AuVFSNode* fsys, char* path) { - if (!fsys || !path) return NULL; - + if (!fsys || !path) { + const char* missing = !fsys ? "fsys" : "path"; + AuTextOut("[Ext2]: %s parameter missing for file opening.\r\n", missing); + return NULL; + } + Ext2Fs* fs = (Ext2Fs*)fsys->device; // edge case opening root directory if (strlen(path) == 0 || strcmp(path, "/") == 0) { AuVFSNode* root_session = (AuVFSNode*)kmalloc(sizeof(AuVFSNode)); + if (!root_session) { + AuTextOut("[Ext2]: out of memory during root directory opening.\r\n"); + return NULL; + } memset(root_session, 0, sizeof(AuVFSNode)); strcpy(root_session->filename, fsys->filename); @@ -178,63 +286,72 @@ AuVFSNode* Ext2Open(AuVFSNode* fsys, char* path) { root_session->first_block = 2; root_session->size = 0; root_session->pos = 0; - root_session->read = NULL; + root_session->read = Ext2Read; root_session->device = fs; root_session->private_data = NULL; return root_session; } uint32_t current_inode_number = 2; - Ext2Inode current_inode; char path_local[256]; - strncpy(path_local, path, 256); - path_local[256] = '\0'; + strncpy(path_local, path, sizeof(path_local) - 1); + path_local[sizeof(path_local) - 1] = '\0'; + char* token = path_local; char* nxt_token = NULL; while (token && *token != '\0') { + while (*token == '/') token++; + if (*token == '\0') break; nxt_token = strchr(token, '/'); if (nxt_token) { *nxt_token = '\0'; nxt_token++; } - if (strlen(token)) { - token = nxt_token; - continue; - } if (Ext2ReadInode(fs, current_inode_number, ¤t_inode) != 0) { - UARTDebugOut("[ext2]: failed to read the inode sector during path sweep.\r\n"); + AuTextOut("[Ext2]: failed to read the inode sector during path sweep.\r\n"); return NULL; } if (!(current_inode.mode & EXT2_S_IFDIR)) { - UARTDebugOut("[ext2]: path element is not a directory container.\r\n"); + AuTextOut("[Ext2]: path element is not a directory container.\r\n"); return NULL; } uint32_t found_inode_num = Ext2FindEntry(fs, ¤t_inode, token); - if (found_inode_num == 0) return NULL; + if (found_inode_num == 0) { + AuTextOut("[Ext2]: path element not found in directory.\r\n"); + return NULL; + } current_inode_number = found_inode_num; token = nxt_token; } - if (Ext2ReadInode(fs, current_inode_number, ¤t_inode) != 0) return NULL; + if (Ext2ReadInode(fs, current_inode_number, ¤t_inode) != 0) { + AuTextOut("[Ext2]: failed to read the final inode sector during path sweep.\r\n"); + return NULL; + } AuVFSNode* file_session = (AuVFSNode*)kmalloc(sizeof(AuVFSNode)); - if (!file_session) return NULL; + if (!file_session) { + AuTextOut("[Ext2]: out of memory during file session creation.\r\n"); + return NULL; + } memset(file_session, 0, sizeof(AuVFSNode)); file_session->first_block = current_inode_number; file_session->size = current_inode.size; - char* raw_filename = strchr(path, '/'); - strcpy(file_session->filename, raw_filename ? (raw_filename + 1) : path); + char* raw_filename = strrchr(path, '/'); + char* final_name = raw_filename ? (raw_filename + 1) : path; + strncpy(file_session->filename, final_name, 31); + file_session->filename[31] = '\0'; if (current_inode.mode & EXT2_S_IFDIR) file_session->flags |= FS_FLAG_DIRECTORY; else if (current_inode.mode & EXT2_S_IFREG)file_session->flags |= FS_FLAG_GENERAL; @@ -269,17 +386,27 @@ AuVFSNode* Ext2Initialise(AuVDisk* vdisk, char* mountname) { AuVDiskRead(vdisk, 2, 2, buffer); Ext2Fs* fs = (Ext2Fs*)kmalloc(sizeof(Ext2Fs)); + if (!fs) { + AuTextOut("[ext2]: out of memory during file system initialization.\r\n"); + kfree(fs); + return NULL; + } memset(fs, 0, sizeof(Ext2Fs)); - fs->vdisk = (AuVFSNode*)vdisk; + fs->vdisk = vdisk; fs->superblock = (Ext2Superblock*)kmalloc(sizeof(Ext2Superblock)); + if (!fs->superblock) { + AuTextOut("[ext2]: out of memory during superblock allocation.\r\n"); + kfree(fs->superblock); + return NULL; + } memcpy(fs->superblock, buffer, sizeof(Ext2Superblock)); if (fs->superblock->magic != EXT2_SUPER_BLOCK_MAGIC) { AuPmmngrFree((void*)V2P((uint64_t)buffer)); kfree(fs->superblock); kfree(fs); - UARTDebugOut("[ext2]: EXT2 magic mismatch \n"); + AuTextOut("[ext2]: EXT2 magic mismatch \n"); for (;;); return NULL; } @@ -332,8 +459,8 @@ AuVFSNode* Ext2Initialise(AuVDisk* vdisk, char* mountname) { fsys->read = Ext2Read; fsys->read_dir = NULL; - fsys->write = NULL; - fsys->create_dir = NULL; + fsys->write = Ext2Write; + fsys->create_dir = Ext2CreateDir; fsys->create_file = NULL; vdisk->fsys = fsys; diff --git a/KernelAA64/Fs/Ext2/ext2dir.c b/KernelAA64/Fs/Ext2/ext2dir.c new file mode 100644 index 000000000..e197eb18a --- /dev/null +++ b/KernelAA64/Fs/Ext2/ext2dir.c @@ -0,0 +1,233 @@ +#include +#include +#include +#include +#include +#include +#include +#include <_null.h> + + +#define EXT2_DIR_REC_LEN(name_len) (((8 + (name_len)) + 3) & ~3) + + +uint32_t Ext2AllocInode(Ext2Fs* fs) { + if (!fs || !fs->superblock) return 0; + + if (fs->superblock->free_inodes_count == 0) { + AuTextOut("[Ext2]: no free inodes available on volume.\r\n"); + return 0; + } + + uint32_t block_size = fs->block_size; + uint32_t sector_per_block = block_size / 512; + uint32_t group_count = fs->block_group_count; + + uint8_t* bitmap_buffer = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!bitmap_buffer) return 0; + + uint32_t allocated_inode_id = 0; + uint32_t target_group = 0; + + for (uint32_t g = 0; g < group_count; g++) { + if (fs->block_desc->free_inodes_count == 0) continue; + + uint32_t bitmap_block = fs->block_desc->inode_bitmap; + uint32_t bitmap_lba = (uint64_t)bitmap_block * sector_per_block; + + memset(bitmap_buffer, 0, block_size); + AuVDiskRead((AuVDisk*)fs->vdisk, bitmap_lba, sector_per_block, (uint64_t*)bitmap_buffer); + + uint32_t bytes_to_scan = fs->inodes_per_group / 8; + if (bytes_to_scan > block_size) bytes_to_scan = block_size; + + for (uint32_t byte_index = 0; byte_index < bytes_to_scan; byte_index++) { + if (bitmap_buffer[byte_index] == 0xFF) continue; + for (uint8_t bit_index = 0; bit_index < 8; bit_index++) { + if (!(bitmap_buffer[byte_index] & (1 << bit_index))) { + uint32_t relative_inode = (byte_index * 8) + bit_index + 1; + allocated_inode_id = (g * fs->inodes_per_group) + relative_inode; + + bitmap_buffer[byte_index] |= (1 << bit_index); + + AuVDiskWrite((AuVDisk*)fs->vdisk, bitmap_lba, sector_per_block, (uint64_t*)bitmap_buffer); + target_group = g; + goto success; + } + } + } + } +success: + AuPmmngrFree((void*)V2P((uint64_t)bitmap_buffer)); + + if (allocated_inode_id == 0) return 0; + + // Update metadata counters + fs->superblock->free_inodes_count--; + fs->block_desc[target_group].free_inodes_count--; + + Ext2FlushSuperblock(fs); + Ext2FlushBgdt(fs); + + return allocated_inode_id; +}; + +int Ext2AddDirEntry(Ext2Fs* fs, Ext2Inode* parent_inode, uint32_t parent_inode_num, uint32_t child_inode_num, const char* child_name, uint8_t file_type) { + if (!fs || !parent_inode || !child_name) return -1; + + uint32_t block_size = fs->block_size; + uint32_t sector_per_block = block_size / 512; + uint32_t name_len = strlen(child_name); + uint16_t required_rec_len = EXT2_DIR_REC_LEN(name_len); + + uint8_t* block_buf = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!block_buf) return -1; + + for (uint32_t i = 0; i < 12; i++) { + uint32_t physical_block = parent_inode->block[i]; + + if (physical_block == 0) { + physical_block = Ext2AllocBlock(fs); + if (physical_block == 0) { + AuPmmngrFree((void*)V2P((uint64_t)block_buf)); + return -1; + } + + parent_inode->block[i] = physical_block; + parent_inode->size += block_size; + parent_inode->blocks = (parent_inode->size + 511) / 512; + Ext2InodeWrite(fs, parent_inode_num, parent_inode); + + memset(block_buf, 0, block_size); + Ext2Dir* new_entry = (Ext2Dir*)block_buf; + new_entry->inode = child_inode_num; + new_entry->rec_len = block_size; + new_entry->name_len = name_len; + new_entry->file_type = file_type; + memcpy(new_entry->name, (void*)child_name, name_len); + + AuVDiskWrite((AuVDisk*)fs->vdisk, (uint64_t)physical_block * sector_per_block, sector_per_block, (uint64_t*)block_buf); + AuPmmngrFree((void*)V2P((uint64_t)block_buf)); + return 0; + } + + uint64_t target_lba = (uint64_t)physical_block * sector_per_block; + memset(block_buf, 0, block_size); + AuVDiskRead((AuVDisk*)fs->vdisk, target_lba, sector_per_block, (uint64_t*)block_buf); + + uint32_t current_pos = 0; + while (current_pos < block_size) { + Ext2Dir* entry = (Ext2Dir*)(block_buf + current_pos); + + if (entry->rec_len == 0) break; + + uint16_t actual_rec_len = EXT2_DIR_REC_LEN(entry->name_len); + + if (entry->rec_len - actual_rec_len >= required_rec_len) { + uint16_t old_rec_len = entry->rec_len; + + entry->rec_len = actual_rec_len; + + Ext2Dir* new_entry = (Ext2Dir*)(block_buf + current_pos + actual_rec_len); + new_entry->inode = child_inode_num; + new_entry->rec_len = old_rec_len - actual_rec_len; + new_entry->name_len = name_len; + new_entry->file_type = file_type; + memcpy(new_entry->name, (void*)child_name, name_len); + + AuVDiskWrite((AuVDisk*)fs->vdisk, target_lba, sector_per_block, (uint64_t*)block_buf); + AuPmmngrFree((void*)V2P((uint64_t)block_buf)); + return 0; + } + + current_pos += entry->rec_len; + } + } + + AuPmmngrFree((void*)V2P((uint64_t)block_buf)); + return -1; +}; + +int Ext2Mkdir(AuVFSNode* parent_node, const char* name, uint16_t permissions) { + if (!parent_node || !name) return -1; + + Ext2Fs* fs = (Ext2Fs*)parent_node->device; + Ext2Inode* parent_inode = (Ext2Inode*)parent_node->private_data; + + if (!fs || !parent_inode) return -1; + + if (!(parent_node->flags & FS_FLAG_DIRECTORY)) { + AuTextOut("[Ext2 Mkdir]: Parent node is not a directory.\r\n"); + return -1; + } + + if (Ext2FindEntry(fs, parent_inode, name) != 0) { + AuTextOut("[Ext2 Mkdir]: Directory entry already exists.\r\n"); + return -1; + } + + uint32_t new_inode_num = Ext2AllocInode(fs); + if (new_inode_num == 0) return -1; + + uint32_t new_block_num = Ext2AllocBlock(fs); + if (new_block_num == 0) return -1; + + uint32_t block_size = fs->block_size; + uint32_t sector_per_block = block_size / 512; + + uint8_t* dir_block = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!dir_block) return -1; + + memset(dir_block, 0, block_size); + + Ext2Dir* dot = (Ext2Dir*)dir_block; + dot->inode = new_inode_num; + dot->rec_len = 12; + dot->name_len = 1; + dot->file_type = 2; + dot->name[0] = '.'; + + Ext2Dir* dotdot = (Ext2Dir*)(dir_block + 12); + dotdot->inode = parent_node->first_block; + dotdot->rec_len = block_size - 12; + dotdot->name_len = 2; + dotdot->file_type = 2; + dotdot->name[0] = '.'; + dotdot->name[1] = '.'; + + AuVDiskWrite((AuVDisk*)fs->vdisk, (uint64_t)new_block_num * sector_per_block, sector_per_block, (uint64_t*)dir_block); + AuPmmngrFree((void*)V2P((uint64_t)dir_block)); + + Ext2Inode new_inode; + memset(&new_inode, 0, sizeof(Ext2Inode)); + + new_inode.mode = EXT2_S_IFDIR | (permissions & 0x0FFF); + new_inode.size = block_size; + new_inode.links_count = 2; + new_inode.blocks = block_size / 512; + new_inode.block[0] = new_block_num; + + if (Ext2InodeWrite(fs, new_inode_num, &new_inode) != 0) return -1; + + if (Ext2AddDirEntry(fs, parent_inode, parent_node->first_block, new_inode_num, name, 2) != 0) return -1; + + parent_inode->links_count++; + Ext2InodeWrite(fs, parent_node->first_block, parent_inode); + + uint32_t group = (new_inode_num - 1) / fs->inodes_per_group; + fs->block_desc[group].used_dirs_count++; + Ext2FlushBgdt(fs); + + return 0; +} + +AuVFSNode* Ext2CreateDir(AuVFSNode* parent, char* name) { + if (!parent || !name) return NULL; + + if (Ext2Mkdir(parent, name, 0755) != 0) { + AuTextOut("[Ext2]: Failed to create directory on disk.\r\n"); + return NULL; + } + + return Ext2Open(parent, name); +} \ No newline at end of file diff --git a/KernelAA64/Fs/Ext2/ext2file.c b/KernelAA64/Fs/Ext2/ext2file.c new file mode 100644 index 000000000..ab59b03cf --- /dev/null +++ b/KernelAA64/Fs/Ext2/ext2file.c @@ -0,0 +1,341 @@ +#include +#include +#include +#include +#include +#include +#include + +void Ext2FlushSuperblock(Ext2Fs* fs) { + if (!fs || !fs->superblock) return; + + int8_t* buffer = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!buffer) return; + + memset(buffer, 0, 4096); + + AuVDiskRead((AuVDisk*)fs->vdisk, 2, 2, (uint64_t*)buffer); + memcpy(buffer, fs->superblock, sizeof(Ext2Superblock)); + AuVDiskWrite((AuVDisk*)fs->vdisk, 2, 2, (uint64_t*)buffer); + + AuPmmngrFree((void*)V2P((uint64_t)buffer)); +}; + +void Ext2FlushBgdt(Ext2Fs* fs) { + if (!fs || !fs->block_desc) return; + + uint32_t bgd_start_block = (fs->block_size == 1024) ? 2 : 1; + uint32_t sector_per_block = fs->block_size / 512; + uint64_t bgd_lba = (uint64_t)bgd_start_block * sector_per_block; + + uint32_t bgd_table_size = fs->block_group_count * sizeof(Ext2BlockDescriptor); + uint32_t blocks_needed = (bgd_table_size + fs->block_size - 1) / fs->block_size; + + uint8_t* buffer = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!buffer) return; + + memset(buffer, 0, fs->block_size); + memcpy(buffer, fs->block_desc, bgd_table_size); + + AuVDiskWrite((AuVDisk*)fs->vdisk, bgd_lba, blocks_needed * sector_per_block, (uint64_t*)buffer); + + AuPmmngrFree((void*)V2P((uint64_t)buffer)); +}; + +uint32_t Ext2AllocBlock(Ext2Fs* fs) { + if (!fs || !fs->superblock) { + AuTextOut("[Ext2]: Invalid filesystem handle.\r\n"); + return 0; + } + + if (fs->superblock->free_blocks_count == 0) { + AuTextOut("[Ext2]: Filesystem is completely full!\r\n"); + return 0; + } + + uint32_t block_size = fs->block_size; + uint32_t sector_per_block = block_size / 512; + uint32_t group_count = fs->block_group_count; + + uint8_t* buffer = (uint8_t*)P2V((uint8_t)AuPmmngrAlloc()); + if (!buffer) { + AuTextOut("[Ext2]: Out of memory allocating bitmap buffer.\r\n"); + return 0; + } + + uint32_t allocated_block_id = 0; + uint32_t target_group = 0; + + for (uint32_t i = 0; iblock_desc->free_blocks_count == 0) continue; + + uint32_t bitmap_block = fs->block_desc->block_bitmap; + uint64_t bitmap_lba = (uint64_t)bitmap_block * sector_per_block; + + memset(buffer, 0, block_size); + AuVDiskRead((AuVDisk*)fs->vdisk, bitmap_lba, sector_per_block, (uint64_t*)buffer); + + for (uint32_t byte = 0; byte < block_size; byte++) { + if (buffer[byte] == 0xFF) continue; + for (uint8_t bit = 0; bit < 8; bit++) { + if (!(buffer[byte] & (1 << bit))) { + uint32_t relative_block = (byte * 8) + bit; + allocated_block_id = (i * fs->block_group_count) + relative_block + fs->superblock->free_data_block; + buffer[byte] |= (1 << bit); + AuVDiskWrite((AuVDisk*)fs->vdisk, bitmap_lba, sector_per_block, (uint64_t*)buffer); + target_group = i; + goto success; + } + } + } + } +success: + AuPmmngrFree((void*)V2P((uint64_t)buffer)); + if (allocated_block_id == 0) { + AuTextOut("[Ext2]: failed to locate a free bit in bitmap.\r\n"); + return 0; + } + + fs->superblock->free_blocks_count--; + fs->block_desc->free_blocks_count--; + + Ext2FlushSuperblock(fs); + Ext2FlushBgdt(fs); + + return allocated_block_id; +}; + +int Ext2InodeWrite(Ext2Fs* fs, uint32_t inode_num, Ext2Inode* inode) { + if (!fs || !inode || inode_num == 0) return -1; + + uint32_t group = (inode_num - 1) / fs->inodes_per_group; + uint32_t index = (inode_num - 1) % fs->inodes_per_group; + + uint32_t inode_table_block = fs->block_desc->inode_table; + uint32_t inode_size = fs->inode_size; + uint32_t byte_offset = index * inode_size; + + uint32_t block_offset = byte_offset / fs->block_size; + uint32_t internal_offset = byte_offset % fs->block_size; + + uint32_t target_block = inode_table_block + block_offset; + uint32_t sector_per_block = fs->block_size / 512; + uint64_t target_lba = (uint64_t)target_block * sector_per_block; + + uint8_t* buffer = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!buffer) return -1; + + AuVDiskRead((AuVDisk*)fs->vdisk, target_lba, sector_per_block, (uint64_t*)buffer); + memcpy(buffer + internal_offset, inode, inode_size); + AuVDiskWrite((AuVDisk*)fs->vdisk, target_lba, sector_per_block, (uint64_t*)buffer); + + AuPmmngrFree((void*)V2P((uint64_t)buffer)); + + return 0; +}; + +static uint32_t Ext2AssignTable(Ext2Fs* fs, uint32_t table_block_id, uint32_t index) { + if(table_block_id == 0) return 0; + uint32_t sector_per_block = fs->block_size / 512; + + uint32_t* table_buffer = (uint32_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!table_buffer) return 0; + + AuVDiskRead((AuVDisk*)fs->vdisk, (uint64_t)table_block_id * sector_per_block, sector_per_block, (uint64_t*)table_buffer); + uint32_t target_block = table_buffer[index]; + + if (target_block == 0) { + target_block = Ext2AllocBlock(fs); + if (target_block != 0) { + table_buffer[index] = target_block; + + AuVDiskWrite((AuVDisk*)fs->vdisk, (uint64_t)table_block_id * sector_per_block, sector_per_block, (uint64_t*)table_buffer); + + uint32_t* zero_buffer = (uint32_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (zero_buffer) { + memset(zero_buffer, 0, fs->block_size); + AuVDiskWrite((AuVDisk*)fs->vdisk, (uint64_t)table_block_id * sector_per_block, sector_per_block, (uint64_t*)zero_buffer); + AuPmmngrFree((void*)V2P((uint64_t)zero_buffer)); + } + } + } + + AuPmmngrFree((void*)V2P((uint64_t)table_buffer)); + return target_block; +}; + +/** + * Ext2GetBlock -- check for blocks if not allocated it allocates them + */ +static uint32_t Ext2GetBlock(Ext2Fs* fs, Ext2Inode* inode, uint32_t inode_num, uint32_t logical_block) { + uint32_t sector_per_block = fs->block_size / 512; + + if (logical_block < 12) { + if (inode->block[logical_block] !=0 ) return inode->block[logical_block]; + uint32_t new_block = Ext2AllocBlock(fs); + if (new_block == 0) return 0; + + inode->block[logical_block] = new_block; + Ext2InodeWrite(fs, inode_num, inode); + return new_block; + } + + if (logical_block < (12 + fs->pointers_per_block)) { + uint32_t single_index = logical_block - 12; + + if (inode->block[12] == 0) { + uint32_t new_table_block = Ext2AllocBlock(fs); + if (new_table_block == 0) return 0; + + inode->block[12] = new_table_block; + Ext2InodeWrite(fs, inode_num, inode); + + + uint8_t* buffer = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + memset(buffer, 0, fs->block_size); + AuVDiskWrite((AuVDisk*)fs->vdisk, (uint64_t)new_table_block * sector_per_block, sector_per_block, (uint64_t*)buffer); + AuPmmngrFree((void*)V2P((uint64_t)buffer)); + } + + return Ext2AssignTable(fs, inode->block[12], single_index); + } + + if (logical_block < (12 + fs->pointers_per_block + (fs->pointers_per_block * fs->pointers_per_block))) { + uint64_t double_index = logical_block - (12 + fs->pointers_per_block); + uint32 lvl1_index = double_index / fs->pointers_per_block; + uint32 lvl2_index = double_index % fs->pointers_per_block; + + if (inode->block[13] == 0) { + uint32_t new_table_block = Ext2AllocBlock(fs); + if (new_table_block == 0) return 0; + + inode->block[13] = new_table_block; + Ext2InodeWrite(fs, inode_num, inode); + + + uint8_t* buffer = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + memset(buffer, 0, fs->block_size); + AuVDiskWrite((AuVDisk*)fs->vdisk, (uint64_t)new_table_block * sector_per_block, sector_per_block, (uint64_t*)buffer); + AuPmmngrFree((void*)V2P((uint64_t)buffer)); + } + + uint32 single_table = Ext2AssignTable(fs, inode->block[13], lvl1_index); + if (single_table == 0) return 0; + + return Ext2AssignTable(fs, single_table, lvl2_index); + } + + if (logical_block < (12 + fs->pointers_per_block + (fs->pointers_per_block * fs->pointers_per_block) + (fs->pointers_per_block * fs->pointers_per_block * fs->pointers_per_block))) { + uint64_t triple_index = logical_block - (12 + fs->pointers_per_block + (fs->pointers_per_block * fs->pointers_per_block)); + uint32_t lvl1_index = triple_index / (fs->pointers_per_block); + uint32_t lvl2_index = (triple_index / fs->pointers_per_block) % fs->pointers_per_block; + uint32_t lvl3_index = triple_index % fs->pointers_per_block; + + if (inode->block[14] == 0){ + uint32_t new_table_block = Ext2AllocBlock(fs); + if (new_table_block == 0) return 0; + + inode->block[14] = new_table_block; + Ext2InodeWrite(fs, inode_num, inode); + + uint8_t* zero_buffer = (uint8_t*)P2V((uint64_t)AuPmmngrAlloc()); + memset(zero_buffer, 0, fs->block_size); + AuVDiskWrite((AuVDisk*)fs->vdisk, (uint64_t)new_table_block * sector_per_block, sector_per_block, (uint64_t*)zero_buffer); + AuPmmngrFree((void*)V2P((uint64_t)zero_buffer)); + } + + uint32 double_table = Ext2AssignTable(fs, inode->block[14], lvl1_index); + if (double_table == 0) return 0; + + uint32_t single_table = Ext2AssignTable(fs, double_table, lvl2_index); + if (single_table) return 0; + + return Ext2AssignTable(fs, single_table, lvl3_index); + } + + AuTextOut("[Ext2]: Logical block exceeds maximum supported Ext2 file boundary.\r\n"); + return 0; +}; + +/** + * Ext2Wrtie -- writes data to a file in the ext2 filesystem + * @param node -- the filesystem node + * @param file -- the file node to write to + * @param buffer -- the buffer to store write data + * @param length -- the number of bytes to write + */ +size_t Ext2Write(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t length){ + if (!node || !file || !buffer || !length){ + const char* missing = !node ? "node" : !file ? "file" : !buffer ? "buffer" : "length"; + AuTextOut("[Ext2]: %s parameter missing for file writing.\r\n", missing); + return 0; + } + + if (length <= 0) { + AuTextOut("[Ext2]: lenght is zero or smaller"); + return 0; + } + + Ext2Fs* fs = (Ext2Fs*)node->device; + Ext2Inode* inode = (Ext2Inode*)file->private_data; + + uint64_t current_pos = file->pos; + + uint32_t block_size = fs->block_size; + uint32_t sector_per_block = block_size / 512; + uint32_t bytes_written = 0; + + if (current_pos >= file->size) { + AuTextOut("[Ext2]: System reached EOF.\r\n"); + return 0; + } + + uint64_t* bounce_page = (uint64_t*)P2V((uint64_t)AuPmmngrAlloc()); + if (!bounce_page) { + AuTextOut("[Ext2]: out of memory during file write.\r\n"); + return 0; + } + + while (bytes_written < length) { + uint64_t current_pos_offset = current_pos + bytes_written; + uint64_t logical_block = current_pos_offset / block_size; + uint32_t internal_offset = current_pos_offset % block_size; + + uint32_t chunk = block_size - internal_offset; + if (chunk > (length - bytes_written)) chunk = length - bytes_written; + + uint32_t physical_block = Ext2GetBlock(fs, inode, file->first_block, logical_block); + if (physical_block == 0) { + AuTextOut("[Ext2 Write Error]: Failed to allocate or resolve physical block.\r\n"); + break; + } + + uint64_t target_lba = (uint64_t)physical_block * sector_per_block; + + if (internal_offset != 0 || chunk < block_size) { + memset(bounce_page, 0, block_size); + AuVDiskRead((AuVDisk*)fs->vdisk, target_lba, sector_per_block, (uint64_t*)bounce_page); + } else { + memset(bounce_page, 0, block_size); + } + + memcpy(bounce_page + internal_offset, ((uint8_t*)buffer) + bytes_written, chunk); + AuVDiskWrite((AuVDisk*)fs->vdisk, target_lba, sector_per_block, (uint64_t*)bounce_page); + + bytes_written += chunk; + } + AuPmmngrFree((void*)V2P((uint64_t)bounce_page)); + + if ((current_pos + bytes_written) > file->size) { + file->size = current_pos + bytes_written; + inode->size = file->size; + } + + inode->blocks = (inode->size + 511) / 512; + + Ext2InodeWrite(fs, file->first_block, inode); + + file->pos += bytes_written; + + return bytes_written; +}; \ No newline at end of file diff --git a/KernelAA64/Fs/Fat/Fat.c b/KernelAA64/Fs/Fat/Fat.c index 784ab2853..adb3992b7 100644 --- a/KernelAA64/Fs/Fat/Fat.c +++ b/KernelAA64/Fs/Fat/Fat.c @@ -301,7 +301,7 @@ size_t FatRead(AuVFSNode* fsys, AuVFSNode* file, uint64_t* buf) { if (file->current == (FAT_EOC_MARK & 0x0FFFFFFF)) return 0; - auto lba = FatClusterToSector32(fs, file->current); + uint32 lba = FatClusterToSector32(fs, file->current); AuVDiskRead(vdisk, lba, fs->__SectorPerCluster, buf); uint32_t value = FatReadFAT(fsys, file->current); diff --git a/KernelAA64/Fs/initrd.c b/KernelAA64/Fs/initrd.c index 287010bee..d0149696e 100644 --- a/KernelAA64/Fs/initrd.c +++ b/KernelAA64/Fs/initrd.c @@ -76,7 +76,7 @@ void AuRamdiskRead(uint64_t lba, size_t count, uint8_t* buffer) { } const uint8_t* src = (const uint8_t*)(ramdisk_start + offset); - memcpy(buffer, src, bytes_to_read); + memcpy(buffer, (void*)src, bytes_to_read); /*for (int i = 0; i < RAMDISK_SECTOR_SIZE * count; i++) buffer[i] = src[i];*/ } diff --git a/KernelAA64/Fs/tty.c b/KernelAA64/Fs/tty.c index 868ada10d..a78c3a0ac 100644 --- a/KernelAA64/Fs/tty.c +++ b/KernelAA64/Fs/tty.c @@ -45,9 +45,9 @@ /** @brief master_count -- internal count value of total * master tty */ -size_t master_count = 0; +static size_t master_count = 0; /** @brief slave_count -- internal slave tty count */ -size_t slave_count = 0; +static size_t slave_count = 0; TTY* root = NULL; TTY* last = NULL; @@ -239,13 +239,15 @@ size_t AuTTYSlaveWrite(AuVFSNode* fsys, AuVFSNode* file, uint64_t* buffer, uint3 TTY* tty = (TTY*)file->device; if (!tty) return 0; - if (len > 512) - len = 512; + if (len > 1024) + len = 1024; if (CircBufFull(tty->masterbuf)) { - AA64Registers* regs = AA64GetCurrentRegCtx(); - AuScheduleThread(regs); + /*AA64Registers* regs = AA64GetCurrentRegCtx(); + AuScheduleThread(regs);*/ + AuSleepThread(curr_th, 10); + AuScheduleNext(); return 0; } @@ -257,15 +259,17 @@ size_t AuTTYSlaveWrite(AuVFSNode* fsys, AuVFSNode* file, uint64_t* buffer, uint3 /* little bit slow down the slave process, * it's too fast */ - //AuSleepThread(curr_th, ); + //AuSleepThread(curr_th,10); //AuScheduleThread(AA64GetCurrentRegCtx()); + //AuScheduleNext(); return len; } int AuTTYSlaveClose(AuVFSNode* fs, AuVFSNode* file) { AuVFSNode* _fs = AuVFSFind("/dev"); if (!_fs) - return 0; + return 1; + return 0; } int AuTTYMasterClose(AuVFSNode* fs, AuVFSNode* file) { @@ -334,7 +338,7 @@ AuVFSNode* AuTTYCreateMaster(TTY* tty) { sztoa(master_count, name + 4, 10); strcpy(node->filename, name); - node->size = 512; + node->size = 1024; node->flags |= FS_FLAG_TTY; node->device = tty; node->uid = 0; @@ -366,7 +370,7 @@ AuVFSNode* AuTTYCreateSlave(TTY* tty) { sztoa(slave_count, name + 4, 10); strcpy(node->filename, name); - node->size = 512; + node->size = 1024; node->flags |= FS_FLAG_TTY; node->device = tty; node->read = AuTTYSlaveRead; @@ -400,13 +404,13 @@ int AuTTYCreate(int* master_fd, int* slave_fd) { TTY* tty = (TTY*)kmalloc(sizeof(TTY)); memset(tty, 0, sizeof(TTY)); - void* inbuffer = kmalloc(512); - memset(inbuffer, 0, 512); - void* outbuffer = kmalloc(512); - memset(outbuffer, 0, 512); + void* inbuffer = kmalloc(1024); + memset(inbuffer, 0, 1024); + void* outbuffer = kmalloc(1024); + memset(outbuffer, 0, 1024); - tty->masterbuf = AuCircBufInitialise((uint8_t*)inbuffer, 512); - tty->slavebuf = AuCircBufInitialise((uint8_t*)outbuffer, 512); + tty->masterbuf = AuCircBufInitialise((uint8_t*)inbuffer, 1024); + tty->slavebuf = AuCircBufInitialise((uint8_t*)outbuffer, 1024); tty->id = slave_count; tty->master_written = 0; @@ -432,18 +436,24 @@ int AuTTYCreate(int* master_fd, int* slave_fd) { slave->uid = proc->creds.uid; slave->gid = proc->creds.gid; + CapRights rights; + rights = CAP_READ | CAP_WRITE; + int fd = AuProcessGetFileDesc(proc); if (fd == -1) return 0; proc->fds[fd] = master; *master_fd = fd; + BordoisilaCapCreate(proc, fd, master, CAP_OBJ_FILE, rights); + fd = AuProcessGetFileDesc(proc); if (fd == -1) return 0; proc->fds[fd] = slave; *slave_fd = fd; - + + BordoisilaCapCreate(proc, fd, slave, CAP_OBJ_FILE, rights); return 1; } diff --git a/KernelAA64/Fs/vdisk.c b/KernelAA64/Fs/vdisk.c index 87ddb320b..839c53ddf 100644 --- a/KernelAA64/Fs/vdisk.c +++ b/KernelAA64/Fs/vdisk.c @@ -41,7 +41,8 @@ #include #include #include -#include +#include +#include AuVDisk* VdiskArray[MAX_VDISK_DEVICES]; int _vdisk_num_; @@ -101,6 +102,7 @@ uint8_t AuVDiskGetIndex() { if (!VdiskArray[i]) return i; } + return UINT8_MAX; } @@ -156,11 +158,12 @@ void AuVDiskRegisterPartition(AuVDisk* vdisk) { memset(buffer, 0, 4096); if (!vdisk->Read) return; + vdisk->Read(vdisk, 1, 1, buffer); uint8_t* aligned_buf = (uint8_t*)buffer; GPTHeader* header = (GPTHeader*)aligned_buf; - + /* check if it's Efi partition */ if (strcmp(header->sig, "EFI PART") != 0) { AuTextOut("[aurora]: vdisk %s doesn't have valid GPT partition \r\n", vdisk->diskname); @@ -212,7 +215,7 @@ void AuVDiskRegisterPartition(AuVDisk* vdisk) { AuTextOut("\r\n"); AuPmmngrFree(buffer); - + } /** @@ -231,6 +234,7 @@ void AuVDiskRegister(AuVDisk* disk) { disk->__VDiskID = _index; /* Register a partition and initialise the file system*/ + AuVDiskRegisterPartition(disk); aurora_fs_type type = AuProbeFileSystem(disk); @@ -245,7 +249,7 @@ void AuVDiskRegister(AuVDisk* disk) { char* mpt = AuVFSReserveMountPointLetter(); /** make letter /a reserved for root '/' **/ - if (strcmp(mpt, "/a") == 0) + if (strcmp(mpt, "a") == 0) FatInitialise(disk, "/"); else FatInitialise(disk, mpt); @@ -255,7 +259,8 @@ void AuVDiskRegister(AuVDisk* disk) { break; case AURORA_FS_EXT2: AuTextOut("[aurora]: vdisk : %s has Ext2 file system \r\n", disk->diskname); - Ext2Initialise(disk, "b"); + mpt = AuVFSReserveMountPointLetter(); + Ext2Initialise(disk, mpt); break; } } diff --git a/KernelAA64/Fs/vfs.c b/KernelAA64/Fs/vfs.c index 3827b4302..50efb291c 100644 --- a/KernelAA64/Fs/vfs.c +++ b/KernelAA64/Fs/vfs.c @@ -32,6 +32,7 @@ #include #include #include <_null.h> +#include #include #include #include @@ -42,6 +43,7 @@ #include #include #include +#include AuVFSContainer* __RootContainer; AuVFSNode* __RootFS; @@ -210,7 +212,7 @@ AU_EXTERN AU_EXPORT AuVFSNode* AuVFSOpen(char* path) { dsb_ish(); } pathname[i] = 0; - aa64_data_cache_clean_range(&pathname, 16); + //aa64_data_cache_clean_range(&pathname, 16); /* skip the fs filename, from the path * and just pass the required path */ @@ -218,7 +220,6 @@ AU_EXTERN AU_EXPORT AuVFSNode* AuVFSOpen(char* path) { next += i; dsb_ish(); dsb_sy_barrier(); - if (fs->open) { //AA64SleepUS(600); Returnable = fs->open(fs, next); @@ -227,7 +228,7 @@ AU_EXTERN AU_EXPORT AuVFSNode* AuVFSOpen(char* path) { //AA64SleepUS(600); } } - data_cache_flush(Returnable); + data_cache_flush((uint64_t*)Returnable); return Returnable; } @@ -359,6 +360,8 @@ int AuVFSRemoveDir(AuVFSNode* fsys, AuVFSNode* file) { return -1; if (fsys->remove_dir && (file->flags & FS_FLAG_DIRECTORY)) return fsys->remove_dir(fsys, file); + + return 0; } diff --git a/KernelAA64/Hal/aa64cpu.c b/KernelAA64/Hal/aa64cpu.c index d123972d3..c02ddb7f9 100644 --- a/KernelAA64/Hal/aa64cpu.c +++ b/KernelAA64/Hal/aa64cpu.c @@ -44,6 +44,7 @@ uint64_t basisTime; uint64_t cpuFrequency; +uint64_t bootTime; uint64_t AA64GetPhysicalTimerCount() { uint64_t val = get_cntpct_el0(); @@ -69,6 +70,7 @@ void AA64ClockInitialize() { cpuFrequency = val / 10000; basisTime = AA64GetPhysicalTimerCount() / cpuFrequency; + bootTime = AuAA64BoardGetBootEpoch(); AuTextOut("[aurora]: using %d mHZ \r\n", cpuFrequency); } @@ -163,6 +165,64 @@ void AA64CPUImplementer(uint32_t midr) { //AuTextOut("CPU Architecture: ARMv8-A(%x) \r\n", arch); } +#define SUBSECONDS_PER_SECOND 1000000 + +void updateTicks(uint64_t ticks, uint64_t* timerTick, uint64_t* timerSubticks) { + *timerSubticks = ticks - basisTime; + *timerTick = *timerSubticks / SUBSECONDS_PER_SECOND; + *timerSubticks = *timerSubticks % SUBSECONDS_PER_SECOND; +} + +int aa64_gettimeofday(timeval* t) { + uint64_t cur_cnt = AA64GetPhysicalTimerCount(); + uint64_t timer_ticks, timer_subticks; + updateTicks(cur_cnt / cpuFrequency, &timer_ticks, &timer_subticks); + t->tv_sec = bootTime + timer_ticks; + t->tv_usec = timer_subticks; + return 0; +} + +uint64_t aa64_now() { + timeval t; + aa64_gettimeofday(&t); + return t.tv_sec; +} + +int aa64_settimeofday(timeval* t) { + if (!t) return -1; + if (t->tv_sec < 0 || t->tv_usec < 0 || t->tv_usec > 1000000) return -1; + + //atomic lock + uint64_t clock = aa64_now(); + bootTime += t->tv_sec - clock; + //atomic unlock + return 0; +} + +/* + * aa64_calculate_ticks -- calculate the number of ticks from given milliseconds + * @param seconds -- amount of seconds + * @param out_milliseconds -- where to store the number of ticks + */ +void aa64_calculate_ticks(uint64_t seconds, uint64_t subsec, uint64_t* out_seconds, uint64_t* out_subsec) { + if (bootTime == 0) { + *out_seconds = 0; + *out_subsec = 0; + return; + } + + uint64_t curr = AA64GetPhysicalTimerCount(); + uint64_t timer_ticks, timer_subticks; + updateTicks(curr / cpuFrequency, &timer_ticks, &timer_subticks); + if (subsec + timer_subticks >= SUBSECONDS_PER_SECOND) { + *out_seconds = timer_ticks + seconds + (subsec + timer_subticks) / SUBSECONDS_PER_SECOND; + *out_subsec = (subsec + timer_subticks) % SUBSECONDS_PER_SECOND; + } + else { + *out_seconds = timer_ticks + seconds; + *out_subsec = timer_subticks + subsec; + } +} /** * @brief AA64SleepUS -- sleep for sometimes * @param us -- microseconds to sleep @@ -243,13 +303,17 @@ void AA64CPUPostInitialize(KERNEL_BOOT_INFO* info) { suspendTimer(); GICInitialize(); AA64TimerSetup(); - + //PS/2 Enable - + uint32_t id = read_midr(); AA64CPUImplementer(id); AA64PCIeInitialize(); AuTextOut("[aurora]: cpu post initialized \r\n"); //AuPL031RTCInit(); //mask_irqs(); +} + +uint64_t AA64CPUGetFreqencyHz() { + return cpuFrequency; } \ No newline at end of file diff --git a/KernelAA64/Hal/aa64lowlevel.s b/KernelAA64/Hal/aa64lowlevel.s index a4beb56af..8f7b80710 100644 --- a/KernelAA64/Hal/aa64lowlevel.s +++ b/KernelAA64/Hal/aa64lowlevel.s @@ -39,6 +39,30 @@ store_x0_x7: str x7, [x0, #48] ret +.global store_x2_x7 +store_x2_x7: + stp x2, x3, [x0, #0] + stp x4, x5, [x0, #16] + stp x6, x7, [x0, #32] + + stp q0, q1, [x0, #64] + stp q2, q3, [x0, #96] + stp q4, q5, [x0, #128] + stp q6,q7, [x0, #160] + ret + +.global store_x3_x7 +store_x3_x7: + stp x3, x4, [x0, #0] + stp x5, x6, [x0, #16] + str x7, [x0, #32] + + stp q0, q1, [x0, #64] + stp q2, q3, [x0, #96] + stp q4, q5, [x0, #128] + stp q6, q7, [x0, #160] + ret + .global _getCurrentEL _getCurrentEL: mrs x0, CurrentEL @@ -235,7 +259,7 @@ mask_irqs: .global setupTimerIRQ setupTimerIRQ: mrs x0, CNTFRQ_EL0 //mrs x0, CTPCT_EL0 - mov x1, 1000 //mov x1,1000 + mov x1, 1000 //mov x1,1000 udiv x0, x0, x1 //add x0, x0, x1 msr CNTV_TVAL_EL0, x0 //msr CNTV_CVAL_EL0, x0 mov x0,1 @@ -248,6 +272,14 @@ suspendTimer: msr CNTV_CTL_EL0, x0 ret +.global resetTimer +resetTimer: + mrs x0, CNTFRQ_EL0 + mov x1, 1000 + udiv x0, x0, x1 + msr CNTV_TVAL_EL0,x0 + ret + .global readTimerCtl readTimerCtl: mrs x0,CNTV_CTL_EL0 @@ -493,3 +525,10 @@ aa64_clean_invalidate_dcache: dsb sy isb ret + +.global aa64_invalidate_icache +aa64_invalidate_icache: + ic ialluis + dsb ish + isb + ret diff --git a/KernelAA64/Hal/aa64switch.s b/KernelAA64/Hal/aa64switch.s index 1527e72b7..b2b8661d8 100644 --- a/KernelAA64/Hal/aa64switch.s +++ b/KernelAA64/Hal/aa64switch.s @@ -283,28 +283,29 @@ aa64_store_fp: str q0, [x0, #(0*16)] str q1, [x0, #(1*16)] str q2, [x0, #(2*16)] - str q4, [x0, #(3*16)] - str q5, [x0, #(4*16)] - str q6, [x0, #(5*16)] - str q7, [x0, #(6*16)] - str q8, [x0, #(7*16)] - str q9, [x0, #(8*16)] - str q10, [x0, #(9*16)] - str q11, [x0, #(10*16)] - str q12, [x0, #(11*16)] - str q13, [x0, #(12*16)] - str q14, [x0, #(13*16)] - str q15, [x0, #(14*16)] - str q16, [x0, #(15*16)] - str q17, [x0, #(16*16)] - str q18, [x0, #(17*16)] - str q19, [x0, #(18*16)] - str q20, [x0, #(19*16)] - str q21, [x0, #(20*16)] - str q22, [x0, #(21*16)] - str q23, [x0, #(22*16)] - str q24, [x0, #(23*16)] - str q25, [x0, #(24*16)] + str q3, [x0, #(3*16)] + str q4, [x0, #(4*16)] + str q5, [x0, #(5*16)] + str q6, [x0, #(6*16)] + str q7, [x0, #(7*16)] + str q8, [x0, #(8*16)] + str q9, [x0, #(9*16)] + str q10, [x0, #(10*16)] + str q11, [x0, #(11*16)] + str q12, [x0, #(12*16)] + str q13, [x0, #(13*16)] + str q14, [x0, #(14*16)] + str q15, [x0, #(15*16)] + str q16, [x0, #(16*16)] + str q17, [x0, #(17*16)] + str q18, [x0, #(18*16)] + str q19, [x0, #(19*16)] + str q20, [x0, #(20*16)] + str q21, [x0, #(21*16)] + str q22, [x0, #(22*16)] + str q23, [x0, #(23*16)] + str q24, [x0, #(24*16)] + str q25, [x0, #(25*16)] str q26, [x0, #(26*16)] str q27, [x0, #(27*16)] str q28, [x0, #(28*16)] @@ -354,4 +355,117 @@ aa64_restore_fp: ret +.global aa64_schedule_init +aa64_schedule_init: + stp x29, x30, [sp, #-208]! + stp x27, x28, [sp, #16] + stp x25, x26, [sp, #32] + stp x23, x24, [sp, #48] + stp x21, x22, [sp, #64] + stp x19, x20, [sp, #80] + stp x17, x18, [sp, #96] + stp x15, x16, [sp, #112] + stp x13, x14, [sp, #128] + stp x11, x12, [sp, #144] + stp x9, x10, [sp, #160] + stp x7, x8, [sp, #176] + stp x5, x6, [sp, #192] + str x4, [sp, #200] + + add x3, sp, #208 + mov x3, sp + bic x3, x3, #15 + str x3,[x0,#96] + + mrs x3,ELR_EL1 + str x3,[x0, #104] + mrs x3, spsr_el1 + str x3, [x0,#112] + + msr ttbr0_el1, x2 + //msr ttbr1_el1, x0 + isb sy + dsb ishst + tlbi vmalle1is + dsb ish + isb + + ldp x19,x20,[x1, #0] + ldp x21,x22,[x1,#16] + ldp x23,x24,[x1,#32] + ldp x25,x26,[x1,#48] + ldp x27, x28,[x1,#64] + ldp x29,x30, [x1,#80] + + ldr x2, [x1, #96] + /* directly load the original stack + * which is top of the stack + */ + bic x2, x2, #15 + mov sp, x2 + ldr x2,[x1,#104] + msr ELR_EL1,x2 + ldr x2, [x1,#112] + msr SPSR_EL1,x2 + + ldrb w2, [x1,#121] + cmp w2, #2 + b.ne _skip_comp_sn + ldrb w3, [x1,#206] + cmp w3, #1 + b.ne _skip_comp_sn + mov x30, 0 +_skip_comp_sn: + /* We must clear the IRQ bit from daifclr manually, + * because when exception is taken DAIF bits are masked */ + ldp x2,x3, [x1,#136] + ldp x4,x5, [x1,#152] + ldp x6,x7,[x1,#168] + ldr x8, [x1,#184] + // msr daifclr, #0x2 + isb + mov x0, 1 + ret + +.global aa64_restore_sp +aa64_restore_sp: + ldr x2, [x0,#96] + bic x2, x2, #15 + mov sp, x2 + + ldr x4, [sp, #200] + ldp x5, x6, [sp, #192] + ldp x7, x8, [sp, #176] + ldp x9, x10, [sp, #160] + ldp x11, x12, [sp, #144] + ldp x13, x14, [sp, #128] + ldp x15, x16, [sp, #112] + ldp x17, x18, [sp, #96] + ldp x19, x20, [sp, #80] + ldp x21, x22, [sp, #64] + ldp x23, x24, [sp, #48] + ldp x25, x26, [sp, #32] + ldp x27, x28, [sp, #16] + ldp x29, x30, [sp], #208 + mov x2, sp + bic x2, x2, #15 + str x2, [x0, #96] + + + ldr x2,[x0,#104] + msr ELR_EL1,x2 + ldr x2, [x0,#112] + msr SPSR_EL1,x2 + ret + +.global aa64_signal_return +aa64_signal_return: + mov x16, 24 + svc #0 + mov x0, x6 + ret + + + + \ No newline at end of file diff --git a/KernelAA64/Hal/basicacpi.c b/KernelAA64/Hal/basicacpi.c index 032586e49..d99383c56 100644 --- a/KernelAA64/Hal/basicacpi.c +++ b/KernelAA64/Hal/basicacpi.c @@ -5,6 +5,13 @@ #include #include #include +#include +#include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif AuroraBasicACPI* __AuroraBasicAcpi; diff --git a/KernelAA64/Hal/gic.c b/KernelAA64/Hal/gic.c index 295d45e00..44b3847dd 100644 --- a/KernelAA64/Hal/gic.c +++ b/KernelAA64/Hal/gic.c @@ -41,32 +41,34 @@ #include GIC __gic; -uint32_t* gic_regs; -uint32_t* gicc_regs; +volatile uint32_t* gic_regs; +volatile uint32_t* gicc_regs; typedef void (*irq_callback)(int spi); /** distributor registers */ -#define GICD(n) (n.gicDMMIO) +#define GICD(n) ((uint8_t*)(n.gicDMMIO)) #define GICD_CTLR 0x0000 #define GICD_TYPER 0x0004 #define GICD_IIDR 0x0008 #define GICD_TYPER2 0x000C -#define GICD_PIDR2 0xFFE8 -#define GICD_PIDR2_ARCHREV(x) (((x) >> 4) & 0xF) +#define GICD_PIDR2 0xFFE8 +#define GICD_PIDR2_ARCHREV(x) (((x) >> 4) & 0xF) #define GIC_VERSION_1 0x1 #define GIC_VERSION_2 0x2 #define GIC_VERSION_3 0x3 #define GIC_VERSION_4 0x4 -#define GICD_ISENABLER(n) (*(volatile uint32_t*)(GICD(__gic) + 0x100 + 4*(n))) + +// All of these macros will now automatically calculate the exact correct byte offsets! +#define GICD_ISENABLER(n) (*(volatile uint32_t*)(GICD(__gic) + 0x100 + 4*(n))) #define GICD_IPRIORITYR(n) (0x400 + (n)) -#define GICD_IGROUPR(n) (*(volatile uint32_t*)(GICD(__gic) + 0x080 + 4*(n))) -#define GICD_ICENABLE(n) (*(volatile uint32_t*)(GICD(__gic) + 0x180 + (n*4))) -#define GICD_ICFGR(n) (*(volatile uint32_t*)(GICD(__gic) + 0x0C00 + (n*4))) -#define GICD_ITARGETSR(n) (*(volatile uint32_t*)(GICD(__gic) + 0x0800 + (n*4))) -#define GICD_IROUTER(n) (0x6000 + 8*(n)) -#define GICD_ICPENDR(n) (0x280 + (n/32)*4) -#define ISPENDING0 0x200 +#define GICD_IGROUPR(n) (*(volatile uint32_t*)(GICD(__gic) + 0x080 + 4*(n))) +#define GICD_ICENABLE(n) (*(volatile uint32_t*)(GICD(__gic) + 0x180 + (n*4))) +#define GICD_ICFGR(n) (*(volatile uint32_t*)(GICD(__gic) + 0x0C00 + (n*4))) +#define GICD_ITARGETSR(n) (*(volatile uint32_t*)(GICD(__gic) + 0x0800 + (n*4))) +#define GICD_IROUTER(n) (0x6000 + 8*(n)) +#define GICD_ICPENDR(n) (0x280 + (n/32)*4) +#define ISPENDING0 0x200 /** cpu registers offsets */ @@ -423,16 +425,16 @@ void GICInitialize() { /* writing 0xff means accepting all types of priority 0x0 -- 0xFF */ if (_need_cpu_interface) { gic_outl_((uint64_t*)__gic.gicCMMIO, GICC_PMR, 0x1ff); - gic_outl_(__gic.gicCMMIO, GICC_CTLR, 0x3); + gic_outl_((uint64_t*)__gic.gicCMMIO, GICC_CTLR, 0x3); isb_flush(); } /* enable the distributor interface */ if (__gic.version >= GIC_VERSION_3) { - gic_outl_(__gic.gicDMMIO, GICD_CTLR, (1u << 5) | (1u << 1)); + gic_outl_((uint64_t*)__gic.gicDMMIO, GICD_CTLR, (1u << 5) | (1u << 1)); } else { - gic_outl_(__gic.gicDMMIO, GICD_CTLR, 0x3); + gic_outl_((uint64_t*)__gic.gicDMMIO, GICD_CTLR, 0x3); isb_flush(); } @@ -451,17 +453,17 @@ void GICInitialize() { void GICREnablePPI(uint32_t cpu, uint32_t intid) { size_t sgi = GICR(__gic) + (cpu * GICR_STRIDE) + GICR_SGI_BASE; - gic_outl_(sgi, 0x100, (1u << intid)); + gic_outl_((uint64_t*)sgi, 0x100, (1u << intid)); } void GICRSetPPIPriority(uint32_t cpu, uint32_t intid, uint8_t prio) { size_t sgi = GICR(__gic) + (cpu * GICR_STRIDE) + GICR_SGI_BASE; uint32_t reg = intid / 4; uint32_t shift = (intid % 4) * 8; - uint32_t val = gic_inl_(sgi, 0x400 + reg * 4); + uint32_t val = gic_inl_((uint64_t*)sgi, 0x400 + reg * 4); val &= ~(0xFFu << shift); val |= ((uint32_t)prio << shift); - gic_outl_(sgi, 0x400 + reg * 4, val); + gic_outl_((uint64_t*)sgi, 0x400 + reg * 4, val); } /** @briefGICEnableIRQ -- enable an IRQ @@ -553,7 +555,7 @@ void GICEnableSPIIRQ(uint32_t irq) { if (__gic.version >= GIC_VERSION_3) { /** route it to cpu0 **/ - gic_outqw(GICD(__gic), 0x6000 + irq * 8, 0ULL); + gic_outqw((uint64_t*)GICD(__gic), 0x6000 + irq * 8, 0ULL); } *(volatile uint8_t*)(GICD(__gic) + GICD_IPRIORITYR(irq)) = 0x80; @@ -670,14 +672,14 @@ void GICCallSPIHandler(int spi) { * @brief GICDisable -- disable the GIC */ void GICDisable() { - gic_outl_(__gic.gicDMMIO, GICD_CTLR, 0); + gic_outl_((uint64_t*)__gic.gicDMMIO, GICD_CTLR, 0); dsb_sy_barrier(); isb_flush(); if (__gic.version < GIC_VERSION_3) { - gic_outl_(__gic.gicCMMIO, GICC_CTLR, 0); - gic_outl_(__gic.gicCMMIO, GICC_PMR, 0xFF); + gic_outl_((uint64_t*)__gic.gicCMMIO, GICC_CTLR, 0); + gic_outl_((uint64_t*)__gic.gicCMMIO, GICC_PMR, 0xFF); dsb_sy_barrier(); isb_flush(); UARTDebugOut("[aurora]: GIC version 2 disabling \r\n"); diff --git a/KernelAA64/Hal/sched.c b/KernelAA64/Hal/sched.c index 08207dc09..c921f632b 100644 --- a/KernelAA64/Hal/sched.c +++ b/KernelAA64/Hal/sched.c @@ -43,10 +43,14 @@ #include #include #include +#include +#include extern void aa64_store_context(AA64Thread* thr); extern void store_syscall(AA64Thread* thr); extern bool aa64_restore_context(AA64Thread* thr); +extern void aa64_restore_sp(AA64Thread* thr); +extern void aa64_schedule_init(AA64Thread* current, AA64Thread* init, uint64_t va); extern void ret_from_syscall(AA64Thread* thr); extern void first_time_sex(AA64Thread* thr); @@ -67,6 +71,7 @@ AA64Thread* _idle_thr; uint64_t thread_id; bool _scheduler_initialized; uint64_t scheduler_tick; +static uint64_t _global_idle_time; /** * @brief AuThreadInsert -- insert a thread into thread list @@ -254,28 +259,10 @@ void AuThreadDeleteSleep(AA64Thread* thread) { void AA64NextThread() { AA64Thread* thread = current_thread; - bool _run_idle = false; -run: - do { - thread = thread->next; - - if (!thread) { - thread = thread_list_head; - } - - if (thread == _idle_thr) { - thread = thread->next; - } - if (!thread) { - _run_idle = true; - break; - } - } while (thread->state != THREAD_STATE_READY); -end: - if (_run_idle) + thread = thread->next; + if (!thread) thread = _idle_thr; - current_thread = thread; } @@ -306,10 +293,12 @@ AA64Thread* AuCreateKthread(void(*entry) (uint64_t),uint64_t* pml, char* name){ t->thread_id = thread_id++; t->fpsr = 0; t->fpcr = 0; + AuSignalInitializeTrampoline(t); AuThreadInsert(t); return t; } + /** * @brief AuCreateSubKthread -- create sub kernel thread of parent * kthread @@ -335,6 +324,7 @@ AA64Thread* AuCreateSubKthread(void(*entry) (uint64_t),uint64_t stack, uint64_t* t->thread_id = thread_id++; t->fpsr = 0; t->fpcr = 0; + //AuSignalInitializeTrampoline(t); AuThreadInsert(t); return t; } @@ -350,24 +340,21 @@ void AuIdleThread(uint64_t ctx) { mask_irqs(); UARTDebugOut("Idle thread running \r\n"); AuTextOut("Starting up Xeneva please wait...\r\n"); - //uint64_t sp = read_sp(); - //UARTDebugOut("SP : %x \r\n", sp); - UARTDebugOut("Current sp sel : %d \r\n", read_spsel()); - uint64_t el = _getCurrentEL(); - UARTDebugOut("IDLE CurrentEl : %d \n", el); + _idle_thr->start_time_us = AuGetCurrentUS(); enable_irqs(); while (1) { enable_irqs(); - // - //UARTDebugOut("IDLE \r\n"); + _wfi(); } } extern void resume_user(AA64Thread* thr,void* ksp); + + void AuResumeUserThread() { AA64Thread* thr = current_thread; thr->x30 = thr->elr_el1; - resume_user(thr, thr->sp); + resume_user(thr, (void*)thr->sp); //aa64_enter_user(thr->sp, thr->elr_el1); while (1) {} } @@ -389,7 +376,8 @@ void AuHandleSleepThreads() { sleep_thr->sleepQuanta--; if (sleep_thr->sleepQuanta == 0){ //settimerdebug(); - sleep_thr->state = THREAD_STATE_READY; + if (sleep_thr->state != THREAD_STATE_LEFT_IN_KERNEL) + sleep_thr->state = THREAD_STATE_READY; AuThreadDeleteSleep(sleep_thr); AuThreadInsert(sleep_thr); } @@ -414,9 +402,9 @@ void AuThreadSafeReturn(uint64_t rcx) { while (1) {} } -extern void AuPrintStack(uint64_t st) { - UARTDebugOut("storing sp : %x \r\n", st); -} + + + /** * @brief AuScheduleThread -- the core of multi-tasking. It schedules * threads next to be runned @@ -429,51 +417,70 @@ void AuScheduleThread(AA64Registers* regs) { } AA64Thread* runThr = current_thread; - //if (runThr->returnFromSyscall) { - // UARTDebugOut("System call interrupted for thread : %s %d\r\n", runThr->name, runThr->syscallNum); - // store_syscall(runThr); - // goto sched; - //} - //else { - aa64_store_context(runThr); - runThr->sp = (uint64_t)regs; - //} + aa64_store_context(runThr); + runThr->sp = (uint64_t)regs; + sched: - //AuTextOut("Schedule thread upto here sp: %x \r\n", regs->EL0SP); - aa64_store_fp(&runThr->fp_regs, &runThr->fpcr, &runThr->fpsr); + aa64_store_fp(&runThr->fp_regs,(uint64_t*)&runThr->fpcr, (uint64_t*)&runThr->fpsr); - //AuTextOut("Stored fp \r\n"); if (regs) { runThr->x0 = regs->x0; runThr->x1 = regs->x1; runThr->x30 = regs->x30; runThr->x29 = regs->x29; } - //AuTextOut("Registered stored \r\n"); + + uint64_t now = AuGetCurrentUS(); + uint64_t delta = now - runThr->start_time_us; + + if (runThr->procSlot != NULL) { + AuProcess* proc = (AuProcess*)runThr->procSlot; + proc->total_runtime_us += delta; + proc->window_runtime_us += delta; + } + else { + _global_idle_time += delta; + } + + /** change thread's running state to ready state */ + if (runThr->state == THREAD_STATE_RUNNING) + runThr->state = THREAD_STATE_READY; + scheduler_tick++; AuHandleSleepThreads(); AA64NextThread(); + + current_thread->start_time_us = now; + + /* mark this thread as running */ + if (current_thread->state == THREAD_STATE_READY) + current_thread->state = THREAD_STATE_RUNNING; + write_both_ttbr(V2P(current_thread->pml)); + + //tlb_flush_vmalle1is(); - aa64_restore_fp(¤t_thread->fp_regs, ¤t_thread->fpcr, ¤t_thread->fpsr); + aa64_restore_fp(¤t_thread->fp_regs, (uint64_t*)¤t_thread->fpcr, (uint64_t*)¤t_thread->fpsr); dsb_sy_barrier(); - uint64_t sp = read_sp(); - /*UARTDebugOut("Scheduler sp : %x \r\n", sp);*/ - /*if (debug) { - UARTDebugOut("next thread : %s \r\n", current_thread->name); - }*/ - /*if (current_thread->returnFromSyscall) { - current_thread->justStored = 0; - ret_from_syscall(current_thread); - goto ret; - }*/ + + /** check if the thread was left somewhere in kernel space **/ + if (current_thread->state == THREAD_STATE_LEFT_IN_KERNEL) { + current_thread->state = THREAD_STATE_READY; + aa64_restore_sp(current_thread); + /* should not reach here */ + for (;;); + } + + + AuSignalDeliver(current_thread); + if ((current_thread->threadType & THREAD_LEVEL_USER) && current_thread->first_run == 1) { uint64_t sp = current_thread->sp; //current_thread->sp = current_thread->originalKSp; - resume_user(current_thread,sp); + resume_user(current_thread,(void*)sp); } @@ -486,6 +493,21 @@ void AuScheduleThread(AA64Registers* regs) { return; } +/** + * @brief AuScheduleNext -- forcefully schedule + * to idle thread + */ +void AuScheduleNext() { + if (_scheduler_initialized == 0) + return; + + current_thread->state = THREAD_STATE_LEFT_IN_KERNEL; + AA64Thread* storeThr = current_thread; + aa64_store_fp(&storeThr->fp_regs, &storeThr->fpcr, &storeThr->fpsr); + current_thread = _idle_thr; + aa64_schedule_init(storeThr, current_thread, V2P(current_thread->pml)); +} + static int ke_stack_idx; /** @@ -496,12 +518,11 @@ static int ke_stack_idx; */ uint64_t AuCreateKernelStack(uint64_t* pml) { uint64_t location = KERNEL_STACK_LOCATION; - location += ke_stack_idx * KERNEL_STACK_SIZE; - UARTDebugOut("Creating kernel stack : %x %d\r\n", location, ke_stack_idx); + location += (uint64_t)ke_stack_idx * KERNEL_STACK_SIZE; for (int i = 0; i < (KERNEL_STACK_SIZE) / 0x1000; i++) { uint64_t addr = (uint64_t)P2V((uint64_t)AuPmmngrAlloc()); - memset(addr, 0, PAGE_SIZE); - AuMapPage(V2P(addr), (location + i * 4096), PTE_AP_RW | PTE_NORMAL_MEM); + memset((void*)addr, 0, PAGE_SIZE); + AuMapPage(V2P(addr), (location + (uint64_t)i * 4096), PTE_AP_RW | PTE_NORMAL_MEM); } ke_stack_idx += 2; return (location + KERNEL_STACK_SIZE); @@ -516,10 +537,9 @@ uint64_t AuCreateKernelStack(uint64_t* pml) { uint64_t AuCreateSubKernelStack(AuProcess* proc, uint64_t* pml) { uint64_t location = KERNEL_STACK_LOCATION; location += proc->_kstack_index_ * KERNEL_STACK_SIZE; - UARTDebugOut("Creating Sub kernel stack : %d, %x \r\n", proc->_kstack_index_, location); for (int i = 0; i < (KERNEL_STACK_SIZE) / 0x1000; i++) { uint64_t addr = (uint64_t)P2V((uint64_t)AuPmmngrAlloc()); - memset(addr, 0, PAGE_SIZE); + memset((void*)addr, 0, PAGE_SIZE); AuMapPage(V2P(addr), (location + i * 4096), PTE_AP_RW | PTE_NORMAL_MEM); } @@ -556,7 +576,7 @@ void AuSchedulerStart() { #endif tlb_flush_vmalle1is(); write_both_ttbr(V2P(idle->pml)); - aa64_restore_fp(&idle->fp_regs, &idle->fpcr, &idle->fpsr); + aa64_restore_fp(&idle->fp_regs, (uint64_t*)&idle->fpcr,(uint64_t*)&idle->fpsr); suspendTimer(); setupTimerIRQ(); first_time_sex(idle); @@ -575,8 +595,7 @@ AA64Thread* AuGetCurrentThread() { * to switch next thread */ void AuForceScheduler() { - AuScheduleThread(NULL); -// UARTDebugOut("Back to force scheduler \n"); + AuScheduleNext(); } /** @@ -595,7 +614,8 @@ void AuBlockThread(AA64Thread* thread) { * @param t -- pointer to thread */ void AuUnblockThread(AA64Thread* thread) { - thread->state = THREAD_STATE_READY; + if (thread->state != THREAD_STATE_LEFT_IN_KERNEL) + thread->state = THREAD_STATE_READY; bool found_ = false; AA64Thread* thr = NULL; for (thr = blocked_thr_head; thr != NULL; thr = thr->next) { @@ -616,13 +636,27 @@ void AuUnblockThread(AA64Thread* thread) { * @param thread -- Pointer to AA64 Thread */ void AuSleepThread(AA64Thread* thread, uint64_t ms) { - //UARTDebugOut("Inserting thread to sleep list : %s \n", thread->name); thread->state = THREAD_STATE_SLEEP; thread->sleepQuanta = ms; AuThreadDelete(thread); AuThreadInsertSleep(thread); } +/** + * @brief AuThreadMakeReady -- make a thread forcefully + * ready for next + * @param thread -- pointer to thread struct + */ +void AuThreadMakeReady(AA64Thread* thread) { + if (thread->state == THREAD_STATE_SLEEP) { + thread->sleepQuanta = 0; + AuThreadDeleteSleep(thread); + AuThreadInsert(thread); + thread->state = THREAD_STATE_READY; + } + else if (thread->state == THREAD_STATE_BLOCKED) + AuUnblockThread(thread); +} /** * @brief AuThreadFindByID -- finds a thread by its id from * ready queue @@ -704,4 +738,5 @@ uint64_t AuGetSystemTimerTick() { */ void AuSetIdleThread(AA64Thread* thr) { _idle_thr = thr; -} \ No newline at end of file +} + diff --git a/KernelAA64/Hal/systable.c b/KernelAA64/Hal/systable.c index 2bc5288f9..fe926f042 100644 --- a/KernelAA64/Hal/systable.c +++ b/KernelAA64/Hal/systable.c @@ -52,7 +52,7 @@ #include #include -#define AURORA_MAX_SYSCALL 72 +#define AURORA_MAX_SYSCALL 79 AA64Registers* svcCurrentRegs; @@ -104,8 +104,8 @@ static void* syscalls[AURORA_MAX_SYSCALL] = { FileIoControl, //21 FileStat, //22 ProcessSleep, //23 - 0, //24 - 0, //25 + SignalReturn, //24 + SetSignal, //25 AuGetSystemTimerTick, //26 AuFTMngrGetFontID, //27 AuFTMngrGetNumFonts, //28 @@ -115,7 +115,7 @@ static void* syscalls[AURORA_MAX_SYSCALL] = { CreateUserThread, //32 SetFileToProcess, //33 ProcessHeapUnmap, //34 - 0, //35 + SendSignal, //35 0, //36 OpenDir, //37 ReadDir, //38 @@ -152,6 +152,13 @@ static void* syscalls[AURORA_MAX_SYSCALL] = { AuPowerReset, //69 AuGetCurrentUS, //70 AuGetCurrentMS, //71 + Alarm, //72 + SetITimer, //73 + GetITimer, //74 + AuProcGetNumProcessCount, //75 + AuProcessFetch, //76 + AuSetWalltime, //77 + AuGetWalltime, //78 }; #ifdef __KERNEL_PROFILER_ON__ @@ -228,6 +235,9 @@ static char* syscall_name[AURORA_MAX_SYSCALL] = { "AuPowerReset", //69 "AuGetCurrentUS", //70 "AuGetCurrentMS", //71 + "Alarm", //72 + "AuProcGetNumProcessCount", //75 + "AuProcessFetch", //76 }; #endif @@ -270,7 +280,7 @@ void AuAA64SyscallHandler(AA64Registers* regs) { PROFILE_END(syscall_name[vector]); skip_2: #endif - return 0; + return ; } retcode = func(regs->x0, regs->x1, regs->x2, regs->x3, regs->x4, regs->x5); @@ -284,6 +294,5 @@ void AuAA64SyscallHandler(AA64Registers* regs) { PROFILE_END(syscall_name[vector]); skip_3: #endif - return 0; - + return; } \ No newline at end of file diff --git a/KernelAA64/Hal/vector.c b/KernelAA64/Hal/vector.c index 4dcf641f3..709021660 100644 --- a/KernelAA64/Hal/vector.c +++ b/KernelAA64/Hal/vector.c @@ -116,7 +116,7 @@ void sync_el1_handler(AA64Registers *regs) { // AuTextOut("SP_EL0 : %x \r\n", regs->EL0SP); UARTDebugOut("Current SPSel : %d \r\n", read_spsel()); UARTDebugOut("EC class : %x \r\n", ec); - for (;;); + /** check if the fault occured on drivers **/ AuDriver* drv = AuDrvManagerCheckFault(read_elr_el1()); if (drv) { @@ -161,23 +161,23 @@ void sync_el1_handler(AA64Registers *regs) { dfsc = esr & 0x3F; - /* switch (dfsc) { - case 0b000000: AuTextOut("Address size, fault level 0 \r\n"); break; - case 0b000001: AuTextOut("Address Size, fault level 1 \r\n"); break; - case 0b000010: AuTextOut("Address size, fault level 2 \r\n"); break; - case 0b000011: AuTextOut("Address size, fault level 3 \r\n"); break; - case 0b000100: AuTextOut("translation, fault level 0 \r\n"); break; - case 0b000101: AuTextOut("translation, fault level 1 \r\n"); break; - case 0b000110: AuTextOut("translation, fault level 2 \r\n"); break; - case 0b000111: AuTextOut("translation, fault level 3 \r\n"); break; - case 0b001001: AuTextOut("access flag, fault level 1 \r\n"); break; - case 0b001010: AuTextOut("access flag, fault level 2 \r\n"); break; - case 0b001011: AuTextOut("access flag, fault level 3 \r\n"); break; - case 0b001101: AuTextOut("permission fault, level 1 \r\n"); break; - case 0b001110: AuTextOut("permission fault, level 2 \r\n"); break; - case 0b001111: AuTextOut("permission fault, level 3 \r\n"); break; - default: AuTextOut("Unknown fault code \r\n"); break; - }*/ + switch (dfsc) { + case 0b000000: UARTDebugOut("Address size, fault level 0 \r\n"); break; + case 0b000001: UARTDebugOut("Address Size, fault level 1 \r\n"); break; + case 0b000010: UARTDebugOut("Address size, fault level 2 \r\n"); break; + case 0b000011: UARTDebugOut("Address size, fault level 3 \r\n"); break; + case 0b000100: UARTDebugOut("translation, fault level 0 \r\n"); break; + case 0b000101: UARTDebugOut("translation, fault level 1 \r\n"); break; + case 0b000110: UARTDebugOut("translation, fault level 2 \r\n"); break; + case 0b000111: UARTDebugOut("translation, fault level 3 \r\n"); break; + case 0b001001: UARTDebugOut("access flag, fault level 1 \r\n"); break; + case 0b001010: UARTDebugOut("access flag, fault level 2 \r\n"); break; + case 0b001011: UARTDebugOut("access flag, fault level 3 \r\n"); break; + case 0b001101: UARTDebugOut("permission fault, level 1 \r\n"); break; + case 0b001110: UARTDebugOut("permission fault, level 2 \r\n"); break; + case 0b001111: UARTDebugOut("permission fault, level 3 \r\n"); break; + default: UARTDebugOut("Unknown fault code \r\n"); break; + } while (1) {} } @@ -199,14 +199,14 @@ void irq_el1_handler(AA64Registers* regs) { uint32_t irq = iar & 0x3FF; if (irq < 1020) { if (irq == 27) { - suspendTimer(); //<--- suspecting this line - setupTimerIRQ(); + //suspendTimer(); //<--- suspecting this line + resetTimer(); + // setupTimerIRQ(); GICSendEOI(iar); GICCheckPending(irq); /** handle expired timers **/ AuroraTimerTick(); - AuScheduleThread(regs); } /*else if (irq == 27) { @@ -284,5 +284,5 @@ void sync_el0_handler(AA64Registers* regs) { extern char vectors[]; void AA64InitializeVectorTable() { - set_vbar_el1(&vectors); + set_vbar_el1((uint64_t)&vectors); } \ No newline at end of file diff --git a/KernelAA64/Ipc/postbox.c b/KernelAA64/Ipc/postbox.c index 8f910f539..59d693616 100644 --- a/KernelAA64/Ipc/postbox.c +++ b/KernelAA64/Ipc/postbox.c @@ -42,6 +42,11 @@ #include #include #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif /** * @brief @@ -331,7 +336,6 @@ void AuIPCPostBoxInitialise() { node2->iocontrol = PostBoxIOControl; dsb_sy_barrier(); AuDevFSAddFile(dev, "/", node2); - AuDevFSList(dev); //aa64_data_cache_clean_range(node, sizeof(AuVFSNode)); pbox = node2; diff --git a/KernelAA64/KernelAA64.lib b/KernelAA64/KernelAA64.lib new file mode 100644 index 000000000..7f79ec09d Binary files /dev/null and b/KernelAA64/KernelAA64.lib differ diff --git a/KernelAA64/KernelAA64.vcxproj b/KernelAA64/KernelAA64.vcxproj index ec4b64b58..2c004724a 100644 --- a/KernelAA64/KernelAA64.vcxproj +++ b/KernelAA64/KernelAA64.vcxproj @@ -70,7 +70,7 @@ Application false v142 - true + false Unicode @@ -116,6 +116,8 @@ false + xnkrnl + false @@ -161,9 +163,9 @@ Level1 true - ARCH_ARM64;__TARGET_BOARD_QEMU_VIRT__;_USE_DLMALLOC;__STDC_LIMIT_MACROS;%(PreprocessorDefinitions) + ARCH_ARM64;__TARGET_BOARD_QEMU_VIRT__;_USE_DLMALLOC;__STDC_LIMIT_MACROS Default - ..\BaseHdr;..\Acpica\include;..\Acpica;%(AdditionalIncludeDirectories) + ..\BaseHdr;..\Acpica\include;..\Acpica;$(SolutionDir)DCL\includes;%(AdditionalIncludeDirectories) EditAndContinue true true @@ -175,6 +177,8 @@ StreamingSIMDExtensions2 false AssemblyAndSourceCode + stdc17 + /Kernel %(AdditionalOptions) Native @@ -199,7 +203,7 @@ /def:exports.def %(AdditionalOptions) - copy "$(SolutionDir)Build\EFI\XENEVA\$(TargetName).exe" "M:\EFI\XENEVA\$(TargetName).exe" + copy "$(SolutionDir)Build\EFI\XENEVA\$(TargetName).exe" "F:\EFI\XENEVA\$(TargetName).exe" @@ -220,26 +224,57 @@ - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + Level2 + + + false + false + ARCH_ARM64;__TARGET_BOARD_IMX8MP_VERDIN_DAHLIA__;_USE_DLMALLOC;__STDC_LIMIT_MACROS true + ..\BaseHdr;..\Acpica\include;..\Acpica;$(SolutionDir)DCL\includes;%(AdditionalIncludeDirectories) + EditAndContinue + true + false + + StreamingSIMDExtensions2 + stdc11 + false + /Oi- /QIfist /Kernel /Os %(AdditionalOptions) + Full - Console + Native true true - true + false + ..\Build\EFI\XENEVA\xnkrnl.exe + true + true + true + Driver + /def:exports.def %(AdditionalOptions) + _AuMain + 0xFFFFC00000000000 + + + false + + false + + true + + copy "$(SolutionDir)Build\EFI\XENEVA\$(TargetName).exe" "F:\EFI\XENEVA\$(TargetName).exe" + + + @@ -252,10 +287,13 @@ + + + @@ -264,6 +302,7 @@ + @@ -287,6 +326,8 @@ + + @@ -306,6 +347,7 @@ + @@ -314,6 +356,7 @@ + @@ -327,6 +370,10 @@ Document clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" $(IntDir)%(Filename).obj + clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj + false + true @@ -336,6 +383,10 @@ Document clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" $(IntDir)%(Filename).obj + clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj + false + true @@ -343,14 +394,21 @@ + + + + + + + @@ -373,11 +431,16 @@ + + + + + false @@ -391,6 +454,10 @@ Document clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" $(IntDir)%(Filename).obj + clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj + false + true @@ -399,6 +466,10 @@ Document clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" $(IntDir)%(Filename).obj + clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj + false + true @@ -407,6 +478,10 @@ Document clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" $(IntDir)%(Filename).obj + false + true + clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj diff --git a/KernelAA64/KernelAA64.vcxproj.filters b/KernelAA64/KernelAA64.vcxproj.filters index 63c843f9b..af61648e9 100644 --- a/KernelAA64/KernelAA64.vcxproj.filters +++ b/KernelAA64/KernelAA64.vcxproj.filters @@ -207,6 +207,34 @@ Fs + + Fs\Ext2 + + + Net + + + + Board\imx8mp + + + Board\imx8mp + + + Cap + + + Log + + + Log + + + Drivers + + + Drivers + @@ -290,6 +318,18 @@ {ca328030-92be-464f-86c9-47904d473330} + + {9e3c015e-2730-4f5a-b260-96fd6a826e4d} + + + {ff284144-c4ef-46a6-8a98-d6967d078115} + + + {7e4e816a-cb9c-4b76-946f-97145714be4a} + + + {a7372d49-db94-4f19-9769-96146f023dd9} + @@ -433,6 +473,42 @@ Include + + Include\Hal + + + Include\Board\imx8mp + + + Include + + + Include\Board\imx8mp + + + Include\Board\imx8mp + + + Include\Board\imx8mp + + + Include + + + Include + + + Include\Log + + + Include\Log + + + Include\Drivers + + + Include\Drivers + diff --git a/KernelAA64/Log/_print.c b/KernelAA64/Log/_print.c new file mode 100644 index 000000000..5293cea44 --- /dev/null +++ b/KernelAA64/Log/_print.c @@ -0,0 +1,897 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ +#include +#include +#include +#include +#include <_null.h> +#include + +#define MAX_STRING_LENGTH 4095 + +#define max(a, b) ((a) > (b) ? (a) : (b)) +#define min(a, b) ((a) < (b) ? (a) : (b)) + +static double floor(double d) { + int i = (int)d; + return ((float)i); +} + +static double pow(double x, double y) { + int count; + + if ((x < 0) && (floor(y) != y)) + return 0; + + if (!y) + x = 1; + else + for (count = 1; count < y; count++) + x *= x; + + return x; +} +static int _ldigits(unsigned long long num, int base, int sign) { + int digits = 1; + if (base < 2) { + return (digits = -1); + } + + if (sign && ((long long)num < 0)) { + num = ((long long)num * -1); + digits += 1; + } + + while (num >= (unsigned long long)base) { + digits += 1; + num /= (unsigned long long)base; + } + + return (digits); +} + +static int _digits(unsigned num, int base, int sign) { + int digits = 1; + if (base < 2) + return (digits = -1); + + if (sign && ((int)num < 0)) { + num = ((int)num * -1); + digits += 1; + } + + while (num >= (unsigned)base) { + digits += 1; + num /= (unsigned)base; + } + + return digits; +} + +static unsigned long long _str2num(const char* string, unsigned base, int sign, int* consumed) { + unsigned long long result = 0; + int64_t length = 0; + int64_t negative = 0; + int64_t count = 0; + + if (!string) { + return 0; + } + + length = strlen(string); + + while ((count < length) && isspace(string[count])) + count += 1; + + if (count >= length) + goto out; + + if ((string[count] == '+') || (string[count] == '-')) + { + if (sign && (string[count] == '-')) + negative = 1; + count += 1; + } + + if (count >= length) { + goto out; + } + + if ((count < (length - 1)) && (!base || (base == 16))) { + if ((string[count] == '0') && (string[count + 1] == 'x')) { + base = 16; + count += 2; + } + } + + if (count >= length) { + goto out; + } + + if (!base) { + if (string[count] == '0') { + base = 8; + count += 1; + } + else { + base = 10; + } + + } + + if (count >= length) + goto out; + + while (count < length) { + switch (base) { + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + if (!isdigit(string[count]) || + ((string[count] - '0') >= (int)base)) { + goto out; + } + result *= base; + result += (string[count] - '0'); + break; + + case 16: + if (!isxdigit(string[count])) + goto out; + result *= base; + if ((string[count] >= '0') && (string[count] <= '9')) + result += (string[count] - '0'); + else if ((string[count] >= 'a') && (string[count] <= 'f')) + result += ((string[count] - 'a') + 10); + else + result += ((string[count] - 'A') + 10); + break; + + default: + goto out; + } + count += 1; + } + +out: + if (negative) + result = ((long long)result * -1); + + if (consumed) + *consumed = count; + + return result; +} + +static void _lnum2str(unsigned long long num, char* string, int base, int sign) +{ + int digits = _ldigits(num, base, sign); + int charCount = 0; + unsigned long long place = 1; + unsigned long long rem = 0; + int count; + + if (!string) + { + return; + } + + // Negative? + if (sign && ((long long)num < 0)) + { + string[charCount++] = '-'; + num = ((long long)num * -1); + digits -= 1; + } + + for (count = 0; count < (digits - 1); count++) + place *= (unsigned long long) base; + + while (place) + { + rem = (num % place); + num = (num / place); + + if (num < 10) + string[charCount++] = ('0' + num); + else + string[charCount++] = ('a' + (num - 10)); + num = rem; + place /= (unsigned long long) base; + } + + string[charCount] = '\0'; + + // Done + return; +} + + + +static void _dbl2str(double num, char* string, int roundPlaces) +{ + int charCount = 0; + unsigned long long* u = NULL; + int sign = 0; + long long exponent = 0; + unsigned long long intPart = 0; + unsigned long long fractPart = 0; + unsigned long long place = 0; + unsigned long long outputFraction = 0; + unsigned long long rem = 0; + unsigned long long count; + + if (!string) + { + return; + } + + string[0] = '\0'; + + u = (unsigned long long*) & num; + sign = (int)(*u >> 63); + exponent = (((*u & (0x7FFULL << 52)) >> 52) - 1023); + intPart = 1; + fractPart = ((*u & 0x000FFFFFFFFFFFFFULL) << 12); + + // Output the sign, if any + if (sign) + string[charCount++] = '-'; + + // Special case exponents + if (exponent == 0x7FF) + { + strcat((string + charCount), "Infinity"); + return; + } + + while (exponent) + { + if (exponent > 0) + { + intPart <<= 1; + if (fractPart & (0x1ULL << 63)) + intPart |= 1; + fractPart <<= 1; + exponent -= 1; + } + else + { + fractPart >>= 1; + if (intPart & 0x1ULL) + fractPart |= (0x1ULL << 63); + intPart >>= 1; + exponent += 1; + } + } + + // Output the whole number part + _lnum2str(intPart, (string + charCount), 10, 0); + charCount = strlen(string); + + string[charCount++] = '.'; + + // Calculate the fraction part + place = 10000000000000000000ULL; + for (count = 2; fractPart; count *= 2) + { + if (!count) + break; + + if (fractPart & (0x1ULL << 63)) + outputFraction += (place / count); + + fractPart <<= 1; + } + + // Output the fraction part + place = 1000000000000000000ULL; + while (place) + { + rem = (outputFraction % place); + outputFraction = (outputFraction / place); + + if (roundPlaces) + { + string[charCount++] = ('0' + outputFraction); + roundPlaces -= 1; + } + else + { + if ((string[charCount - 1] < '9') && (outputFraction > 4)) + string[charCount - 1] += 1; + break; + } + + outputFraction = rem; + place /= 10; + } + + string[charCount] = '\0'; + return; +} + +static void _num2str(unsigned num, char* string, int base, int sign) +{ + int digits = _digits(num, base, sign); + int charCount = 0; + unsigned place = 1; + unsigned rem = 0; + int count; + + if (!string) + return; + + // Negative? + if (sign && ((int)num < 0)) + { + string[charCount++] = '-'; + num = ((int)num * -1); + digits -= 1; + } + + for (count = 0; count < (digits - 1); count++) + place *= (unsigned)base; + + while (place) + { + rem = (num % place); + num = (num / place); + + if (num < 10) + string[charCount++] = ('0' + num); + else + string[charCount++] = ('a' + (num - 10)); + num = rem; + place /= (unsigned)base; + } + + string[charCount] = '\0'; + + //errno = 0; +} + +static void _flt2str(float num, char* string, int roundPlaces) +{ + int charCount = 0; + unsigned* u = NULL; + int sign = 0; + int exponent = 0; + unsigned intPart = 0; + unsigned fractPart = 0; + unsigned place = 0; + unsigned outputFraction = 0; + unsigned rem = 0; + unsigned count; + + if (!string) + { + return; + } + + string[0] = '\0'; + + u = (unsigned*)# + sign = (*u >> 31); + exponent = (((*u & 0x7F800000) >> 23) - 127); + intPart = 1; + fractPart = ((*u & 0x007FFFFF) << 9); + + // Output the sign, if any + if (sign) + string[charCount++] = '-'; + + // Special case exponents + if (exponent == 0xFF) + { + strcat((string + charCount), "Infinity"); + return; + } + + while (exponent) + { + if (exponent > 0) + { + intPart <<= 1; + if (fractPart & (0x1 << 31)) + intPart |= 1; + fractPart <<= 1; + exponent -= 1; + } + else + { + fractPart >>= 1; + if (intPart & 0x01) + fractPart |= (0x1 << 31); + intPart >>= 1; + exponent += 1; + } + } + + // Output the whole number part + _num2str(intPart, (string + charCount), 10, 0); + charCount = strlen(string); + + string[charCount++] = '.'; + + // Calculate the fraction part + place = 1000000000; + for (count = 2; fractPart; count *= 2) + { + if (!count) + break; + + if (fractPart & (0x1 << 31)) + outputFraction += (place / count); + + fractPart <<= 1; + } + + // Output the fraction part + place = 100000000; + while (place) + { + rem = (outputFraction % place); + outputFraction = (outputFraction / place); + + if (roundPlaces) + { + string[charCount++] = ('0' + outputFraction); + roundPlaces -= 1; + } + else + { + if ((string[charCount - 1] < '9') && (outputFraction > 4)) + string[charCount - 1] += 1; + break; + } + + outputFraction = rem; + place /= 10; + } + + string[charCount] = '\0'; + return; +} + +static double strtod(const char* nptr, char** endptr) { + int sign = 1; + if (*nptr == '-') { + sign = -1; + nptr++; + } + + long long decimal_part = 0; + + while (*nptr && *nptr != '.') { + if (*nptr < '0' || *nptr > '9') { + break; + } + decimal_part *= 10LL; + decimal_part += (long long)(*nptr - '0'); + nptr++; + } + + double sub_part = 0; + double multiplier = 0.1; + + if (*nptr == '.') { + nptr++; + + while (*nptr) { + if (*nptr < '0' || *nptr > '9') { + break; + } + + sub_part += multiplier * (*nptr - '0'); + multiplier *= 0.1; + nptr++; + } + } + + double expn = (double)sign; + + if (*nptr == 'e' || *nptr == 'E') { + nptr++; + + int exponent_sign = 1; + + if (*nptr == '+') { + nptr++; + } + else if (*nptr == '-') { + exponent_sign = -1; + nptr++; + } + + int64_t exponent = 0; + + while (*nptr) { + if (*nptr < '0' || *nptr > '9') { + break; + } + exponent *= 10; + exponent += (*nptr - '0'); + nptr++; + } + + expn = pow(10.0, (double)(exponent * exponent_sign)); + } + + if (endptr) { + *endptr = (char*)nptr; + } + double result = ((double)decimal_part + sub_part) * expn; + return result; +} + +static float strtof(const char* nptr, char** endptr) { + return strtod(nptr, endptr); +} + +#define atou(string) ((unsigned) _str2num(string, 10, 0, NULL)) +#define atoull(string) _str2num(string, 10, 0, NULL) +#define atoo(string) ((unsigned)_str2num(string, 8, 0, NULL)) +#define atooll(string) _str2num(string, 8, 0, NULL) +#define dtoa(num, string, round) _dbl2str(num, string, round) +#define ftoa(num, string) _flt2str(num, string, round) +#define itoa(num, string) _num2str(num, string, 10, 1) +#define itouo(num, string) _num2str(num,string, 10, 1) +#define itoux(num,string) _num2str(num, string, 16,0); +#define itox(num, string) _num2str(num, string, 16, 1) +#define lltoa(num, string) _lnum2str(num, string, 10,1) +#define lltouo(num, string) _lnum2str(num, string, 8, 0) +#define lltoux(num, string) _lnum2str(num, string, 16,0) +#define lltox(num, string) _lnum2str(num, string, 16, 1) +#define xtoi(string) ((int)_str2num(string, 16, 1, NULL)) +#define xtoll(string) ((long long) _str2num(string, 16,1, NULL)) +#define ulltoa(num, string) _lnum2str(num, string, 10, 0) +#define utoa(num, string) _num2str(num, string, 10, 0) + +/** + * @brief _xeprint -- copied from XEClib implementation + * @param output -- pointer to memory buffer, where to put formatted + * string + * @param outputLen -- output len + * @param format -- formatted string + * @param list -- pointer to variable argument list + */ +int _xeprint(char* output, int outputlen, const char* format, va_list list) { + int inCount = 0; + int64_t outCount = 0; + int formatLen = 0; + int zeroPad = 0; + int leftJust = 0; + int fieldWidth = 0; + int isLong = 0; + long long intArg = 0; + double doubleArg; + int digits = 0; + + formatLen = strlen(format); + if (formatLen < 0) { + //errno = formatLen; + return (outCount = 0); + } + + if (formatLen > outputlen) + return (outCount = 0); + + formatLen = min(formatLen, MAX_STRING_LENGTH); + + for (inCount = 0; ((inCount < formatLen) && + (outCount < outputlen));) + { + if (format[inCount] != '%') { + output[outCount++] = format[inCount++]; + continue; + } + else if ((format[inCount] == '%') && (format[inCount + 1] == '%')) { + output[outCount++] = format[inCount]; + inCount += 2; + continue; + } + + inCount += 1; + zeroPad = 0; + if (format[inCount] == '0') { + zeroPad = 1; + inCount += 1; + } + + leftJust = 0; + if (format[inCount] == '-') { + leftJust = 1; + inCount += 1; + } + + fieldWidth = 0; + if ((format[inCount] >= '1') && (format[inCount] <= '9')) { + fieldWidth = atoi(format + inCount); + while ((format[inCount] >= '0') && (format[inCount] <= '9')) + inCount++; + } + + isLong = 0; + if (format[inCount] == 'l') { + inCount += 1; + if (format[inCount] == 'l') { + isLong = 1; + inCount += 1; + } + } + + if (isLong) { + intArg = (long long)va_arg(list, unsigned); + intArg |= (((long long)va_arg(list, unsigned)) << 32); + } + else if ((format[inCount] == 'e') || (format[inCount] == 'E') || + (format[inCount] == 'f') || (format[inCount] == 'F') || + (format[inCount] == 'g') || (format[inCount] == 'G')) { + + } + else { + intArg = va_arg(list, unsigned long long); + } + switch (format[inCount]) { + case 'd': + case 'i': { + if (fieldWidth) { + if (isLong) + digits = _ldigits(intArg, 10, 1); + else + digits = _digits(intArg, 10, 1); + + + if (!leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = (zeroPad ? '0' : ' '); + } + + } + if (isLong) + lltoa(intArg, (output + outCount)); + else + itoa(intArg, (output + outCount)); + + outCount = strlen(output); + + if (fieldWidth && leftJust) { + while (digits++ < fieldWidth) { + output[outCount++] = ' '; + } + } + break; + } + + case 'u': { + if (fieldWidth) { + if (isLong) + digits = _ldigits(intArg, 10, 0); + else + digits = _digits(intArg, 10, 0); + + if (!leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = (zeroPad ? '0' : ' '); + } + } + + if (isLong) + ulltoa(intArg, (output + outCount)); + else + utoa(intArg, (output + outCount)); + + outCount = strlen(output); + + if (fieldWidth && leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = ' '; + } + break; + } + case 'c': + { + output[outCount++] = (unsigned char)intArg; + break; + } + case 's': { + const char* str = intArg ? (const char*)(uint64_t)intArg : "(NULL)"; + int slen = strlen(str); + int pad = fieldWidth; + + if (fieldWidth && !leftJust) { + while (pad-- > 0) + output[outCount++] = ' '; + } + + strcpy(output + outCount, str); + outCount += slen; + + if (fieldWidth && leftJust) { + while (pad-- > 0) + output[outCount++] = ' '; + } + break; + } + case 'p': { + output[outCount++] = '0'; + output[outCount++] = 'x'; + fieldWidth = (2 * sizeof(void*)); + + if (isLong) + digits = _ldigits(intArg, 16, 0); + else + digits = _digits(intArg, 16, 0); + + if (!leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = '0'; + } + + if (isLong) + lltoux(intArg, (output + outCount)); + else + itoux(intArg, (output + outCount)); + + outCount = strlen(output); + + if (fieldWidth && leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = ' '; + } + break; + } + case 'o': { + if (fieldWidth) { + if (isLong) + digits = _ldigits(intArg, 8, 0); + else + digits = _digits(intArg, 8, 0); + + if (!leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = (zeroPad ? '0' : ' '); + } + } + + if (isLong) + lltouo(intArg, (output + outCount)); + else + itouo(intArg, (output + outCount)); + + outCount = strlen(output); + + if (fieldWidth && leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = ' '; + } + break; + } + case 'x': + case 'X': + { + if (fieldWidth) { + if (isLong) + digits = _ldigits(intArg, 16, 0); + else + digits = _digits(intArg, 16, 0); + + if (!leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = (zeroPad ? '0' : ' '); + } + } + + if (isLong) + lltoux(intArg, (output + outCount)); + else + itoux(intArg, (output + outCount)); + + outCount = strlen(output); + + if (fieldWidth && leftJust) { + while (digits++ < fieldWidth) + output[outCount++] = ' '; + } + break; + } + + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': { + doubleArg = (double)va_arg(list, double); + list += sizeof(int); + + if (fieldWidth) + dtoa(doubleArg, (output + outCount), fieldWidth); + else + dtoa(doubleArg, (output + outCount), 6); + + outCount = strlen(output); + break; + } + default: { + output[outCount++] = format[inCount - 1]; + output[outCount++] = format[inCount]; + break; + } + } + inCount += 1; + } + output[outCount] = '\0'; + return (outCount); +} + + +int _vsnprintf(char* output, size_t sz, const char* format, va_list ap) { + int len = 0; + sz = min(sz, MAX_STRING_LENGTH); + + memset(output, 0, sz); + + len = _xeprint(output, sz, format, ap); + return len; +} + +extern void store_x2_x7(uint8_t* buffer); +extern void store_x3_x7(uint8_t* buffer); + +int _sprintf(char* output, const char* format, ...) { + va_list list; + uint8_t buffer[192]; + store_x2_x7(buffer); + list = (va_list)buffer; + int len = 0; + len = _xeprint(output, MAX_STRING_LENGTH, format, list); + va_end(list); + return len; +} + +int _snprintf(char* output, size_t sz, const char* format, ...) { + va_list list; + uint8_t buffer[192]; + store_x3_x7(buffer); + list = (va_list)buffer; + int len = 0; + memset(output, 0, sz); + len = _xeprint(output, MAX_STRING_LENGTH, format, list); + va_end(list); + return len; +} + diff --git a/KernelAA64/Log/klog.c b/KernelAA64/Log/klog.c new file mode 100644 index 000000000..fc3aff9fa --- /dev/null +++ b/KernelAA64/Log/klog.c @@ -0,0 +1,210 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2023-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define LOG_BUFFER_SIZE (128*1024) +#define LOG_LINE_MAX 256 + +typedef struct _blog_ring_ { + char buffer[LOG_BUFFER_SIZE]; + uint32_t head; + uint32_t tail; + uint32_t len; + uint64_t seq; + //lock +}BLogRing; + +static bool _Blog_use_uart; + +/** level tags */ +static const char* level_tag[BORDOISILA_DEBUG_LEVEL_COUNT] = { + "EMERG", + "ERROR", + "WARN", + "INFO", + "DEBUG" +}; + + +static const uint32_t level_col[BORDOISILA_DEBUG_LEVEL_COUNT] = { + 0xFFFF3B30, + 0xFFD9534F, + 0xFFFFC107, + 0xFFE6E6E6, + 0xFF888888 +}; + + +static BLogRing _log_ring; +BLogLevel _log_console_level = BORDOISILA_DEBUG; + + +/** + * @brief B_KLogInit -- initialize bordoisila + * logging system + */ +void B_KLogInit() { + _log_ring.head = 0; + _log_ring.tail = 0; + _log_ring.len = 0; + _log_ring.seq = 0; + _Blog_use_uart = 0; +} + +static void _BLog_Write_Locked(const char* data, uint32_t n) { + if (n >= LOG_BUFFER_SIZE) { + data += (n - (LOG_BUFFER_SIZE - 1)); + n = LOG_BUFFER_SIZE - 1; + } + + for (uint32_t i = 0; i < n; i++) { + _log_ring.buffer[_log_ring.head] = data[i]; + _log_ring.head = (_log_ring.head + 1) % LOG_BUFFER_SIZE; + + if (_log_ring.len < LOG_BUFFER_SIZE) { + _log_ring.len++; + } + else { + _log_ring.tail = (_log_ring.tail + 1) % LOG_BUFFER_SIZE; + } + } + + _log_ring.seq++; +} + +static void _BlogRingWrite(const char* data, uint32_t n) { + //spinlock + _BLog_Write_Locked(data, n); + //spin unlock +} + +void BlogDump(BLogSinkFunc sink, void* ctx) { + if (!sink) return; + + //lock + + uint32_t pos = _log_ring.tail; + uint32_t left = _log_ring.len; + + char snapshot[512]; + //unlock + + while (left > 0) { + uint32_t chunk = left < sizeof(snapshot) ? left : sizeof(snapshot); + + //lock + for (uint32_t i = 0; i < chunk; i++) { + snapshot[i] = _log_ring.buffer[(pos + i) % LOG_BUFFER_SIZE]; + } + + //unlock + + sink(snapshot, chunk, ctx); + + pos = (pos + chunk) % LOG_BUFFER_SIZE; + + left -= chunk; + } +} + +static inline void _blog_get_uptime(uint64_t* sec, uint32_t* usec) { + uint64_t cntpct = get_cntpct_el0(); + uint64_t cntfrq = get_cntfrq_el0(); + + if (cntfrq == 0) { + *sec = 0; + *usec = 0; + return; + } + + *sec = cntpct / cntfrq; + *usec = (uint32_t)(((cntpct % cntfrq) * 1000000ULL) / cntfrq); +} + +extern void store_x2_x7(uint8_t* buffer); + +/** + * @brief BPrintK -- print formatted string to circular buffer + * @param level -- logging level + * @param fmt -- formatted string + */ +void BPrintK(BLogLevel level, const char* fmt, ...) { + uint8_t buffer[192]; + store_x2_x7(buffer); + + char line[LOG_LINE_MAX]; + + + uint64_t sec; + uint32_t usec; + + if (level >= BORDOISILA_DEBUG_LEVEL_COUNT) + level = BORDOISILA_DEBUG_LEVEL_COUNT; + + _blog_get_uptime(&sec, &usec); + + int prefix_len = _snprintf(line, sizeof(line), "[%d.%d] [%s] ", + (unsigned long long)sec, usec, level_tag[level]); + + if (prefix_len < 0) prefix_len = 0; + + if ((uint32_t)prefix_len >= sizeof(line)) prefix_len = sizeof(line) - 1; + + + + va_list args = (va_list)buffer; + int body_len = _vsnprintf(line + prefix_len, sizeof(line) - prefix_len, fmt, args); + va_end(args); + + if (body_len < 0) body_len = 0; + int total = prefix_len + body_len; + if (total >= (int)sizeof(line)) { + total = sizeof(line) - 1; + } + + if (total == 0 || line[total - 1] != '\n') { + line[total++] = '\n'; + } + + _BlogRingWrite(line, (uint32_t)total); + + if (!_Blog_use_uart) + AuPutS_Color(line, level_col[level]); + else + uartPuts(line); +} \ No newline at end of file diff --git a/KernelAA64/Makefile b/KernelAA64/Makefile index 1a1435518..d43929072 100644 --- a/KernelAA64/Makefile +++ b/KernelAA64/Makefile @@ -1,28 +1,59 @@ -# XenevaOS KernelAA64 Makefile (GCC Build) +# XenevaOS KernelAA64 Makefile TARGET = KernelAA64.elf -CROSS_COMPILE ?= aarch64-linux-gnu- +OBJDIR = obj + +# Default toolchain is GCC +TOOLCHAIN ?= gcc -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)ld +# Triggered when you run "make llvm" +.PHONY: all clean llvm +llvm: + @$(MAKE) TOOLCHAIN=llvm all # Target Board selection (Default: qemu_virt) BOARD ?= qemu_virt ifeq ($(BOARD), rpi3) - BOARD_FLAG = -D__TARGET_BOARD_RPI3__ + BOARD_FLAG = -D__TARGET_BOARD_RPI3__ else - BOARD_FLAG = -D__TARGET_BOARD_QEMU_VIRT__ + BOARD_FLAG = -D__TARGET_BOARD_QEMU_VIRT__ endif -INCLUDES = -I../BaseHdr -I../Acpica/include -I../Acpica -CFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ - -O2 \ - -DARCH_ARM64 $(BOARD_FLAG) -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS \ - $(INCLUDES) +INCLUDES = -I../BaseHdr -I../Acpica/include -I../Acpica -I. + + +ifeq ($(TOOLCHAIN), llvm) + # llvm configuration + CC = clang + LD = ld.lld + OBJCOPY = llvm-objcopy + + LLVM_TARGET = -target aarch64-unknown-windows + + CFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 $(LLVM_TARGET) -fno-builtin \ + -DARCH_ARM64 $(BOARD_FLAG) -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS \ + $(INCLUDES) + + LDFLAGS = $(LLVM_TARGET) -fuse-ld=lld -nostdlib \ + -Wl,-entry:_AuMain \ + -Wl,-base:0xFFFFC00000000000 \ + -Wl,-subsystem:native + +else + # original gcc configuration + CROSS_COMPILE ?= aarch64-linux-gnu- + CC = $(CROSS_COMPILE)gcc + LD = $(CROSS_COMPILE)ld + OBJCOPY = $(CROSS_COMPILE)objcopy + + CFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 \ + -DARCH_ARM64 $(BOARD_FLAG) -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS \ + $(INCLUDES) +endif -OBJDIR = obj -# Find all C and Assembly files recursively C_SRCS_ALL = $(shell find . -name '*.c') C_SRCS = $(filter-out ./Board/Rpi3bp/vc4dsi.c, $(C_SRCS_ALL)) S_SRCS = $(shell find . -name '*.s') @@ -32,23 +63,33 @@ S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) OBJS = $(C_OBJS) $(S_OBJS) -.PHONY: all clean all: $(TARGET) +ifeq ($(TOOLCHAIN), llvm) + $(TARGET): $(OBJS) - @echo "Linking KernelAA64..." + @echo "Linking native PE32+ Kernel using LLVM..." + $(CC) $(LDFLAGS) $(OBJS) -o KernelAA64.exe + @touch $(TARGET) +else + +$(TARGET): $(OBJS) + @echo "Linking KernelAA64 using GCC..." $(LD) -nostdlib -T linker.ld $(OBJS) -o $@ @echo "Converting ELF to PE32+..." - $(CROSS_COMPILE)objcopy -O pei-aarch64-little $@ KernelAA64.exe + $(OBJCOPY) -O pei-aarch64-little $@ KernelAA64.exe +endif +# Compile C source files $(OBJDIR)/%.o: %.c @mkdir -p $(dir $@) $(CC) $(CFLAGS) -c $< -o $@ +# Assemble ASM source files $(OBJDIR)/%.o: %.s @mkdir -p $(dir $@) $(CC) $(CFLAGS) -c $< -o $@ clean: - rm -rf $(OBJDIR) $(TARGET) + rm -rf $(OBJDIR) $(TARGET) KernelAA64.exe \ No newline at end of file diff --git a/KernelAA64/Mm/dlmalloc.c b/KernelAA64/Mm/dlmalloc.c index 2441b783d..9c90f6072 100644 --- a/KernelAA64/Mm/dlmalloc.c +++ b/KernelAA64/Mm/dlmalloc.c @@ -1568,6 +1568,7 @@ extern "C" { #include /* for sbrk, sysconf */ #else /* LACKS_UNISTD_H */ #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) +typedef long ptrdiff_t; extern void* sbrk(ptrdiff_t); #endif /* FreeBSD etc */ #endif /* LACKS_UNISTD_H */ diff --git a/KernelAA64/Mm/dma.c b/KernelAA64/Mm/dma.c index 2ad81cb03..6ae4d9dde 100644 --- a/KernelAA64/Mm/dma.c +++ b/KernelAA64/Mm/dma.c @@ -278,7 +278,7 @@ void AuDMAPoolDestroy(AuDMAPool* pool) { while (page) { AuDMAPage* next = page->next; kfree(page->bitmap); - AuPmmngrFree(page->phys); + AuPmmngrFree((void*)page->phys); kfree(page); page = next; } diff --git a/KernelAA64/Mm/kmalloc.c b/KernelAA64/Mm/kmalloc.c index a8bef04c9..c68334dfd 100644 --- a/KernelAA64/Mm/kmalloc.c +++ b/KernelAA64/Mm/kmalloc.c @@ -30,6 +30,11 @@ #include #include #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include <_null.h> #include #include diff --git a/KernelAA64/Mm/mmap.c b/KernelAA64/Mm/mmap.c index 011d5a25a..c55be3587 100644 --- a/KernelAA64/Mm/mmap.c +++ b/KernelAA64/Mm/mmap.c @@ -41,6 +41,8 @@ #include #include #include +#include +#include #define PROTECTION_FLAG_READONLY 1<<0 @@ -113,6 +115,7 @@ AuSharedMmapObject* AuSharedMmapObjectFindByName(char* name) { return NULL; } +extern void aa64_schedule_init(AA64Thread* current, AA64Thread* init); /** * @brief CreateMemMapping -- Create a memory mapping of just memory, file or device * @param address -- address from where mapping start, if null, kernel will @@ -130,7 +133,6 @@ void* CreateMemMapping(void* address, size_t len, int prot, int flags, int fd, if (!len) return 0; - /* for now, memory mapping doesn't support lazy loading * so everything works at pre-paging */ @@ -141,6 +143,8 @@ void* CreateMemMapping(void* address, size_t len, int prot, int flags, int fd, if (!proc) return NULL; } + + AuVFSNode* file = NULL; AuVFSNode* fsys = NULL; uint64_t startingPhysAddr = NULL; @@ -265,7 +269,7 @@ void* CreateMemMapping(void* address, size_t len, int prot, int flags, int fd, fb->numPageIndex++; if (file->eof) { - UARTDebugOut("File : %s , eof done : %d\r\n", file->filename, file->eof); + //UARTDebugOut("File : %s , eof done : %d\r\n", file->filename, file->eof); } } diff --git a/KernelAA64/Mm/mmserv.c b/KernelAA64/Mm/mmserv.c index 47b0b04f3..93fdbc6ca 100644 --- a/KernelAA64/Mm/mmserv.c +++ b/KernelAA64/Mm/mmserv.c @@ -37,6 +37,7 @@ #include #include <_null.h> #include +#include /* ============================================================ * Shared Memory diff --git a/KernelAA64/Mm/pmmngr.c b/KernelAA64/Mm/pmmngr.c index 46fda11ce..1aff40b3d 100644 --- a/KernelAA64/Mm/pmmngr.c +++ b/KernelAA64/Mm/pmmngr.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #define PAGE_SHIFT 12 @@ -301,9 +303,8 @@ void AuPmmngrInitialize(KERNEL_BOOT_INFO* info) { pageCount = (dtb_end - dtb_start) / 0x1000; for (int i = 0; i < pageCount; i++) { - uint64_t addr = dtb_start + (uint64_t)i * 0x1000; // ((uint64_t)Address - UsablePhysicalMemory); - uint64_t Index = (addr - UsablePhysicalMemory); - AuPmmngrLockPage(Index); + uint64_t addr = dtb_start + (uint64_t)i * 0x1000; + AuPmmngrLockPage(addr); } @@ -313,8 +314,7 @@ void AuPmmngrInitialize(KERNEL_BOOT_INFO* info) { pageCount = (initrdEnd - initrdStart) / 0x1000; for (int i = 0; i < pageCount; i++) { uint64_t addr = initrdStart + (uint64_t)i * 0x1000; - uint64_t Index = (addr - UsablePhysicalMemory); - AuPmmngrLockPage(Index); + AuPmmngrLockPage(addr); } uint64_t lbStart = lb->littleBootStart; @@ -324,8 +324,7 @@ void AuPmmngrInitialize(KERNEL_BOOT_INFO* info) { for (int i = 0; i < pageCount; i++) { uint64_t addr = lbStart + (uint64_t)i * 0x1000; - uint64_t Index = (addr - UsablePhysicalMemory); - AuPmmngrLockPage(Index); + AuPmmngrLockPage(addr); } AuTextOut("[aurora]: Pmmngr locked LittleBoot reserved memory\r\n"); } diff --git a/KernelAA64/Mm/vmmngr.c b/KernelAA64/Mm/vmmngr.c index 9bcd518ab..842db9762 100644 --- a/KernelAA64/Mm/vmmngr.c +++ b/KernelAA64/Mm/vmmngr.c @@ -39,6 +39,11 @@ #include <_null.h> #include #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif uint64_t* _RootPaging; @@ -204,7 +209,8 @@ bool AuMapPage(uint64_t phys_addr, uint64_t virt_addr, uint8_t attrib) { if (pml1[i1] & 1){ //AuPmmngrFree((void*)phys_addr); - AuTextOut("[aurora]: vmmngr page already present : %x \r\n", virt_addr); + AuTextOut("[aurora]: vmmngr page already present : virt=%x phys=%x \r\n", virt_addr, (pml1[i1] & ~0xFFFULL)); + UARTDebugOut("[aurora]: vmmngr page already present : virt=%x phys=%x \r\n", virt_addr, (pml1[i1] & ~0xFFFULL)); return false; } @@ -275,7 +281,8 @@ bool AuMapPageEx(uint64_t* pml4i, uint64_t phys_addr, uint64_t virt_addr, uint8_ if (pml1[i1] & 1) { //AuPmmngrFree((void*)phys_addr); - AuTextOut("[aurora]: vmmngr page already present : %x \n", (pml1[i1] & ~0xFFFULL)); + AuTextOut("[aurora]: vmmngr page already present : virt=%x phys=%x \n", virt_addr, (pml1[i1] & ~0xFFFULL)); + UARTDebugOut("[aurora]: vmmngr page already present : virt=%x phys=%x \r\n", virt_addr, (pml1[i1] & ~0xFFFULL)); return false; } @@ -520,7 +527,7 @@ void AuUpdatePageFlags(uint64_t virt_addr, uint64_t flags) { //AuTextOut("Your physical page is -> %x %x\n", page, V2P(page)); if (page) { - pt[pt_index(virt_addr)] = (V2P(page) & ~0xFFFULL) | flags; + pt[pt_index(virt_addr)] = (V2P(*page) & ~0xFFFULL) | flags; data_cache_flush(&pt[pt_index(virt_addr)]); } } diff --git a/KernelAA64/Net/arp.c b/KernelAA64/Net/arp.c index 1d23cfe94..08210f16c 100644 --- a/KernelAA64/Net/arp.c +++ b/KernelAA64/Net/arp.c @@ -125,11 +125,12 @@ void ARPHandlePacket(void* data, AuVFSNode* nic) { } } if (ntohs(packet->operation) == 1) { - char spa[17]; ip_ntoa(ntohl(packet->arp_data.arp_eth_ipv4.arp_spa)); - char tpa[17]; - ip_ntoa(ntohl(packet->arp_data.arp_eth_ipv4.arp_tpa)); - if (eth->ipv4addr && packet->arp_data.arp_eth_ipv4.arp_tpa == eth->ipv4addr) { + uint32_t tpa = 0; + memcpy(&tpa, &packet->arp_data.arp_eth_ipv4.arp_tpa, 4); + + ip_ntoa(ntohl(tpa)); + if (eth->ipv4addr && tpa == eth->ipv4addr) { NetARP arp; arp.hwAddressType = htons(1); arp.hwProtocolType = htons(ETHERNET_TYPE_IPV4); @@ -138,8 +139,16 @@ void ARPHandlePacket(void* data, AuVFSNode* nic) { arp.operation = htons(2); memcpy(arp.arp_data.arp_eth_ipv4.arp_sha, eth->mac, 6); memcpy(arp.arp_data.arp_eth_ipv4.arp_tha, packet->arp_data.arp_eth_ipv4.arp_sha, 6); - arp.arp_data.arp_eth_ipv4.arp_spa = eth->ipv4addr; - arp.arp_data.arp_eth_ipv4.arp_tpa = packet->arp_data.arp_eth_ipv4.arp_spa; + + //arp.arp_data.arp_eth_ipv4.arp_spa = eth->ipv4addr; + memcpy(&arp.arp_data.arp_eth_ipv4.arp_spa, ð->ipv4addr, 4); + //arp.arp_data.arp_eth_ipv4.arp_tpa = packet->arp_data.arp_eth_ipv4.arp_spa; + memcpy(&arp.arp_data.arp_eth_ipv4.arp_tpa, &packet->arp_data.arp_eth_ipv4.arp_spa, 4); + + uint32_t tpa, spa = 0; + memcpy(&tpa, &arp.arp_data.arp_eth_ipv4.arp_tpa, 4); + memcpy(&spa, &arp.arp_data.arp_eth_ipv4.arp_spa, 4); + AuEthernetSend(nic, &arp, sizeof(NetARP), ETHERNET_TYPE_ARP, packet->arp_data.arp_eth_ipv4.arp_sha); } } diff --git a/KernelAA64/Net/aunet.c b/KernelAA64/Net/aunet.c index 49bce5de4..82d61e963 100644 --- a/KernelAA64/Net/aunet.c +++ b/KernelAA64/Net/aunet.c @@ -42,6 +42,7 @@ #include #include #include +#include static hashmap_t* netadapters; diff --git a/KernelAA64/Net/ethernet.c b/KernelAA64/Net/ethernet.c index 3ce0cebd8..8c69bc87d 100644 --- a/KernelAA64/Net/ethernet.c +++ b/KernelAA64/Net/ethernet.c @@ -40,19 +40,17 @@ #include #include #include +#include + -#ifdef ARCH_X64 #pragma pack(push,1) -#endif -typedef struct _ethernet_ { +ALIGNED(2) typedef struct _ethernet_ { uint8_t dest[6]; uint8_t src[6]; uint16_t typeLen; uint8_t payload[]; }Ethernet; -#ifdef ARCH_X64 #pragma pack(pop) -#endif AU_EXTERN AU_EXPORT void AuEthernetHandle(void* data, int size, AuVFSNode* nic) { @@ -60,8 +58,8 @@ AU_EXTERN AU_EXPORT void AuEthernetHandle(void* data, int size, AuVFSNode* nic) AuNetworkDevice* ndev = (AuNetworkDevice*)nic->device; if (!ndev) return; - list_t* raw_sockets = AuRawSocketGetList(); + UARTDebugOut("Adding to raw_sockets \r\n"); for (int i = 0; i < raw_sockets->pointer; i++) { AuSocket* sock = (AuSocket*)list_get_at(raw_sockets, i); AuSocketAdd(sock, frame, size); @@ -116,13 +114,13 @@ void AuEthernetSend(AuVFSNode* nic, void* data, size_t len, uint16_t type, uint8 Ethernet* pacl = (Ethernet*)kmalloc(totalSz); memset(pacl, 0, totalSz); memcpy(&pacl->payload, data, len); - memcpy(pacl->dest, dest, 6); + memcpy(&pacl->dest, dest, 6); uint8_t* src_mac = ndev->mac; - memcpy(pacl->src, src_mac, 6); + memcpy(&pacl->src, src_mac, 6); pacl->typeLen = htons(type); - - if (nic->write) { + UARTDebugOut("PaclTypelen : %d \r\n", pacl->typeLen); + if (nic->write) nic->write(nic, nic, (uint64_t*)pacl, totalSz); - } + kfree(pacl); } \ No newline at end of file diff --git a/KernelAA64/Net/ipv4.c b/KernelAA64/Net/ipv4.c index e8841627c..84856cbe0 100644 --- a/KernelAA64/Net/ipv4.c +++ b/KernelAA64/Net/ipv4.c @@ -43,6 +43,7 @@ #include #include #include +#include uint16_t IPv4CalculateChecksum(IPv4Header* p) { uint32_t sum = 0; @@ -73,16 +74,22 @@ void IPv4HandlePacket(void* data, AuVFSNode* nic) { char dest[16]; char src[16]; IPv4Header* pack = (IPv4Header*)data; - ip_ntoa(ntohl(pack->destAddress)); - ip_ntoa(ntohl(pack->srcAddress)); - switch (pack->protocol) { + uint32_t destIP; + memcpy(&destIP, &pack->destAddress, 4); + uint32_t srcIP; + memcpy(&srcIP, &pack->srcAddress, 4); + ip_ntoa(ntohl(destIP)); + ip_ntoa(ntohl(srcIP)); + uint8_t protocol; + memcpy(&protocol, &pack->protocol, 1); + switch (protocol) { case 1: { UARTDebugOut("[ipv4]: received ICMP message \r\n"); - //AuICMPHandle(pack, nic); + AuICMPHandle(pack, nic); break; } case IPV4_PROTOCOL_UDP: { - UARTDebugOut("[ipv4]: received UDP packet \r\n"); + UDPHandlePacket(pack); break; } case IPV4_PROTOCOL_TCP: { @@ -146,7 +153,7 @@ void IPV4SendPacket(IPv4Header* packet, AuVFSNode* nic) { cache = AuARPGet(ip_dest); if (!cache) { AuARPRequestMAC(nic, ip_dest); - UARTDebugOut("[aurora]:Requesting MAC \r\n"); + UARTDebugOut("[aurora]:Requesting MAC #1 \r\n"); /* Not implemented yet */ AuSleepThread(AuGetCurrentThread(), 100); @@ -159,12 +166,12 @@ void IPV4SendPacket(IPv4Header* packet, AuVFSNode* nic) { cache = AuARPGet(ip_dest); if (!cache) { AuARPRequestMAC(nic, ip_dest); - UARTDebugOut("[aurora]: Requesting MAC \r\n"); + UARTDebugOut("[aurora]: Requesting MAC #2\r\n"); /* Not implemented yet */ - AuSleepThread(AuGetCurrentThread(), 10000); + AuSleepThread(AuGetCurrentThread(), 100); AuForceScheduler(); - + UARTDebugOut("Rechecking ARP \r\n"); cache = AuARPGet(ip_dest); } } diff --git a/KernelAA64/Net/socket.c b/KernelAA64/Net/socket.c index 3df3493ed..02a419481 100644 --- a/KernelAA64/Net/socket.c +++ b/KernelAA64/Net/socket.c @@ -41,6 +41,7 @@ #include #include #include +#include #include list_t* raw_socket_list; @@ -62,7 +63,13 @@ void AuSocketAdd(AuSocket* sock, void* data, size_t sz) { char* data_ = (char*)kmalloc(sizeof(size_t) + sz); memset(data_, 0, sz + sizeof(size_t)); *(size_t*)data_ = sz; - memcpy(data_ + sizeof(size_t), data, sz); + UARTDebugOut("Adding data %x , sz : %d\r\n", data, sz); + //memcpy(data_ + sizeof(size_t), (char*)data, sz); + char* dest = data_ + sizeof(size_t); + const char* src = (const char*)data; + for (size_t i = 0; i < sz; i++) { + dest[i] = src[i]; + } UARTDebugOut("]aurora]: socket sock stack -> %x \r\n", sock->rxstack); AuStackPush(sock->rxstack, data_); } @@ -85,10 +92,16 @@ void* AuSocketGet(AuSocket* sock) { * @param flags -- flags to be cared about */ int AuRawSocketReceive(AuSocket* sock, msghdr* msg, int flags) { - if (!sock->binedDev) + if (!sock->binedDev) { + UARTDebugOut("No binded device \r\n"); return -1; - if (msg->msg_iovlen == 0) return 0; + } + if (msg->msg_iovlen == 0) { + UARTDebugOut("MSG_IOVLen : 0 \r\n"); + return 0; + } char* data = (char*)AuSocketGet(sock); + UARTDebugOut("Getting data : %x \r\n", data); if (!data) return -1; size_t pack_sz = *(size_t*)data; if (msg->msg_iov[0].iov_len < pack_sz) return -1; diff --git a/KernelAA64/Net/tcp.c b/KernelAA64/Net/tcp.c new file mode 100644 index 000000000..f43c5925a --- /dev/null +++ b/KernelAA64/Net/tcp.c @@ -0,0 +1,387 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2024, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +list_t* tcpSocketList; + +typedef struct _tcpcheckheader_ { + uint32_t source; + uint32_t destination; + uint8_t zeros; + uint8_t protocol; + uint16_t tcpLen; + uint8_t tcpHeader[]; +}TCPCheckHeader; + +/** Implementation needed **/ + + +/* + * CalculateTCPChecksum -- calculate tcp checksum + * @param p -- Pointer to TCP Checksum header + * @param h -- Pointer to TCP header + * @param d -- Payload + * @param payloadsz -- size of the payload + */ +uint16_t CalculateTCPChecksum(TCPCheckHeader* p, TCPHeader* h, void* d, size_t payloadsz) { + uint32_t sum = 0; + uint16_t* s = (uint16_t*)p; + + for (int i = 0; i < 6; ++i) { + sum += ntohs(s[i]); + if (sum > 0xFFFF) + sum = (sum >> 16) + (sum & 0xFFFF); + } + + s = (uint16_t*)h; + for (int i = 0; i < 10; ++i) { + sum += ntohs(s[i]); + if (sum > 0xFFFF) + sum = (sum >> 16) + (sum & 0xFFFF); + } + + uint16_t dwords = payloadsz / 2; + s = (uint16_t*)d; + for (unsigned int i = 0; i < dwords; ++i) { + sum += ntohs(s[i]); + if (sum > 0xFFFF) + sum = (sum >> 16) + (sum & 0xFFFF); + } + + if (dwords * 2 != payloadsz) { + uint8_t* t = (uint8_t*)d; + uint8_t tmp[2]; + tmp[0] = t[dwords * sizeof(uint16_t)]; + tmp[1] = 0; + + uint16_t* f = (uint16_t*)tmp; + + sum += ntohs(f[0]); + if (sum > 0xFFFF) + sum = (sum >> 16) + (sum & 0xFFFF); + } + + return ~(sum & 0xFFFF) & 0xFFFF; +} +/* + * AuTCPReceive -- TCP protocol receive interface + * @param sock -- Pointer to socket + * @param msghdr -- Message header containing every information + * @param flags -- extra flags + */ +int AuTCPReceive(AuSocket* sock, msghdr* msg, int flags) { + return 0; +} + +/* +* AuTCPSend -- TCP protocol send interface +* @param sock -- Pointer to socket +* @param msghdr -- Message header containing every information +* @param flags -- extra flags +*/ +int AuTCPSend(AuSocket* sock, msghdr* msg, int flags) { + return 0; +} + +/* +* AuTCPClose -- TCP protocol close call +* @param sock -- Pointer to socket +*/ +void AuTCPClose(AuSocket* sock) { + return; +} + +static int _tcp_port_ = 49152; +/* + * AuTCPObtainPort -- obtains a new port for + * a session, port number 0 - 1024 are reserved + * for services and protocols like HTTP(port 80) + * FTP(port 21), SSH(port 22)..etc + * Rage from 1024 to 49151 are assigned by Internet + * Assigned Numbers Authority for specific services + * upon application by a requesting entity. + * Dynamic/Private ports ranges from 49152 - 65535 + * this ports are not assigned and can be used + * dynamically by applications and services + * @param sock -- Pointer to socket session + */ +void AuTCPObtainPort(AuSocket* sock) { + int port = _tcp_port_++; + sock->sessionPort = port; + list_add(tcpSocketList, sock); +} + +/* + * AuTCPAcknowledge -- send ack packets + * @param nic -- Pointer to NIC device + * @param sock -- Pointer to session socket + * @param ippack -- Pointer to IPv4 packet + * @param payloadLen -- length of the payload +*/ +int AuTCPAcknowledge(AuVFSNode* nic, AuSocket* sock, IPv4Header* ippack, size_t payloadLen) { + AuNetworkDevice* nicdev = (AuNetworkDevice*)nic->device; + if (!nicdev) + return -1; + + + /* need to implement three way ack to handle + * packet loss or errors + */ + TCPHeader* tcp = (TCPHeader*)&ippack->payload; + int windowsz = TCP_DEFAULT_WIN_SZ; + + unsigned seq_num = sock->packID + 1; + unsigned ack_num = (tcp->sequenceNum + payloadLen); + size_t totalLen = sizeof(IPv4Header) + sizeof(TCPHeader); + IPv4Header* ipv4 = (IPv4Header*)kmalloc(totalLen); + ipv4->totalLength = htons(totalLen); + ipv4->destAddress = ippack->srcAddress; + ipv4->srcAddress = nicdev->ipv4addr; + ipv4->timeToLive = 64; + ipv4->protocol = IPV4_PROTOCOL_TCP; + sock->ipv4Iden++; + ipv4->identification = htons(sock->ipv4Iden); + ipv4->flagsFragOffset = htons(0x0); + ipv4->versionHeaderLen = 0x45; + ipv4->typeOfService = 0; + ipv4->headerChecksum = htons(IPv4CalculateChecksum(ipv4)); + + /* handle fin packets */ + int flags = TCP_FLAGS_ACK; + + TCPHeader* tcppack = (TCPHeader*)&ipv4->payload; + tcppack->srcPort = htons(sock->sessionPort); + tcppack->destPort = tcp->srcPort; + tcppack->sequenceNum = htonl(seq_num); + tcppack->ackNum = htonl(ack_num); + tcppack->dataOffsetFlags = htons(flags | 0x5000); + tcppack->window = htons(windowsz); + tcppack->checksum = 0; + tcppack->urgentPointer = 0; + + TCPCheckHeader checkhdr; + checkhdr.source = ipv4->srcAddress; + checkhdr.destination = ipv4->destAddress; + checkhdr.zeros = 0; + checkhdr.protocol = IPV4_PROTOCOL_TCP; + checkhdr.tcpLen = htons(sizeof(TCPHeader)); + + tcppack->checksum = htons(CalculateTCPChecksum(&checkhdr, tcppack, NULL, 0)); + IPV4SendPacket(ipv4, nic); + UARTDebugOut("TCP-ACK Sent !! successfully \r\n"); + kfree(ipv4); + return 0; +} +/* +* AuTCPConnect -- TCP protocol connect interface +* @param sock -- Pointer to socket +* @param addr -- socket address information +* @param addrlen -- address length +*/ +int AuTCPConnect(AuSocket* sock, sockaddr* addr, socklen_t addrlen) { + sockaddr_in* sockdata = (sockaddr_in*)addr; + UARTDebugOut("TCP connect call called \r\n"); + AuTCPObtainPort(sock); + int sourcePort = sock->sessionPort; + sock->sockState = SOCK_STATE_WAITING_FOR_CONNECTION; + sock->ipv4Iden = rand(); + AuVFSNode* nic = AuNetworkRoute(sockdata->sin_addr.s_addr); + if (!nic) { + UARTDebugOut("[Aurora-net]: TCP failed to connect, no NIC\r\n"); + return 1; + } + + AuNetworkDevice* ndev = (AuNetworkDevice*)nic->device; + if (!ndev) { + UARTDebugOut("[Aurora-net]: TCP No Netword device data \r\n"); + return 1; + } + + size_t totalLen = sizeof(IPv4Header) + sizeof(TCPHeader); + + /* IPV4 Header */ + IPv4Header* ipv4 = (IPv4Header*)kmalloc(totalLen); + ipv4->totalLength = htons(totalLen); + ipv4->destAddress = sockdata->sin_addr.s_addr; + ipv4->srcAddress = ndev->ipv4addr; + ipv4->timeToLive = 64; + ipv4->protocol = IPV4_PROTOCOL_TCP; + ipv4->identification = htons(sock->ipv4Iden); + ipv4->flagsFragOffset = htons(0x0); + ipv4->versionHeaderLen = 0x45; + ipv4->typeOfService = 0; + ipv4->headerChecksum = htons(IPv4CalculateChecksum(ipv4)); + + TCPHeader* tcp = (TCPHeader*)&ipv4->payload; + tcp->srcPort = htons(sock->sessionPort); + tcp->destPort = sockdata->sin_port; + tcp->sequenceNum = 0; + tcp->ackNum = 0; + tcp->dataOffsetFlags = htons((1 << 1) | 0x5000); + tcp->window = htons(TCP_DEFAULT_WIN_SZ); + tcp->checksum = 0; + tcp->urgentPointer = 0; + sock->packID = tcp->sequenceNum; + + TCPHeader* tcpch = (TCPHeader*)ipv4->payload; + UARTDebugOut("TCP Check SRC -> %d \r\n", tcpch->srcPort); + + TCPCheckHeader checkhdr; + checkhdr.source = ipv4->srcAddress; + checkhdr.destination = ipv4->destAddress; + checkhdr.zeros = 0; + checkhdr.protocol = IPV4_PROTOCOL_TCP; + checkhdr.tcpLen = htons(sizeof(TCPHeader)); + + tcp->checksum = htons(CalculateTCPChecksum(&checkhdr, tcp, NULL, 0)); + + IPV4SendPacket(ipv4, nic); + + uint64_t s, ss = 0; + uint64_t ns, nss = 0; + aa64_calculate_ticks(1, 0, &s, &ss); + int attempts = 0; + while (!sock->rxstack->itemCount) { + AuSleepThread(AuGetCurrentThread(), 20); + AuScheduleNext(); + + aa64_calculate_ticks(0, 0, &ns, &nss); + //connection refused + if (sock->sockState == SOCK_STATE_CONNECTION_RST) { + UARTDebugOut("Sock state reset \r\n"); + kfree(ipv4); + return -1; + } + if ((ns > s || (ns == s && nss > ss))) { + if (attempts == 3) { + UARTDebugOut("Attempts == 3 \r\n"); + kfree(ipv4); + return -1; //timeout + } + UARTDebugOut("[aurora]: TCP retrying connection \r\n"); + IPV4SendPacket(ipv4, nic); + aa64_calculate_ticks(1, 0, &s, &ss); + attempts++; + } + } + kfree(ipv4); + UARTDebugOut("[aurora]: TCP connection succeeded \r\n"); + return 0; +} + + +int AuTCPBind(AuSocket* sock, sockaddr* addr, socklen_t addrlen) { + return 0; +} + + +uint64_t AuTCPRead(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t len) { + return 0; +} + +uint64_t AuTCPWrite(AuVFSNode* node, AuVFSNode* file, uint64_t* buffer, uint32_t len) { + return 0; +} + +int AuTCPFileClose(AuVFSNode* fsys, AuVFSNode* file) { + AuSocket* sock = (AuSocket*)file->device; + if (sock) { + if (sock->rxstack) { + while (sock->rxstack->itemCount) { + void* data = AuStackPop(sock->rxstack); + kfree(data); + } + kfree(sock->rxstack); + } + kfree(sock); + } + kfree(file); + UARTDebugOut("TCP/IP Socket Closed \r\n"); + return 0; +} +/* + * CreateTCPSocket -- creates a new TCP Socket + */ +int CreateTCPSocket() { + int fd = -1; + AA64Thread* thread = AuGetCurrentThread(); + if (!thread) + return -1; + AuProcess* proc = AuProcessFindThread(thread); + if (!proc) + proc = AuProcessFindSubThread(thread); + if (!proc) + return -1; + AuSocket* sock = (AuSocket*)kmalloc(sizeof(AuSocket)); + memset(sock, 0, sizeof(AuSocket)); + sock->send = AuTCPSend; + sock->receive = AuTCPReceive; + sock->connect = AuTCPConnect; + sock->bind = AuTCPBind; + sock->close = AuTCPClose; + sock->rxstack = AuStackCreate(); + fd = AuProcessGetFileDesc(proc); + AuVFSNode* node = (AuVFSNode*)kmalloc(sizeof(AuVFSNode)); + memset(node, 0, sizeof(AuVFSNode)); + node->flags |= FS_FLAG_SOCKET; + node->device = sock; + node->close = AuTCPFileClose; + node->iocontrol = SocketIOControl; + proc->fds[fd] = node; + UARTDebugOut("TCP Socket created \r\n"); + return fd; +} + +/* + * TCPGetSocketList -- return the current socket + * list of TCP + */ +list_t* TCPGetSocketList() { + return tcpSocketList; +} + +/* + * TCPProtocolInstall -- initialize the TCP protocol + */ +void TCPProtocolInstall() { + tcpSocketList = initialize_list(); +} \ No newline at end of file diff --git a/KernelAA64/Net/udp.c b/KernelAA64/Net/udp.c index 756fc798e..8a93a487e 100644 --- a/KernelAA64/Net/udp.c +++ b/KernelAA64/Net/udp.c @@ -48,6 +48,43 @@ int UDPGetPort(AuSocket* sock) { list_add(udp_socket_list, sock); return out; } + + +/** + * @brief AuUDPHandlePacket -- handle incoming packet + * @param packet -- pointer to ipv4 packet + */ +void UDPHandlePacket(char* packet) { + IPv4Header* ipv4 = (IPv4Header*)packet; + UDPHeader* udp = (UDPHeader*)&ipv4->payload; + uint16_t dest_port; + memcpy(&dest_port, &udp->destPort, 2); + uint16_t src_port; + memcpy(&src_port, &udp->srcPort, 2); + + uint16_t totalLen = 0; + memcpy(&totalLen, &ipv4->totalLength, 2); + +#ifdef DEBUG_SERIAL + UARTDebugOut("UDP Packet received with dest_port : %d , src_port : %d \r\n", ntohs(dest_port), src_port); + UARTDebugOut("Data bytes (%d bytes): \r\n", ntohs(totalLen)); + for (int i = 0; i < 15; i++) { + UARTDebugOut("%c", udp->payload[i]); + } +#endif + + /** add it to its destination socket **/ + for (int i = 0; i < udp_socket_list->pointer; i++) { + AuSocket* sock = (AuSocket*)list_get_at(udp_socket_list, i); + if (sock->sessionPort == ntohs(dest_port)) { + AuSocketAdd(sock, packet, ntohs(totalLen)); +#ifdef DEBUG_SERIAL + UARTDebugOut("UDP Packet added \r\n"); +#endif + break; + } + } +} /** * @brief AuUDPReceive -- UDP protocol receive interface * @param sock -- Pointer to socket diff --git a/KernelAA64/Serv/fileserv.c b/KernelAA64/Serv/fileserv.c index 85fe80098..3759c0e8a 100644 --- a/KernelAA64/Serv/fileserv.c +++ b/KernelAA64/Serv/fileserv.c @@ -30,6 +30,7 @@ **/ #include +#include #include #include #include @@ -42,6 +43,7 @@ #include #include #include +#include extern uint64_t read_sp(); extern uint64_t read_sp_el1(); @@ -50,7 +52,7 @@ extern uint64_t read_sp_el1(); * @param file -- file path * @param mode -- mode of the file */ -int OpenFile(char* filename, int mode) { +int OpenFile(char* filename, int mode) { AA64Thread* current_thr = AuGetCurrentThread(); if (!current_thr) return -1; @@ -102,6 +104,29 @@ int OpenFile(char* filename, int mode) { if (file->open) file->open(file,NULL); current_proc->fds[fd] = file; +CapRights rights = CAP_SEEK; + +if (mode & FILE_OPEN_READ_ONLY) + rights |= CAP_READ | CAP_WRITE; + +if (mode & (FILE_OPEN_WRITE | FILE_OPEN_CREAT)) + rights |= CAP_WRITE; + +/* Preserve current default behaviour */ +if (mode == 0) + rights |= CAP_READ; + +if (rights & CAP_READ) + BPrintK(BORDOISILA_WARN, "Creating rights has read %s, %d, fname: %s\r\n", current_proc->name, fd, filename); + +BordoisilaCapCreate( + current_proc, + fd, + file, + CAP_OBJ_FILE, + rights); + + //_setdebug = 1; return fd; } @@ -178,6 +203,9 @@ size_t ReadFile(int fd, void* buffer, size_t length) { if (!file) { return 0; } + if (!BordoisilaCapCheckRights(current_proc, fd, CAP_READ)) { + return 0; + } size_t ret_bytes = 0; /* every general file will contain its @@ -229,10 +257,13 @@ size_t WriteFile(int fd, void* buffer, size_t length) { if (!current_proc) return 0; } + AuVFSNode* file = current_proc->fds[fd]; uint8_t* aligned_buffer = (uint8_t*)buffer; if (!file) return 0; + if (!BordoisilaCapCheckRights(current_proc, fd, CAP_WRITE)) + return 0; size_t write_bytes = 0; size_t ret_bytes; /* every general file will contain its @@ -286,15 +317,18 @@ int CloseFile(int fd) { AuVFSNode* file = current_proc->fds[fd]; if (file->flags & FS_FLAG_FILE_SYSTEM) { current_proc->fds[fd] = 0; + BordoisilaCapDestroy(current_proc, fd); return -1; } if (file->flags & FS_FLAG_CACHED) { current_proc->fds[fd] = 0; + BordoisilaCapDestroy(current_proc, fd); return 0; } if (file->flags & FS_FLAG_GENERAL) { current_proc->fds[fd] = 0; + BordoisilaCapDestroy(current_proc, fd); /** NEED to fix, freeing the file causes crash **/ kfree(file); return 0; @@ -303,6 +337,7 @@ int CloseFile(int fd) { if (file->flags & FS_FLAG_DIRECTORY) { current_proc->fds[fd] = 0; + BordoisilaCapDestroy(current_proc, fd); kfree(file); return 0; } @@ -311,6 +346,7 @@ int CloseFile(int fd) { if (file->close) file->close(file, file); current_proc->fds[fd] = 0; + BordoisilaCapDestroy(current_proc, fd); return 0; } diff --git a/KernelAA64/Serv/thrserv.c b/KernelAA64/Serv/thrserv.c index f4635d9dd..4cc7d662f 100644 --- a/KernelAA64/Serv/thrserv.c +++ b/KernelAA64/Serv/thrserv.c @@ -39,6 +39,9 @@ #include #include #include +#include +#include +#include /** * @brief GetThreadID -- returns current id @@ -100,10 +103,12 @@ int ProcessWaitForTermination(int pid) { //NOT IMPLEMENTED AA64Thread* current_thr = AuGetCurrentThread(); AuProcess* proc = AuProcessFindThread(current_thr); - AuProcessWaitForTermination(proc, pid); - AA64Registers* regs = AA64GetCurrentRegCtx(); - AuScheduleThread(regs); - return 0; + int ret = AuProcessWaitForTermination(proc, pid); + if (ret == 1) { + AA64Registers* regs = AA64GetCurrentRegCtx(); + AuScheduleThread(regs); + } + return ret; } /** @@ -258,9 +263,29 @@ int SetFileToProcess(int fileno, int dest_fdidx, int proc_id) { * fileno to destination processes file * entry */ + + + + destproc->fds[dest_fdidx] = file; file->fileCopyCount += 1; - } + + /* inherit the capability if inheritance is allowed */ + AuCapability* src = BordoisilaCapLookup(proc, fileno); + if (src && !(src->flags & CAP_FLAG_NO_INHERIT)) { + BPrintK(BORDOISILA_INFO, "Capability copied from proc : %s, fileno-> %d \r\n", proc->name, fileno); + BordoisilaCapCreate( + destproc, + dest_fdidx, + file, + src->object_type, + src->rights); + } + + + } + return 0; + } /** @@ -300,4 +325,72 @@ size_t GetEnvironmenBlock() { } return proc->_envp_block_; +} + +void SignalReturn(int signum) { + AA64Thread* thr = AuGetCurrentThread(); + AA64Registers* regs = (AA64Registers*)thr->sp; + memcpy(regs, &thr->signal.regs, sizeof(AA64Registers)); + thr->elr_el1 = thr->signal.elr_el1; + //thr->state = thr->signal.last_thread_state; + thr->x30 = regs->x30; +} + +/** + * @brief SendSignal -- send a signal to destination + * thread + * @param pid -- process id + * @param signum -- signal number + */ +int SendSignal(int pid, int signum) { + UARTDebugOut("Send signal called \r\n"); + AuProcess* proc = AuProcessFindPID(pid); + if (!proc) + return 1; + UARTDebugOut("Sending Signal to proc : %s \r\n", proc->name); + AA64Thread* mainthr = proc->main_thread; + if (!mainthr) + return 1; + return AuAllocSignal(mainthr, signum); +} + +/* + * SetSignal -- register a signal handler + * @param signo -- signal number + * @param handler -- handler to register + */ +int SetSignal(int signo, AuSignalHandler handler) { + AA64Thread* thr = AuGetCurrentThread(); + if (!thr) + return 0; + thr->sigs[signo] = (uint64_t*)handler; +} + +/** + * @brief Alarm -- schedules a timer for next one-shot + * @param seconds -- amount of second to consider + */ +int Alarm(uint64_t seconds) { + AA64Thread* thr = AuGetCurrentThread(); + if (!thr) + return 0; + return AuTimerCalculateAlarm(thr, seconds); +} + +int SetITimer(int which, const itimerval_t* new_value, itimerval_t* old_value) { + AA64Thread* thr = AuGetCurrentThread(); + if (!thr) + return 0; + UARTDebugOut("ITIMERVAL : itval.tv_sec : %d \r\n", new_value->it_value.tv_sec); + UARTDebugOut("ITIMERVAL : itval.tv_usec: %d \r\n", new_value->it_value.tv_usec); + UARTDebugOut("ITIMERVAL : interval.tv_sec : %d \r\n", new_value->it_interval.tv_sec); + UARTDebugOut("ITIMERVAL : interval.tv_usec: %d \r\n", new_value->it_interval.tv_usec); + return AuTimerSetITimer(thr, which, new_value, old_value); +} + +int GetITimer(int which, const itimerval_t* curr_value) { + AA64Thread* thr = AuGetCurrentThread(); + if (!thr) + return 0; + return AuTimerGetITimer(thr, which, curr_value); } \ No newline at end of file diff --git a/KernelAA64/Sound/sndcore.c b/KernelAA64/Sound/sndcore.c index de8197d50..17da6d830 100644 --- a/KernelAA64/Sound/sndcore.c +++ b/KernelAA64/Sound/sndcore.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,7 @@ #include #include #include +#include #define AURORA_MAX_SOUND_CARDS 256 diff --git a/KernelAA64/aucon.c b/KernelAA64/aucon.c index dacc231cf..ddafb4e02 100644 --- a/KernelAA64/aucon.c +++ b/KernelAA64/aucon.c @@ -30,7 +30,11 @@ **/ #include - +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include #include <_null.h> #include "font.h" @@ -43,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -290,6 +295,16 @@ void AuPutPixel(size_t x, size_t y, uint32_t col) { * @param c -- character to print */ void AuPutC(char c) { + if (early_) { + if (is_uart_initialized()) + uartPutc(c); + else if (_print_func) { + char buf[2] = {c, 0}; + _print_func(buf); + } + return; + } + if (console_x > v_res / 9) { console_x = 0; console_y++; @@ -311,22 +326,35 @@ void AuPutC(char c) { console_x++; uint32_t* lfb = aucon->buffer; - if (console_y + 1 > h_res / 16) + if (console_y + 1 > v_res / 16) { - for (int i = 16; i < h_res * v_res; i++) - lfb[i] = lfb[i + v_res * 16]; + for (int i = 0; i < (v_res - 16) * h_res; i++) + lfb[i] = lfb[i + h_res * 16]; + for (int i = (v_res - 16) * h_res; i < v_res * h_res; i++) + lfb[i] = CONSOLE_BACKGROUND; + for (int i = 0; i < h_res * (v_res - 16); i++) + lfb[i] = lfb[i + h_res * 16]; + + memset(lfb + h_res * (v_res - 16), 0, h_res * 16 * sizeof(uint32_t)); console_y--; } } - /** * @brief Prints string to console output * @param str -- string to print */ void AuPutS(char* str) { + if (early_) { + if (is_uart_initialized()) + uartPuts(str); + else if (_print_func) + _print_func(str); + return; + } + uint32_t* lfb = aucon->buffer; while (*str) { @@ -373,25 +401,99 @@ void AuPutS(char* str) { /* Scroll */ if (console_y + 1 > v_res / 16) { - for (int i = 16; i < v_res * h_res; i++) + for (int i = 0; i < (v_res - 16) * h_res; i++) + lfb[i] = lfb[i + h_res * 16]; + for (int i = (v_res - 16) * h_res; i < v_res * h_res; i++) + lfb[i] = CONSOLE_BACKGROUND; + for (int i = 0; i < h_res * (v_res - 16); i++) lfb[i] = lfb[i + h_res * 16]; + + memset(lfb + h_res * (v_res - 16), 0, h_res * 16 * sizeof(uint32_t)); console_y--; } } /** - * @brief AuTextOut -- standard text printing function - * for entire kernel - * @param text -- text to output + * @brief Prints string to console output + * @param str -- string to print + * @param col -- foreground color */ -void AuTextOut(const char* format, ...) { +void AuPutS_Color(char* str, uint32_t color) { if (early_) { if (is_uart_initialized()) - UARTDebugOut(format); - else - _print_func(format); + uartPuts(str); + else if (_print_func) + _print_func(str); return; } + + uint32_t* lfb = aucon->buffer; + while (*str) { + + if (*str > 0xFF) { + //unicode + } + else if (*str == '\n') { + ++console_y; + console_x = 0; + } + else if (*str == '\r') { + } + else if (*str == '\b') { + if (console_x > 0) + --console_x; + } + else { + + const bx_fontcharbitmap_t entry = bx_vgafont[*str]; + for (size_t y = 0; y < 16; ++y) { + + for (size_t x = 0; x < 8; ++x) { + + if (entry.data[y] & (1 << x)) { + AuPutPixel(x + console_x * 9, y + console_y * 16, color); + } + else { + AuPutPixel(x + console_x * 9, y + console_y * 16, CONSOLE_BACKGROUND); + } + } + AuPutPixel(8 + console_x * 9, y + console_y * 16, CONSOLE_BACKGROUND); + } + ++console_x; + if (console_x > h_res / 9) { + console_x = 0; + ++console_y; + } + } + + ++str; + } + + + /* Scroll */ + if (console_y + 1 > v_res / 16) + { + for (int i = 0; i < (v_res - 16) * h_res; i++) + lfb[i] = lfb[i + h_res * 16]; + for (int i = (v_res - 16) * h_res; i < v_res * h_res; i++) + lfb[i] = CONSOLE_BACKGROUND; + for (int i = 0; i < h_res * (v_res - 16); i++) + lfb[i] = lfb[i + h_res * 16]; + + memset(lfb + h_res * (v_res - 16), 0, h_res * 16 * sizeof(uint32_t)); + console_y--; + } +} + +#ifdef _MSC_VER +extern void store_x0_x7(uint64_t* buffer); +#endif +/** + * @brief AuTextOut -- standard text printing function + * for entire kernel + * @param text -- text to output + */ +void AuTextOut(const char* format, ...) { if (bypass_autextout) return; diff --git a/KernelAA64/audrv.c b/KernelAA64/audrv.c index db4b58b9b..59a653bad 100644 --- a/KernelAA64/audrv.c +++ b/KernelAA64/audrv.c @@ -34,6 +34,11 @@ #include #include #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include #include #include @@ -299,7 +304,7 @@ void AuDriverLoad(char* filename, AuDriver* driver) { size_t file_offset = 0; while (file->eof != 1) { uint64_t block = ((uint64_t)scratchBuffer + file_offset); - size_t bytes_read = AuVFSNodeReadBlock(fsys, file, block); + size_t bytes_read = AuVFSNodeReadBlock(fsys, file, (uint64_t*)block); if (bytes_read == 0) break; file_offset += bytes_read; } diff --git a/KernelAA64/circbuf.c b/KernelAA64/circbuf.c index b4fdf2f48..0c21ddd54 100644 --- a/KernelAA64/circbuf.c +++ b/KernelAA64/circbuf.c @@ -31,6 +31,11 @@ #include #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif /** * @brief AuAdvancePointer -- advances the pointer diff --git a/KernelAA64/dtb.c b/KernelAA64/dtb.c index ae6e19ca0..d9753bbef 100644 --- a/KernelAA64/dtb.c +++ b/KernelAA64/dtb.c @@ -252,6 +252,23 @@ uint64_t AuDeviceTreeGetRegSize(uint32_t* node, uint32_t addressCell, uint32_t s return 0; } +uint32_t* AuDeviceTreeGetPropCells(uint32_t* node, const char* property, uint32_t* out_num_cells) { + uint32_t* prop = AuDeviceTreeFindProperty(node, property); + if (!prop) { + *out_num_cells = 0; return NULL; + } + uint32_t len_bytes = AuDTBSwap32(prop[0]); + *out_num_cells = len_bytes / 4; + return &prop[2]; +} + +uint32_t AuDeviceTreeGetU32Property(uint32_t* node, const char* property, uint32_t default_val) { + if (!node) return default_val; + uint32_t* prop = AuDeviceTreeFindProperty(node, property); + if (!prop) return default_val; + return AuDTBSwap32(prop[2]); +} + /** * @brief AuDeviceTreeInitialize -- initialize the device tree * @param fdt_address -- device tree address passed by @@ -294,4 +311,76 @@ void AuDeviceTreeMapMMIO() { void* mmio = (void*)P2V((uint64_t)dtbAddress); //AuMapMMIO((uint64_t)dtbAddress, pageCount); dtbAddress = mmio; AuTextOut("[aurora]: Device tree mmio %x mapped with page count : %d \r\n",mmio, pageCount); +} + + +uint32_t* dump_recursive_(uint32_t* node, int depth); + +void AuDeviceTreeDumpAll() { + fdt_header_t* fdt = (fdt_header_t*)dtbAddress; + uint32_t* node = (uint32_t*)((uint64_t)dtbAddress + AuDTBSwap32(fdt->off_dt_struct)); + dump_recursive_(node, 0); +} + +uint32_t* dump_recursive_(uint32_t* node, int depth){ + while (AuDTBSwap32(*node) == 4) node++; + if (AuDTBSwap32(*node) != 1) return node; + node++; + + char* name = (char*)node; + for (int i = 0; i < depth; i++) AuTextOut(" "); + AuTextOut("[aurora]: node: \%s \r\n", name); + + while ((*node & 0xFF000000) && (*node & 0xFF0000) && (*node & 0xFF00) && (*node & 0xFF)) node++; + node++; + + while (1) { + while (AuDTBSwap32(*node) == 4)node++; + uint32_t tag = AuDTBSwap32(*node); + if (tag == 2) return node + 1; + if (tag == 9) return node; + if (tag == 3) { + uint32_t len = AuDTBSwap32(node[1]); + node += 3; + node += (len + 3) / 4; + } + else if (tag == 1) { + node = dump_recursive_(node, depth + 1); + } + else { + AuTextOut("[aurora]: UNKNOWN TAG %x at node %x - DESYNC \r\n", tag, (void*)node); + return node; + } + } +} + +void AuDeviceTreeDumpAllProps(const char* node_name) { + uint32_t* node = AuDeviceTreeGetNode(node_name); + if (!node) { + AuTextOut("[aurora]: AuDeviceTreeDumpAllProps: no node found : %s \r\n", node_name); + return; + } + + fdt_header_t* fdt = (fdt_header_t*)dtbAddress; + char* strings = (char*)((uint64_t)dtbAddress + AuDTBSwap32(fdt->off_dt_strings)); + + while ((*node & 0xFF000000) && (*node & 0xFF0000) && (*node & 0xFF00) && (*node & 0xFF)) node++; + node++; + + AuTextOut("[aurora]: properties of \%s: \r\n", node_name); + while (1) { + while (AuDTBSwap32(*node) == 4) node++; + uint32_t tag = AuDTBSwap32(*node); + if (tag == 2 || tag == 9)break; + if (tag == 3) { + uint32_t len = AuDTBSwap32(node[1]); + uint32_t nameoff = AuDTBSwap32(node[2]); + AuTextOut("[aurora]: \%s\" (len=%d)\r\n", strings + nameoff, len); + node += 3; + node += (len + 3) / 4; + } + else { + break; + } + } } \ No newline at end of file diff --git a/KernelAA64/hashmap.c b/KernelAA64/hashmap.c index 5f31d165d..ba54df12c 100644 --- a/KernelAA64/hashmap.c +++ b/KernelAA64/hashmap.c @@ -136,14 +136,12 @@ void* AuHashmapSet(hashmap_t* map, const void* key, void* value) { void* AuHashmapGet(hashmap_t* map, const void* key) { unsigned int hash = map->hash_func(key) % map->size; - UARTDebugOut("Hashget hash : %d \r\n", hash); hashmap_entry_t* x = map->entries[hash]; if (!x) { return NULL; } else { do { - UARTDebugOut("Hasmap hash key : %x \r\n", x->key); if (map->hash_comp(x->key, key)) return x->value; x = x->next; diff --git a/KernelAA64/init.c b/KernelAA64/init.c index 375a4ddd7..cb847e239 100644 --- a/KernelAA64/init.c +++ b/KernelAA64/init.c @@ -69,6 +69,8 @@ #include #include #include +// #include +#include extern int _fltused = 1; static bool _littleboot_used; @@ -109,7 +111,6 @@ int i_ = 1; extern void sub_rsp(); void AuEntryTest(uint64_t test) { - //aa64_utest(); int c = 10; //enable_irqs(); AuTextOut("[aurora]: test2 \r\n"); @@ -197,6 +198,7 @@ void _AuMain(KERNEL_BOOT_INFO* info) { #endif AuConsoleInitialize(info, true); + B_KLogInit(); AuDeviceTreeInitialize(info); AA64CpuInitialize(); mask_irqs(); @@ -210,10 +212,11 @@ void _AuMain(KERNEL_BOOT_INFO* info) { AA64CPUPostInitialize(info); AuTextOut("Initializing VFS \r\n"); AuVFSInitialise(); - AuTextOut("[aurora]: VFS initialized \r\n"); AuInitrdInitialize(info); AuConsolePostInitialise(info); //AuConsoleBypassAuTextOut(); + + AuroraTimerInitialize(); /* initialize the tty service */ @@ -250,6 +253,7 @@ void _AuMain(KERNEL_BOOT_INFO* info) { /* required virtio-mouse and keyboard */ //Here goes board pre driver initialize AuDrvMngrInitialize(info); + UARTDebugOut("[aurora]: driver initialized \r\n"); FontManagerInitialise(); @@ -276,22 +280,21 @@ void _AuMain(KERNEL_BOOT_INFO* info) { #endif UARTDebugOut("[aurora]: starting xeneva (ARM64) please wait...\r\n"); - /* clear out the lower half memory */ AuVmmngrBootFree(); + UARTDebugOut("this"); AuMmngrFileCacheEnable(); UARTDebugOut("[aurora]: boot freed up \r\n"); AuSchedulerInitialize(); - AuProcess* proc = AuCreateProcessSlot(0, "exec"); int num_args = 1; - char* about = (char*)kmalloc(strlen("-about")); + char* about = (char*)kmalloc(strlen("-about") + 1); strcpy(about, "-about"); char** argvs = (char**)kmalloc(num_args * sizeof(char*)); - memset(argvs, 0, num_args); + memset(argvs, 0, num_args * sizeof(char*)); argvs[0] = about; /** make init process, as root of all */ @@ -302,7 +305,6 @@ void _AuMain(KERNEL_BOOT_INFO* info) { #ifdef __KERNEL_PROFILER_ON__ PROFILE_END("_AuMain"); #endif - AuSchedulerStart(); while (1) { //UARTDebugOut("Printing \n"); diff --git a/KernelAA64/loader.c b/KernelAA64/loader.c index 8b4ac6356..676c75d8e 100644 --- a/KernelAA64/loader.c +++ b/KernelAA64/loader.c @@ -44,6 +44,7 @@ #include #include <_null.h> #include +#include #define LOADER_SCRATCH_VIRT 0xFFFFC00000700000 @@ -83,40 +84,61 @@ void testFunc(uint64_t x0, uint64_t x1) { void AuProcessEntUser(uint64_t rcx) { mask_irqs(); AA64Thread* t = AuGetCurrentThread(); + t->start_time_us = AuGetCurrentUS(); AuUserEntry* uentry = t->uentry; uentry->rsp -= 32; PUSHALIGN(uentry->rsp, 16); t->first_run = 1; - /* do all arguments passing stuff, arguments - * are passed as strings to stack + + /* + * ARM64 ABI: argc and argv must be placed on the user stack so that + * crt0arm64.s can pop them via: ldp x0, x1, [sp], #16 + * + * Step 1: Push each argument string onto the user stack (grow downward). + * Record the resulting user-space SP as argv[i] in the + * user-mapped argvaddr page. + * Step 2: Push argc and argv_ptr (argvaddr) onto the user stack. + * Step 3: Free kernel-side copies AFTER we have finished reading them. */ - char** argvs = (char**)uentry->argvaddr; - for (int i = 0; i < uentry->num_args; i++) { + /* Step 1 — push strings and record user-space pointers */ + char** argvs = (char**)uentry->argvkernel; /* kernel-accessible VA of argv[] page */ + for (int i = uentry->num_args - 1; i >= 0; i--) { char* str = uentry->argvs[i]; - for (int j = strlen(str); j >= 0; j--) { + int slen = strlen(str); + /* push null terminator first, then chars in reverse so string + * reads forward at lower address after push */ + PUSH(uentry->rsp, char, '\0'); + for (int j = slen - 1; j >= 0; j--) { PUSH(uentry->rsp, char, str[j]); } + /* record the user-space address of this string */ argvs[i] = (char*)uentry->rsp; } - /* I think this code should be placed in _KeProcessExit */ + /* Step 2 — align, then push argv_ptr and argc */ + PUSHALIGN(uentry->rsp, 16); + PUSH(uentry->rsp, size_t, (size_t)uentry->argvaddr); /* x1 = argv */ + PUSH(uentry->rsp, size_t, (size_t)uentry->num_args); /* x0 = argc */ + PUSHALIGN(uentry->rsp, 16); + + /* Step 3 — free kernel-side argv copies (no longer needed) */ if (uentry->argvs) { for (int i = 0; i < uentry->num_args; i++) { - //uint64_t addr = (uint64_t)uentry->argvs[i]; kfree(uentry->argvs[i]); } - void* address = (void*)uentry->argvs; - kfree(address); + kfree(uentry->argvs); } - PUSHALIGN(uentry->rsp, 16); uentry->argvs = 0; - PUSH(uentry->rsp, size_t, (size_t)uentry->argvaddr); - PUSH(uentry->rsp, size_t, (size_t)uentry->num_args); - PUSHALIGN(uentry->rsp, 16); + + UARTDebugOut("[loader]: entering user: sp=%x entry=%x argc=%d argv=%x\r\n", + uentry->rsp, uentry->entrypoint, uentry->num_args, uentry->argvaddr); + + uint64_t* check_sp = (uint64_t*)uentry->rsp; + UARTDebugOut("[loader]: stack check [0]: %x, [1]: %x\r\n", check_sp[0], check_sp[1]); + aa64_enter_user(uentry->rsp, uentry->entrypoint); - while (1) { - } + while (1) {} } /** @@ -134,37 +156,42 @@ void AuLoaderMapExecFromCache(AuProcess* proc, AuMMFileBack *fb,PIMAGE_NT_HEADER UARTDebugOut("Name : %s \r\n", fb->file->filename); for (size_t i = 0; i < nt->FileHeader.NumberOfSections; ++i) { size_t load_addr = _image_base_ + secthdr[i].VirtualAddress; - void* sect_addr = (void*)load_addr; - size_t sectsz = secthdr[i].VirtualSize; - int req_pages = sectsz / 4096 + - ((sectsz % 4096) ? 1 : 0); - uint64_t* block = 0; - int physFrameIndex = 0; - size_t rawSize = secthdr[i].SizeOfRawData; size_t virtSize = secthdr[i].VirtualSize; + size_t rawSize = secthdr[i].SizeOfRawData; size_t fileOffset = secthdr[i].PointerToRawData; - int page_index = fileOffset / PAGE_SIZE; - AuMMPageCache* cache = AuMmngrFileCacheGetByIndex(fb, page_index); - if (secthdr[i].Characteristics & IMAGE_SCN_MEM_WRITE) { - for (int j = 0; j < req_pages; j++) { - uint64_t alloc = (load_addr + j * 0x1000); - uint64_t phys = P2V((size_t)AuPmmngrAlloc()); - AuMapPageEx(proc->cr3, V2P(phys), alloc, PTE_USER_EXECUTABLE | PTE_AP_RW_USER | PTE_NORMAL_MEM); - if (!block) - block = (uint64_t*)phys; - memcpy(phys, (void*)P2V(cache->physicalPage), PAGE_SIZE); - physFrameIndex++; - cache = cache->next; + + /* Ensure all pages for this section's virtual address range are mapped */ + size_t end_addr = load_addr + virtSize; + for (size_t v_page = (load_addr & ~0xFFFULL); v_page < end_addr; v_page += PAGE_SIZE) { + void* phys = AuGetPhysicalAddressEx(proc->cr3, v_page); + if (!phys) { + phys = AuPmmngrAlloc(); + memset((void*)P2V((size_t)phys), 0, PAGE_SIZE); + AuMapPageEx(proc->cr3, (uint64_t)phys, v_page, PTE_USER_EXECUTABLE | PTE_AP_RW_USER | PTE_NORMAL_MEM); } } - else { - for (int j = 0; j < req_pages; j++) { - uint64_t alloc = (load_addr + j * 0x1000); - uint64_t phys = cache->physicalPage; //P2V((size_t)AuPmmngrAlloc()); - AuMapPageEx(proc->cr3, phys, alloc, PTE_USER_EXECUTABLE | PTE_AP_RW_USER | PTE_NORMAL_MEM); - physFrameIndex++; - cache = cache->next; + + /* Copy data from the scratch buffer to the mapped pages, handling boundaries */ + size_t bytes_to_copy = rawSize; + size_t current_vaddr = load_addr; + size_t current_file_offset = fileOffset; + while (bytes_to_copy > 0) { + size_t page_offset = current_vaddr & 0xFFF; + size_t bytes_in_this_page = PAGE_SIZE - page_offset; + if (bytes_in_this_page > bytes_to_copy) { + bytes_in_this_page = bytes_to_copy; + } + + void* phys = AuGetPhysicalAddressEx(proc->cr3, current_vaddr); + if (phys) { + void* dest = (void*)(P2V((size_t)phys) + page_offset); + void* src = (void*)((uint64_t)_ldr_scratchBuffer + current_file_offset); + memcpy(dest, src, bytes_in_this_page); } + + current_vaddr += bytes_in_this_page; + current_file_offset += bytes_in_this_page; + bytes_to_copy -= bytes_in_this_page; } } } @@ -230,7 +257,7 @@ int AuLoadExecToProcess(AuProcess* proc, char* filename, int argc, char** argv) size_t file_offset = 0; while (file->eof != 1) { uint64_t block = ((uint64_t)_ldr_scratchBuffer + file_offset); - size_t bytes_read = AuVFSNodeReadBlock(fsys, file, block); + size_t bytes_read = AuVFSNodeReadBlock(fsys, file, (uint64_t*)block); if (bytes_read == 0) break; file_offset += bytes_read; } @@ -248,14 +275,14 @@ int AuLoadExecToProcess(AuProcess* proc, char* filename, int argc, char** argv) size_t copy_sz = PAGE_SIZE; if (i == total_pages - 1 && (file_offset % PAGE_SIZE) != 0) copy_sz = file_offset % PAGE_SIZE; - memcpy(P2V(physcache), (void*)((uint64_t)_ldr_scratchBuffer + i * PAGE_SIZE), copy_sz); + memcpy((void*)P2V(physcache), (void*)((uint64_t)_ldr_scratchBuffer + i * PAGE_SIZE), copy_sz); } fb->readComplete = true; } else { AuMMPageCache* pcache = fb->pageCache; size_t file_offset = 0; while (pcache != NULL) { - memcpy((void*)((uint64_t)_ldr_scratchBuffer + file_offset), P2V(pcache->physicalPage), PAGE_SIZE); + memcpy((void*)((uint64_t)_ldr_scratchBuffer + file_offset), (void*)P2V(pcache->physicalPage), PAGE_SIZE); file_offset += PAGE_SIZE; pcache = pcache->next; } @@ -267,7 +294,7 @@ int AuLoadExecToProcess(AuProcess* proc, char* filename, int argc, char** argv) PIMAGE_NT_HEADERS nt = RAW_OFFSET(PIMAGE_NT_HEADERS,dos, dos->e_lfanew); PSECTION_HEADER secthdr = RAW_OFFSET(PSECTION_HEADER,&nt->OptionalHeader, nt->FileHeader.SizeOfOptionaHeader); - uint64_t _image_base_ = 0x60000000000;// nt->OptionalHeader.ImageBase; + uint64_t _image_base_ = 0x600000000;// nt->OptionalHeader.ImageBase; entry ent = (entry)(nt->OptionalHeader.AddressOfEntryPoint + _image_base_);//nt->OptionalHeader.ImageBase); //AuTextOut("Image base address : %x \n", dos->e_magic); uint64_t* cr3 = proc->cr3; @@ -344,23 +371,28 @@ int AuLoadExecToProcess(AuProcess* proc, char* filename, int argc, char** argv) uentry->stackBase = proc->_main_stack_; int num_args = argc; uint64_t argvaddr = 0; + uint64_t argvkernel = 0; if (num_args) { /* Allocate a memory for passing arguments */ uint64_t* args = (uint64_t*)P2V((size_t)AuPmmngrAlloc()); memset(args, 0, PAGE_SIZE); - if (!AuMapPageEx(proc->cr3, (size_t)V2P((uint64_t)args), 0x40000000000,PTE_AP_RW_USER | PTE_NORMAL_MEM)) { + if (!AuMapPageEx(proc->cr3, (size_t)V2P((uint64_t)args), 0x40000000000, PTE_AP_RW_USER | PTE_NORMAL_MEM)) { UARTDebugOut("Arguments address already mapped \n"); argvaddr = 0; + argvkernel = 0; } else { - argvaddr = 0x40000000000; + argvaddr = 0x40000000000; /* user-space VA for crt0 */ + argvkernel = (uint64_t)args; /* kernel-space VA for AuProcessEntUser to write */ } } uentry->argvaddr = argvaddr; + uentry->argvkernel = argvkernel; uentry->num_args = num_args; uentry->argvs = argv; thr->uentry = uentry; proc->main_thread = thr; + thr->procSlot = proc; file->current = file->first_block; file->eof = 0; #ifdef __KERNEL_PROFILER_ON__ diff --git a/KernelAA64/pcie.c b/KernelAA64/pcie.c index 344a3a9ac..c8cd6b7e1 100644 --- a/KernelAA64/pcie.c +++ b/KernelAA64/pcie.c @@ -55,7 +55,7 @@ static int _pcie_check_and_map_dtb() { return 1; } AuTextOut("[aurora]: pcie found \r\n"); -#ifdef __TARGET_BOARD_QEMU_VIRT__ +#ifdef __TARGET_BOARD_QEMU_VIRT__ /* else need to parse the DTB for */ uint32_t addressCell = AuDeviceTreeGetAddressCells(pcie); uint32_t sizeCell = AuDeviceTreeGetSizeCells(pcie); @@ -65,9 +65,11 @@ static int _pcie_check_and_map_dtb() { AuTextOut("[aurora]: ecam address : %x, size value : %x \n", ecamAddr, sizeValue); /** in qemu, ecam address is 256 mb so 0x10000 number of pages */ - _ecamAddress = AuMapMMIO(ecamAddr, 0x10000); -#endif + if (ecamAddr != 0) + _ecamAddress = (uint64_t)AuMapMMIO(ecamAddr, 0x10000); + _pcieInitialized = 1; +#endif return 0; } @@ -127,7 +129,6 @@ void AA64PCIeInitialize() { AuTextOut("[aurora]: Ki koriba aru !! Eku dekhun device discovery mechanism support nokore !! Baad diya \r\n"); AuTextOut("[aurora]: Ponta Bhaat khuwa ge \r\n"); _pcieInitialized = 0; - for (;;); return; } @@ -250,15 +251,15 @@ uint32_t AuPCIERead(uint64_t device, int reg, int bus, int dev, int func) { break; } if (size == 1) { - result = *RAW_OFFSET(volatile uint8_t*, device, reg); + result = *RAW_OFFSET(volatile uint8_t*, device, ®); return result; } else if (size == 2) { - result = *RAW_OFFSET(volatile uint16_t*, device, reg); + result = *RAW_OFFSET(volatile uint16_t*, device, ®); return result; } else if (size == 4) { - result = *RAW_OFFSET(volatile uint32_t*,device, reg); + result = *RAW_OFFSET(volatile uint32_t*,device, ®); return result; } diff --git a/KernelAA64/pe.c b/KernelAA64/pe.c index f3d7283c7..a7e2786ee 100644 --- a/KernelAA64/pe.c +++ b/KernelAA64/pe.c @@ -34,6 +34,11 @@ #include #include #include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include #define IMAGE_DOS_SIGNATURE 0x5A4D @@ -364,4 +369,5 @@ bool AuCoffResolveAddress(uint8_t* imageBase, uint64_t paddr) { else UARTDebugOut("[aurora]: pe symbol , offset : %x \r\n", rva); + return 1; } \ No newline at end of file diff --git a/KernelAA64/power.c b/KernelAA64/power.c index a513ef1fa..3ed00952e 100644 --- a/KernelAA64/power.c +++ b/KernelAA64/power.c @@ -83,6 +83,9 @@ int AuPowerDown() { tlb_flush_vmalle1is(); AuAA64BoardPowerDown(); + + //false here + return 1; } /** diff --git a/KernelAA64/process.c b/KernelAA64/process.c index 962e5e62e..b87ac5499 100644 --- a/KernelAA64/process.c +++ b/KernelAA64/process.c @@ -29,20 +29,30 @@ * **/ +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif #include #include #include #include #include +#include #include #include #include <_null.h> #include +#include #include #include #include #include #include +#include +#include +#include static int pid = 1; @@ -245,6 +255,8 @@ AuProcess * AuCreateProcessSlot(AuProcess * parent, char* name) { proc->proc_heapmem_len = 0; proc->_kstack_index_ = 1; proc->_main_stack_ = main_thr_stack; + proc->prev_sample_time_us = AuGetCurrentUS(); + proc->prev_sample_runtime_us = 0; uint64_t* envpBlock = (uint64_t*)P2V((size_t)AuPmmngrAlloc()); memset(envpBlock, 0, PAGE_SIZE); @@ -308,9 +320,7 @@ int AuCreateUserthread(AuProcess* proc, void(*entry) (), char* name) uint64_t kstack = stack; stack = ((uint64_t)kstack & ~(uint64_t)0xF); stack -= 64; - UARTDebugOut("User stack created %x \r\n", stack); AA64Thread* thr = AuCreateSubKthread(AuProcessEntUser,stack,proc->cr3, name); - UARTDebugOut("[aurora]: user thread created \r\n"); thr->threadType = THREAD_LEVEL_USER; thr->first_run = 0; thr->procSlot = proc; @@ -320,9 +330,7 @@ int AuCreateUserthread(AuProcess* proc, void(*entry) (), char* name) uentry->entrypoint = (uint64_t)entry; uentry->argvs = 0; uentry->num_args = 0; - UARTDebugOut("[aurora]: creating user stack for user thread cr3 : %x %x\r\n",proc->cr3, V2P((uint64_t)thr->pml)); uentry->rsp = (uint64_t)CreateSubUserStack(proc, proc->cr3); - UARTDebugOut("[aurora]:User stack created : %x main_stack : %x \r\n", uentry->rsp, proc->_main_stack_); uentry->stackBase = uentry->rsp; thr->uentry = uentry; int thread_indx = proc->num_thread; @@ -407,6 +415,7 @@ void AuProcessExit(AuProcess* proc, bool schedulable) { } /** free up all allocated files by this process **/ + BordoisilaCapCleanupProcess(proc); for (int i = 0; i < FILE_DESC_PER_PROCESS; i++) { AuVFSNode* file = proc->fds[i]; if (file) { @@ -487,7 +496,7 @@ AuProcess* AuGetKillableProcess() { * @param pid -- pid of the process, if -1 then any child * process */ -void AuProcessWaitForTermination(AuProcess* proc, int pid) { +int AuProcessWaitForTermination(AuProcess* proc, int pid) { if (pid == -1) { do { AuProcess* killable = AuGetKillableProcess(); @@ -499,19 +508,105 @@ void AuProcessWaitForTermination(AuProcess* proc, int pid) { if (!killable) { - AuSleepThread(proc->main_thread, 10); proc->state = PROCESS_STATE_SUSPENDED; - return; + //AuScheduleNext(); + return -1; } } while (1); } else { AuProcess* proc = AuProcessFindByPID(0, pid); if (!proc) - return; + return -1; AA64Thread* thr = AuGetCurrentThread(); AuBlockThread(thr); list_add(proc->waitlist, thr); - return; + return 1; + } + return 0; +} + +/** + * @brief AuProcGetNumProcessCount -- returns the total number + * of process created + */ +int AuProcGetNumProcessCount() { + int count = 0; + for (AuProcess* first = proc_first; first != NULL; first = first->next) + count++; + return count; +} + +static int AuProcGetOpenFileCount(AuProcess* proc) { + int count = 0; + for (int i = 0; i < FILE_DESC_PER_PROCESS; i++) { + if (!proc->fds[i]) + continue; + + count += 1; } + return count; +} + +static uint64_t AuProcessGetLiveRuntime(AuProcess* proc, uint64_t now_us) { + uint64_t runtime = proc->total_runtime_us; + if (proc->main_thread->state == THREAD_STATE_RUNNING) + runtime += (now_us - proc->main_thread->start_time_us); + for (int i = 0; i < proc->num_thread; i++) { + AA64Thread* thr = proc->threads[i]; + if (!thr) + continue; + if (thr->state == THREAD_STATE_RUNNING) + runtime += (now_us - thr->start_time_us); + + } + return runtime; +} + + +static uint32_t AuProcessUpdateCPUPercent(AuProcess* proc, uint64_t now) { + uint64_t live_runtime = AuProcessGetLiveRuntime(proc, now); + + uint64_t runtime_delta = live_runtime - proc->prev_sample_runtime_us; + uint64_t time_delta = now - proc->prev_sample_time_us; + + if (time_delta == 0) + proc->cpu_usage = 0; + else + proc->cpu_usage = (uint32_t)((runtime_delta * 1000) / time_delta);// * num_cores ); + + proc->prev_sample_runtime_us = live_runtime; + proc->prev_sample_time_us = now; + return proc->cpu_usage; +} +/** + * @brief AuProcessFetch -- fetch current process table + * status + * @param list -- Pointer to AuProcessList + * @param num_proc_count -- number of process count + */ +int AuProcessFetch(AuProcessList* list, int num_proc_count) { + + AuProcess* first = proc_first; + uint64_t now = AuGetCurrentUS(); + + for (int i = 0; i < num_proc_count; i++) { + if (!first) + break; + size_t namelen = strlen(first->name); + if (namelen >= sizeof(list[i].name)) + namelen = sizeof(list[i].name) - 1; + memcpy(list[i].name, first->name, namelen); + list[i].name[namelen] = '\0'; + list[i].num_file_opened = AuProcGetOpenFileCount(first); + list[i].num_threads = first->num_thread; + list[i].proc_id = first->proc_id; + list[i].total_runtime_us = first->total_runtime_us; + list[i].window_runtime_us = first->window_runtime_us; + first->cpu_usage = AuProcessUpdateCPUPercent(first, now); + list[i].cpu_usage = first->cpu_usage; + first = first->next; + } + + return 0; } \ No newline at end of file diff --git a/KernelAA64/signal.c b/KernelAA64/signal.c new file mode 100644 index 000000000..cd123b89d --- /dev/null +++ b/KernelAA64/signal.c @@ -0,0 +1,126 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#include +#include +#include +#include +#include +#include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif + + +extern void aa64_signal_return(); +/** + * @brief AuAllocSignal -- allocate a signal for destination + * thread + * @param thr -- destination thread + * @param signum -- signal number + */ +int AuAllocSignal(AA64Thread* thr, int signum) { + if (!thr) + return 1; + + if (signum <= 0) + return 1; + + if (signum > SIGTTOU) + return 1; + + /* check if all tokens are sold out !!*/ + + /** let's go with standard posix signal **/ + thr->sig_pending |= (1UL << signum); + + AuThreadMakeReady(thr); + return 0; +} + +static inline int ctzl(uint64_t x) { + if (x == 0) return 64; + int n = 0; + while (!(x & 1UL)) { + x >>= 1; + n++; + } + return n; +} +/** + * @brief AuSignalDispatch -- dispatch a signal + * @param thr -- pointer to thread + */ +int AuSignalDispatch(AA64Thread* thr) { + //lock here + int result = 0; + uint64_t deliverable = thr->sig_pending; + if (deliverable) { + int signo = ctzl(deliverable); + thr->sig_pending &= ~(1UL << signo); + result = signo; + } + //unlock here + //UARTDebugOut("SignalDispatch sig number : %d \r\n", result); + return result; +} + +/** + * @brief AuSignalDeliver -- deliver the current thread's + * signal + * @param current_thread -- pointer to thread + */ +bool AuSignalDeliver(AA64Thread* current_thread) { + int signo; + while ((signo = AuSignalDispatch(current_thread)) != 0) { + if (signo > SIGHUP || signo < SIGTTOU) { + AA64Registers* regs_ = (AA64Registers*)current_thread->sp; + memcpy(¤t_thread->signal.regs, regs_, sizeof(AA64Registers)); + current_thread->signal.elr_el1 = current_thread->elr_el1; + current_thread->elr_el1 = (uint64_t)current_thread->sigs[signo]; + regs_->x30 = current_thread->signal.sigret_address; + return true; + } + } + return false; +} + +/** + * @brief AuSignalInitializeTrampoline -- installs + * return trampoline code to threads sig return address + * @param t -- pointer to thread struct + */ +void AuSignalInitializeTrampoline(AA64Thread* t) { + uint64_t* phys = (uint64_t*)P2V((uint64_t)AuPmmngrAlloc()); + memcpy(phys, &aa64_signal_return, PAGE_SIZE); + AuMapPageEx((uint64_t*)t->pml, V2P((uint64_t)phys), 0xD0000000, PTE_USER_EXECUTABLE | PTE_NORMAL_MEM | PTE_AP_RW_USER); + t->signal.sigret_address = 0xD0000000; +} diff --git a/KernelAA64/stack.c b/KernelAA64/stack.c index 78687f2c7..486cbe4f6 100644 --- a/KernelAA64/stack.c +++ b/KernelAA64/stack.c @@ -33,6 +33,7 @@ #include #include #include <_null.h> +#include /** * @brief AuStackCreate -- create a new stack @@ -51,8 +52,14 @@ AuStack* AuStackCreate() { void AuStackPush(AuStack* stack, void* data) { AuStackItem* newItem = (AuStackItem*)kmalloc(sizeof(AuStackItem)); newItem->data = data; - newItem->link = stack->top; - stack->top = newItem; + newItem->link = NULL; + + if (stack->bottom) + stack->bottom->link = newItem; + else + stack->top = newItem; + + stack->bottom = newItem; stack->itemCount += 1; } @@ -64,12 +71,15 @@ void* AuStackPop(AuStack* stack) { void* data = NULL; if (!stack->top) return NULL; + UARTDebugOut("Stack Pop here \r\n"); AuStackItem* si; si = stack->top; - stack->top = stack->top->link; + stack->top = si->link; + if (!stack->top) + stack->bottom = NULL; si->link = NULL; + stack->itemCount--; data = si->data; kfree(si); - stack->itemCount--; return data; } \ No newline at end of file diff --git a/KernelAA64/string.c b/KernelAA64/string.c index 649e44875..4bb82866a 100644 --- a/KernelAA64/string.c +++ b/KernelAA64/string.c @@ -5,6 +5,7 @@ #include <_null.h> #include #include +#include #define MAX_STRING_LENGTH 4095 @@ -12,7 +13,8 @@ typedef size_t WT; #define WS (sizeof(WT)) -void memset(void* targ, int val, uint32_t len) { + +void memset(void* targ, int val, uint32_t len) { /*uint8_t* t = (uint8_t*)targ; while (len--) *t++ = (unsigned char*)val;*/ @@ -45,6 +47,7 @@ void memset(void* targ, int val, uint32_t len) { *t++ = byte_val; } + int memcmp(const void* first, const void* second, size_t length) { size_t count; for (count = 0; count < length; count++) @@ -66,10 +69,11 @@ int memcmp(const void* first, const void* second, size_t length) { } -void memcpy(void* __restrict dest, void* __restrict src, size_t len) { +void* memcpy(void* __restrict dest, void* __restrict src, size_t len) { //_fastcpy(dest, src, count); - //uint8_t* t = (uint8_t*)dest; - //uint8_t* s = (uint8_t*)src; + + //volatile uint8_t* t = (volatile uint8_t*)dest; + //const volatile uint8_t* s = (const volatile uint8_t*)src; //if (len > 0) { // // check to see if target is in the range of src and if so, do a memmove() instead // if ((t > s) && (t < (s + len))) { @@ -83,10 +87,10 @@ void memcpy(void* __restrict dest, void* __restrict src, size_t len) { // *t++ = *s++; // } //} - uint8_t* t = (uint8_t*)dest; - const uint8_t* s = (const uint8_t*)src; + volatile uint8_t* t = (volatile uint8_t*)dest; + const volatile uint8_t* s = (const volatile uint8_t*)src; - if (len == 0 || dest == src) return; + if (len == 0 || dest == src) return NULL; if ((t > s) && (t < (s + len))) { t += len; @@ -99,8 +103,8 @@ void memcpy(void* __restrict dest, void* __restrict src, size_t len) { if (len >= 8) { uint32_t blocks = len / 8; - uint64_t* t64 = (uint64_t*)t; - const uint64_t* s64 = (const uint64_t*)s; + volatile uint64_t* t64 = (volatile uint64_t*)t; + const volatile uint64_t* s64 = (const volatile uint64_t*)s; while (blocks--) *(--t64) = *(--s64); @@ -122,8 +126,8 @@ void memcpy(void* __restrict dest, void* __restrict src, size_t len) { if (len >= 8) { uint32_t blocks = len / 8; - uint64_t* t64 = (uint64_t*)t; - const uint64_t* s64 = (const uint64_t*)s; + volatile uint64_t* t64 = (volatile uint64_t*)t; + const volatile uint64_t* s64 = (const volatile uint64_t*)s; while (blocks--) *t64++ = *s64++; @@ -165,6 +169,17 @@ char* strcpy(char* __restrict s1, const char* __restrict s2) return s1_p; } +char* strrchr(const char* str, int c) { + const char* last = NULL; + + do { + if (*str == (char)c) { + last = str; + } + } while (*str++ != '\0'); + return (char*)last; +} + size_t strlen(const char* s) { const char* a = s; @@ -254,6 +269,7 @@ char* strcat(char* destString, const char* sourceString) return (destString); } + char* strncat(char* destString, const char* sourceString, size_t maxLength) { unsigned count1, count2; diff --git a/KernelAA64/timer.c b/KernelAA64/timer.c index 70238c667..f8e9feeca 100644 --- a/KernelAA64/timer.c +++ b/KernelAA64/timer.c @@ -34,10 +34,18 @@ #include #include #include +#include <_null.h> +#include +#if defined(__GNUC__) || defined(__clang__) +#ifndef __cplusplus +#include +#endif +#endif static AuKernelTimer _timers[AURORA_MAX_TIMER]; static uint64_t _system_current_us; static uint64_t _system_current_ms; +static void AuWalltimeUpdate(); static inline uint64_t _get_current_us() { uint64_t cnt = get_cntpct_el0(); @@ -49,6 +57,16 @@ static inline uint64_t _get_current_ms() { return _get_current_us() / 1000; } +typedef struct _clock_state_ { + uint64_t cycle_last; + uint64_t mult; + uint32_t shift; + int64_t wall_sec; + int64_t wall_nsec; +}AuClockState; + +static AuClockState wallClock; + /** * @brief AuroraTimerInitialize -- initialize aurora * timer @@ -58,6 +76,8 @@ void AuroraTimerInitialize() { memset(&_timers[i], 0, sizeof(AuKernelTimer)); _system_current_us = 0; _system_current_ms = 0; + wallClock.shift = 32; + wallClock.mult = ((uint64_t)1000000000ULL << wallClock.shift) / (AA64CPUGetFreqencyHz() * 10000); } /** @@ -143,6 +163,9 @@ void AuroraTimerTick() { _system_current_us = now; _system_current_ms = _get_current_ms(); + //update the wall time + AuWalltimeUpdate(); + for (int i = 0; i < AURORA_MAX_TIMER; i++) { if (!_timers[i].active) continue; if (now < _timers[i].expireUS) continue; @@ -168,3 +191,203 @@ uint64_t AuGetCurrentUS() { return _system_current_us; } +void __kernel_timer_alarm_callback(void* param) { + AA64Thread* thr = (AA64Thread*)param; + AuAllocSignal(thr, SIGALRM); +} + +/** + * @brief AuTimerCalculateAlarm -- schedule a timer to one-shot mode + * respective to given seconds + * @param thr -- pointer to thread which requires one-shot timer + * @param seconds -- amount of second to wait + */ +int AuTimerCalculateAlarm(AA64Thread* thr, uint64_t seconds) { + uint64_t now = _get_current_us(); + int remaining_sec = 0; + + int existing_idx = -1; + for (int i = 0; i < AURORA_MAX_TIMER; i++) { + if (_timers[i].active && _timers[i].owner == thr && + _timers[i].handler == __kernel_timer_alarm_callback) { + existing_idx = i; + break; + } + } + + if(existing_idx != -1) { + if (_timers[existing_idx].expireUS > now) { + uint64_t remaining_us = _timers[existing_idx].expireUS - now; + remaining_sec = (remaining_us + 999999) / 1000000; + } + _timers[existing_idx].active = 0; + _timers[existing_idx].owner = NULL; + } + + if (seconds == 0) + return remaining_sec; + + int free_idx = -1; + for (int i = 0; i < AURORA_MAX_TIMER; i++) { + if (!_timers[i].active) { + free_idx = i; + break; + } + } + + if (free_idx == -1) + return remaining_sec; + + _timers[free_idx].expireUS = now + (seconds * 1000000ULL); + _timers[free_idx].intervalUS = 0; + _timers[free_idx].handler = __kernel_timer_alarm_callback; + _timers[free_idx].param = (void*)thr; + _timers[free_idx].owner = thr; + _timers[free_idx].active = 1; + + return remaining_sec; +} + + +static inline uint64_t _timeval_to_us(const timeval_t* tv) { + return (uint64_t)tv->tv_sec * 1000000ULL; +} + +static inline uint64_t _us_to_timeval(uint64_t us, timeval_t* tv) { + tv->tv_sec = us / 1000000ULL; + tv->tv_usec = us % 1000000ULL; + return 0; +} + +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +/** + *@brief AuTimerSetITimer -- posix standard implementation of + * setting periodic timer + */ +int AuTimerSetITimer(AA64Thread* thr, int which, const itimerval_t* newval, itimerval_t* oldval) { + if (which != ITIMER_REAL) + return -1; + + uint64_t now = _get_current_us(); + + int idx = -1; + for (int i = 0; i < AURORA_MAX_TIMER; i++) { + if (_timers[i].active && _timers[i].owner == thr && + _timers[i].handler == __kernel_timer_alarm_callback) { + idx = i; + break; + } + } + + if (oldval) { + if (idx != -1 && _timers[idx].expireUS > now) { + _us_to_timeval(_timers[idx].expireUS - now, &oldval->it_value); + } + else { + oldval->it_value.tv_sec = 0; + oldval->it_value.tv_usec = 0; + } + _us_to_timeval(_timers[idx != -1 ? idx : 0].intervalUS, &oldval->it_interval); + if (idx == -1) { + oldval->it_interval.tv_sec = 0; + oldval->it_interval.tv_usec = 0; + } + } + + uint64_t new_value_us = newval ? _timeval_to_us(&newval->it_value) : 0; + uint64_t new_interval_us = newval ? _timeval_to_us(&newval->it_interval) : 0; + + if (new_value_us == 0) { + if (idx != -1) { + _timers[idx].active = 0; + _timers[idx].owner = NULL; + } + return 0; + } + + if (idx == -1) { + for (int i = 0; i < AURORA_MAX_TIMER; i++) { + if (!_timers[i].active) { + idx = i; + break; + } + } + if (idx == -1) + return -1; + } + UARTDebugOut("Seting kernel timer : %d \r\n", idx); + _timers[idx].expireUS = now + new_value_us; + _timers[idx].intervalUS = new_interval_us; + _timers[idx].handler = __kernel_timer_alarm_callback; + _timers[idx].param = (void*)thr; + _timers[idx].owner = thr; + _timers[idx].active = 1; + + return 0; +} + +int AuTimerGetITimer(AA64Thread* thr, int which, itimerval_t* curr_value) { + if(which != ITIMER_REAL) return -1; + if (!curr_value) return -1; + uint64_t now = _get_current_us(); + + for (int i = 0; i < AURORA_MAX_TIMER; i++) { + if (_timers[i].active && _timers[i].owner == thr && + _timers[i].handler == __kernel_timer_alarm_callback) { + uint64_t remaining = (_timers[i].expireUS > now) ? (_timers[i].expireUS - now) : 0; + _us_to_timeval(remaining, &curr_value->it_value); + _us_to_timeval(_timers[i].intervalUS, &curr_value->it_interval); + return 0; + } + } + + curr_value->it_value.tv_sec = curr_value->it_value.tv_usec = 0; + curr_value->it_interval.tv_sec = curr_value->it_interval.tv_usec = 0; + return 0; +} + +void AuSetWalltime(int64_t sec, int64_t nsec) { + //lock + /** need credential verifications too, for security **/ + wallClock.cycle_last = get_cntpct_el0(); + wallClock.wall_sec = sec; + wallClock.wall_nsec = nsec; +} + + +void AuGetWalltime(int64_t* out_sec, int64_t* out_ns) { + /** need credential verifications too, for security **/ + + uint64_t now = get_cntpct_el0(); + uint64_t delta_cycles = now - wallClock.cycle_last; + uint64_t delta_ns = (delta_cycles * wallClock.mult) >> wallClock.shift; + + int64_t sec = wallClock.wall_sec; + int64_t nsec = wallClock.wall_nsec + (int64_t)delta_ns; + + sec += nsec / 1000000000LL; + nsec %= 1000000000LL; + + *out_sec = sec; + *out_ns = nsec; +} + +static void AuWalltimeUpdate() { + //lock + uint64_t now = get_cntpct_el0(); + uint64_t delta_cycles = now - wallClock.cycle_last; + uint64_t delta_ns = (delta_cycles * wallClock.mult) >> wallClock.shift; + + wallClock.wall_nsec += (int64_t)delta_ns; + if (wallClock.wall_nsec >= 10000000000LL) { + wallClock.wall_sec += wallClock.wall_nsec / 1000000000LL; + wallClock.wall_nsec %= 1000000000LL; + } + + wallClock.cycle_last = now; + //lock release +} + diff --git a/Libs/Chitralekha/Chitralekha.vcxproj b/Libs/Chitralekha/Chitralekha.vcxproj index eea66101d..8ac1a2eb4 100644 --- a/Libs/Chitralekha/Chitralekha.vcxproj +++ b/Libs/Chitralekha/Chitralekha.vcxproj @@ -1,4 +1,4 @@ - + @@ -65,10 +65,10 @@ MultiByte - Application + DynamicLibrary false - v120 - true + v142 + false MultiByte @@ -104,6 +104,10 @@ false chlkha + + chlkha + false + Level3 @@ -153,13 +157,13 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) Level3 - Disabled + MaxSpeed false ..\..\Libs\XEClib\includes;..\..\Ports\freetype2\include;%(AdditionalIncludeDirectories) ARCH_ARM64;YES_DYNAMIC;DYNAMIC_EXPORTER;_USE_FREETYPE;STB_IMAGE_RESIZE_IMPLEMENTATION;THEME_DEFAULT;COLOR_RGBA;%(PreprocessorDefinitions) @@ -180,8 +184,8 @@ ..\..\Build\chlkha.dll - ..\..\ARM64\Debug;..\..\Libs\XECrt - XEClib.lib;ftype.lib + ..\..\ARM64\Debug;..\..\Libs\XECrt; $(SolutionDir)Build; + XEClib.lib;ftype.lib;xecrt.lib; true false true @@ -199,7 +203,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).dll" M:\$(TargetName).dll" + if exist M:\ ( copy "..\..\Build\$(TargetName).dll" "M:\$(TargetName).dll" ) else ( echo M: drive not found, skipping copy ) @@ -235,14 +239,42 @@ Level3 MaxSpeed true - true + false true + ..\..\Libs\XEClib\includes;..\..\Ports\freetype2\include;%(AdditionalIncludeDirectories) + ARCH_ARM64;YES_DYNAMIC;DYNAMIC_EXPORTER;_USE_FREETYPE;STB_IMAGE_RESIZE_IMPLEMENTATION;THEME_DEFAULT;COLOR_RGBA;%(PreprocessorDefinitions) + false + false + + + false + StreamingSIMDExtensions2 + false + Disabled - true + + true true + ..\..\Build\chlkha.dll + ..\..\ARM64\Debug;..\..\Libs\XECrt; $(SolutionDir)Build; + XEClib.lib;ftype.lib + true + false + true + true + Native + Driver + 0x0000000600000000 + + false + + /filealign:4096 %(AdditionalOptions) + + copy "..\..\Build\$(TargetName).dll" M:\$(TargetName).dll" + @@ -327,6 +359,8 @@ false Document true + true + false @@ -335,6 +369,10 @@ true clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" $(IntDir)%(Filename).obj + false + true + clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj diff --git a/Libs/Chitralekha/Makefile b/Libs/Chitralekha/Makefile new file mode 100644 index 000000000..5734fd4c1 --- /dev/null +++ b/Libs/Chitralekha/Makefile @@ -0,0 +1,80 @@ +# XenevaOS Chitralekha Library Makefile (GCC Build) + +TARGET = libChitralekha.a +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +AR = $(CROSS_COMPILE)ar + +INCLUDES = -I./ -I../XEClib/includes -I../../BaseHdr -I../XEClib/includes/c++ -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT -DCOLOR_RGBA \ + $(INCLUDES) + +OBJDIR = obj + +# Source files for ARM64 +CPP_SRCS = audio/audio.cpp \ + boxblur.cpp \ + chitralekha.cpp \ + color.cpp \ + draw.cpp \ + font.cpp \ + keycode.cpp \ + ttf.cpp \ + widgets/base.cpp \ + widgets/button.cpp \ + widgets/defaultmenu.cpp \ + widgets/defaultonoff.cpp \ + widgets/defaultprogressbar.cpp \ + widgets/defaultscrollbar.cpp \ + widgets/defaultslider.cpp \ + widgets/defaulttextbox.cpp \ + widgets/defaultviews.cpp \ + widgets/defaultwindow.cpp \ + widgets/gridview.cpp \ + widgets/icon.cpp \ + widgets/list.cpp \ + widgets/listview.cpp \ + widgets/menubar.cpp \ + widgets/menu.cpp \ + widgets/msgbox.cpp \ + widgets/onoff.cpp \ + widgets/popupwin.cpp \ + widgets/progress.cpp \ + widgets/scrollbar.cpp \ + widgets/scrollpane.cpp \ + widgets/sidebar.cpp \ + widgets/slider.cpp \ + widgets/textbox.cpp \ + widgets/toolbar.cpp \ + widgets/view.cpp \ + widgets/window.cpp + +S_SRCS = _fastcpy_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: $(TARGET) + +$(TARGET): $(OBJS) + @echo "Archiving $(TARGET)..." + $(AR) rcs $@ $(OBJS) + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) diff --git a/Libs/Chitralekha/chitralekha.cpp b/Libs/Chitralekha/chitralekha.cpp index 1e573ec12..bab500549 100644 --- a/Libs/Chitralekha/chitralekha.cpp +++ b/Libs/Chitralekha/chitralekha.cpp @@ -40,8 +40,7 @@ #include "_fastcpy.h" #include "color.h" -extern "C" int _fltused = 1; - +// removed _fltused here since it's in XEClib int ChPrintLibName() { _KePrint("Chitralekha Graphics Library v1.0 \n"); return 0; @@ -159,7 +158,11 @@ void ChCanvasScreenUpdate(ChCanvas* canvas, int _x, int _y, int _w, int _h) { y = 0; for (int64_t i = 0; i < h; i++){ - void* fb_mem = (fb + (y + i) * (canvas->screenWidth) + x); + // Use canvas->pitch instead of screenWidth to handle padding/alignment in hardware framebuffer + uint32_t pitch_pixels = canvas->pitch / (canvas->bpp / 8); + if (canvas->pitch == 0) pitch_pixels = canvas->screenWidth; // fallback + + void* fb_mem = (fb + (y + i) * pitch_pixels + x); void* canvas_mem = (canvas->buffer + (y + i) * (canvas->canvasWidth) + x); _fastcpy(fb_mem, canvas_mem, w*4); diff --git a/Libs/Chitralekha/font.cpp b/Libs/Chitralekha/font.cpp index 0d0dc6287..eb10996be 100644 --- a/Libs/Chitralekha/font.cpp +++ b/Libs/Chitralekha/font.cpp @@ -89,7 +89,9 @@ void ChFontSetSize(ChFont* font, int size) { if (!font) return; font->fontSz = size / 72.f * 96; +#ifdef _USE_FREETYPE FT_Set_Pixel_Sizes(font->face, 0, font->fontSz); +#endif font->fontHeight = font->fontSz; } @@ -318,6 +320,7 @@ void ChFontDrawCharClipped(ChCanvas* canv, ChFont* font, char c, int penx, int p * @param string -- total string */ int64_t ChFontGetWidth(ChFont* font,char* string) { +#ifdef _USE_FREETYPE if (!font) return -1; size_t font_width = 0; @@ -339,6 +342,9 @@ int64_t ChFontGetWidth(ChFont* font,char* string) { font_width = bbox_xmax - bbox_xmin; } return font_width; +#else + return 8 * strlen(string); +#endif } /* @@ -348,6 +354,7 @@ int64_t ChFontGetWidth(ChFont* font,char* string) { * @param c -- character */ int64_t ChFontGetWidthChar(ChFont* font, char c) { +#ifdef _USE_FREETYPE if (!font) return -1; size_t font_width = 0; @@ -365,6 +372,9 @@ int64_t ChFontGetWidthChar(ChFont* font, char c) { font_width = bbox_xmax - bbox_xmin; } return font_width; +#else + return 8; +#endif } /* @@ -374,6 +384,7 @@ int64_t ChFontGetWidthChar(ChFont* font, char c) { * @param string -- total string */ int64_t ChFontGetHeight(ChFont* font, char* string) { +#ifdef _USE_FREETYPE if (!font) return -1; size_t font_height = 0; @@ -393,6 +404,9 @@ int64_t ChFontGetHeight(ChFont* font, char* string) { font_height = bbox_ymax - bbox_ymin; } return font_height; +#else + return 16; +#endif } /* @@ -402,6 +416,7 @@ int64_t ChFontGetHeight(ChFont* font, char* string) { * @param c -- character */ int64_t ChFontGetHeightChar(ChFont* font, char c) { +#ifdef _USE_FREETYPE if (!font) return -1; size_t font_h = 0; @@ -419,6 +434,9 @@ int64_t ChFontGetHeightChar(ChFont* font, char c) { font_h = bbox_ymax - bbox_ymin; } return font_h; +#else + return 16; +#endif } int ChFontClamp(int val, int min, int max) { @@ -525,6 +543,9 @@ int ChFontDrawTextClipped(ChCanvas *canv, ChFont* font, char* string, int penx, prev = glyfIndx; string++; } + return 0; +#else + return 0; #endif } diff --git a/Libs/Chitralekha/keycode.cpp b/Libs/Chitralekha/keycode.cpp index ddfaa8e6d..b3d323a38 100644 --- a/Libs/Chitralekha/keycode.cpp +++ b/Libs/Chitralekha/keycode.cpp @@ -118,12 +118,17 @@ static int _kkybrd_scancode_std[] = { KEY_KP_0, //0x52 //keypad insert key KEY_KP_DECIMAL, //0x53 //keypad delete key KEY_UNKNOWN, //0x54 - KEY_UNKNOWN, //0x55 - KEY_UNKNOWN, //0x56 + KEY_KP_2, //0x55 //mapped because, got fired by extended code keys + KEY_KP_2, //0x56 //mapped because extended key code fire this KEY_F11, //0x57 KEY_F12 //0x58 }; +#define SCANCODE_EXTENDED_MASK 0xFF00 +#define SCANCODE_EXTENDED_FLAG 0xE000 +#define SCANCODE_KEY_MASK 0x7F +#define SCANCODE_RELEASE_BIT 0x80 + /** * @brief ChitralekhaKeyInitialise -- initialise keycode * library, this is automatically called during starting of @@ -188,6 +193,8 @@ void ChitralekhaProcessKey(int code) { } } + + /* ChitralekhaGetKeyPress -- Get pressed key information * @param code -- code to convert */ @@ -196,6 +203,16 @@ char ChitralekhaGetKeyPress(int code) { if (code < 128) { key = _kkybrd_scancode_std[code]; } + + bool ext = ((code & SCANCODE_EXTENDED_MASK) == SCANCODE_EXTENDED_FLAG); + if (ext) { + bool released = (code & SCANCODE_RELEASE_BIT) != 0; + uint8_t keycode = code & SCANCODE_KEY_MASK; + if (!released) { + key = _kkybrd_scancode_std[keycode]; + } + + } return key; } /* diff --git a/Libs/Chitralekha/widgets/button.cpp b/Libs/Chitralekha/widgets/button.cpp index 3bbc9c2f6..0016801e4 100644 --- a/Libs/Chitralekha/widgets/button.cpp +++ b/Libs/Chitralekha/widgets/button.cpp @@ -221,8 +221,8 @@ XE_EXTERN XE_EXPORT ChButton* ChCreateButton(int x, int y, int w, int h, char *t button->base.y =CHITRALEKHA_WINDOW_DEFAULT_PAD_Y + y; button->base.w = w; button->base.h = h; - button->title = (char*)malloc(strlen(text)); - memset(button->title, 0, strlen(text)); + button->title = (char*)malloc(strlen(text) + 1); + memset(button->title, 0, strlen(text) + 1); strcpy(button->title, text); button->base.ChMouseEvent = ChButtonMouseEvent; button->base.ChPaintHandler = ChButtonDefaultPainter; diff --git a/Libs/Chitralekha/widgets/defaulttextbox.cpp b/Libs/Chitralekha/widgets/defaulttextbox.cpp index 36d1cc29c..7bc2dbc80 100644 --- a/Libs/Chitralekha/widgets/defaulttextbox.cpp +++ b/Libs/Chitralekha/widgets/defaulttextbox.cpp @@ -65,10 +65,17 @@ void ChDefaultTextboxPrint(ChCanvas* canv, ChTextBox* tb, char* text) { break; int w = ChFontGetWidthChar(tb->font, text[i]); int h = ChFontGetHeightChar(tb->font, text[i]); +#ifdef _USE_FREETYPE int x_v = penx + tb->font->face->glyph->bitmap_left; int y_v = peny - tb->font->face->glyph->bitmap_top; int b_w = tb->font->face->glyph->bitmap.width; int draw_width = tb->font->face->glyph->bitmap.width; +#else + int x_v = penx; + int y_v = peny; + int b_w = w; + int draw_width = w; +#endif if (x_v + draw_width >= (tb->wid.x + tb->wid.w)) { tb->textCursorPosY += 1; @@ -80,8 +87,12 @@ void ChDefaultTextboxPrint(ChCanvas* canv, ChTextBox* tb, char* text) { ChFontDrawCharClipped(canv, tb->font, text[i], penx, peny, tb->textColor, &clipRect); +#ifdef _USE_FREETYPE penx += tb->font->face->glyph->advance.x >> 6; peny += tb->font->face->glyph->advance.y >> 6; +#else + penx += w; +#endif tb->textCursorPosX++; } diff --git a/Libs/Chitralekha/widgets/menu.cpp b/Libs/Chitralekha/widgets/menu.cpp index 8815558e4..960cf72f3 100644 --- a/Libs/Chitralekha/widgets/menu.cpp +++ b/Libs/Chitralekha/widgets/menu.cpp @@ -151,7 +151,7 @@ ChMenuItem* ChCreateMenuItem(char* title,ChPopupMenu* pm) { mi->wid.h = DEFAULT_MENU_ITEM_HEIGHT; mi->wid.x = 0; mi->wid.ChMouseEvent = ChMenuItemMouseEvent; - mi->title = (char*)malloc(strlen(title)); + mi->title = (char*)malloc(strlen(title) + 1); strcpy(mi->title, title); mi->menu = NULL; list_add(pm->MenuItems, mi); diff --git a/Libs/Chitralekha/widgets/menubar.cpp b/Libs/Chitralekha/widgets/menubar.cpp index dbf6acad0..41457ceff 100644 --- a/Libs/Chitralekha/widgets/menubar.cpp +++ b/Libs/Chitralekha/widgets/menubar.cpp @@ -140,7 +140,7 @@ void ChMenuButtonDestroy(ChWidget* wid, ChWindow* win) { * @param title -- title of the button */ ChMenuButton *ChCreateMenubutton(ChMenubar* mb, char* title) { - int title_len = strlen(title); + int title_len = strlen(title) + 1; int mbut_w = title_len + 10; ChMenuButton* mbut = (ChMenuButton*)malloc(sizeof(ChMenuButton)); memset(mbut, 0, sizeof(ChMenuButton)); @@ -150,9 +150,9 @@ ChMenuButton *ChCreateMenubutton(ChMenubar* mb, char* title) { mbut->wid.h = mb->wid.h; mbut->wid.ChDestroy = ChMenuButtonDestroy; mbut->wid.ChActionHandler = 0; - mbut->title = (char*)malloc(strlen(title)); + mbut->title = (char*)malloc(strlen(title) + 1); mbut->popupMenu = NULL; - memset(mbut->title, 0, strlen(title)); + memset(mbut->title, 0, strlen(title) + 1); strcpy(mbut->title, title); return mbut; } diff --git a/Libs/Chitralekha/widgets/msgbox.cpp b/Libs/Chitralekha/widgets/msgbox.cpp index fc6b1fa7c..2fee4eb86 100644 --- a/Libs/Chitralekha/widgets/msgbox.cpp +++ b/Libs/Chitralekha/widgets/msgbox.cpp @@ -123,8 +123,8 @@ void ChMessageBoxPrepareButtons(ChWindow* win, ChMessageBox *mb,uint8_t buttons) XE_EXTERN XE_EXPORT ChMessageBox* ChCreateMessageBox(ChWindow* mainWin,char* title, char* msg, uint8_t buttons, uint8_t icon) { ChMessageBox* mb = (ChMessageBox*)malloc(sizeof(ChMessageBox)); memset(mb, 0, sizeof(ChMessageBox)); - mb->message = (char*)malloc(strlen(msg) - 1); - memset(mb->message, 0, (strlen(msg) - 1)); + mb->message = (char*)malloc(strlen(msg) + 1); + memset(mb->message, 0, (strlen(msg) + 1)); strcpy(mb->message, msg); mb->icon = icon; mb->type = buttons; diff --git a/Libs/Chitralekha/widgets/view.cpp b/Libs/Chitralekha/widgets/view.cpp index 0b1fd9a15..86a7805e7 100644 --- a/Libs/Chitralekha/widgets/view.cpp +++ b/Libs/Chitralekha/widgets/view.cpp @@ -196,7 +196,7 @@ void ChListViewSetScrollpane(ChListView* view, ChScrollPane *pane){ ChListItem* ChListViewAddItem(ChWindow* win, ChListView* lv, char* itemText) { ChListItem* li = (ChListItem*)malloc(sizeof(ChListItem)); memset(li, 0, sizeof(ChListItem)); - li->itemText = (char*)malloc(strlen(itemText)); + li->itemText = (char*)malloc(strlen(itemText) + 1); strcpy(li->itemText, itemText); int xpos = 0; int ypos = 0; diff --git a/Libs/Chitralekha/widgets/window.cpp b/Libs/Chitralekha/widgets/window.cpp index 2a5a72805..5d1aad7bf 100644 --- a/Libs/Chitralekha/widgets/window.cpp +++ b/Libs/Chitralekha/widgets/window.cpp @@ -171,8 +171,8 @@ XE_EXTERN XE_EXPORT ChWindow* ChCreateWindow(ChitralekhaApp *app, uint16_t attri win->canv = canv; win->sharedwin = app->shwinbuf; win->info = (ChSharedWinInfo*)win->sharedwin; - win->title = (char*)malloc(strlen(title)); - memset(win->title, 0, strlen(title)); + win->title = (char*)malloc(strlen(title) + 1); + memset(win->title, 0, strlen(title) + 1); strcpy(win->title, title); win->info->x = x; win->info->y = y; @@ -901,8 +901,8 @@ XE_EXTERN XE_EXPORT ChWindow* ChCreatePopupWindow(ChWindow* win, int x, int y, i popup->canv = canv; popup->sharedwin = app->shwinbuf; popup->info = (ChSharedWinInfo*)popup->sharedwin; - popup->title = (char*)malloc(strlen(title)); - memset(popup->title, 0, strlen(title)); + popup->title = (char*)malloc(strlen(title) + 1); + memset(popup->title, 0, strlen(title) + 1); strcpy(popup->title, title); popup->info->x = win->info->x + x; popup->info->y = win->info->y + y; diff --git a/Libs/XEClib/Makefile b/Libs/XEClib/Makefile new file mode 100644 index 000000000..82ad72a3c --- /dev/null +++ b/Libs/XEClib/Makefile @@ -0,0 +1,50 @@ +# XenevaOS XEClib Makefile (GCC Build) + +TARGET = libXEClib.a +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +AR = $(CROSS_COMPILE)ar + +INCLUDES = -I./includes -I./includes/c++ -I../../BaseHdr +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS \ + $(INCLUDES) + +OBJDIR = obj + +# Source files for ARM64 +CPP_SRCS = acosf.cpp arpa/inet.cpp atan2f.cpp atanf.cpp c++/ios.cpp c++/iostream.cpp \ + c++/istream.cpp c++/memory.cpp c++/new.cpp c++/ostream.cpp c++/_string.cpp \ + ceilf.cpp ctype.cpp errno.cpp fmodf.cpp math.cpp qsort.cpp roundf.cpp \ + stat.cpp stdio.cpp stdlib.cpp string.cpp sys/xenet.cpp sys/_heap.cpp \ + sys/_procheap.cpp sys/_xeneva.cpp sys/_xeprint.cpp time.cpp \ + _xeinput.cpp _xeprint.cpp + +S_SRCS = _callbase_arm64.s setjmp_arm64.s store_stack_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: $(TARGET) + +$(TARGET): $(OBJS) + @echo "Archiving $(TARGET)..." + $(AR) rcs $@ $(OBJS) + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) diff --git a/Libs/XEClib/XEClib.vcxproj b/Libs/XEClib/XEClib.vcxproj index 76d21ff01..a74aba9ff 100644 --- a/Libs/XEClib/XEClib.vcxproj +++ b/Libs/XEClib/XEClib.vcxproj @@ -45,7 +45,7 @@ MultiByte - DynamicLibrary + StaticLibrary true v142 MultiByte @@ -65,9 +65,9 @@ MultiByte - Application + DynamicLibrary false - v120 + v142 true MultiByte @@ -100,10 +100,15 @@ XEClib - .dll + .lib false XEClib + + XEClib + false + .dll + Level3 @@ -198,7 +203,8 @@ /filealign:4096 /def:_export_arm64.def %(AdditionalOptions) - copy "..\..\Build\$(TargetName).dll" M:\$(TargetName).dll" + + @@ -233,24 +239,56 @@ Level3 MaxSpeed - true - true + + + false true + ..\..\Libs\XEClib\includes; includes\c++ + ARCH_ARM64; YES_DYNAMIC; DYNAMIC_EXPORTER; + false + + + false + StreamingSIMDExtensions2 + false + /Oi- %(AdditionalOptions) - true + false true true + ..\..\Build\XEClib.dll + + true + false + true + true + Native + true + Driver + 0x10000 + 0x0000000400000000 + + false + + /filealign:4096 /def:_export_arm64.def %(AdditionalOptions) + + copy "..\..\Build\$(TargetName).dll" M:\$(TargetName).dll" + true + true + false true false true + true + false @@ -279,6 +317,7 @@ + @@ -292,6 +331,7 @@ + @@ -343,7 +383,9 @@ true - + + true + @@ -356,6 +398,10 @@ $(IntDir)%(Filename).obj true false + clang --target=aarch64-windows-msvc -fms-compatibility -fms-extensions -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj + false + true @@ -365,6 +411,10 @@ Document clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" $(IntDir)%(Filename).obj + false + true + clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj false @@ -372,6 +422,10 @@ Document clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" $(IntDir)%(Filename).obj + false + true + clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" + $(IntDir)%(Filename).obj diff --git a/Libs/XEClib/XEClib.vcxproj.filters b/Libs/XEClib/XEClib.vcxproj.filters index 754d6edca..e86c2c4d5 100644 --- a/Libs/XEClib/XEClib.vcxproj.filters +++ b/Libs/XEClib/XEClib.vcxproj.filters @@ -202,6 +202,12 @@ includes + + includes + + + includes\sys + diff --git a/Libs/XEClib/_callbase_arm64.s b/Libs/XEClib/_callbase_arm64.s index bf750accb..76d07bd4c 100644 --- a/Libs/XEClib/_callbase_arm64.s +++ b/Libs/XEClib/_callbase_arm64.s @@ -33,11 +33,11 @@ __chkstk: .global _KePrint _KePrint: - mov x19,x8 + str x8, [sp, #-16]! mov x16, 1 svc #0 mov x0, x6 - mov x8,x19 + ldr x8, [sp], #16 ret .global _KePauseThread @@ -612,6 +612,55 @@ _KeGetCurrentUS: .global _KeGetCurrentMS _KeGetCurrentMS: mov x16, 71 + svc #0 + mov x0, x6 + ret + +.global _KeSetAlarm +_KeSetAlarm: + mov x16, 72 + svc #0 + mov x0, x6 + ret + +.global _KeSetITimer +_KeSetITimer: + mov x16, 73 + svc #0 + mov x0, x6 + ret + +.global _KeGetITimer +_KeGetITimer: + mov x16, 74 + svc #0 + mov x0, x6 + ret + +.global _KeGetNumProcessCount +_KeGetNumProcessCount: + mov x16, 75 + svc #0 + mov x0, x6 + ret + +.global _KeProcessFetch +_KeProcessFetch: + mov x16, 76 + svc #0 + mov x0, x6 + ret + +.global _KeSetWalltime +_KeSetWalltime: + mov x16, 77 + svc #0 + mov x0, x6 + ret + +.global _KeGetWalltime +_KeGetWalltime: + mov x16, 78 svc #0 mov x0, x6 ret \ No newline at end of file diff --git a/Libs/XEClib/_export_arm64.def b/Libs/XEClib/_export_arm64.def index 583cdd5b8..3c39de1f5 100644 --- a/Libs/XEClib/_export_arm64.def +++ b/Libs/XEClib/_export_arm64.def @@ -33,6 +33,7 @@ EXPORTS _KeSetFileToProcess _KeProcessHeapUnmap _KeSendSignal + _KeSetSignal _KeGetCurrentTime _KeOpenDir _KeReadDir @@ -61,4 +62,11 @@ EXPORTS setjmp longjmp _KeGetCurrentUS - _KeGetCurrentMS \ No newline at end of file + _KeGetCurrentMS + _KeSetAlarm + _KeGetITimer + _KeSetITimer + _KeGetNumProcessCount + _KeProcessFetch + _KeSetWalltime + _KeGetWalltime \ No newline at end of file diff --git a/Libs/XEClib/_xeprint.cpp b/Libs/XEClib/_xeprint.cpp index 5bbaa55d3..26f58a43e 100644 --- a/Libs/XEClib/_xeprint.cpp +++ b/Libs/XEClib/_xeprint.cpp @@ -678,14 +678,22 @@ int _xeprint(char* output, int outputlen, const char* format, va_list list) { break; } case 's': { - if (intArg) { - strcpy((output + outCount), (char*)((uint64_t)intArg)); - outCount += strlen((char*)intArg); - } - else { - strncpy((output + outCount), "(NULL)", 7); - outCount += 6; - } + const char* str = intArg ? (const char*)(uint64_t)intArg : "(NULL)"; + int slen = strlen(str); + int pad = fieldWidth; + + if (fieldWidth && !leftJust) { + while (pad-- > 0) + output[outCount++] = ' '; + } + + strcpy(output + outCount, str); + outCount += slen; + + if (fieldWidth && leftJust) { + while (pad-- > 0) + output[outCount++] = ' '; + } break; } case 'p':{ diff --git a/Libs/XEClib/c++/memory.cpp b/Libs/XEClib/c++/memory.cpp index 8afd2be13..8e3345d6f 100644 --- a/Libs/XEClib/c++/memory.cpp +++ b/Libs/XEClib/c++/memory.cpp @@ -33,7 +33,7 @@ namespace std { template - allocator::allocator() + allocator::allocator() throw() { } @@ -45,7 +45,7 @@ namespace std { template - allocator::~allocator() + allocator::~allocator() throw() { } diff --git a/Libs/XEClib/c++/new.cpp b/Libs/XEClib/c++/new.cpp index 56d383d15..329bc87ec 100644 --- a/Libs/XEClib/c++/new.cpp +++ b/Libs/XEClib/c++/new.cpp @@ -53,6 +53,10 @@ void operator delete[](void* ptr) { free(ptr); } -void operator delete(void* p, uint64_t s) { +void operator delete(void* p, std::size_t s) { + free(p); +} +void operator delete[](void* p, std::size_t s) { + free(p); } \ No newline at end of file diff --git a/Libs/XEClib/includes/_xeprint.h b/Libs/XEClib/includes/_xeprint.h index c0cf56dad..954df6d5f 100644 --- a/Libs/XEClib/includes/_xeprint.h +++ b/Libs/XEClib/includes/_xeprint.h @@ -45,9 +45,9 @@ XE_EXTERN{ XE_LIB unsigned long long _str2num(const char* string, unsigned base, int sign, int *consumed); XE_LIB void _lnum2str(unsigned long long num, char *string, int base, int sign); XE_LIB void _dbl2str(double num, char *string, int roundPlaces); - XE_LIB void _num2str(unsigned num, char *string, int base, int sign); + void _num2str(unsigned num, char *string, int base, int sign); XE_LIB void _flt2str(float num, char *string, int roundPlaces); - XE_LIB double strtod(const char *nptr, char **endptr); + double strtod(const char *nptr, char **endptr); XE_LIB float strtof(const char *nptr, char **endptr); int _xeprint(char* output, int outputlen, const char* format, va_list list); int _xeinput(const char *input, const char *format, va_list list); diff --git a/Libs/XEClib/includes/signal.h b/Libs/XEClib/includes/signal.h new file mode 100644 index 000000000..e5d0ffe88 --- /dev/null +++ b/Libs/XEClib/includes/signal.h @@ -0,0 +1,51 @@ +/** +* BSD 2-Clause License +* +* Copyright (c) 2022-2026, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __SIGNAL_H__ +#define __SIGNAL_H__ + +#include +#include + + +/** + * @brief signal -- register a signal handler to + * a specific signal number + * @param signum -- signal number + * @param handler -- handler address + */ +#define signal(signum,handler) _KeSetSignal(signum,handler) + +/* @brief kill system call + * @param pid -- process id + * @param signum -- signal number + */ +#define kill(pid,signum) _KeSendSignal(pid,signum) + +#endif diff --git a/Libs/XEClib/includes/size_t.h b/Libs/XEClib/includes/size_t.h index a65815c28..59ea36860 100644 --- a/Libs/XEClib/includes/size_t.h +++ b/Libs/XEClib/includes/size_t.h @@ -31,7 +31,11 @@ extern "C" { #endif +#ifdef __SIZE_TYPE__ + typedef __SIZE_TYPE__ size_t; +#else typedef unsigned long long size_t; +#endif #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/Libs/XEClib/includes/stddef.h b/Libs/XEClib/includes/stddef.h index 0c8b63649..fed472d01 100644 --- a/Libs/XEClib/includes/stddef.h +++ b/Libs/XEClib/includes/stddef.h @@ -36,10 +36,10 @@ #include -typedef int ptrdiff_t; +typedef int64_t ptrdiff_t; -typedef int ssize_t; -typedef unsigned wint_t; +typedef int64_t ssize_t; +typedef unsigned int wint_t; #if !defined(__cplusplus) typedef unsigned wchar_t; diff --git a/Libs/XEClib/includes/stdint.h b/Libs/XEClib/includes/stdint.h index 5d83e1137..4342b5e11 100644 --- a/Libs/XEClib/includes/stdint.h +++ b/Libs/XEClib/includes/stdint.h @@ -80,11 +80,11 @@ typedef long long int_fast64_t; typedef unsigned long long uint_fast64_t; /* 7.18.1.4 Integer types capable of holding object pointers */ -typedef int intptr_t; - -#if defined(ARCH_ARM64) || defined(ARCH_X64) -typedef __int64 uintptr_t; +#if defined(ARCH_ARM64) || defined(__aarch64__) || defined(ARCH_X64) || defined(__x86_64__) +typedef long long intptr_t; +typedef unsigned long long uintptr_t; #else +typedef int intptr_t; typedef unsigned int uintptr_t; #endif diff --git a/Libs/XEClib/includes/string.h b/Libs/XEClib/includes/string.h index 51e1d33b0..928ec6366 100644 --- a/Libs/XEClib/includes/string.h +++ b/Libs/XEClib/includes/string.h @@ -27,8 +27,8 @@ * **/ -#ifndef __STRING_H__ -#define __STRING_H__ +#ifndef __XE_STRING_H__ +#define __XE_STRING_H__ #include #include <_xeneva.h> @@ -69,7 +69,7 @@ XE_EXTERN{ //!===================================================== //! M E M O R Y G L O B A L F U N C T I O N S //!===================================================== - XE_LIB void* _cdecl memset(void *targ, unsigned char val, size_t len); + XE_LIB void* memset(void *targ, int val, size_t len); XE_LIB void *memcpy(void *targ, void *src, size_t len); XE_LIB int memcmp(const void *first, const void *second, size_t length); @@ -78,7 +78,7 @@ XE_EXTERN{ XE_LIB int ffs(int); XE_LIB int fls(int); XE_LIB size_t mbslen(const char*); - XE_LIB void* memmove(void* dest, void const *src, unsigned __int64 bytes); + XE_LIB void* memmove(void* dest, void const *src, size_t bytes); XE_LIB void *memchr(const void *src, int c, size_t n); #ifdef __cplusplus diff --git a/Libs/XEClib/includes/sys/_keproc.h b/Libs/XEClib/includes/sys/_keproc.h index 7a2a3206b..b628a7c41 100644 --- a/Libs/XEClib/includes/sys/_keproc.h +++ b/Libs/XEClib/includes/sys/_keproc.h @@ -51,6 +51,21 @@ XE_EXTERN{ PROCESS_TOKEN_NETSERVER, }; + +/** + * _sys_proc_list -- a way to report current status + * of information about all processes + */ +typedef struct _sys_proc_list_ { + int proc_id; + char name[16]; + uint64_t total_runtime_us; + uint64_t window_runtime_us; + uint32_t num_threads; + uint32_t num_file_opened; + uint32_t cpu_usage; +}XEProcessList; + /** * @brief _KePauseThread -- pause currently running * thread @@ -189,6 +204,10 @@ XE_EXTERN{ */ XE_LIB int _KeProcessTokenRemoveSelf(uint8_t category); + XE_LIB int _KeGetNumProcessCount(); + + XE_LIB int _KeProcessFetch(XEProcessList* list, int num_proc_count); + #ifdef __cplusplus } #endif diff --git a/Libs/XEClib/includes/sys/_kesignal.h b/Libs/XEClib/includes/sys/_kesignal.h index facc179ca..edfbdfb17 100644 --- a/Libs/XEClib/includes/sys/_kesignal.h +++ b/Libs/XEClib/includes/sys/_kesignal.h @@ -30,6 +30,7 @@ #ifndef __KE_SIGNAL_H__ #define __KE_SIGNAL_H__ +#ifdef ARCH_X64 #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 @@ -67,8 +68,38 @@ #define SIGWINEVENT 35 #define SIGCAT 36 #define SIGTTOU 37 +#elif ARCH_ARM64 +/** in arch64 decided to go with minimal number of calls */ +#define SIGHUP 1 /* Terminal closed or hangup*/ +#define SIGINT 2 /* Interrupt (CTRL+C) */ +#define SIGQUIT 3 /* Quit (CTRL+), generate core dump */ +#define SIGILL 4 /* Illegal instruction*/ +#define SIGTRAP 5 /* Breakpoint or trace trap */ +#define SIGABRT 6 /* Abort a process */ +#define SIGBUS 7 /* Bus error */ +#define SIGFPE 8 /* Floating-point exception */ +#define SIGKILL 9 /* Forcefully terminate */ +#define SIGUSR1 10 /* User-defined signal 1*/ +#define SIGSEGV 11 /* Invalid memory access (segmentation fault) */ +#define SIGUSR2 12 /* user-defined signal 2*/ +#define SIGPIPE 13 /* Write to a broken pipe */ +#define SIGALRM 14 /* Alarm timer expired */ +#define SIGTERM 15 /* Graceful termination request */ +#define SIGCHLD 17 /*Child process stopped or exited */ +#define SIGCONT 18 /* Continue a stopped process */ +#define SIGSTOP 19 /* Stop process */ +#define SIGTSTP 20 /* Terminal stop */ +#define SIGTTIN 21 /* Background process attempted terminal input */ +#define SIGTTOU 22 /* Background process attempted terminal output */ +#endif + +#ifdef ARCH_X64 #define NUMSIGNALS 38 +#elif ARCH_ARM64 +#define NUMSIGNALS 23 +#endif + #define NSIG NUMSIGNALS diff --git a/Libs/XEClib/includes/sys/_ketime.h b/Libs/XEClib/includes/sys/_ketime.h index 6608dec79..d6af668e6 100644 --- a/Libs/XEClib/includes/sys/_ketime.h +++ b/Libs/XEClib/includes/sys/_ketime.h @@ -39,6 +39,15 @@ XE_EXTERN{ #endif +/* defined in seconds */ +#define TZ_SEC_IST_INDIA 19800 //+5:30 +#define TZ_SEC_CHINA_STD 28800 //+8:00 +#define TZ_SEC_JAPAN_STD 32400 //+9:00 +#define TZ_SEC_NEPAL 20700 //+5:45 +#define TZ_SEC_PAKISTAN 18000 //+5:00 +#define TZ_SEC_UAE_GULF 14400 //+4:00 +#define TZ_SEC_BANGLADESH 21600 //+6:00 + #pragma pack(push,1) typedef struct _xe_time_ { @@ -62,6 +71,10 @@ XE_EXTERN{ XE_LIB uint64_t _KeGetCurrentMS(); + XE_LIB void _KeSetWalltime(int64_t sec, int64_t nsec); + + XE_LIB void _KeGetWalltime(int64_t* sec, int64_t* nsec); + #ifdef __cplusplus } #endif diff --git a/Libs/XEClib/includes/sys/_ketimer.h b/Libs/XEClib/includes/sys/_ketimer.h index 0c1bf1479..b4fac53df 100644 --- a/Libs/XEClib/includes/sys/_ketimer.h +++ b/Libs/XEClib/includes/sys/_ketimer.h @@ -73,6 +73,15 @@ XE_EXTERN{ */ XE_LIB int _KeDestroyTimer(int threadID); + /** + * @brief _KeSetAlarm -- set one-shot alarm + * @param seconds -- second to consider + */ + XE_LIB int _KeSetAlarm(unsigned long long seconds); + + XE_LIB int _KeSetITimer(int which, const void*, const void*); + + XE_LIB int _KeGetITimer(int which, const void*); #ifdef __cplusplus } diff --git a/Libs/XEClib/includes/sys/netdb.h b/Libs/XEClib/includes/sys/netdb.h index 01fa016cf..f2e80d2f6 100644 --- a/Libs/XEClib/includes/sys/netdb.h +++ b/Libs/XEClib/includes/sys/netdb.h @@ -41,7 +41,11 @@ XE_EXTERN{ #pragma pack(push,1) +#if defined(_MSC_VER) __declspec(align(2)) +#else +__attribute__((aligned(2))) +#endif typedef struct _dns_ { uint16_t qid; uint16_t flags; diff --git a/Libs/XEClib/includes/sys/time.h b/Libs/XEClib/includes/sys/time.h new file mode 100644 index 000000000..e3f65dfe9 --- /dev/null +++ b/Libs/XEClib/includes/sys/time.h @@ -0,0 +1,50 @@ +/** +* @file timer.h +* +* BSD 2-Clause License +* +* Copyright (c) 2022-2023, Manas Kamal Choudhury +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* 1. Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* 2. Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following disclaimer in the documentation +* and/or other materials provided with the distribution. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +**/ + +#ifndef __SYS_TIME_H__ +#define __SYS_TIME_H__ + +#include +#include + +struct itimerval { + timeval it_interval; + timeval it_value; +}; + +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +#define setitimer(which,newval,oldval) _KeSetITimer(which, newval, oldval) +#define getitimer(which,curval) _KeGetITimer(which, curval) + +#endif diff --git a/Libs/XEClib/includes/time.h b/Libs/XEClib/includes/time.h index 3c3901cd8..67a8dd927 100644 --- a/Libs/XEClib/includes/time.h +++ b/Libs/XEClib/includes/time.h @@ -78,6 +78,11 @@ XE_EXTERN{ long tv_usec; }timeval; + struct timespec { + time_t tv_sec; + long tv_nsec; + }; + XE_LIB char *asctime(const struct tm *); XE_LIB clock_t clock(void); @@ -87,7 +92,7 @@ XE_EXTERN{ XE_LIB time_t mktime(struct tm *); XE_LIB time_t time(time_t *t); XE_LIB int gettimeofday(timeval *val); - + XE_LIB int nanosleep(const struct timespec* req, struct timespec* rem); #ifdef __cplusplus } #endif diff --git a/Libs/XEClib/includes/unistd.h b/Libs/XEClib/includes/unistd.h index 608633330..b011ffee3 100644 --- a/Libs/XEClib/includes/unistd.h +++ b/Libs/XEClib/includes/unistd.h @@ -33,9 +33,10 @@ #define __UNISTD_H__ #include <_xeneva.h> +#include #ifdef __cplusplus -XE_EXTERN { +XE_EXTERN{ #endif #define STDIN_FILENO 0 @@ -61,6 +62,10 @@ XE_EXTERN { #define __NEED_intptr_t #define __NEED_useconds_t +#define alarm(x) _KeSetAlarm((unsigned long long)x) + + XE_LIB unsigned int sleep(unsigned int seconds); + #ifdef __cplusplus } #endif diff --git a/Libs/XEClib/math.cpp b/Libs/XEClib/math.cpp index 1e64192d2..05e2133cd 100644 --- a/Libs/XEClib/math.cpp +++ b/Libs/XEClib/math.cpp @@ -32,7 +32,7 @@ #define itable ((double *) xtable) -static int xtable[16] = { +static unsigned int xtable[16] = { 0x540bcb0d, 0x3fe56936, 0x415a86d3, 0x3fe35800, 0xd9ac3519, 0x3fe1c80d, 0x34f91569, 0x3fe08be9, 0x8f3386d8, 0x3fee4794, 0x9ea02719, 0x3feb5b28, 0xe4ff9edc, 0x3fe92589, 0x1c52539d, 0x3fe76672 diff --git a/Libs/XEClib/stdio.cpp b/Libs/XEClib/stdio.cpp index 82d5da05b..22d4650d2 100644 --- a/Libs/XEClib/stdio.cpp +++ b/Libs/XEClib/stdio.cpp @@ -33,6 +33,8 @@ #include #include <_xeprint.h> +static char output_printf[512]; +static size_t output_printf_len = 0; /* * fopen -- opens the file specified by name and associates a * stream with it. @@ -238,11 +240,6 @@ int fclose(FILE* fp) { return ret; } -int fflush(FILE* stream) { - //_KeWriteFile(stream->_file_num,stream->ptr, ) - //not implemented - return 0; -} int putchar(int c) { return fputc(c, stdout); @@ -252,7 +249,7 @@ int puts(const char *s) { _KePrint("Puts: %x , strlen: %d\r\n", stdout, strlen(s)); fwrite((void*)s, 1, strlen(s), stdout); _KePrint("fwrite done \r\n"); - fwrite("\n", 1, 1, stdout); + fwrite((void*)"\n", 1, 1, stdout); return 0; } @@ -280,8 +277,6 @@ int sprintf(char* output, const char* format, ...) { len = _xeprint(output, MAX_STRING_LENGTH, format, list); va_end(list); return len; - - return 0; } int snprintf(char* output, size_t sz, const char* format, ...) { @@ -299,6 +294,27 @@ int snprintf(char* output, size_t sz, const char* format, ...) { return len; } + +static void __stdout_flush_raw() { + if (output_printf_len > 0) { + _KeWriteFile(XENEVA_STDOUT, output_printf, output_printf_len); + output_printf_len = 0; + } +} + +static void __stdout_putc(char c) { + output_printf[output_printf_len++] = c; + if (c == '\n' || output_printf_len >= 512) { + _KeWriteFile(XENEVA_STDOUT, output_printf, output_printf_len); + output_printf_len = 0; + } +} + +static void __stdout_write(const char* data, size_t len) { + for (size_t i = 0; i < len; i++) + __stdout_putc(data[i]); +} + int printf(const char* format, ...) { va_list list; va_start(list, format); @@ -307,15 +323,26 @@ int printf(const char* format, ...) { _store_stack_param(buffer); list = (va_list)buffer; #endif - char output[MAX_STRING_LENGTH + 1]; - memset(output, '\0', MAX_STRING_LENGTH); - int len = _xeprint(output, MAX_STRING_LENGTH, format, list); + char _output[MAX_STRING_LENGTH + 1]; + memset(_output, '\0', MAX_STRING_LENGTH); + int len = _xeprint(_output, MAX_STRING_LENGTH, format, list); va_end(list); - _KeWriteFile(XENEVA_STDOUT, output, strlen(output)); + //if (strchr(_output, '\n') == 0) + //_KeWriteFile(XENEVA_STDOUT, _output, strlen(_output)); + __stdout_write(_output, len); return len; } +int fflush(FILE* stream) { + //_KeWriteFile(stream->_file_num,stream->ptr, ) + //not implemented + if (stream != stdout) + return 1; + __stdout_flush_raw(); + return 0; +} + int vfprintf(FILE *stream, const char* format, va_list list) { int status = 0; diff --git a/Libs/XEClib/string.cpp b/Libs/XEClib/string.cpp index fd120a595..05527af17 100644 --- a/Libs/XEClib/string.cpp +++ b/Libs/XEClib/string.cpp @@ -42,6 +42,10 @@ #define HIGHS (ONES * (UCHAR_MAX/2+1)) #define HASZERO(x) ((x)-ONES & ~(x) & HIGHS) +#ifdef _MSC_VER +#pragma function(memset) +#endif + void* _cdecl memset(void *targ, unsigned char val, size_t len){ /*uint8_t *t = (uint8_t*)targ; while (len--) @@ -109,13 +113,18 @@ void memset(void *targ, unsigned char val, uint32_t len){ } - +#ifdef _MSC_VER +#pragma function(memcmp) +#endif int memcmp(const void *vl, const void *vr, size_t n){ const unsigned char *l = (unsigned char*)vl, *r = (unsigned char*)vr; for (; n && *l == *r; n--, l++, r++); return n ? *l - *r : 0; } +#ifdef _MSC_VER +#pragma function(memcpy) +#endif void *memcpy(void *dest, void *src, size_t len) { uint8_t* t = (uint8_t*)dest; @@ -236,6 +245,10 @@ void *memcpy(void *dest, void *src, uint32_t len) { } #endif +#ifdef _MSC_VER +#pragma function(strcmp) +#endif + int strcmp(const char* str1, const char* str2){ int res = 0; while (!(res = *(unsigned char*)str1 - *(unsigned char*)str2) && *str2) @@ -249,18 +262,27 @@ int strcmp(const char* str1, const char* str2){ return res; } +#ifdef _MSC_VER +#pragma function(strcpy) +#endif + char *strcpy(char* __restrict s1, const char * __restrict s2){ char *s1_p = s1; for (; (*s1 = *s2); s1++, s2++); return s1_p; } +#ifdef _MSC_VER +#pragma function(strlen) +#endif + size_t strlen(const char* s){ const char* a = s; for (; *s; s++); return s - a; } + size_t strnlen(const char *string, size_t maxlen){ size_t count = 0; diff --git a/Libs/XEClib/sys/_xeprint.cpp b/Libs/XEClib/sys/_xeprint.cpp index 87ed9e50e..d37f24cea 100644 --- a/Libs/XEClib/sys/_xeprint.cpp +++ b/Libs/XEClib/sys/_xeprint.cpp @@ -31,6 +31,7 @@ #include #include #include +#include <_xeprint.h> int _ldigits(unsigned long long num, int base, int sign) { int digits = 1; diff --git a/Libs/XEClib/sys/xenet.cpp b/Libs/XEClib/sys/xenet.cpp index ca189d20c..68c778921 100644 --- a/Libs/XEClib/sys/xenet.cpp +++ b/Libs/XEClib/sys/xenet.cpp @@ -133,8 +133,16 @@ struct hostent* gethostbyname(const char* name) { return NULL; } + /** need someway to: get all available interfaces + * rather than hardcoding it + */ +#ifdef ARCH_X64 char ifname[5]; strcpy(ifname, "e1000"); +#else + char ifname[12]; + strcpy(ifname, "virtio-net"); +#endif socket_setopt(sock, SOL_SOCKET, SO_BINDTODEVICE, ifname, strlen(ifname) + 1); XEDNSEntry dns; @@ -213,7 +221,7 @@ struct hostent* gethostbyname(const char* name) { if (len > 0) break; /* sleep for 1s*/ - _KeProcessSleep(10000); + _KeProcessSleep(100); timeout++; } diff --git a/Libs/XEClib/time.cpp b/Libs/XEClib/time.cpp index 2b14d8410..ba9a00e43 100644 --- a/Libs/XEClib/time.cpp +++ b/Libs/XEClib/time.cpp @@ -30,6 +30,7 @@ #include #include #include +#include int dayOfWeek(unsigned day, unsigned month, unsigned year) { if (month < 3) { @@ -161,4 +162,39 @@ time_t mktime(tm* timestruc) { } time_t time(time_t* t) { return 0; +} + + +/** + * unistd.h sleep implementation + */ +unsigned int sleep(unsigned int seconds) { + uint64_t ticks = (uint64_t)seconds * 1000ULL; + _KeProcessSleep(ticks); + return 0; +} + +/** + * implementation of time.h nanosleep + */ +static inline uint64_t ns_to_ticks_ceil(uint64_t total_ns) { + return (total_ns + 999999ULL) / 1000000ULL; +} + +static inline void ticks_to_timespec(uint64_t ticks, struct timespec* ts) { + uint64_t total_ns = ticks * 1000000ULL; + ts->tv_sec = total_ns / 1000000000ULL; + ts->tv_nsec = total_ns % 1000000000ULL; +} + + +int nanosleep(const struct timespec* req, struct timespec* rem) { + if (!req || req->tv_nsec < 0 || req->tv_nsec >= 1000000000L || req->tv_sec < 0) + return -1; + + uint64_t total_ns = (uint64_t)req->tv_sec * 1000000000ULL + (uint64_t)req->tv_nsec; + uint64_t ticks = ns_to_ticks_ceil(total_ns); + + _KeProcessSleep(ticks); + return 0; } \ No newline at end of file diff --git a/Libs/XECrt/xecrt.lib b/Libs/XECrt/xecrt.lib new file mode 100644 index 000000000..7376fc185 Binary files /dev/null and b/Libs/XECrt/xecrt.lib differ diff --git a/Process/AudioPlayer/AudioPlayer.vcxproj b/Process/AudioPlayer/AudioPlayer.vcxproj index bbc12c2c1..8c489c8ef 100644 --- a/Process/AudioPlayer/AudioPlayer.vcxproj +++ b/Process/AudioPlayer/AudioPlayer.vcxproj @@ -1,4 +1,4 @@ - + @@ -153,7 +153,7 @@ ..\..\Build\audplr.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -172,7 +172,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -200,7 +200,7 @@ ..\..\Build\audplr.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -221,7 +221,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/AudioPlayer/Makefile b/Process/AudioPlayer/Makefile new file mode 100644 index 000000000..d1769916d --- /dev/null +++ b/Process/AudioPlayer/Makefile @@ -0,0 +1,48 @@ +# XenevaOS AudioPlayer Makefile (GCC Build) + +TARGET = audplr.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = main.cpp minimp3.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: audplr.exe + +audplr.exe: $(TARGET) + @echo "Converting ELF to PE32+ (audplr.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) audplr.exe + +$(TARGET): $(OBJS) + @echo "Linking audplr.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) audplr.exe diff --git a/Process/AudioPlayer/crt_arm64.s b/Process/AudioPlayer/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/AudioPlayer/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/AudioPlayer/linker.ld b/Process/AudioPlayer/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/AudioPlayer/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/Calculator/Calculator.vcxproj b/Process/Calculator/Calculator.vcxproj index f44aa0b8b..1f886f2c0 100644 --- a/Process/Calculator/Calculator.vcxproj +++ b/Process/Calculator/Calculator.vcxproj @@ -1,4 +1,4 @@ - + @@ -140,7 +140,7 @@ ..\..\Build\calc.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -159,7 +159,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -185,7 +185,7 @@ ..\..\Build\calc.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -206,7 +206,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/Calculator/Makefile b/Process/Calculator/Makefile new file mode 100644 index 000000000..41ba95f6d --- /dev/null +++ b/Process/Calculator/Makefile @@ -0,0 +1,48 @@ +# XenevaOS Calculator Makefile (GCC Build) + +TARGET = calc.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = main.cpp actions.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: calc.exe + +calc.exe: $(TARGET) + @echo "Converting ELF to PE32+ (calc.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) calc.exe + +$(TARGET): $(OBJS) + @echo "Linking calc.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) calc.exe diff --git a/Process/Calculator/crt_arm64.s b/Process/Calculator/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/Calculator/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/Calculator/linker.ld b/Process/Calculator/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/Calculator/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/Calender/Calender.vcxproj b/Process/Calender/Calender.vcxproj index 7b036ec3b..150c4de79 100644 --- a/Process/Calender/Calender.vcxproj +++ b/Process/Calender/Calender.vcxproj @@ -181,7 +181,7 @@ ..\..\Build\$(TargetName).exe - ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + ..\..\ARM64\Debug;..\..\Libs\XECrt;$(SolutionDir)Build;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false diff --git a/Process/Calender/Makefile b/Process/Calender/Makefile new file mode 100644 index 000000000..82f7247f6 --- /dev/null +++ b/Process/Calender/Makefile @@ -0,0 +1,48 @@ +# XenevaOS Calender Makefile (GCC Build) + +TARGET = calendr.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = main.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: calendr.exe + +calendr.exe: $(TARGET) + @echo "Converting ELF to PE32+ (calendr.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) calendr.exe + +$(TARGET): $(OBJS) + @echo "Linking calendr.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) calendr.exe diff --git a/Process/Calender/crt_arm64.s b/Process/Calender/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/Calender/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/Calender/linker.ld b/Process/Calender/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/Calender/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/Calender/main.cpp b/Process/Calender/main.cpp index 439b7fe90..0b52fb59e 100644 --- a/Process/Calender/main.cpp +++ b/Process/Calender/main.cpp @@ -270,6 +270,38 @@ void CalenderRepaint(int year, int month, int num_days) { ChWindowUpdate(mainWin, 0, 0, mainWin->info->width, mainWin->info->height, 1, 0); } + +/** + * AI Generated code + */ +static void civil_from_days(int64_t z, int* y, unsigned* m, unsigned* d) { + z += 719468; + int64_t era = (z >= 0 ? z : z - 146096) / 146097; + unsigned doe = (unsigned)(z - era * 146097); + unsigned yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; + int64_t y0 = (int64_t)yoe + era * 400; + unsigned doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + unsigned mp = (5 * doy + 2) / 153; + *d = doy - (153 * mp + 2) / 5 + 1; + *m = mp + (mp < 10 ? 3 : -9); + *y = (int)(y0 + (*m <= 2)); +} + +void CalenderGetYMD(uint32_t* year, uint32_t* month, uint32_t* day, int32_t tz_offset) { + int64_t sec_, nsec_; + _KeGetWalltime(&sec_, &nsec_); + sec_ += tz_offset; + + int64_t days = (int64_t)sec_ / 86400; + uint32_t secs_of_day = sec_ % 86400; + + int y; unsigned mo, d; + civil_from_days(days, &y, &mo, &d); + *year = y; + *month = mo; + *day = d; +} + /* * main -- main entry */ @@ -284,10 +316,14 @@ int main(int argc, char* argv[]){ calenderBuffer = (uint8_t*)malloc(sizeof(DateBox) * 42); memset(calenderBuffer, 0, sizeof(DateBox) * 42); - _KeGetCurrentTime(&t); + //_KeGetCurrentTime(&t); + current_month = t.month; current_year = t.year; current_day = t.day; + CalenderGetYMD((uint32_t*)¤t_year, + (uint32_t*)¤t_month,(uint32_t*)¤t_day, + TZ_SEC_IST_INDIA); monthText = ChInitialiseFont(FORTE); @@ -344,7 +380,7 @@ int main(int argc, char* argv[]){ */ CalenderRepaint(t.year, t.month, days_in_month[t.month]); - //ChWindowBroadcastIcon(app, "/icons/calndr.bmp"); + ChWindowBroadcastIcon(app, "/icons/calndr.bmp"); PostEvent e; memset(&e, 0, sizeof(PostEvent)); diff --git a/Process/Control/Control.vcxproj b/Process/Control/Control.vcxproj index cd18a982d..f8e3e9ab7 100644 --- a/Process/Control/Control.vcxproj +++ b/Process/Control/Control.vcxproj @@ -133,7 +133,7 @@ Native true ..\..\Build\ctrl.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -151,7 +151,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/Control/Makefile b/Process/Control/Makefile new file mode 100644 index 000000000..cc6ba8fa7 --- /dev/null +++ b/Process/Control/Makefile @@ -0,0 +1,48 @@ +# XenevaOS Control Makefile (GCC Build) + +TARGET = ctrl.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = ctrl.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: ctrl.exe + +ctrl.exe: $(TARGET) + @echo "Converting ELF to PE32+ (ctrl.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) ctrl.exe + +$(TARGET): $(OBJS) + @echo "Linking ctrl.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) ctrl.exe diff --git a/Process/Control/crt_arm64.s b/Process/Control/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/Control/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/Control/ctrl.cpp b/Process/Control/ctrl.cpp index 42a4a3b3b..17b89dc2e 100644 --- a/Process/Control/ctrl.cpp +++ b/Process/Control/ctrl.cpp @@ -152,7 +152,7 @@ int main(int argc, char* argv[]) { "making them a \nfull-fledged standalone device capable of replacing smartphones by doing everything \nthey do."; char* android = "We're working towards adding an Android Compatibility Layer which will bring support for all" " android apps on XenevaOS."; - char* default = "Default text for Control App "; + char* default_text = "Default text for Control App "; if (argc > 1) { char* param = argv[1]; if (strcmp(param, "about") == 0) { @@ -163,7 +163,7 @@ int main(int argc, char* argv[]) { _add_buttons = false; } else if (strcmp(param, "default") == 0) { - ChTextBoxSetText(tb, default); + ChTextBoxSetText(tb, default_text); _add_buttons = false; } } diff --git a/Process/Control/linker.ld b/Process/Control/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/Control/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/Deodhai/Deodhai.vcxproj b/Process/Deodhai/Deodhai.vcxproj index 10966b545..c5a6d0006 100644 --- a/Process/Deodhai/Deodhai.vcxproj +++ b/Process/Deodhai/Deodhai.vcxproj @@ -1,4 +1,4 @@ - + @@ -171,7 +171,7 @@ true ..\..\Build\deodhai.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -191,7 +191,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -218,7 +218,7 @@ true ..\..\Build\$(TargetName).exe - ..\..\ARM64\Debug;..\..\Libs\XECrt + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -240,7 +240,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/DeodhaiAudio/DeodhaiAudio.vcxproj b/Process/DeodhaiAudio/DeodhaiAudio.vcxproj index 6cad7a92d..f4c579339 100644 --- a/Process/DeodhaiAudio/DeodhaiAudio.vcxproj +++ b/Process/DeodhaiAudio/DeodhaiAudio.vcxproj @@ -169,7 +169,7 @@ Native true ..\..\Build\deoaud.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib; true false @@ -215,7 +215,7 @@ Native true ..\..\Build\deoaud.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib; true false @@ -236,7 +236,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/DeodhaiAudio/Makefile b/Process/DeodhaiAudio/Makefile new file mode 100644 index 000000000..938d20913 --- /dev/null +++ b/Process/DeodhaiAudio/Makefile @@ -0,0 +1,48 @@ +# XenevaOS DeodhaiAudio Makefile (GCC Build) + +TARGET = deoaud.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = audmain.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: deoaud.exe + +deoaud.exe: $(TARGET) + @echo "Converting ELF to PE32+ (deoaud.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) deoaud.exe + +$(TARGET): $(OBJS) + @echo "Linking deoaud.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) deoaud.exe diff --git a/Process/DeodhaiAudio/audmain.cpp b/Process/DeodhaiAudio/audmain.cpp index 906ee809e..8193ba6cb 100644 --- a/Process/DeodhaiAudio/audmain.cpp +++ b/Process/DeodhaiAudio/audmain.cpp @@ -32,7 +32,7 @@ #include #include #include -#include > +#include #include #include #include @@ -389,6 +389,10 @@ int main(int argc, char* argv[]) { DeodhaiAudioHandleMessage(msg); memset(buff, 0, sizeof(DeodhaiAudioMessage)); } - _KeProcessSleep(sleep_duration); + //_KeProcessSleep(sleep_duration); + /** actually, hardware should generate interrupt + * and unblock this thread, we'll fix that in future + */ + _KePauseThread(); } } \ No newline at end of file diff --git a/Process/DeodhaiAudio/crt_arm64.s b/Process/DeodhaiAudio/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/DeodhaiAudio/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/DeodhaiAudio/linker.ld b/Process/DeodhaiAudio/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/DeodhaiAudio/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/DeodhaiXR/DeodhaiXR.vcxproj b/Process/DeodhaiXR/DeodhaiXR.vcxproj index 01659d864..706d33afd 100644 --- a/Process/DeodhaiXR/DeodhaiXR.vcxproj +++ b/Process/DeodhaiXR/DeodhaiXR.vcxproj @@ -1,4 +1,4 @@ - + @@ -174,7 +174,7 @@ F:\calc.exe - E:\Xeneva Project\Aurora\x64\Debug;E:\Xeneva Project\Aurora\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;E:\Xeneva Project\Aurora\x64\Debug;E:\Xeneva Project\Aurora\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; Chitralekha.lib;ftype.lib; true false @@ -218,7 +218,7 @@ ..\..\Build\$(TargetName).exe - ..\..\ARM64\Debug;..\..\Libs\XECrt + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt XEClib.lib; chlkha.lib;xecrt.lib; true false @@ -242,7 +242,7 @@ clang --target=aarch64-windows-msvc -c -o "$(IntDir)%(Filename).obj" "%(FullPath)" - copy "..\..\Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/DeodhaiXR/Makefile b/Process/DeodhaiXR/Makefile new file mode 100644 index 000000000..c3e0f2b51 --- /dev/null +++ b/Process/DeodhaiXR/Makefile @@ -0,0 +1,49 @@ +# XenevaOS DeodhaiXR Makefile (GCC Build) + +TARGET = deodxr.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = alpha.cpp animation.cpp backdirty.cpp clip.cpp compose.cpp cursor.cpp \ + dirty.cpp main.cpp rect.cpp surface.cpp window.cpp +S_SRCS = crt_arm64.s _fastcpy_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: deodxr.exe + +deodxr.exe: $(TARGET) + @echo "Converting ELF to PE32+ (deodxr.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) deodxr.exe + +$(TARGET): $(OBJS) + @echo "Linking deodxr.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) deodxr.exe diff --git a/Process/DeodhaiXR/_fastcpy_arm64.s b/Process/DeodhaiXR/_fastcpy_arm64.s index ed7bdf6e0..203a1b7f8 100644 --- a/Process/DeodhaiXR/_fastcpy_arm64.s +++ b/Process/DeodhaiXR/_fastcpy_arm64.s @@ -49,8 +49,8 @@ _fastcpy: b.lt .byte_loop .blk16_loop: - ldp q0, q1,[x1], #16 - stp q0,q1,[x0],#16 + ldr q0,[x1], #16 + str q0,[x0],#16 sub x2, x2, #16 cmp x2, #16 b.ge .blk16_loop diff --git a/Process/DeodhaiXR/alpha.cpp b/Process/DeodhaiXR/alpha.cpp index c45b227b6..a609ede6d 100644 --- a/Process/DeodhaiXR/alpha.cpp +++ b/Process/DeodhaiXR/alpha.cpp @@ -31,7 +31,9 @@ #include "deodxr.h" #include "alpha.h" +#if defined(ARCH_ARM64) #include +#endif #include #include "window.h" #include @@ -44,6 +46,7 @@ static const uint8_t alpha_shuffle[16] = { }; void __pixel_blend_neon(uint32_t* dst, const uint32_t* src, int width) { +#if defined(ARCH_ARM64) int x = 0; uint8x16_t shuf = vld1q_u8(alpha_shuffle); for (; x <= width - 4; x += 4) { @@ -84,7 +87,7 @@ void __pixel_blend_neon(uint32_t* dst, const uint32_t* src, int width) { } } - // scaler tail + // scalar tail for (; x < width; x++) { uint32_t sp = src[x], dp = dst[x]; uint8_t sa = sp >> 24; @@ -95,9 +98,21 @@ void __pixel_blend_neon(uint32_t* dst, const uint32_t* src, int width) { uint8_t g = ((uint32_t)((sp >> 8) & 0xFF) * sa + (uint32_t)((dp >> 8) & 0xFF) * inv) >> 8; uint8_t b = ((uint32_t)((sp) & 0xFF) * sa + (uint32_t)((dp) & 0xFF) * inv) >> 8; dst[x] = (0xFF << 24) | (r << 16) | (g << 8) | b; - } } +#else + for (int x = 0; x < width; x++) { + uint32_t sp = src[x], dp = dst[x]; + uint8_t sa = sp >> 24; + if (sa == 255) { dst[x] = sp; continue; } + if (sa == 0) { continue; } + uint32_t inv = 255 - sa; + uint8_t r = ((uint32_t)((sp >> 16) & 0xFF) * sa + (uint32_t)((dp >> 16) & 0xFF) * inv) >> 8; + uint8_t g = ((uint32_t)((sp >> 8) & 0xFF) * sa + (uint32_t)((dp >> 8) & 0xFF) * inv) >> 8; + uint8_t b = ((uint32_t)((sp) & 0xFF) * sa + (uint32_t)((dp) & 0xFF) * inv) >> 8; + dst[x] = (0xFF << 24) | (r << 16) | (g << 8) | b; + } +#endif } #define GLASS_BLUR_RADIUS 6 @@ -185,6 +200,7 @@ void glass_precompute_blur(uint32_t* out_blur, uint32_t* tmp, const uint32_t* ca } void _blend_scanline_glass_neon(uint32_t* canvas_row, const uint32_t* win_row, const uint32_t* blur_row, int width) { +#if defined(ARCH_ARM64) uint8x16_t shuf = vld1q_u8(alpha_shuffle); int x = 0; @@ -193,7 +209,6 @@ void _blend_scanline_glass_neon(uint32_t* canvas_row, const uint32_t* win_row, c uint8x16_t b = vld1q_u8((const uint8_t*)(blur_row + x)); uint8x16_t d = vld1q_u8((const uint8_t*)(canvas_row + x)); - uint8x16_t sa = vqtbl1q_u8(s, shuf); uint8x16_t inv = vsubq_u8(vdupq_n_u8(255), sa); @@ -208,14 +223,15 @@ void _blend_scanline_glass_neon(uint32_t* canvas_row, const uint32_t* win_row, c uint8x16_t is_zero = vceqq_u8(sa, zero); uint8x16_t is_nonzero = vmvnq_u8(is_zero); - uint8x16_t result = vorrq_u8(vandq_u8(blended, is_nonzero), vandq_u8(d, is_zero)); // vcombine_u8(vshrn_n_u16(lo, 8), vshrn_n_u16(hi, 8)); - + uint8x16_t result = vorrq_u8(vandq_u8(blended, is_nonzero), vandq_u8(d, is_zero)); vst1q_u8((uint8_t*)(canvas_row + x), result); - } - /** scaler tail*/ + /** scalar tail */ for (; x < width; x++) { +#else + for (int x = 0; x < width; x++) { +#endif uint32_t sp = win_row[x]; uint32_t bp = blur_row[x]; uint8_t sa = (uint8_t)(sp >> 24); @@ -224,7 +240,7 @@ void _blend_scanline_glass_neon(uint32_t* canvas_row, const uint32_t* win_row, c canvas_row[x] = sp; } else if (sa == 0) { - //canvas_row[x] = bp; + canvas_row[x] = bp; } else { uint32_t inv = 255 - sa; @@ -324,6 +340,7 @@ void _shadow_compose_neon(uint32_t* canv, int canvas_w, int canvas_h, const uint int x = 0; for (; x <= row_w - 4; x += 4) { + #if 0 /* WIP: NEON shadow compose path — unused scaffolding, type errors pending fix */ uint32x4_t s4 = vld1q_u32(src + x); uint32x4_t d4 = vld1q_u32(dst + x); @@ -336,6 +353,7 @@ void _shadow_compose_neon(uint32_t* canv, int canvas_w, int canvas_h, const uint uint8x8_t inv_hi = vmovn_u16(vmovl_u32(vget_high_u32(inv4))); uint8x8_t inv_lo4 = vzip1_u8(inv_lo, inv_lo); + #endif for (int i = x; i < x + 4; i++) { uint32_t dp = dst[i]; @@ -347,7 +365,6 @@ void _shadow_compose_neon(uint32_t* canv, int canvas_w, int canvas_h, const uint uint8_t b = (uint8_t)(((dp >> 0 & 0xFF) * inv) >> 8); dst[i] = (0xFFu << 24) | ((uint32_t)r << 16) | ((uint32_t)g << 8) | b; - } } diff --git a/Process/DeodhaiXR/compose.cpp b/Process/DeodhaiXR/compose.cpp index 96753f804..17af1a285 100644 --- a/Process/DeodhaiXR/compose.cpp +++ b/Process/DeodhaiXR/compose.cpp @@ -33,6 +33,19 @@ #include "_fastcpy.h" extern Window* _get_always_on_top(); + +bool is_window_fully_overlapped(WinSharedInfo* curInfo, Window* alwaysOnTop) { + for (Window* check = alwaysOnTop; check != NULL; check = check->next) { + WinSharedInfo* info = (WinSharedInfo*)check->sharedInfo; + if (info->hide) + continue; + if (curInfo->x >= info->x && (curInfo->x + curInfo->width <= info->x + info->width) && + curInfo->y >= info->y && (curInfo->y + curInfo->height <= info->y + info->height)) { + return true; + } + } + return false; +} /** * @brief Check for small area updates !! not entire window */ @@ -40,6 +53,13 @@ void _compose_dirty_area_(ChCanvas* canvas,Window* win, Window* focusedWin, WinS Window* alwaysOnTop = _get_always_on_top(); if ((info->rect_count > 0) && (info->dirty)) { + + if (is_window_fully_overlapped(info, alwaysOnTop)) { + info->rect_count = 0; + info->dirty = 0; + return; + } + for (int k = 0; k < info->rect_count; k++) { int64_t r_x = info->rect[k].x; int64_t r_y = info->rect[k].y; @@ -73,6 +93,8 @@ void _compose_dirty_area_(ChCanvas* canvas,Window* win, Window* focusedWin, WinS Window* clipWin = NULL; WinSharedInfo* clipInfo = NULL; + + if (info->alpha) { for (int j = 0; j < r_h; j++) { for (int i = 0; i < r_w; i++) { @@ -107,6 +129,20 @@ void _compose_dirty_area_(ChCanvas* canvas,Window* win, Window* focusedWin, WinS } + /* always on top list */ + /* for (clipWin = alwaysOnTop; clipWin != NULL; clipWin = clipWin->next) { + clipInfo = (WinSharedInfo*)clipWin->sharedInfo; + if (clipWin == win) + continue; + r2.x = clipInfo->x; + r2.y = clipInfo->y; + r2.w = clipInfo->width; + r2.h = clipInfo->height; + + if (ClipCheckIntersect(&r1, &r2)) { + ClipCalculateRect(&r1, &r2, clipRect, &clipCount); + } + }*/ /* for (Window* cutt = win; cutt != NULL; cutt = cutt->next) { WinSharedInfo* cuttinfo = (WinSharedInfo*)cutt->sharedInfo; @@ -250,8 +286,15 @@ void _compose_dirty_area_(ChCanvas* canvas,Window* win, Window* focusedWin, WinS void _compose_entire_window(ChCanvas* canvas, Window* win, bool _window_update_all_, WinSharedInfo* info, Window* focusedWin, bool _window_moving_, bool _shadow_update) { Window* alwaysOnTop = _get_always_on_top(); + /* If no small areas, update entire window */ if (win != NULL && _window_update_all_ || (info->rect_count == 0 && info->updateEntireWindow == 1)) { + + if (is_window_fully_overlapped(info, alwaysOnTop)) { + if (info->updateEntireWindow) + info->updateEntireWindow = 0; + return; + } int64_t winx = 0; int64_t winy = 0; winx = info->x; diff --git a/Process/DeodhaiXR/crt_arm64.s b/Process/DeodhaiXR/crt_arm64.s index e69de29bb..17b2d6c49 100644 --- a/Process/DeodhaiXR/crt_arm64.s +++ b/Process/DeodhaiXR/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/DeodhaiXR/linker.ld b/Process/DeodhaiXR/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/DeodhaiXR/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/DeodhaiXR/main.cpp b/Process/DeodhaiXR/main.cpp index c2919394e..82c834929 100644 --- a/Process/DeodhaiXR/main.cpp +++ b/Process/DeodhaiXR/main.cpp @@ -891,7 +891,7 @@ int main(int argc, char* argv[]){ DeodhaiBackSurfaceUpdate(canv, 0, 0, screen_w, screen_h); if (screen_w == 1024 && screen_h == 768) { _KePrint("Drawing wallpaper \r\n"); - DrawWallpaper(canv, "/mtn.jpg"); + DrawWallpaper(canv, "/XE1_2.jpg"); DeodhaiBackSurfaceUpdate(canv, 0, 0, screen_w, screen_h); } else if (screen_w == 1920 && screen_h == 1080) { diff --git a/Process/DeodhaiXR/window.cpp b/Process/DeodhaiXR/window.cpp index 354c34e6e..b1a5adbcd 100644 --- a/Process/DeodhaiXR/window.cpp +++ b/Process/DeodhaiXR/window.cpp @@ -122,8 +122,8 @@ Window* CreateWindow(int x, int y, int w, int h, uint16_t flags, uint16_t ownerI win->backBufferKey = backBufferKey; win->sharedInfo = CreateSharedWinSpace(&shKey, ownerId); win->shWinKey = shKey; - win->title = (char*)malloc(strlen(title)); - memset(win->title, 0, strlen(title)); + win->title = (char*)malloc(strlen(title) + 1); + memset(win->title, 0, strlen(title) + 1); strcpy(win->title, title); WinSharedInfo* shwin = (WinSharedInfo*)win->sharedInfo; shwin->x = x; diff --git a/Process/Files/Files.vcxproj b/Process/Files/Files.vcxproj index f9c457f4b..e34148c57 100644 --- a/Process/Files/Files.vcxproj +++ b/Process/Files/Files.vcxproj @@ -1,4 +1,4 @@ - + @@ -141,7 +141,7 @@ ..\..\Build\file.exe - ..\..\x64\Debug;E:\Xeneva Project\Aurora\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;E:\Xeneva Project\Aurora\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib;chlkha.lib;ftype.lib; true false @@ -160,7 +160,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -186,7 +186,7 @@ ..\..\Build\file.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt XEClib.lib; xecrt.lib;chlkha.lib;ftype.lib; true false @@ -207,7 +207,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/Files/Makefile b/Process/Files/Makefile new file mode 100644 index 000000000..5f7e22b57 --- /dev/null +++ b/Process/Files/Makefile @@ -0,0 +1,48 @@ +# XenevaOS Files Makefile (GCC Build) + +TARGET = file.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = main.cpp extmngr.cpp partition.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: file.exe + +file.exe: $(TARGET) + @echo "Converting ELF to PE32+ (file.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) file.exe + +$(TARGET): $(OBJS) + @echo "Linking file.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) file.exe diff --git a/Process/Files/crt_arm64.s b/Process/Files/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/Files/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/Files/linker.ld b/Process/Files/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/Files/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/Init/Init.vcxproj b/Process/Init/Init.vcxproj index cf762672d..5d282b012 100644 --- a/Process/Init/Init.vcxproj +++ b/Process/Init/Init.vcxproj @@ -1,4 +1,4 @@ - + @@ -147,10 +147,10 @@ _aumain /filealign:4096 %(AdditionalOptions) - ..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;%(AdditionalLibraryDirectories) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -192,10 +192,10 @@ _aumain /filealign:4096 %(AdditionalOptions) - ..\..\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\ARM64\Debug;%(AdditionalLibraryDirectories) - copy "..\..\Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/Init/Makefile b/Process/Init/Makefile new file mode 100644 index 000000000..c5d2b3d5f --- /dev/null +++ b/Process/Init/Makefile @@ -0,0 +1,48 @@ +# XenevaOS init.exe Makefile (GCC Build) + +TARGET = init.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = _init.cpp splash.cpp +S_SRCS = crt0arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: init.exe + +init.exe: $(TARGET) + @echo "Converting ELF to PE32+ (init.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) init.exe + +$(TARGET): $(OBJS) + @echo "Linking init.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) init.exe diff --git a/Process/Init/_init.cpp b/Process/Init/_init.cpp index d339c2db4..2a7f5c01a 100644 --- a/Process/Init/_init.cpp +++ b/Process/Init/_init.cpp @@ -52,6 +52,7 @@ #define GROUP_VIDEO 21 #define GROUP_TTY 22 #define GROUP_AUDIO 21 +#define GROUP_NETWORK 23 /** hardcoded untill we get proper * login manager @@ -113,7 +114,10 @@ void init_basic_gid_to_dev() { if (fd != -1) { _KeCredChangeID(fd, 0, GROUP_VIDEO); } - + fd = _KeOpenFile("/dev/net/virtio-net", FILE_OPEN_READ_ONLY); + if (fd != -1) { + _KeCredChangeID(fd, 0, GROUP_NETWORK); + } } /** @@ -259,17 +263,19 @@ extern "C" void main(int argc, char* argv[]) { /** TODO: add IPC system to track real system progress and animate the logo accordingly **/ _KeProcessSleep(100); - + int proc = 0; #ifdef ARCH_ARM64 - int proc = _KeCreateProcess(0, "netmngr"); - _KeSetUID(proc, UAC_DEAMONS); - _KeSetGID(proc, UAC_DEAMONS); - _KeCredAddSGroup(proc, ggid_misc_world); - _KeProcessLoadExec(proc, "/netmngr.exe\0", 0, NULL); + proc = _KeCreateProcess(0, "netmngr"); + int ret_nm = _KeProcessLoadExec(proc, "/netmngr.exe", 0, NULL); + if (ret_nm != -1) { + _KeSetUID(proc, UAC_DEAMONS); + _KeSetGID(proc, UAC_DEAMONS); + _KeCredAddSGroup(proc, ggid_misc_world); + _KeProcessSleep(500); + } - _KeProcessSleep(500); /** actually, design should be like that, each process after @@ -304,7 +310,7 @@ extern "C" void main(int argc, char* argv[]) { #elif ARCH_X64 - int proc = _KeCreateProcess(0, "deodhai"); + proc = _KeCreateProcess(0, "deodhai"); _KeProcessLoadExec(proc, "/deodhai.exe", 0, NULL); #endif @@ -322,7 +328,9 @@ extern "C" void main(int argc, char* argv[]) { memset(init_msg_buff, 0, sizeof(InitRequestMsg) + 1); } if (pid == 1) - _KeProcessWaitForTermination(-1); + if (_KeProcessWaitForTermination(-1) == -1) { + _KeProcessSleep(1000); + } } diff --git a/Process/Init/linker.ld b/Process/Init/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/Init/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/Init/splash.cpp b/Process/Init/splash.cpp index 64958119c..7981cf2ed 100644 --- a/Process/Init/splash.cpp +++ b/Process/Init/splash.cpp @@ -103,6 +103,8 @@ void _fill_screen(unsigned x, unsigned y, unsigned w, unsigned h, uint32_t col) void SplashScreenShow() { int graphFd = _KeOpenFile("/dev/graph", FILE_OPEN_WRITE); _KePrint("graphFD : %d \r\n", graphFd); + if (graphFd == -1) + return; XEFileIOControl ioctl; memset(&ioctl, 0, sizeof(XEFileIOControl)); ioctl.syscall_magic = AURORA_SYSCALL_MAGIC; diff --git a/Process/NETMngr/NETMngr.vcxproj b/Process/NETMngr/NETMngr.vcxproj index 0b4ffd2f9..a7982da0e 100644 --- a/Process/NETMngr/NETMngr.vcxproj +++ b/Process/NETMngr/NETMngr.vcxproj @@ -1,4 +1,4 @@ - + @@ -136,7 +136,7 @@ ..\..\Build\netmngr.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -155,7 +155,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe + copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe" @@ -181,7 +181,7 @@ ..\..\Build\netmngr.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -202,7 +202,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/NETMngr/main.cpp b/Process/NETMngr/main.cpp index 8d50e75aa..0a66f8875 100644 --- a/Process/NETMngr/main.cpp +++ b/Process/NETMngr/main.cpp @@ -262,7 +262,6 @@ void ip_ntoa(uint32_t src_addr, char* out) { int main(int argc, char* argv[]){ printf("\nNetwork Manager Started ...\n"); printf("Identifying Network...\n"); - _KePauseThread(); /* for now we have only ethernet driver, so * we will use that @@ -299,13 +298,18 @@ int main(int argc, char* argv[]){ rtentry->ifname = (char*)malloc(strlen("e1000")); strcpy(rtentry->ifname, "virtio-net"); bool rt_entry_filled = false; - while (1) { + int timeout = 10000; + while (timeout--) { int size = socket_receive(sock_fd, buf, 4096, 0); - if (size <= 0){ + if (size == 0){ + _KePrint("Socket didn't have data in it \r\n"); _KeProcessSleep(100); continue; } + if (size == -1) + break; + Ethernet* eth = (Ethernet*)buf; if (memcmp(eth->dest, mac, 6) && @@ -323,21 +327,25 @@ int main(int argc, char* argv[]){ if (ntohl(dhcp->xid) != xid) { printf("DHCP not out transaction of xid : %d \n", xid); + _KePrint("DHCP not out transaction of xid : %d \r\n", xid); continue; } if (stage == 1) { + _KePrint("DHCP Received %x stage1\r\n", ntohl(dhcp->xid)); uint32_t yiaddr = dhcp->yiaddr; uint8_t payload2[] = { 53,1,3,50,4,(yiaddr) & 0xFF,(yiaddr >> 8) & 0xFF, (yiaddr >> 16) & 0xFF, (yiaddr >> 24) & 0xFF, 55,2,3,6,255,0 }; Ethernet* eth2 = fillDHCP(payload2, 14); uint32_t totalsz2 = (sizeof(Ethernet) + sizeof(IPV4) + sizeof(UDPPack) + sizeof(DHCPPack) + 32); + _KePrint("Sending another DHCP \r\n"); socket_send(sock_fd, eth2, totalsz2, 0); stage = 2; }else if (stage == 2) { char src_ip[16]; ip_ntoa(ntohl(ip->source), src_ip); printf("DHCP Packet received from -> %s \r\n", src_ip); + _KePrint("DHCP Packet received from -> %s \r\n", src_ip); uint32_t yiaddr = dhcp->yiaddr; char yiaddr_ip[16]; ip_ntoa(ntohl(yiaddr), yiaddr_ip); @@ -359,6 +367,7 @@ int main(int argc, char* argv[]){ ip_ntoa(ntohl(ip_data), addr); _KeFileIoControl(e1000, NET_SET_SUBNET_MASK, &ip_data); printf("Subnet mask %s %x\n", addr, ip_data); + _KePrint("Subnet mask %s %x \n", addr, ip_data); rtentry->netmask = ip_data; rt_entry_filled = true; } @@ -370,6 +379,7 @@ int main(int argc, char* argv[]){ ip_ntoa(ntohl(ip_data), addr); _KeFileIoControl(e1000, NET_SET_GATEWAY_ADDRESS, &ip_data); printf("Gateway : %s %x\n", addr, ip_data); + _KePrint("Gateway : %s - %x \r\n", addr, ip_data); rtentry->gateway = ip_data; rt_entry_filled = true; } @@ -384,6 +394,7 @@ int main(int argc, char* argv[]){ dns.address = ip_data; _KeFileIoControl(sock_fd, SOCK_ADD_DNS_SERVER, &dns); printf("DNS server %s\n", addr); + _KePrint("DNS server %s \r\n", addr); } opt += len; } @@ -392,6 +403,7 @@ int main(int argc, char* argv[]){ int ret = _KeFileIoControl(sock_fd, SOCK_ROUTE_TABLE_ADD, rtentry); if (ret) { printf("[NetManager]: Failed to add Route Entry \n"); + _KePrint("[netmanagr]: failed to add route entry \r\n"); } free(rtentry->ifname); free(rtentry); diff --git a/Process/Namdapha/Makefile b/Process/Namdapha/Makefile new file mode 100644 index 000000000..77cac39c6 --- /dev/null +++ b/Process/Namdapha/Makefile @@ -0,0 +1,48 @@ +# XenevaOS Namdapha Makefile (GCC Build) + +TARGET = nmdapha.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT -DNAMDAPHA_HORIZONTAL \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = NamdaphaButton.cpp _gettime.cpp gomenu.cpp namdapha.cpp nmGoButton.cpp section.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: nmdapha.exe + +nmdapha.exe: $(TARGET) + @echo "Converting ELF to PE32+ (nmdapha.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) nmdapha.exe + +$(TARGET): $(OBJS) + @echo "Linking nmdapha.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) nmdapha.exe diff --git a/Process/Namdapha/Namdapha.vcxproj b/Process/Namdapha/Namdapha.vcxproj index 7765a6c03..ff8ca2c28 100644 --- a/Process/Namdapha/Namdapha.vcxproj +++ b/Process/Namdapha/Namdapha.vcxproj @@ -1,4 +1,4 @@ - + @@ -145,7 +145,7 @@ ..\..\Build\nmdapha.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -164,7 +164,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -190,7 +190,7 @@ ..\..\Build\nmdapha.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -211,7 +211,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/Namdapha/NamdaphaButton.cpp b/Process/Namdapha/NamdaphaButton.cpp index cac8367cc..30e6cb5f1 100644 --- a/Process/Namdapha/NamdaphaButton.cpp +++ b/Process/Namdapha/NamdaphaButton.cpp @@ -164,6 +164,10 @@ ButtonInfo* NmCreateButtonInfo(char* filename) { ButtonInfo* btninfo = (ButtonInfo*)malloc(sizeof(ButtonInfo)); memset(btninfo, 0, sizeof(ButtonInfo)); int fd = _KeOpenFile(filename, FILE_OPEN_READ_ONLY); + if (fd == -1) { + free(btninfo); + return NULL; + } XEFileStatus stat; _KeFileStat(fd, &stat); @@ -190,10 +194,13 @@ void NmButtonInfoRead(ButtonInfo* btninfo) { BMP* bmp = (BMP*)buffer; unsigned int offset = bmp->off_bits; - BMPInfo* info = (BMPInfo*)(buffer + sizeof(BMP)); - int width = info->biWidth; - int height = info->biHeight; - int bpp = info->biBitCount; + uint8_t* info = (uint8_t*)(buffer + sizeof(BMP)); + int width = 0; + memcpy(&width, (uint8_t*)info + 4, sizeof(int)); + int height = 0; + memcpy(&height, (uint8_t*)info + 8, sizeof(int)); + int bpp = 0; + memcpy(&bpp, (uint8_t*)info + 14, sizeof(unsigned short)); void* image_bytes = (void*)(buffer + offset); btninfo->imageData = (uint8_t*)image_bytes; @@ -212,6 +219,7 @@ void NmButtonInfoRead(ButtonInfo* btninfo) { * @param y -- Y coordinate */ void NmButtonInfoDrawIcon(ButtonInfo* info, ChCanvas* canv, int x, int y){ + if (!info || !info->imageData) return; uint32_t width = info->iconWidth; uint32_t height = info->iconHeight; uint32_t j = 0; @@ -228,7 +236,7 @@ void NmButtonInfoDrawIcon(ButtonInfo* info, ChCanvas* canv, int x, int y){ uint32_t a = image_row[j++] & 0xff; uint32_t rgb = ((a << 24) | (r << 16) | (g << 8) | (b)); if (rgb & 0xFF000000) - ChDrawPixel(canv, x + k, y + i, rgb); + ChDrawPixel(canv, x + k, y + i, rgb); } } } \ No newline at end of file diff --git a/Process/Namdapha/_gettime.cpp b/Process/Namdapha/_gettime.cpp index 1a9455cab..7fa102bdc 100644 --- a/Process/Namdapha/_gettime.cpp +++ b/Process/Namdapha/_gettime.cpp @@ -33,17 +33,239 @@ #include #include #include +#include +#include +#include +#include + +#pragma pack(push,1) +typedef struct { + uint8_t mode : 3; + uint8_t vn : 3; + uint8_t li : 2; + uint8_t stratum; + uint8_t poll; + int8_t precision; + uint32_t root_delay; + uint32_t root_dispersion; + uint32_t reference_id; + + uint32_t reference_ts_sec; + uint32_t referenece_ts_frac; + + uint32_t origin_ts_sec; + uint32_t origin_ts_frac; + + uint32_t receive_ts_sec; + uint32_t receive_ts_frac; + + uint32_t transmit_ts_sec; + uint32_t transmit_ts_frac; +}ntp_packet_t; +#pragma pack(pop) + +#define NTP_PORT 123 +#define NTP_PACKET_SIZE 48 + +#define NTP_UNIX_EPOCH_DELTA 2208988800UL + +static uint32_t swap32(uint32_t v) { + return ((v & 0x000000FFu) << 24) | + ((v & 0x0000FF00u) << 8) | + ((v & 0x00FF0000u) >> 8) | + ((v & 0xFF000000u) >> 24); +} + +static int64_t floordiv(int64_t a, int64_t b) { + int64_t q = a / b; + int64_t r = a % b; + if ((r != 0) && ((r < 0) != (b < 0))) q--; + return q; +} + +static int64_t floormod(int64_t a, int64_t b) { + int64_t r = a % b; + if (r != 0 && (r < 0) != (b < 0)) r += b; + return r; +} + + +/** + * AI Generated code + */ +static void civil_from_days(int64_t z, int* y, unsigned* m, unsigned* d) { + z += 719468; + int64_t era = (z >= 0 ? z : z - 146096) / 146097; + unsigned doe = (unsigned)(z - era * 146097); + unsigned yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; + int64_t y0 = (int64_t)yoe + era * 400; + unsigned doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + unsigned mp = (5 * doy + 2) / 153; + *d = doy - (153 * mp + 2) / 5 + 1; + *m = mp + (mp < 10 ? 3 : -9); + *y = (int)(y0 + (*m <= 2)); +} + +static void print_human_time(uint32_t unix_sec, uint32_t nsec, int32_t offset_seconds) { + int64_t days = (int64_t)unix_sec / 86400; + uint32_t secs_of_day = unix_sec % 86400; + + int y; unsigned mo, d; + civil_from_days(days, &y, &mo, &d); + + unsigned hh = secs_of_day / 3600; + unsigned mm = (secs_of_day % 3600) / 60; + unsigned ss = secs_of_day % 60; + + int32_t off_h = offset_seconds / 3600; + int32_t off_m = (offset_seconds < 0 ? -offset_seconds : offset_seconds) % 3600 / 60; + _KePrint("Current Celender : %d :: %d :: %d \r\n", mo, y, d); +} + +static void print_ist_time(int64_t utc_sec) { + int64_t local_sec = utc_sec + TZ_SEC_IST_INDIA; + int64_t secs_of_day = local_sec % 86400; + if (secs_of_day < 0) secs_of_day += 86400; + + unsigned hh = (unsigned)(secs_of_day / 3600); + unsigned mm = (unsigned)((secs_of_day % 3600) / 60); + unsigned ss = (unsigned)(secs_of_day % 60); + + _KePrint("IST Time = %d :: %d :: %d \r\n", hh, mm, ss); +} + +static void ntp_build_request(ntp_packet_t* pack) { + memset(pack, 0, sizeof(ntp_packet_t)); + pack->li = 0; + pack->vn = 4; + pack->mode = 3; +} + +static void ntp_ts_to_unix(uint32_t sec_be, uint32_t frac_be, uint32_t* unix_sec, + uint32_t* frac_out) { + uint32_t sec = swap32(sec_be); + uint32_t frac = swap32(frac_be); + *unix_sec = sec - (uint32_t)NTP_UNIX_EPOCH_DELTA; + *frac_out = frac; +} + +static void ntp_ts_to_tmespec(uint32_t sec_be, uint32_t frac_be, timespec* ts) { + uint32_t sec = swap32(sec_be); + uint32_t frac = swap32(frac_be); + + ts->tv_sec = (time_t)(sec - NTP_UNIX_EPOCH_DELTA); + ts->tv_nsec = (long)(((uint64_t)frac * 1000000000ULL) >> 32); +} + +int ntp_get_time(const char* server_ip, uint32_t* out_unix_sec, uint32_t* out_unix_ns) { + ntp_packet_t req, resp; + int sock, ret; + + ntp_build_request(&req); + + struct hostent* he = gethostbyname(server_ip); + if (he == NULL || he->h_addr_list[0] == NULL) + return -5; + + struct in_addr server_addr; + memcpy(&server_addr, he->h_addr_list[0], sizeof(in_addr)); + + + sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) + return -1; + + sockaddr_in dest; + dest.sin_family = AF_INET; + dest.sin_port = htons(NTP_PORT); + dest.sin_addr = server_addr; + + for (int i = 0; i < 4; i++) { + ret = sendto(sock, &req, sizeof(req), 0, (sockaddr*)&dest, sizeof(sockaddr_in)); + sockaddr_in from; + socklen_t fromLen = sizeof(sockaddr_in); + ret = recvfrom(sock, &resp, sizeof(ntp_packet_t), 0, (sockaddr*)&from, &fromLen); + + if (resp.mode != 4 || resp.stratum == 0) { + _KePrint("kiss-o'-death \r\n"); + } + + /* if (resp.mode == 4 || resp.stratum != 0) + break;*/ + + sleep(1); + } + ntp_ts_to_unix(resp.transmit_ts_sec, resp.transmit_ts_frac, out_unix_sec, out_unix_ns); + timespec ss; + + _KePrint("Raw UTC: Transmit_ts_sec : %d, ts_frac : %d \r\n", resp.transmit_ts_sec, resp.transmit_ts_frac); + + ntp_ts_to_tmespec(resp.transmit_ts_sec, resp.transmit_ts_frac, &ss); + + _KePrint("Timspec sec : %d, nsec :%d \r\n", ss.tv_sec, ss.tv_nsec); + + /* set kernel walltime value, but be sure you own the + * credentials and caps to be able to modify walltime + */ + _KeSetWalltime(ss.tv_sec, ss.tv_nsec); + + return 0; +} void NamdaphaGetOnlineTime() { - int sock = socket(AF_INET, SOCK_DGRAM, 0); - sockaddr_in server_addr; - server_addr.sin_family = AF_INET; - server_addr.sin_port = htons(80); - _KePrint("[namdapha]: socket created : %d \r\n", sock); - //memcpy(&server_addr.sin_addr, &ipaddr, sizeof(uint32_t)); - //printf("server port -> %d \n", server_addr.sin_port); - /*if (connect(sock, (sockaddr_*)&server_addr, sizeof(server_addr)) < 0) { - printf("error connecting to %s \n", s); - return 0; - }*/ + const char* server = "pool.ntp.org"; + uint32_t sec, ns; + + //int ret = ntp_get_time(server, &sec, &ns); + + int64_t sec_, nsec_; + _KeGetWalltime(&sec_, &nsec_); + print_ist_time(sec_); + print_human_time(sec_, nsec_, TZ_SEC_IST_INDIA); + _KePrint("unix time: %d sec, %d ns fraction \r\n", sec_, nsec_); +} + +/** + * @brief NamdaphaGetYOD -- get year, month and date + * @param year -- memory location where to store year + * @param month -- memory location where to store month + * @param day -- memory location where to store day + * @param tz_offset -- timezone offset in second + */ +void NamdaphaGetYMD(uint32_t* year, uint32_t* month, uint32_t* day, int32_t tz_offset) { + int64_t sec_, nsec_; + _KeGetWalltime(&sec_, &nsec_); + //sec_ += tz_offset; + + int64_t days = (int64_t)sec_ / 86400; + uint32_t secs_of_day = sec_ % 86400; + + int y; unsigned mo, d; + civil_from_days(days, &y, &mo, &d); + *year = y; + *month = mo; + *day = d; +} + +/** + * NamdaphaGetWallTime -- get the walltime update + * @param hour -- memory location to store hour + * @param minute -- memory location to store minute + * @param sec -- memory location to store second + * @param tz_offset -- timezone offset + */ +void NamdaphaGetWallTime(int* hour, int* minute, int* sec, int tz_offset) { + int64_t sec_, nsec_; + _KeGetWalltime(&sec_, &nsec_); + + int64_t local_sec = sec_ + tz_offset; + int64_t secs_of_day = local_sec % 86400; + if (secs_of_day < 0) secs_of_day += 86400; + + unsigned hh = (unsigned)(secs_of_day / 3600); + unsigned mm = (unsigned)((secs_of_day % 3600) / 60); + unsigned ss = (unsigned)(secs_of_day % 60); + *hour = hh; + *minute = mm; + *sec = ss; } \ No newline at end of file diff --git a/Process/Namdapha/crt_arm64.s b/Process/Namdapha/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/Namdapha/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/Namdapha/linker.ld b/Process/Namdapha/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/Namdapha/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/Namdapha/namdapha.cpp b/Process/Namdapha/namdapha.cpp index ad13d06bd..6e9f304d4 100644 --- a/Process/Namdapha/namdapha.cpp +++ b/Process/Namdapha/namdapha.cpp @@ -41,6 +41,15 @@ #include "section.h" #include +typedef struct _nm_time_ { + int day; + int year; + int month; + int hour; + int minute; + int second; +}NamdaphaTime; + ChitralekhaApp *app; ChWindow* win; list_t* button_list; @@ -57,7 +66,7 @@ NamdaphaButton* timebutton; ButtonInfo* defaultappico; uint32_t gomenuh; NamdaphaButton *gobutton; -XETime _time; +NamdaphaTime _time; list_t* sectList; extern void GoMenuThread(); @@ -109,11 +118,11 @@ void NamdaphaTimeButtonPaint(NamdaphaButton* button, ChWindow* win) { char date[20]; memset(&date, 0, 20); - sprintf(date, "%02d-%02d-%d", _time.day, _time.month, _time.year); + sprintf(date, "%02d-%02d-%02d", _time.day, _time.month, _time.year); ChFontSetSize(app->baseFont, 11); int date_w = ChFontGetWidth(app->baseFont,date); - /*ChFontDrawText(win->canv, app->baseFont, date, button->x + button->w / 2 - date_w / 2, - button->y + button->h - 4, 10,WHITE);*/ + ChFontDrawText(win->canv, app->baseFont, date, button->x + button->w / 2 - date_w / 2, + button->y + button->h - 4, 10,WHITE); } /* @@ -430,7 +439,6 @@ extern void NamdaphaGetOnlineTime(); int main(int argc, char* arv[]){ app = ChitralekhaStartApp(argc, arv); - _KePrint("Namdapha bar started basefont : %x \r\n", app->baseFont); ChFontSetSize(app->baseFont, 13); /* create a demo canvas just for getting the graphics * file descriptor @@ -487,14 +495,25 @@ int main(int argc, char* arv[]){ //_KeCreateTimer(threadID, _KE_TIMER_UNDIFINED_MAXCOUNT, _KE_TIMER_UPDATE_ORDER_MINUTE); //_KeStartTimer(threadID); memset(&_time, 0, sizeof(XETime)); + uint32_t year, day, month; + NamdaphaGetYMD(&year, &month, &day, TZ_SEC_IST_INDIA); + _time.day = day; + _time.month = month; + _time.year = year; + + int hour, min, sec; + NamdaphaGetWallTime(&hour, &min, &sec, TZ_SEC_IST_INDIA); + _time.hour = hour; + _time.minute = min; + _time.second = sec; + + //_KeGetCurrentTime(&_time); - _KePrint("[namdapha]: go button creating \r\n"); gobutton = NamdaphaInitialiseGoButton(win); gobutton->actionHandler = NamdaphaGoButtonAction; list_add(button_list, gobutton); - _KePrint("[namdapha]: go buttons icon loaded \r\n"); /* default application icon, if any application * fails to set an icon, this icon will appear */ @@ -505,6 +524,8 @@ int main(int argc, char* arv[]){ /* allocate memory for time string */ currenttime = (char*)malloc(strlen("00:00 CC")); memset(currenttime, 0, strlen("00:00 CC")); + sprintf(currenttime, "%02d-%02d", _time.hour, _time.minute); + /* now initialise the time button */ timebutton = NmCreateButton(win->info->width - NAMDAPHA_WIDTH, 10, NAMDAPHA_WIDTH, 50, "06:51 PM"); @@ -521,15 +542,12 @@ int main(int argc, char* arv[]){ win->info->alpha = 0; win->info->alphaValue = 0.3f; - _KePrint("Namdapha : all set, ready to paint itself \r\n"); ChWindowPaint(win); - _KePrint("Now getting xelnchr handle \r\n"); gomenuh = ChGetWindowHandle(app, "Xeneva Launcher"); gobutton->winHandle = gomenuh; - //NamdaphaGetOnlineTime(); + NamdaphaGetOnlineTime(); //NamdaphaPlayStartupSound(); - _KePrint("[namdapha]: window got \r\n"); PostEvent e; memset(&e, 0, sizeof(PostEvent)); while (1) { diff --git a/Process/Namdapha/nmdapha.h b/Process/Namdapha/nmdapha.h index 13cd5e86a..db86691aa 100644 --- a/Process/Namdapha/nmdapha.h +++ b/Process/Namdapha/nmdapha.h @@ -159,4 +159,22 @@ extern int NamdaphaGetScreenWidth(); /* NamdaphaGetScreenHeight -- returns the screen height */ extern int NamdaphaGetScreenHeight(); +/** + * @brief NamdaphaGetYOD -- get year, month and date + * @param year -- memory location where to store year + * @param month -- memory location where to store month + * @param day -- memory location where to store day + * @param tz_offset -- timezone offset in second + */ +extern void NamdaphaGetYMD(uint32_t* year, uint32_t* month, uint32_t* day, int32_t tz_offset); + +/** + * NamdaphaGetWallTime -- get the walltime update + * @param hour -- memory location to store hour + * @param minute -- memory location to store minute + * @param sec -- memory location to store second + * @param tz_offset -- timezone offset + */ +extern void NamdaphaGetWallTime(int* hour, int* minute, int* sec, int tz_offset); + #endif \ No newline at end of file diff --git a/Process/Piano/Piano.vcxproj b/Process/Piano/Piano.vcxproj index bbea8cc49..00c129067 100644 --- a/Process/Piano/Piano.vcxproj +++ b/Process/Piano/Piano.vcxproj @@ -134,7 +134,7 @@ Native true ..\..\Build\piano.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -152,7 +152,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe + copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe" diff --git a/Process/Process/Process.sln b/Process/Process/Process.sln new file mode 100644 index 000000000..ccbe4ff22 --- /dev/null +++ b/Process/Process/Process.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.36107.64 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Process", "Process.vcxproj", "{A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}.Debug|x64.ActiveCfg = Debug|x64 + {A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}.Debug|x64.Build.0 = Debug|x64 + {A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}.Debug|x86.ActiveCfg = Debug|Win32 + {A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}.Debug|x86.Build.0 = Debug|Win32 + {A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}.Release|x64.ActiveCfg = Release|x64 + {A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}.Release|x64.Build.0 = Release|x64 + {A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}.Release|x86.ActiveCfg = Release|Win32 + {A6DB321C-E47C-460C-B4D5-3F1B9F2B8B84}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {AB671E38-B7A5-48AC-A78F-FB685D9EA30E} + EndGlobalSection +EndGlobal diff --git a/Process/Process/Process.vcxproj b/Process/Process/Process.vcxproj new file mode 100644 index 000000000..42daf7f76 --- /dev/null +++ b/Process/Process/Process.vcxproj @@ -0,0 +1,150 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + + 16.0 + Win32Proj + {a6db321c-e47c-460c-b4d5-3f1b9f2b8b84} + Process + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + true + + + false + + + true + + + false + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + diff --git a/Process/Process/Process.vcxproj.filters b/Process/Process/Process.vcxproj.filters new file mode 100644 index 000000000..a8a65633b --- /dev/null +++ b/Process/Process/Process.vcxproj.filters @@ -0,0 +1,17 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + \ No newline at end of file diff --git a/Process/Terminal/Makefile b/Process/Terminal/Makefile new file mode 100644 index 000000000..fb451aaaa --- /dev/null +++ b/Process/Terminal/Makefile @@ -0,0 +1,48 @@ +# XenevaOS Terminal Makefile (GCC Build) + +TARGET = term.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -D_USE_FREETYPE -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = term.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: term.exe + +term.exe: $(TARGET) + @echo "Converting ELF to PE32+ (term.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) term.exe + +$(TARGET): $(OBJS) + @echo "Linking term.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) term.exe diff --git a/Process/Terminal/Terminal.vcxproj b/Process/Terminal/Terminal.vcxproj index d4e54467f..d0bab25c2 100644 --- a/Process/Terminal/Terminal.vcxproj +++ b/Process/Terminal/Terminal.vcxproj @@ -1,4 +1,4 @@ - + @@ -130,7 +130,7 @@ - ..\..\Libs\XECrt;..\..\x64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\Libs\XECrt;..\..\x64\Debug;%(AdditionalLibraryDirectories) xecrt.lib;XEClib.lib;chlkha.lib; true ..\..\Build\term.exe @@ -150,7 +150,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -173,7 +173,7 @@ - ..\..\ARM64\Debug;..\..\Libs\XECrt + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt xecrt.lib;XEClib.lib;chlkha.lib; true ..\..\Build\term.exe @@ -195,7 +195,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/Terminal/crt_arm64.s b/Process/Terminal/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/Terminal/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/Terminal/esccode.h b/Process/Terminal/esccode.h index bdaacbce6..fcbb365ec 100644 --- a/Process/Terminal/esccode.h +++ b/Process/Terminal/esccode.h @@ -38,11 +38,13 @@ #define SEQUENCE_DCS 'P' #define SEQUENCE_CSI '[' //control #define SEQUENCE_ST '\\' +#define SEQUENCE_OSC ']' #define CSI_CURSOR_UP 'A' #define CSI_CURSOR_DOWN 'B' #define CSI_CURSOR_FORWARD 'C' #define CSI_CURSOR_BACKWARD 'D' +#define CSI_CURSOR_HOME 'H' #define CSI_CNL 'E' //cursor next line #define CSI_CPL 'F' //Cursor previous line #define CSI_CHA 'G' //Cursor horizontal absolute @@ -80,4 +82,8 @@ #define CSI_ERASE_TEXT_NONLINE 'J' #define CSI_ERASE_TEXT_LINE 'K' +#define CSI_SET_MODE 'h' +#define CSI_RESET_MODE 'l' +#define CSI_SAVE_CURSOR 's' +#define CSI_RESTORE_CURSOR 'u' #endif \ No newline at end of file diff --git a/Process/Terminal/linker.ld b/Process/Terminal/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/Terminal/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/Terminal/term.cpp b/Process/Terminal/term.cpp index 64d8a9f70..291a0307f 100644 --- a/Process/Terminal/term.cpp +++ b/Process/Terminal/term.cpp @@ -40,6 +40,10 @@ #include #include "esccode.h" #include +#include +#include +#include +#include ChWindow* win; ChitralekhaApp* app; @@ -50,12 +54,15 @@ Terminal term; bool dirty = false; bool _escape_seq = false; bool _seq_csi = false; +bool _seq_osc = false; bool _cursor_blink = 0; bool _update_terminal_ = false; bool _first_time = false; uint32_t backColor; uint32_t fgColor; char* escBuf; +char oscBuf[64]; +int oscLen; int shell_id; #define TERMINAL_BLACK 0xFF373434 @@ -70,6 +77,84 @@ static inline int _terminal_cell_to_pixelY(Terminal* t, int row) { return t->originY + row * t->cellH; } +static void _terminal_mouse_to_cell(Terminal* t, int mouseX, int mouseY, int* cellX, int* cellY) { + int relX = mouseX - t->originX; + int relY = mouseY - t->originY; + + *cellX = relX / t->cellW; + *cellY = relY / t->cellH; + + if (*cellX < 0) *cellX = 0; + if (*cellX >= t->cols) *cellX = t->cols - 1; + if (*cellY < 0) *cellY = 0; + if (*cellY >= t->rows) *cellY = t->rows - 1; +} + +void TerminalDrawCell(Terminal* t, int col, int row); + +static void _terminal_redraw_cursor(Terminal* t) { + if (!t->blink_visible) return; + if (t->scrolling) return; + TermCell* c = &t->cells[t->cursorY][t->cursorX]; + int px = _terminal_cell_to_pixelX(t, t->cursorX); + int py = _terminal_cell_to_pixelY(t, t->cursorY); + + uint32_t cursor_col = 0xFFAEAEAE; //c->bg; + + uint32_t* pixels = win->canv->buffer; + for (int y = 0; y < t->cellH; y++) { + uint32_t* row = pixels + (py + y) * win->canv->canvasWidth + px; + for (int x = 0; x < t->cellW; x++) + row[x] = cursor_col; + } + + + if (c->c && c->c != ' ') { + char buf[2] = { c->c, '\0' }; + ChRect clip; + clip.x = px; + clip.y = py; + clip.w = t->cellW; + clip.h = t->cellH; + ChFontDrawTextClipped(win->canv, consolas, buf, px, py + t->baseine, TERMINAL_BLACK, &clip); + } + // draw the character here + ChWindowUpdate(win, px, py, t->cellW, t->cellH, 0, 1); +} + + +static void _terminal_erase_cursor(Terminal* t) { + if (t->scrolling) return; + TermCell* cell = &term.cells[t->cursorY][t->cursorX]; + cell->flags |= (1 << 1); + if (!cell->bg) + cell->bg = TERMINAL_BLACK; + TerminalDrawCell(t, t->cursorX,t->cursorY); + cell->flags &= ~(1 << 1); + int px = _terminal_cell_to_pixelX(t, t->cursorX); + int py = _terminal_cell_to_pixelY(t, t->cursorY); + ChWindowUpdate(win, px, py, t->cellW, t->cellH, 0, 1); +} + + +/** + * @brief _terminal_blink_cursor -- blinks the cursor + * @param signum -- signal number + */ +static void _terminal_blink_cursor(int signum) { + if (term.cursor_hide) return; + if (!term.scrolling) { + if (term.blink_visible) { + _terminal_erase_cursor(&term); + term.blink_visible = false; + } + else { + term.blink_visible = true; + _terminal_redraw_cursor(&term); + } + } + alarm(1); +} /* * TerminalDrawArrayFont -- draw bitmap fonts using defined array * @param canv -- Pointer to canvas @@ -123,16 +208,18 @@ void TerminalDrawCell(Terminal *t,int col, int row) { int py = _terminal_cell_to_pixelY(t, row); - if (cell->c && cell->c != ' ') { - char buf[2] = { cell->c, '\0' }; - ChRect clip; - clip.x = px; - clip.y = py; - clip.w = t->cellW; - clip.h = t->cellH; - + if (cell->c || cell->flags & (1<<1)) { ChDrawRect(win->canv, px, py, t->cellW, t->cellH, cell->bg); - ChFontDrawTextClipped(win->canv, consolas, buf, px, py + t->baseine, cell->fg, &clip); + if (cell->c) { + char buf[2] = { cell->c, '\0' }; + ChRect clip; + clip.x = px; + clip.y = py; + clip.w = t->cellW; + clip.h = t->cellH; + + ChFontDrawTextClipped(win->canv, consolas, buf, px, py + t->baseine, cell->fg, &clip); + } } } @@ -146,6 +233,7 @@ void TerminalFlush(Terminal* t) { if (!(cell->flags & 0x1)) continue; TerminalDrawCell(t, c, r); cell->flags &= ~0x1; + cell->flags &= ~(1 << 1); int px = _terminal_cell_to_pixelX(t, c); int py = _terminal_cell_to_pixelY(t, r); @@ -177,9 +265,11 @@ void TerminalDrawCursor() { * one line up */ void TerminalScroll(Terminal* t, int lines) { + t->scrolling = true; int regionRows = t->scrollBot - t->scrollTop + 1; if (lines > regionRows) lines = regionRows; +// _terminal_erase_cursor(t); for (int r = t->scrollTop; r <= t->scrollBot - lines; r++) memcpy(t->cells[r], t->cells[r + lines],t->cols * sizeof(TermCell)); @@ -227,6 +317,7 @@ void TerminalScroll(Terminal* t, int lines) { ChWindowUpdate(win, regionPx, regionPy, regionW, regionH, 0, 1); t->cursorY = t->scrollBot; + t->scrolling = false; } /* TerminalClearScreen -- clears entire screen area of @@ -235,6 +326,7 @@ void TerminalScroll(Terminal* t, int lines) { void TerminalClearScreen(Terminal* t) { t->lastCursorX = t->cursorX; t->lastCursorY = t->cursorY; + _terminal_erase_cursor(t); for (int r = 0; r < t->rows; r++) { for (int c = 0; c < t->cols; c++){ t->cells[r][c].c = ' '; @@ -311,6 +403,7 @@ void TerminalPrintChar(Terminal* t,char c, uint32_t fgcolor, uint32_t bgcolor) { backColor = TERMINAL_BLACK; t->lastCursorY = t->cursorY; t->lastCursorX = t->cursorX; + _terminal_erase_cursor(t); t->cursorY++; t->cursorX = 0; if (t->cursorY >= t->scrollBot){ @@ -338,6 +431,7 @@ void TerminalPrintChar(Terminal* t,char c, uint32_t fgcolor, uint32_t bgcolor) { TerminalPutChar(t, c, backColor, fgColor); t->lastCursorX = t->cursorX; t->lastCursorY = t->cursorY; + _terminal_erase_cursor(t); t->cursorX++; if (t->cursorX == t->cols) { t->cursorX = 0; @@ -360,6 +454,118 @@ void TerminalPrintString(Terminal* t,char* string, uint32_t fgcolor, uint32_t bg } } +void TerminalReplaceInput(Terminal* t, const char* newText) { + int oldLen = t->intputLen; + char slave_buf[2]; + slave_buf[0] = '\b'; + slave_buf[1] = '\0'; + int curX = t->cursorX; + int curY = t->cursorY; + t->lastCursorX = curX; + t->lastCursorY = curY; + for (int i = 0; i < oldLen; i++) { + if (curX > 0) { + curX--; + } + else if (curY > 0) { + curY--; + curX = t->cols - 1; + } + TermCell* c = &t->cells[curY][curX]; + c->c = ' '; + c->fg = t->defaultFg; + c->bg = t->defaultBG; + c->flags |= 0x1; + + /** drain the last character passed to slave buffer */ + _KeWriteFile(master_fd, slave_buf, 1); + } + + strncpy(t->inputBuffer, newText, 255); + t->inputBuffer[255] = '\0'; + t->intputLen = strlen(t->inputBuffer); + + for (int i = 0; i < t->intputLen; i++) { + //TerminalPrintChar(t, t->inputBuffer[i], t->defaultFg, t->defaultBG); + _KeWriteFile(master_fd, &t->inputBuffer[i], 1); + } + + TerminalFlush(t); + //_update_terminal_ = 1; +} + + +void TerminalHistoryPush(Terminal* t, const char* cmd) { + if (!cmd || cmd[0] == '\0') return; + + /*if (t->history.count > 0) { + int last = (t->history.head - 1 + TERMINAL_HISTORY_MAX) % TERMINAL_HISTORY_MAX; + if (strcmp(t->history.entries[last], cmd) == 0) { + t->history.browse = -1; + return; + } + }*/ + for (int i = 0; i < t->history.count; i++) { + int idx = (t->history.head - 1 - i + TERMINAL_HISTORY_MAX * 2) % TERMINAL_HISTORY_MAX; + if (strcmp(t->history.entries[idx], cmd) == 0) { + for (int j = i; j > 0; j--) { + int dst = (t->history.head - 1 - j + TERMINAL_HISTORY_MAX * 2) % TERMINAL_HISTORY_MAX; + int src = (t->history.head - 1 - j + 1 + TERMINAL_HISTORY_MAX * 2) % TERMINAL_HISTORY_MAX; + memcpy(t->history.entries[dst], t->history.entries[src], 256); + } + + t->history.head = (t->history.head - 1 + TERMINAL_HISTORY_MAX) % TERMINAL_HISTORY_MAX; + t->history.count--; + break; + } + } + + strncpy(t->history.entries[t->history.head], cmd, 255); + t->history.entries[t->history.head][255] = '\0'; + t->history.head = (t->history.head + 1) % TERMINAL_HISTORY_MAX; + if (t->history.count < TERMINAL_HISTORY_MAX) + t->history.count++; + + t->history.browse = -1; +} + + +void TerminalHistoryUp(Terminal* t) { + if (t->history.count == 0) return; + + if (t->history.browse == -1) { + strncpy(t->inputSaved, t->inputBuffer, 255); + t->history.browse = 0; + } + else { + if (t->history.browse < t->history.count - 1) + t->history.browse++; + else + return; + } + + int idx = (t->history.head - 1 - t->history.browse + TERMINAL_HISTORY_MAX * 2) + % TERMINAL_HISTORY_MAX; + _terminal_erase_cursor(t); + TerminalReplaceInput(t, t->history.entries[idx]); +} + +void TerminalHistoryDown(Terminal* t) { + if (t->history.browse == -1) return; + + if (t->history.browse > 0) { + t->history.browse--; + int idx = (t->history.head - 1 - t->history.browse + TERMINAL_HISTORY_MAX * 2) + % TERMINAL_HISTORY_MAX; + _terminal_erase_cursor(t); + TerminalReplaceInput(t, t->history.entries[idx]); + } + else { + t->history.browse = -1; + _terminal_erase_cursor(t); + TerminalReplaceInput(t, t->inputSaved); + } +} /* ProcessControlSequence -- the main emulation function * of ANSI Terminal * @param ch -- Character to emulate @@ -515,6 +721,41 @@ void ProcessControlSequence(Terminal* term_,char ch) { memset(escBuf, 0, 256); return; } + + if (ch == CSI_CURSOR_HOME || ch == 'f') { + for (int i = 0; i < 256; i++) { + if (escBuf[i] == CSI_CURSOR_HOME || escBuf[i] == 'f') { + escBuf[i] = 0; + break; + } + } + int row = 0, col = 0; + char* semi = strchr(escBuf, ';'); + if (semi) { + *semi = '\0'; + row = atoi(escBuf); + col = atoi(semi + 1); + }else { + row = atoi(escBuf); + col = 0; + } + + if (row > 0) row--; + if (col > 0) col--; + + if (row < 0) row = 0; + if (row >= term.rows) row = term.rows - 1; + if (col < 0) col = 0; + if (col >= term.cols) col = term.cols - 1; + + term.cursorX = row; + term.cursorY = col; + + _escape_seq = false; + _seq_csi = false; + memset(escBuf, 0, 256); + return; + } /* emulate erase text non line mode */ if (ch == CSI_ERASE_TEXT_NONLINE) { for (int i = 0; i < 256; i++) { @@ -580,6 +821,99 @@ void ProcessControlSequence(Terminal* term_,char ch) { memset(escBuf, 0, 256); return; } + + if (ch == CSI_SET_MODE || ch == CSI_RESET_MODE) { + for (int i = 0; i < 256; i++) { + if (escBuf[i] == ch) { + escBuf[i] = 0; + break; + } + } + + int mode = 0; + if (escBuf[0] == '?') + mode = atoi(escBuf + 1); + else + mode = atoi(escBuf); + + switch (mode) { + case 25: + term_->blink_visible = (ch == CSI_SET_MODE) ? 1 : 0; + term_->cursor_hide = !term_->blink_visible; + //if (term_->cursor_hide == 0) + //alarm(1); + _KePrint("Cursor blink change requested %d\r\n", term_->cursor_hide); + break; + + case 1049: + break; + case 1000: + break; + default: + break; + } + _escape_seq = false; + _seq_csi = false; + memset(escBuf, 0, 256); + return; + } + + if (ch == CSI_SAVE_CURSOR) { + term_->savedCursorX = term_->cursorX; + term_->savedCursorY = term_->cursorY; + _escape_seq = false; + _seq_csi = false; + memset(escBuf, 0, 256); + return; + } + + if (ch == CSI_RESTORE_CURSOR) { + term_->cursorX = term_->savedCursorX; + term_->cursorY = term_->savedCursorY; + _escape_seq = false; + _seq_csi = false; + memset(escBuf, 0, 256); + return; + } + +} + +void ProcessOSCSequence(Terminal* t, const char* payload) { + //OSC 133 - shell integration/ semantic prompt markers + if (strncmp(payload, "133;", 4) == 0) { + char marker = payload[4]; + switch (marker) { + case 'A': { + t->inputStartX = t->cursorX; + t->inputStartY = t->cursorY; + break; + } + + case 'B': { + t->inputStartX = t->cursorX; + t->inputStartY = t->cursorY; + t->intputLen = 0; + t->inputBuffer[0] = '\0'; + break; + } + + case 'C': { + //input startX = -1; + t->inputStartX = -1; + break; + } + case 'D': { + //command done, parse exit code from OSC payload, + //e.g. 133;D;0-> exit code = atoi(payload+6) + break; + } + } + + if (strncmp(payload, "0;", 2) == 0 || strncmp(payload, "2;", 2) == 0) { + //Set window title (win, payload+2); + return; + } + } } /* @@ -599,10 +933,43 @@ void TerminalProcessLine(Terminal* t,char ch) { ProcessControlSequence(t, ch); return; } + + if (ch == SEQUENCE_OSC) { + _seq_osc = true; + oscLen = 0; + oscBuf[0] = '\0'; + return; + } + + if (_seq_osc) { + if (ch == '\007') { + oscBuf[oscLen] = '\0'; + ProcessOSCSequence(t, oscBuf); + _seq_osc = false; + _escape_seq = false; + oscLen = 0; + return; + } + + if (ch == '\\') { + oscBuf[oscLen] = '\0'; + ProcessOSCSequence(t, oscBuf); + _seq_osc = false; + _escape_seq = false; + oscLen = 0; + return; + } + + if (oscLen < 64) //increase it to 255 in future + oscBuf[oscLen++] = ch; + return; + } } else { /* process default state */ if (ch == ASCII_ESC_CHAR) { + if (_seq_osc) + return; _escape_seq = true; return; } @@ -622,6 +989,44 @@ void TerminalProcessLine(Terminal* t,char ch) { TerminalPrintChar(t, ch,fgColor,backColor); } } + +void TerminalHandleMouseClick(Terminal* t, int mouseX, int mouseY, int button) { + /** skip the titlebar **/ + if (mouseY <= 26) + return; + + int cellX = 0; + int cellY = 0; + _terminal_mouse_to_cell(t, mouseX, mouseY, &cellX, &cellY); + + //if (t->lastCellXClicked == cellX && t->lastCellYClicked == cellY) { + // t->lastCellXClicked = -1; + // t->lastCellYClicked = -1; + //} + + if (t->lastCellXClicked != -1 && t->lastCellYClicked != -1) { + TermCell* cell = &t->cells[t->lastCellYClicked][t->lastCellXClicked]; + uint32_t bg = cell->bg; + cell->bg = cell->fg; + cell->fg = bg; + cell->flags |= 0x1; + } + + TermCell* cell = &t->cells[cellY][cellX]; + uint32_t bg = cell->bg; + cell->bg = cell->fg; + cell->fg = bg; + cell->flags |= 0x1; + + t->lastCellXClicked = cellX; + t->lastCellYClicked = cellY; + + TerminalFlush(t); +} + +/* custom key mappings, it's a bug */ +#define TERMINAL_KEY_RIGHT 0x2E +#define TERMINAL_KEY_LEFT 0x33 /* * TerminalHandleMessage -- handle incoming 'Deodhai' messages * @param e -- Pointer to PostEvent memory location where @@ -630,6 +1035,9 @@ void TerminalProcessLine(Terminal* t,char ch) { void TerminalHandleMessage(PostEvent *e) { switch (e->type) { case DEODHAI_REPLY_MOUSE_EVENT: + if (e->dword3) { + TerminalHandleMouseClick(&term, e->dword - win->info->x, e->dword2 - win->info->y, e->dword3); + } ChWindowHandleMouse(win, e->dword, e->dword2, e->dword3); memset(e, 0, sizeof(PostEvent)); break; @@ -637,19 +1045,86 @@ void TerminalHandleMessage(PostEvent *e) { int code = e->dword; ChitralekhaProcessKey(code); char rawkey = ChitralekhaGetKeyPress(code); + bool _pass_to_input = true; char c = ChitralekhaKeyToASCII(code); - if (rawkey == KEY_RETURN) + if (rawkey == KEY_RETURN) { + TerminalHistoryPush(&term, term.inputBuffer); c = '\n'; + term.intputLen = 0; + term.inputBuffer[0] = '\0'; + _pass_to_input = false; + } + + if (rawkey == KEY_BACKSPACE) { + if (term.intputLen > 0) { + term.intputLen--; + term.inputBuffer[term.intputLen] = '\0'; + c = '\b'; + _pass_to_input = false; + } + } + /** check from extended key code map **/ + if (rawkey == KEY_KP_8) { + TerminalHistoryUp(&term); + memset(e, 0, sizeof(PostEvent)); + return; + } + + /** chec from extended key code map **/ + if (rawkey == KEY_KP_2) { + TerminalHistoryDown(&term); + memset(e, 0, sizeof(PostEvent)); + return; + } + + if (rawkey == TERMINAL_KEY_LEFT) { + if (term.cursorX > term.inputStartX) { + _terminal_erase_cursor(&term); + term.cursorX--; + _terminal_redraw_cursor(&term); + } + memset(e, 0, sizeof(PostEvent)); + } + + if (rawkey == TERMINAL_KEY_RIGHT) { + if (term.cursorX < term.inputStartX + term.intputLen) { + _terminal_erase_cursor(&term); + term.cursorX++; + _terminal_redraw_cursor(&term); + } + memset(e, 0, sizeof(PostEvent)); + } + /** + * handle CTRL + combined keys + */ if (ChitralekhaKeyGetCTRL()) { if (c == KEY_C) { + _KePrint("Sending signal to id : %d \r\n", shell_id); if (shell_id > 0) - _KeSendSignal(shell_id, SIGINT); + kill(shell_id, SIGINT); c = '\n'; } if (c == KEY_H) { ChWindowHide(win); } + + if (c == KEY_W) { + TerminalHistoryUp(&term); + memset(e, 0, sizeof(PostEvent)); + return; + } + + if (c == KEY_S) { + TerminalHistoryDown(&term); + memset(e, 0, sizeof(PostEvent)); + return; + } + } + + if (_pass_to_input && c >= 0x20 && c < 0x7F && term.intputLen < 255) { + term.inputBuffer[term.intputLen++] = c; + term.inputBuffer[term.intputLen] = '\0'; } _KeWriteFile(master_fd, &c, 1); /* else its a key release event */ @@ -675,17 +1150,18 @@ void TerminalHandleMessage(PostEvent *e) { * asynchronous reads */ void TerminalThread() { - char buf[512]; - memset(&buf, 0, 512); + char* buf = (char*)malloc(1024); + memset(buf, 0, 1024); int bytes_read = 0; while (1) { - bytes_read = _KeReadFile(master_fd, buf, 512); - if (bytes_read >= 512) { - bytes_read = 512; + bytes_read = _KeReadFile(master_fd, buf, 1024); + if (bytes_read >= 1024) { + bytes_read = 1024; } for (int i = 0; i < bytes_read; i++){ TerminalProcessLine(&term,buf[i]); + } /* now bytes_read tells the terminal @@ -694,14 +1170,12 @@ void TerminalThread() { */ if ((bytes_read > 0) || _update_terminal_) { TerminalFlush(&term); - - //TerminalDrawCursor(); bytes_read = 0; _update_terminal_ = false; } #ifdef ARCH_ARM64 - _KeProcessSleep(4); + _KeProcessSleep(60); #elif ARCH_X64 _KeProcessSleep(10000); #endif @@ -722,11 +1196,16 @@ int main(int argc, char* arv[]){ ChFontSetSize(consolas, 12); int f_w = ChFontGetWidthChar(consolas,'M'); - int f_h = consolas->face->size->metrics.height >> 6;//ChFontGetHeightChar(consolas, 'A'); +#ifdef _USE_FREETYPE + int f_h = consolas->face->size->metrics.height >> 6; + term.baseine = consolas->face->size->metrics.ascender >> 6; +#else + int f_h = ChFontGetHeightChar(consolas, 'A'); + term.baseine = f_h - 4; +#endif term.cellW = f_w; term.cellH = f_h; - term.baseine = consolas->face->size->metrics.ascender >> 6; int term_w = win->info->width; int term_h = win->info->height - 16; // -26 for titlebar height @@ -744,9 +1223,16 @@ int main(int argc, char* arv[]){ term.defaultFg = WHITE; term.scrollTop = 0; term.scrollBot = term.rows - 1; - term.originX = 0; + term.originX = 1; term.originY = 26; - + term.lastCellXClicked = -1; + term.lastCellYClicked = -1; + term.inputStartX = 0; + term.inputStartY = 0; + term.scrolling = 0; + term.savedCursorX = 0; + term.savedCursorY = 0; + term.cursor_hide = 0; backColor = term.defaultBG; fgColor = term.defaultFg; @@ -765,6 +1251,8 @@ int main(int argc, char* arv[]){ /*term_buffer = (TermCell*)malloc(ws_col * ws_row * sizeof(TermCell)); memset(term_buffer, 0x0, static_cast(ws_col) * ws_row * sizeof(TermCell));*/ + signal(SIGALRM, _terminal_blink_cursor); + ChWindowPaint(win); int term_id = _KeGetProcessID(); @@ -786,6 +1274,17 @@ int main(int argc, char* arv[]){ int thread_idx = _KeCreateThread(TerminalThread, "asyncthr"); ChWindowBroadcastIcon(app, "/icons/term.bmp"); + + term.blink_visible = 1; + /** setup periodic timer for cursor **/ + /*struct itimerval blink_timer; + blink_timer.it_value.tv_sec = 0; + blink_timer.it_value.tv_usec = 500000; + blink_timer.it_interval.tv_sec = 0; + blink_timer.it_interval.tv_usec = 500000; + setitimer(ITIMER_REAL, &blink_timer, NULL);*/ + alarm(1); + PostEvent e; memset(&e, 0, sizeof(PostEvent)); while (1) { diff --git a/Process/Terminal/term.h b/Process/Terminal/term.h index 5b4405f64..b0abe6b81 100644 --- a/Process/Terminal/term.h +++ b/Process/Terminal/term.h @@ -35,6 +35,9 @@ #define TERMINAL_MAX_COLS 256 #define TERMINAL_MAX_ROWS 128 +#define TERMINAL_HISTORY_MAX 100 + + typedef struct _cell_ { uint8_t c; uint32_t bg; @@ -42,11 +45,20 @@ typedef struct _cell_ { uint8_t flags; }TermCell; +typedef struct _term_history_ { + char entries[TERMINAL_HISTORY_MAX][256]; + int count; + int head; + int browse; +}TerminalHistory; + typedef struct { TermCell cells[TERMINAL_MAX_ROWS][TERMINAL_MAX_COLS]; int cols, rows; int cursorX, cursorY; int lastCursorX, lastCursorY; + int inputStartX, inputStartY; + int savedCursorX, savedCursorY; int cellW, cellH; int baseine; int originX, originY; @@ -54,6 +66,15 @@ typedef struct { uint32_t defaultBG; int scrollTop; int scrollBot; + TerminalHistory history; + char inputBuffer[256]; + char inputSaved[256]; + int intputLen; + int lastCellXClicked; + int lastCellYClicked; + volatile bool blink_visible; + bool scrolling; + bool cursor_hide; }Terminal; #endif \ No newline at end of file diff --git a/Process/XELnch/Makefile b/Process/XELnch/Makefile new file mode 100644 index 000000000..a11f05806 --- /dev/null +++ b/Process/XELnch/Makefile @@ -0,0 +1,49 @@ +# XenevaOS XELnch Makefile (GCC Build) + +TARGET = xelnch.elf +CROSS_COMPILE ?= aarch64-linux-gnu- + +CXX = $(CROSS_COMPILE)g++ +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)ld +OBJCOPY = $(CROSS_COMPILE)objcopy + +INCLUDES = -I../../Libs/XEClib/includes -I../../Libs/XEClib/includes/c++ -I../../BaseHdr -I../../Libs/Chitralekha -I../../Ports/freetype2/include +CXXFLAGS = -Wall -Wextra -ffreestanding -fno-stack-protector -fno-stack-check -fno-strict-aliasing \ + -O2 -fPIE -fno-exceptions -fno-rtti \ + -DARCH_ARM64 -D__TARGET_BOARD_QEMU_VIRT__ -D_USE_DLMALLOC -D__STDC_LIMIT_MACROS -DTHEME_DEFAULT \ + $(INCLUDES) + +OBJDIR = obj + +CPP_SRCS = AppGrid.cpp button.cpp lconfig.cpp main.cpp pagebutton.cpp pwbutton.cpp \ + rrect.cpp search.cpp searchbar.cpp +S_SRCS = crt_arm64.s + +CPP_OBJS = $(patsubst %.cpp,$(OBJDIR)/%.o,$(CPP_SRCS)) +S_OBJS = $(patsubst %.s,$(OBJDIR)/%.o,$(S_SRCS)) + +OBJS = $(CPP_OBJS) $(S_OBJS) + +.PHONY: all clean + +all: xelnch.exe + +xelnch.exe: $(TARGET) + @echo "Converting ELF to PE32+ (xelnch.exe)..." + $(OBJCOPY) -O pei-aarch64-little $(TARGET) xelnch.exe + +$(TARGET): $(OBJS) + @echo "Linking xelnch.elf..." + $(LD) -nostdlib -T linker.ld $(OBJS) ../../Libs/Chitralekha/libChitralekha.a ../../Libs/XEClib/libXEClib.a -o $@ + +$(OBJDIR)/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(CXXFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(CXXFLAGS) -c $< -o $@ + +clean: + rm -rf $(OBJDIR) $(TARGET) xelnch.exe diff --git a/Process/XELnch/XELnch.vcxproj b/Process/XELnch/XELnch.vcxproj index ed31de1aa..13747e443 100644 --- a/Process/XELnch/XELnch.vcxproj +++ b/Process/XELnch/XELnch.vcxproj @@ -1,4 +1,4 @@ - + @@ -87,8 +87,8 @@ Application false - v120 - true + v142 + false MultiByte @@ -122,6 +122,10 @@ false xelnch + + xelnch + false + Level3 @@ -153,7 +157,7 @@ ..\..\Build\xelnch.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -172,7 +176,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -198,7 +202,7 @@ ..\..\Build\xelnch.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -219,7 +223,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -255,14 +259,44 @@ Level3 MaxSpeed true - true - true + false + false + ..\..\Libs\XEClib\includes;..\..\Libs\Chitralekha;..\..\Ports\freetype2\include;%(AdditionalIncludeDirectories) + ARCH_ARM64;YES_DYNAMIC;DYNAMIC_IMPORTER;NANOSVG_IMPLEMENTATION;NANOSVGRAST_IMPLEMENTATION;%(PreprocessorDefinitions) + false + false + + + false + false + /Oi- %(AdditionalOptions) + false + Disabled true true true + ..\..\Build\xelnch.exe + ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; + true + false + true + true + Native + true + Driver + 0x0000000600000000 + + false + + _xemain + /filealign:4096 %(AdditionalOptions) + + copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe + diff --git a/Process/XELnch/button.cpp b/Process/XELnch/button.cpp index 31e68bf4b..78809f12c 100644 --- a/Process/XELnch/button.cpp +++ b/Process/XELnch/button.cpp @@ -206,6 +206,7 @@ ButtonIcon* CreateLaunchButtonIcon(char* iconfile, LaunchButton* button) { icon->usageCount = 0; button->buttonIcon = icon; ButtonIconRead(icon); + return icon; } /* ButtonIconRead-- read the button icon file @@ -214,17 +215,26 @@ ButtonIcon* CreateLaunchButtonIcon(char* iconfile, LaunchButton* button) { void ButtonIconRead(ButtonIcon* btninfo) { if (!btninfo) return; - _KeReadFile(btninfo->iconFd, btninfo->fileBuffer, btninfo->fileSize); + int read_bytes = _KeReadFile(btninfo->iconFd, btninfo->fileBuffer, btninfo->fileSize); uint8_t* buffer = (uint8_t*)btninfo->fileBuffer; - BMP* bmp = (BMP*)buffer; - unsigned int offset = bmp->off_bits; + unsigned int offset = 0; + memcpy(&offset, buffer + 10, sizeof(int)); - BMPInfo* info = (BMPInfo*)(buffer + sizeof(BMP)); - int width = info->biWidth; - int height = info->biHeight; - int bpp = info->biBitCount; + uint8_t* info = (uint8_t*)(buffer + sizeof(BMP)); + int width = 0; + memcpy(&width, info + 4, sizeof(int)); + int height = 0; + memcpy(&height, info + 8, sizeof(int)); + int bpp = 0; + memcpy(&bpp, info + 14, sizeof(unsigned short)); + + // printf("ButtonIconRead: fd=%d size=%d read=%d width=%d height=%d offset=%d\n", btninfo->iconFd, btninfo->fileSize, read_bytes, width, height, offset); + + btninfo->iconBpp = bpp; + btninfo->iconWidth = width; + btninfo->iconHeight = height; void* image_bytes = (void*)(buffer + offset); btninfo->imageData = (uint8_t*)image_bytes; @@ -243,53 +253,71 @@ void ButtonIconRead(ButtonIcon* btninfo) { * @param y -- Y coordinate */ void ButtonIconDraw(ButtonIcon* info, ChCanvas* canv, int x, int y, ChRect* limit){ - uint32_t width = info->iconWidth; - uint32_t height = info->iconHeight; - uint32_t imageHeight = height; - uint32_t j = 0; - + int width = info->iconWidth; + int height = info->iconHeight; + if (x > (limit->x + limit->w)) return; if (y > (limit->y + limit->h)) return; - if (y <= limit->y) { - int diff = limit->y - y; - y = limit->y; - height -= diff; - imageHeight -= diff; - } - - if (x <= limit->x) - x = limit->x; - if ((y + height) <= limit->y) return; if ((x + width) <= limit->x) return; + int diff_y = 0; + if (y <= limit->y) { + diff_y = limit->y - y; + y = limit->y; + height -= diff_y; + } + + int diff_x = 0; + if (x <= limit->x) { + diff_x = limit->x - x; + x = limit->x; + width -= diff_x; + } + if ((x + width) > (limit->x + limit->w)) width = (limit->x + limit->w) - x; if ((y + height) > (limit->y + limit->h)) height = (limit->y + limit->h) - y; - uint8_t* image = info->imageData; + int bytes_per_pixel = info->iconBpp / 8; + if (bytes_per_pixel == 0) bytes_per_pixel = 3; + int row_pitch = ((info->iconWidth * info->iconBpp + 31) / 32) * 4; + for (int i = 0; i < height; i++) { - char* image_row = (char*)image + (static_cast(height) - i - 1) * (static_cast(width) * 4); - uint32_t h = height - 1 - i; - j = 0; + int image_y = diff_y + i; + int bmp_row = info->iconHeight - 1 - image_y; + if (bmp_row < 0 || bmp_row >= info->iconHeight) continue; + + uint8_t* image_row = image + bmp_row * row_pitch; for (int k = 0; k < width; k++) { - uint32_t b = image_row[j++] & 0xff; - uint32_t g = image_row[j++] & 0xff; - uint32_t r = image_row[j++] & 0xff; - uint32_t a = image_row[j++] & 0xff; - uint32_t rgb = ((a << 24) | (r << 16) | (g << 8) | (b)); - if (rgb & 0xFF000000) - ChDrawPixel(canv, x + k, y + i, rgb); + int image_x = diff_x + k; + if (image_x < 0 || image_x >= info->iconWidth) continue; + + uint8_t* pixel = image_row + image_x * bytes_per_pixel; + uint32_t b = pixel[0]; + uint32_t g = pixel[1]; + uint32_t r = pixel[2]; + + if (bytes_per_pixel == 3) { + if (r == 255 && g == 255 && b == 255) continue; + ChDrawPixel(canv, x + k, y + i, (r << 16) | (g << 8) | b); + } else { + uint32_t a = pixel[3]; + if (a > 0) { + uint32_t rgb = ((a << 24) | (r << 16) | (g << 8) | b); + ChDrawPixel(canv, x + k, y + i, rgb); + } + } } } } \ No newline at end of file diff --git a/Process/XELnch/crt_arm64.s b/Process/XELnch/crt_arm64.s new file mode 100644 index 000000000..17b2d6c49 --- /dev/null +++ b/Process/XELnch/crt_arm64.s @@ -0,0 +1,10 @@ +.extern main +.extern _KeProcessExit + +.global _aumain +_aumain: + ldp x0,x1, [sp], #16 + sub sp, sp,32 + bl main + add sp, sp,32 + bl _KeProcessExit \ No newline at end of file diff --git a/Process/XELnch/linker.ld b/Process/XELnch/linker.ld new file mode 100644 index 000000000..bab733bc4 --- /dev/null +++ b/Process/XELnch/linker.ld @@ -0,0 +1,27 @@ +ENTRY(_aumain) + +SECTIONS +{ + . = 0x0000000600000000; + + .text : ALIGN(4096) + { + *(.text*) + } + + .rodata : ALIGN(4096) + { + *(.rodata*) + } + + .data : ALIGN(4096) + { + *(.data*) + } + + .bss : ALIGN(4096) + { + *(COMMON) + *(.bss*) + } +} diff --git a/Process/XELnch/main.cpp b/Process/XELnch/main.cpp index 50faaf17b..2519e690e 100644 --- a/Process/XELnch/main.cpp +++ b/Process/XELnch/main.cpp @@ -37,8 +37,10 @@ XESearchBar* searchBar; /* the main painting code */ void XELauncherPaint(ChWindow* win) { + _KePrint("Paining launcher \r\n"); ChDrawRect(win->canv, 0, 0, win->info->width, win->info->height, LAUNCHER_BACKGROUND_COLOR); + _KePrint("Painging all widgets \r\n"); for (int i = 0; i < win->widgets->pointer; i++) { ChWidget* wid = (ChWidget*)list_get_at(win->widgets, i); if (wid) @@ -341,6 +343,7 @@ int main(int argc, char* arv[]){ restart->base.ChActionHandler = xe_restart_action; ChWindowAddWidget(win, (ChWidget*)restart); + _KePrint("Launcher paingint \r\n"); ChWindowPaint(win); PostEvent e; diff --git a/Process/XEShell/XEShell.vcxproj b/Process/XEShell/XEShell.vcxproj index c0df36922..92e60e130 100644 --- a/Process/XEShell/XEShell.vcxproj +++ b/Process/XEShell/XEShell.vcxproj @@ -1,4 +1,4 @@ - + @@ -136,7 +136,7 @@ ..\..\Build\xesh.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; true false @@ -155,7 +155,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -181,7 +181,7 @@ ..\..\Build\xesh.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt XEClib.lib; xecrt.lib; true false @@ -202,7 +202,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/XEShell/main.cpp b/Process/XEShell/main.cpp index 9967f3995..e33aaaae2 100644 --- a/Process/XEShell/main.cpp +++ b/Process/XEShell/main.cpp @@ -30,10 +30,13 @@ #include #include #include +#include #include #include #include #include +#include +#include char *cmdBuf; int index; @@ -61,13 +64,29 @@ void XEShellSigInterrupt(int signo) { _KeProcessSleep(10); } +void XEShellSignalTest(int signo) { + printf("[xeshell]: signal raised++ (SIGINT - CTRL+C)\r\n"); +} + +int timercount; +void XEShellTimerCallback(int signo) { + printf("[xeshell]: signal raised++ (ALARM) tick : %d\r\n", timercount); + timercount++; +// alarm(3); +} + /*Write the current directory string * for now, only root directory is * current directory '/' */ void XEShellWriteCurrentDir() { if (_draw_shell_curdir){ + //OSC 133;A = prompt start + printf("\033]133;A\007"); printf("\033[32m\033[40mXEShell /$:\033[37m\033[40m"); + /* OSC 133;B = prompt end, input starts here*/ + printf("\033]133;B\007"); + fflush(stdout); _draw_shell_curdir = false; } } @@ -130,7 +149,7 @@ void XEShellSpawn(char* string) { * shell's file descriptors */ int file = _KeOpenFile(filename, FILE_OPEN_READ_ONLY); if (file == -1){ - printf("\n No command or program found \n"); + printf("\n No command or program found %s\n", filename); return; } int proc_id = _KeCreateProcess(0, string); @@ -187,11 +206,11 @@ void XEShellReadLine() { index++; return; } - _KePrint("xeshell : %c \r\n", c); printf("%c", c); cmdBuf[index++] = c; } cmdBuf[index] = '\0'; + fflush(stdout); } /* @@ -467,11 +486,58 @@ int main(int argc, char* arv[]){ _sig_handled = false; job = 0; index = 0; + timercount = 0; _XESetEnvironmentVariable("PWD", currentDirectory, 0); + _KeSetSignal(SIGINT, XEShellSignalTest); + signal(SIGALRM, XEShellTimerCallback); + //alarm(3); +#if 0 + struct itimerval one_shot; + one_shot.it_value.tv_sec = 2; + one_shot.it_value.tv_usec = 0; + one_shot.it_interval.tv_sec = 0; + one_shot.it_interval.tv_usec = 0; + + printf("Arming one-shot timer for 2s....\r\n"); + if (setitimer(ITIMER_REAL, &one_shot, NULL) < 0) { + printf("settimer error \r\n"); + } + + //_KeProcessSleep(6); + sleep(6); + printf("after one-shot test: tickcount: %d (expected 1) \r\n", timercount); + + timercount = 0; + struct itimerval periodic; + periodic.it_value.tv_sec = 1; + periodic.it_value.tv_usec = 0; + periodic.it_interval.tv_sec = 1; + periodic.it_interval.tv_usec = 0; + + printf("arming periodic timer (1s interval)...\r\n"); + if (setitimer(ITIMER_REAL, &periodic, NULL) < 0) { + printf("settimer failed here \r\n"); + } + //_KeProcessSleep(6); + sleep(10); + printf("after periodic-test : tick count %d, (expected ~5)\r\n", timercount); + + struct itimerval curr; + if (getitimer(ITIMER_REAL, &curr) == 0) { + printf("current timer : value=%ld.%06ds interval=%ld.%06lds\r\n", (long)curr.it_value.tv_sec, + (long)curr.it_value.tv_usec, (long)curr.it_interval.tv_sec, (long)curr.it_interval.tv_usec); + } + + struct itimerval disarm; + memset(&disarm, 0, sizeof(itimerval)); + setitimer(ITIMER_REAL, &disarm, NULL); + timercount = 0; + //_KeProcessSleep(6); +#endif while (1){ XEShellWriteCurrentDir(); XEShellReadLine(); XEShellProcessLine(); - _KeProcessSleep(2); + _KeProcessSleep(60); } } \ No newline at end of file diff --git a/Process/cat/cat.vcxproj b/Process/cat/cat.vcxproj index 8cdfb45f5..c1896ccef 100644 --- a/Process/cat/cat.vcxproj +++ b/Process/cat/cat.vcxproj @@ -105,7 +105,7 @@ ..\..\Build\$(TargetName).exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false diff --git a/Process/glimpse/glimpse.vcxproj b/Process/glimpse/glimpse.vcxproj index 33dc7cd2c..b1475a402 100644 --- a/Process/glimpse/glimpse.vcxproj +++ b/Process/glimpse/glimpse.vcxproj @@ -1,4 +1,4 @@ - + @@ -140,7 +140,7 @@ F:\calc.exe - E:\Xeneva Project\Aurora\x64\Debug;E:\Xeneva Project\Aurora\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;E:\Xeneva Project\Aurora\x64\Debug;E:\Xeneva Project\Aurora\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; Chitralekha.lib;ftype.lib; true false @@ -182,7 +182,7 @@ $(SolutionDir)Build\glimpse.exe - $(SolutionDir)ARM64\Debug;$(SolutionDir)Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;$(SolutionDir)ARM64\Debug;$(SolutionDir)Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -203,7 +203,7 @@ /filealign:4096 %(AdditionalOptions) - copy "$(SolutionDir)Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "$(SolutionDir)Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/monitor/main.cpp b/Process/monitor/main.cpp new file mode 100644 index 000000000..e8592b815 --- /dev/null +++ b/Process/monitor/main.cpp @@ -0,0 +1,112 @@ +#include +#include +#include +#include +#include + + +#include +#define SLEEP_1_SECOND() sleep(1) + + +#define CUR_HOME "\x1b[H" +#define CLR_SCREEN "\x1b[2J" +#define CLR_EOL "\x1b[K" +#define CUR_HIDE "\x1b[?25l" +#define CUR_SHOW "\x1b[?25h" + + +#define CLR_RESET "\x1b[0m" +#define CLR_BOLD "\x1b[1m" +#define CLR_CYAN "\x1b[36m" +#define CLR_YELLOW "\x1b[33m" +#define CLR_WHITE "\x1b[37m" +#define CLR_BLUE "\x1b[34m" +#define CLR_GREEN "\x1b[32m" +#define CLR_RED "\x1b[31m" + +static int num_process; +XEProcessList* list; + + +static const char* CpuColor(uint32_t cpu_x10) { + if (cpu_x10 >= 700) return CLR_RED; /* >= 70.0% */ + else if (cpu_x10 >= 300) return CLR_YELLOW; /* >= 30.0% */ + else return CLR_GREEN; +} + +static void PrintHeader() { + printf(CLR_BOLD CLR_CYAN "%-6s %-16s %-10s %-8s" CLR_EOL "\n" CLR_RESET, + "PID", "NAME", "FILES", "CPU%"); + printf(CLR_CYAN "%-6s %-16s %-10s %-8s" CLR_EOL "\n" CLR_RESET, + "------", "----------------", "----------", "--------"); +} + +static void PrintProcessRow(XEProcessList* p) { + unsigned int whole = p->cpu_usage / 10; + unsigned int frac = p->cpu_usage % 10; + fflush(stdout); + printf(CLR_YELLOW "%-6d " CLR_RESET, p->proc_id); + printf(CLR_WHITE "%-16s " CLR_RESET, p->name); + printf(CLR_WHITE "%-10u " CLR_RESET, p->num_file_opened); + printf("%s%3u.%u%%" CLR_RESET CLR_EOL "\r\n", CpuColor(p->cpu_usage), whole, frac); +} + + +static int RenderFrame(int prev_row_count) { + + if (num_process <= 0) { + printf(CUR_HOME CLR_RED "No process information available." CLR_EOL "\n" CLR_RESET); + return 0; + } + + + if (!list) { + printf(CUR_HOME CLR_RED "Failed to allocate process list buffer." CLR_EOL "\n" CLR_RESET); + return prev_row_count; + } + + memset(list, 0, num_process * sizeof(XEProcessList)); + if (_KeProcessFetch(list, num_process) != 0) { + printf(CUR_HOME CLR_RED "Failed to fetch process information." CLR_EOL "\n" CLR_RESET); + free(list); + return prev_row_count; + } + + printf(CUR_HOME); + PrintHeader(); + for (int i = 0; i < num_process; i++) { + PrintProcessRow(&list[i]); + } + + + for (int i = num_process; i < prev_row_count; i++) { + printf(CLR_EOL "\n"); + } + + return num_process; +} + +int DisplayProcessListLive() { + printf(CLR_SCREEN CUR_HOME CUR_HIDE); /* one-time full clear at startup */ + + int prev_row_count = 0; + num_process = _KeGetNumProcessCount(); + list = (XEProcessList*)malloc(sizeof(XEProcessList) * num_process); + + for (;;) { + int new_proc_count = _KeGetNumProcessCount(); + if (new_proc_count != num_process) { + num_process = new_proc_count; + list = (XEProcessList*)realloc(list, sizeof(XEProcessList) * num_process); + } + prev_row_count = RenderFrame(prev_row_count); + fflush(stdout); + SLEEP_1_SECOND(); + } + return 0; /* unreachable */ +} + +int main() { + DisplayProcessListLive(); +} \ No newline at end of file diff --git a/Process/monitor/monitor.vcxproj b/Process/monitor/monitor.vcxproj new file mode 100644 index 000000000..0cc943b17 --- /dev/null +++ b/Process/monitor/monitor.vcxproj @@ -0,0 +1,251 @@ + + + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + + + + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4} + monitor + 10.0 + + + + Application + true + v120 + MultiByte + + + Application + true + v120 + MultiByte + + + Application + true + v142 + MultiByte + + + Application + false + v120 + true + MultiByte + + + Application + false + v120 + true + MultiByte + + + Application + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + monitor + + + + Level3 + Disabled + true + + + true + + + + + Level4 + Disabled + false + E:\Xeneva Project\Aurora\Libs\XEClib\includes;E:\Xeneva Project\Aurora\Libs\Chitralekha;E:\os_dev\freetype2-master\freetype2-master\include;%(AdditionalIncludeDirectories) + ARCH_X64;YES_DYNAMIC; DYNAMIC_IMPORTER ;%(PreprocessorDefinitions) + true + false + + + false + StreamingSIMDExtensions2 + false + true + true + + + + + F:\calc.exe + E:\Xeneva Project\Aurora\x64\Debug;E:\Xeneva Project\Aurora\Libs\XECrt;%(AdditionalLibraryDirectories) + XEClib.lib; xecrt.lib; Chitralekha.lib;ftype.lib; + true + false + true + true + Native + Driver + true + false + UseLinkTimeCodeGeneration + _xemain + 0x0000000000600000 + + false + + /ALIGN:512 %(AdditionalOptions) + + + + + Level4 + Disabled + false + ..\..\Libs\XEClib\includes;%(AdditionalIncludeDirectories) + ARCH_ARM64;YES_DYNAMIC; DYNAMIC_IMPORTER ;%(PreprocessorDefinitions) + true + false + + + + + false + StreamingSIMDExtensions2 + false + true + true + false + + + + + ..\..\Build\monitor.exe + ..\..\ARM64\Debug;..\..\Libs\XECrt;$(SolutionDir)Build;%(AdditionalLibraryDirectories) + XEClib.lib; xecrt.lib; + true + false + true + true + Native + Driver + true + false + UseLinkTimeCodeGeneration + _xemain + 0x0000000600000000 + + + false + + + /filealign:4096 %(AdditionalOptions) + + + copy "$(SolutionDir)Build\$(TargetName).exe" "M:\$(TargetName).exe" + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + + + \ No newline at end of file diff --git a/Process/monitor/monitor.vcxproj.filters b/Process/monitor/monitor.vcxproj.filters new file mode 100644 index 000000000..4327830c9 --- /dev/null +++ b/Process/monitor/monitor.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Process/mp4plr/mp4plr.vcxproj b/Process/mp4plr/mp4plr.vcxproj index 844c9e228..547b4d484 100644 --- a/Process/mp4plr/mp4plr.vcxproj +++ b/Process/mp4plr/mp4plr.vcxproj @@ -108,7 +108,7 @@ ..\..\Build\$(TargetName).exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -127,7 +127,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe + copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe" diff --git a/Process/nslook/nslook.vcxproj b/Process/nslook/nslook.vcxproj index b8c699eb5..4f7e5c84e 100644 --- a/Process/nslook/nslook.vcxproj +++ b/Process/nslook/nslook.vcxproj @@ -105,7 +105,7 @@ ..\..\Build\nslook.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -124,7 +124,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe + copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe" diff --git a/Process/nyancat/main.cpp b/Process/nyancat/main.cpp new file mode 100644 index 000000000..374416768 --- /dev/null +++ b/Process/nyancat/main.cpp @@ -0,0 +1,73 @@ +#include +#include +#include +#include +#include +#include +#include + +#define STAR_COUNT 12 + +static const char starGlyphs[] = { '.', '+', '*', '+' }; + +typedef struct { + uint8_t x, y; + uint8_t phase; + uint8_t speed; +}Star; + + +static Star stars[STAR_COUNT]; + +void StarsInit(int cols, int rows) { + for (int i = 0; i < STAR_COUNT; i++) { + stars[i].x = (i * 7 + 3) % (cols - 1); + stars[i].y = (i * 5 + 1) % (rows - 1); + stars[i].phase = i % 4; + stars[i].speed = (i % 2) + 1; + } +} + +void StarsDraw(int tick) { + printf("\033[?25l\033[H"); + + for (int i = 0; i < STAR_COUNT; i++) { + Star* s = &stars[i]; + uint8_t p = (s->phase + tick * s->speed) % 4; + + printf("\033[%d;%dH%c", s->y + 1, s->x + 1, starGlyphs[p]); + } + + fflush(stdout); +} + +void StarsErase() { + for (int i = 0; i < STAR_COUNT; i++) + printf("\033[%d;%dH ", stars[i].y + 1, stars[i].x + 1); + printf("\033[?25h"); + fflush(stdout); +} + +void StarsRun(int cols, int rows, int frames) { + StarsInit(cols, rows); + printf("\033[2J"); + + for (int tick = 0; tick < frames; tick++) { + StarsDraw(tick); + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 150000000L; + nanosleep(&ts, NULL); + } + + StarsErase(); + printf("\033[2J]033[H"); + fflush(stdout); +} + +int main(int argc, char* argv[]) { + WinSize sz; + _KeFileIoControl(0, TIOCGWINSZ, &sz); + _KePrint("started twinkling col : %d, row : %d \r\n", sz.ws_col, sz.ws_row); + StarsRun(sz.ws_col, sz.ws_row, 100); +} \ No newline at end of file diff --git a/Process/nyancat/nyancat.vcxproj b/Process/nyancat/nyancat.vcxproj new file mode 100644 index 000000000..8effd1386 --- /dev/null +++ b/Process/nyancat/nyancat.vcxproj @@ -0,0 +1,251 @@ + + + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + + + + {24CAE2F8-A031-49D7-B5D6-B3DBBD7D5ED8} + nyancat + 10.0 + + + + Application + true + v120 + MultiByte + + + Application + true + v120 + MultiByte + + + Application + true + v142 + MultiByte + + + Application + false + v120 + true + MultiByte + + + Application + false + v120 + true + MultiByte + + + Application + false + v120 + true + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + nyancat + + + + Level3 + Disabled + true + + + true + + + + + Level4 + Disabled + false + E:\Xeneva Project\Aurora\Libs\XEClib\includes;E:\Xeneva Project\Aurora\Libs\Chitralekha;E:\os_dev\freetype2-master\freetype2-master\include;%(AdditionalIncludeDirectories) + ARCH_X64;YES_DYNAMIC; DYNAMIC_IMPORTER ;%(PreprocessorDefinitions) + true + false + + + false + StreamingSIMDExtensions2 + false + true + true + + + + + F:\calc.exe + E:\Xeneva Project\Aurora\x64\Debug;E:\Xeneva Project\Aurora\Libs\XECrt;%(AdditionalLibraryDirectories) + XEClib.lib; xecrt.lib; Chitralekha.lib;ftype.lib; + true + false + true + true + Native + Driver + true + false + UseLinkTimeCodeGeneration + _xemain + 0x0000000000600000 + + false + + /ALIGN:512 %(AdditionalOptions) + + + + + Level4 + Disabled + false + ..\..\Libs\XEClib\includes;%(AdditionalIncludeDirectories) + ARCH_ARM64;YES_DYNAMIC; DYNAMIC_IMPORTER ;%(PreprocessorDefinitions) + true + false + + + + + false + StreamingSIMDExtensions2 + false + true + true + false + + + + + ..\..\Build\nyancat.exe + ..\..\ARM64\Debug;..\..\Libs\XECrt;$(SolutionDir)Build;%(AdditionalLibraryDirectories) + XEClib.lib; xecrt.lib; + true + false + true + true + Native + Driver + true + false + UseLinkTimeCodeGeneration + _xemain + 0x0000000C00000000 + + + false + + + /filealign:4096 %(AdditionalOptions) + + + copy "$(SolutionDir)Build\$(TargetName).exe" "M:\$(TargetName).exe" + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + + + + + + \ No newline at end of file diff --git a/Process/nyancat/nyancat.vcxproj.filters b/Process/nyancat/nyancat.vcxproj.filters new file mode 100644 index 000000000..4327830c9 --- /dev/null +++ b/Process/nyancat/nyancat.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Process/ping/main.cpp b/Process/ping/main.cpp index fdfcc840f..784b0cc0b 100644 --- a/Process/ping/main.cpp +++ b/Process/ping/main.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #define BYTES_TO_SEND 56 @@ -69,26 +70,23 @@ static uint16_t ICMPCalculateChecksum(char* payload, size_t len) { */ int main(int argc, char* argv[]){ printf("\n"); - char* s = (char*)malloc(strlen(argv[1])+1); - strcpy(s, argv[1]); + char* s = (char*)malloc(strlen("www.getxeneva.com") + 1); + strcpy(s, "www.getxeneva.com"); hostent* ent = gethostbyname(s); if (!ent) { free(s); _KePauseThread(); } - printf("Hostent addr -> %x \r\n", ent->h_addr_list); char* addr = inet_ntoa(*(struct in_addr*)ent->h_addr_list[0]); - _KePrint("PING started \r\n"); - + uint32_t ipaddr = *(uint32_t*)ent->h_addr_list[0]; in_addr inaddr; inaddr.s_addr = ipaddr; - printf("IPAddr -> %s \n", inet_ntoa(inaddr)); - char request[] = "GET / HTTP/1.1\r\nHost:google.com\r\nConnection: close\r\n\r\n"; + /*char request[] = "GET / HTTP/1.1\r\nHost:google.com\r\nConnection: close\r\n\r\n"; int sock = socket(AF_INET, SOCK_STREAM, 0); sockaddr_in server_addr; @@ -101,8 +99,8 @@ int main(int argc, char* argv[]){ return 0; } - printf("TCP connection to %s successfull \n", s); - /*int sock = socket(AF_INET, SOCK_DGRAM, IPPROTOCOL_ICMP); + printf("TCP connection to %s successfull \n", s);*/ + int sock = socket(AF_INET, SOCK_DGRAM, IPPROTOCOL_ICMP); if (sock < 0) { fprintf(stderr, "ping: failed to create socket \n"); @@ -116,7 +114,7 @@ int main(int argc, char* argv[]){ in_addr ad; ad.s_addr = dest.sin_addr.s_addr; - printf("PINGING %s Address : %s \n",s, addr); + printf("ping: %s address : %s \n",s, addr); ICMPHeader* ping = (ICMPHeader*)malloc(BYTES_TO_SEND); @@ -137,6 +135,7 @@ int main(int argc, char* argv[]){ sockaddr_in src; socklen_t src_sz = 0; size_t len = 0; + int timeout = 1000; while (1) { if (response_recved == 5) break; @@ -152,24 +151,26 @@ int main(int argc, char* argv[]){ pings_sent++; src_sz = sizeof(sockaddr_in); - len = recvfrom(sock, data, 4096, 0, (sockaddr*)&src, &src_sz); - - if (len > 0) { - ICMPHeader* icmp = (ICMPHeader*)data; - if (icmp->type == 0) { - char* from = inet_ntoa(src.sin_addr); - printf("%d bytes from %s : sequence= %d \n", len, from, ntohs(icmp->sequenceNum)); - response_recved++; + while (timeout--) { + len = recvfrom(sock, data, 4096, 0, (sockaddr*)&src, &src_sz); + + if (len > 0) { + ICMPHeader* icmp = (ICMPHeader*)data; + if (icmp->type == 0) { + char* from = inet_ntoa(src.sin_addr); + printf("%d bytes from %s : sequence= %d \n", len, from, ntohs(icmp->sequenceNum)); + response_recved++; + break; + } } } - - _KeProcessSleep(1000); + timeout = 1000; + //_KeProcessSleep(100); + sleep(1); } - printf("---statistics---- %s \n", argv[1]); + printf("---statistics----: %s \n", s); printf("%d packets sent, %d packets received \n", pings_sent, response_recved); - _KeCloseFile(sock);*/ - while (1) - _KePauseThread(); + _KeCloseFile(sock); return 0; } diff --git a/Process/ping/ping.vcxproj b/Process/ping/ping.vcxproj index a8132784b..b6bd4421b 100644 --- a/Process/ping/ping.vcxproj +++ b/Process/ping/ping.vcxproj @@ -1,6 +1,10 @@  + + Debug + ARM64 + Debug Win32 @@ -9,6 +13,10 @@ Debug x64 + + Release + ARM64 + Release Win32 @@ -39,6 +47,12 @@ v142 MultiByte + + Application + true + v142 + MultiByte + Application false @@ -53,6 +67,13 @@ true MultiByte + + Application + false + v120 + true + MultiByte + @@ -63,17 +84,27 @@ + + + + + + false ping + + false + ping + Level3 @@ -106,7 +137,7 @@ ..\..\Build\ping.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -125,7 +156,55 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe + copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe" + + + + + Level4 + Disabled + false + ..\..\Libs\XEClib\includes;..\..\Libs\Chitralekha;..\..\Ports\freetype2\include;%(AdditionalIncludeDirectories) + ARCH_ARM64;YES_DYNAMIC; DYNAMIC_IMPORTER ;%(PreprocessorDefinitions) + true + false + + + + + false + StreamingSIMDExtensions2 + false + true + true + false + + + + + ..\..\Build\ping.exe + ..\..\ARM64\Debug;..\..\Libs\XECrt;$(SolutionDir)Build;%(AdditionalLibraryDirectories) + XEClib.lib; xecrt.lib; + true + false + true + true + Native + Driver + true + false + UseLinkTimeCodeGeneration + _xemain + 0x0000000600000000 + + + false + + + /filealign:4096 %(AdditionalOptions) + + + copy "$(SolutionDir)Build\$(TargetName).exe" "M:\$(TargetName).exe" @@ -156,6 +235,20 @@ true + + + Level3 + MaxSpeed + true + true + true + + + true + true + true + + diff --git a/Process/play/play.vcxproj b/Process/play/play.vcxproj index f4cde371f..2a485da79 100644 --- a/Process/play/play.vcxproj +++ b/Process/play/play.vcxproj @@ -1,4 +1,4 @@ - + @@ -136,7 +136,7 @@ ..\..\Build\play.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -155,7 +155,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe + copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe" @@ -181,7 +181,7 @@ ..\..\Build\play.exe - ..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\ARM64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -202,7 +202,7 @@ /filealign:4096 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe + if exist M:\ ( copy "..\..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/Process/rm/rm.vcxproj b/Process/rm/rm.vcxproj index 3ad81a2df..1fc1114ec 100644 --- a/Process/rm/rm.vcxproj +++ b/Process/rm/rm.vcxproj @@ -105,7 +105,7 @@ ..\..\Build\rm.exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false @@ -124,7 +124,7 @@ /ALIGN:512 %(AdditionalOptions) - copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe + copy "..\..\Build\$(TargetName).exe" "%XENEVA_BUILDS%\$(TargetName).exe" diff --git a/Process/systray/systray.vcxproj b/Process/systray/systray.vcxproj index e77ce844d..caeec7d23 100644 --- a/Process/systray/systray.vcxproj +++ b/Process/systray/systray.vcxproj @@ -113,7 +113,7 @@ ..\..\Build\$(TargetName).exe - ..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\..\x64\Debug;..\..\Libs\XECrt;%(AdditionalLibraryDirectories) XEClib.lib; xecrt.lib; chlkha.lib;ftype.lib; true false diff --git a/Resources/resources/lncher.cnf b/Resources/resources/lncher.cnf index d4fc90a3b..fbcafdb87 100644 --- a/Resources/resources/lncher.cnf +++ b/Resources/resources/lncher.cnf @@ -1,23 +1,29 @@ {[Title]Xeneva Terminal| [Icon]/icons/terml.bmp| +[Param]| [App]/term.exe} {[Title]Calculator| [Icon]/icons/calcl.bmp| +[Param]| [App]/calc.exe} {[Title]Files| [Icon]/icons/filel.bmp| +[Param]| [App]/file.exe} {[Title]Accent Player| [Icon]/icons/medial.bmp| +[Param]| [App]/audplr.exe} {[Title]Controls| [Icon]/icons/gearl.bmp| +[Param]| [App]/ctrl.exe} {[Title]Calender| [Icon]/icons/calndrl.bmp| +[Param]| [App]/calendr.exe> \ No newline at end of file diff --git a/Scripts/Linux/build_and_run_qemu.sh b/Scripts/Linux/build_and_run_qemu.sh old mode 100644 new mode 100755 index 8d467d824..a9eaf351e --- a/Scripts/Linux/build_and_run_qemu.sh +++ b/Scripts/Linux/build_and_run_qemu.sh @@ -1,12 +1,62 @@ #!/bin/bash set -e -# Check for manual build flag -FORCE_MANUAL_BUILD=0 -if [ "$1" == "--force-manual-build" ]; then - FORCE_MANUAL_BUILD=1 -fi +# Check for build flags +FORCE_LEGACY_BUILD=0 +BUILD_USER_APPS=0 + +for arg in "$@"; do + if [ "$arg" == "--force-legacy-build" ]; then + FORCE_LEGACY_BUILD=1 + elif [ "$arg" == "--force-user-apps" ]; then + BUILD_USER_APPS=1 + fi +done +if [ "$BUILD_USER_APPS" -eq 1 ]; then + echo "[+] Rebuilding Libraries and User Applications..." + + echo " [-] Building XEClib..." + make -C Libs/XEClib clean + make -C Libs/XEClib + + echo " [-] Building Chitralekha..." + make -C Libs/Chitralekha clean + make -C Libs/Chitralekha + + APPS=( + "Init" + "DeodhaiXR" + "Terminal" + "Namdapha" + "XELnch" + "DeodhaiAudio" + "Calender" + "Calculator" + "AudioPlayer" + "Files" + "Control" + ) + + for app in "${APPS[@]}"; do + echo " [-] Building $app..." + make -C Process/$app clean + make -C Process/$app + done + + echo "[+] Deploying newly built binaries to Resources/resources/..." + cp -f Process/Init/init.exe Resources/resources/ + cp -f Process/DeodhaiXR/deodxr.exe Resources/resources/ + cp -f Process/Terminal/term.exe Resources/resources/ + cp -f Process/Namdapha/nmdapha.exe Resources/resources/ + cp -f Process/XELnch/xelnch.exe Resources/resources/ + cp -f Process/DeodhaiAudio/deoaud.exe Resources/resources/ + cp -f Process/Calender/calendr.exe Resources/resources/ + cp -f Process/Calculator/calc.exe Resources/resources/ + cp -f Process/AudioPlayer/audplr.exe Resources/resources/ + cp -f Process/Files/file.exe Resources/resources/ + cp -f Process/Control/ctrl.exe Resources/resources/ +fi echo "[+] Creating 512MB FAT32 image..." dd if=/dev/zero of=fat.img bs=1M count=512 @@ -17,9 +67,9 @@ mmd -i fat.img ::/EFI mmd -i fat.img ::/EFI/BOOT mmd -i fat.img ::/EFI/XENEVA -# [Note: (Temporary Dev Workaround) -# During the active porting phase, you can place a pre-built initrd2.img -# (with GUI/resources) at the root of the repository to skip manual building. +# [Note: The default script will always build initrd2.img and pack resources. +# Using a pre-built legacy initrd2.img is NOT RECOMMENDED, but can be forced +# by passing the --force-legacy-build flag. # Example Directory Structure: # XenevaOS/ # ├── KernelAA64/ @@ -27,19 +77,20 @@ mmd -i fat.img ::/EFI/XENEVA # ├── Scripts/ # └── initrd2.img <-- Place it exactly here # ] -if [ "$FORCE_MANUAL_BUILD" -eq 1 ] || [ ! -f "initrd2.img" ]; then +if [ "$FORCE_LEGACY_BUILD" -eq 0 ]; then echo "[+] Creating 64MB FAT32 initrd2.img and packing resources..." dd if=/dev/zero of=initrd2.img bs=1M count=64 mkfs.vfat -F 32 initrd2.img - mcopy -i initrd2.img Resources/resources/* ::/ + mcopy -o -i initrd2.img Resources/resources/* ::/ + mcopy -o -i initrd2.img Process/Init/init.exe ::/init.exe else echo "[+] Found pre-built initrd2.img, skipping manual creation." echo " (Use --force-manual-build flag to override)" fi -mcopy -i fat.img BootAA64/Build/EFI/BOOT/BOOTAA64.efi ::/EFI/BOOT/BOOTAA64.EFI -mcopy -i fat.img KernelAA64/KernelAA64.exe ::/EFI/XENEVA/xnkrnl.exe -mcopy -i fat.img initrd2.img ::/initrd2.img +mcopy -o -i fat.img BootAA64/Build/EFI/BOOT/BOOTAA64.efi ::/EFI/BOOT/BOOTAA64.EFI +mcopy -o -i fat.img KernelAA64/KernelAA64.exe ::/EFI/XENEVA/xnkrnl.exe +mcopy -o -i fat.img initrd2.img ::/initrd2.img echo "[+] Image ready! Booting QEMU..." qemu-system-aarch64 -machine virt,gic-version=2,highmem=off \ @@ -51,4 +102,5 @@ qemu-system-aarch64 -machine virt,gic-version=2,highmem=off \ -device virtio-tablet-pci \ -device usb-ehci \ -device usb-kbd \ - -serial stdio + -serial stdio \ + -display gtk,zoom-to-fit=on \ No newline at end of file diff --git a/Scripts/Linux/lib/dist_determine.sh b/Scripts/Linux/lib/dist_determine.sh new file mode 100644 index 000000000..62eb32e1e --- /dev/null +++ b/Scripts/Linux/lib/dist_determine.sh @@ -0,0 +1,83 @@ +#! This script is not meant for execution, so no need for execution permission or shebang. + +function print_os_group_id(){ + printf "${STY_CYAN}" + printf "===INFO===\n" + printf "Detected OS_DISTRO_ID: ${OS_DISTRO_ID}\n" + printf "Detected OS_DISTRO_ID_LIKE: ${OS_DISTRO_ID_LIKE}\n" + printf "Determined OS_GROUP_ID: ${OS_GROUP_ID}\n" + printf "==========\n\n" + printf "${STY_RST}" +} +function print_os_group_id_alike(){ + printf "${STY_YELLOW}" + printf "===WARNING===\n" + printf "Your OS_GROUP_ID has been determined by \"alike\" match.\n" + printf "Ideally, it should also work for your distro.\n" + printf "Still, there is a chance that it not works as expected or even fails.\n" + printf "Proceed only at your own risk.\n" + printf "=============\n\n" + printf "${STY_RST}" +} +function print_os_group_id_unsupported(){ + printf "${STY_RED}" + printf "===CAUTION===\n" + printf "\"--via-nix\" is forcely specified \n" + printf "as the only way to try to install on your distro.\n" + printf "It is still experimental.\n" + printf "Some functionalities are missing.\n" + printf "It may also behave unexpectedly.\n" + printf "Proceed only at your own risk.\n" + printf "=============\n\n" + printf "${STY_RST}" + sleep 3 +} +function print_os_group_id_fallback(){ + printf "${STY_RED}" + printf "===CAUTION===\n" + printf "Distro not recognized, determined as fallback.\n" + printf "=============\n\n" + printf "${STY_RST}" +} +function print_os_group_id_architecture(){ + printf "${STY_RED}" + printf "===CAUTION===\n" + printf "Detected machine architecture: ${MACHINE_ARCH}\n" + printf "This script only supports x86_64.\n" + printf "It is very likely to fail when installing dependencies on your machine.\n" + printf "=============\n\n" + printf "${STY_RST}" +} + +#Detecting distro +OS_RELEASE_FILE_CUSTOM="${REPO_ROOT}/os-release" +if test -f "${OS_RELEASE_FILE_CUSTOM}"; then + printf "${STY_YELLOW}Warning: using custom os-release file \"${OS_RELEASE_FILE_CUSTOM}\".${STY_RST}\n" + OS_RELEASE_FILE="${OS_RELEASE_FILE_CUSTOM}" +elif test -f /etc/os-release; then + OS_RELEASE_FILE=/etc/os-release +else + printf "${STY_RED}/etc/os-release does not exist, aborting...${STY_RST}\n" ; exit 1 +fi +export OS_DISTRO_ID=$(awk -F'=' '/^ID=/ { gsub(/["\x27]/,"",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) +export OS_DISTRO_ID_LIKE=$(awk -F'=' '/^ID_LIKE=/ { gsub(/["\x27]/,"",$2); print tolower($2) }' ${OS_RELEASE_FILE} 2> /dev/null) + + +# Determine distro +if [[ "$OS_DISTRO_ID" =~ ^(arch|endeavouros|cachyos)$ ]]; then + OS_GROUP_ID="arch" + print_os_group_id_functions=(print_os_group_id) +elif [[ "$OS_DISTRO_ID_LIKE" == "arch" ]]; then + OS_GROUP_ID="arch" + print_os_group_id_functions=(print_os_group_id{,_alike}) +elif [[ "$OS_DISTRO_ID" =~ ^(ubuntu|debian|linuxmint|pop|kali|elementary|zorin|deepin|mx|pureos|tails|neon|linuxmint|peppermint|bodhi|parrot|)$ ]]; then + OS_GROUP_ID="debian" + print_os_group_id_functions=(print_os_group_id) +elif [[ "$OS_DISTRO_ID_LIKE" == "debian" ]]; then + OS_GROUP_ID="debian" + print_os_group_id_functions=(print_os_group_id{,_alike}) +else + OS_GROUP_ID="fallback" + INSTALL_VIA_NIX=true + print_os_group_id_functions=(print_os_group_id{,_fallback,_unsupported}) +fi \ No newline at end of file diff --git a/Scripts/Linux/lib/distro/arch.sh b/Scripts/Linux/lib/distro/arch.sh new file mode 100644 index 000000000..f7e1b3696 --- /dev/null +++ b/Scripts/Linux/lib/distro/arch.sh @@ -0,0 +1,22 @@ +#! this script is only meant to be sourced. + +# install-yay(){ +# x sudo pacman -S --needed --noconfirm base-devel +# x git clone https://aur.archlinux.org/yay-bin.git /tmp/buildyay +# x cd /tmp/buildyay +# x makepkg -o +# x makepkg -se +# x makepkg -i --noconfirm +# x cd ${REPO_ROOT} +# rm -rf /tmp/buildyay +# } + +if ! command -v pacman >/dev/null 2>&1; then + printf "${STY_RED}[$0]: pacman not found, are you sure you are on arch (you sussy baka!) ${STY_RST}\n" + exit 1 +fi + +# this prevents makepkg from resetting sudo +if [[ -z "${PACMAN_AUTH:-}" ]]; then + export PACMAN_AUTH="sudo" +fi \ No newline at end of file diff --git a/Scripts/Linux/lib/distro/debian.sh b/Scripts/Linux/lib/distro/debian.sh new file mode 100644 index 000000000..066f0a8a2 --- /dev/null +++ b/Scripts/Linux/lib/distro/debian.sh @@ -0,0 +1,33 @@ +#! This script is not meant for execution, so no need for execution permission or shebang. + +if ! command -v apt >/dev/null 2>&1; then + printf "${STY_RED}[$0]: apt not found, are you sure you are on debian based system (you sussy baka!) ${STY_RST}\n" + exit 1 +fi + +# update the system +v sudo apt update +v sudo apt upgrade + +# common for both llvm and gcc +v sudo apt install make +v sudo apt install dosfstools +v sudo apt install mtools +sudo apt install qemu-system-arm + +case $2 in + --llvm|llvm) + v sudo apt install clang + v sudo apt install lld + v sudo apt install llvm + ;; + --gcc|gcc) + v sudo apt install gcc-aarch64-linux-gnu + v sudo apt install binutils-aarch64-linux-gnu + cd ../.. + v git clone https://github.com/vathpela/gnu-efi + ;; + *) + printf "${STY_RED}Plese choose from llvm and gcc. Aborting ...${STY_RST}\n" + ;; +esac diff --git a/Scripts/Linux/lib/enviorment_variables.sh b/Scripts/Linux/lib/enviorment_variables.sh new file mode 100644 index 000000000..fef357c2b --- /dev/null +++ b/Scripts/Linux/lib/enviorment_variables.sh @@ -0,0 +1,20 @@ +#! This script is not meant for execution, so no need for execution permission or shebang. + +# color's for terminal beautification, what ? you dont like color or smt? +STY_RED='\e[31m' +STY_GREEN='\e[32m' +STY_YELLOW='\e[33m' +STY_BLUE='\e[34m' +STY_PURPLE='\e[35m' +STY_CYAN='\e[36m' + +# in case we might need this +STY_BOLD='\e[1m' +STY_FAINT='\e[2m' +STY_SLANT='\e[3m' +STY_UNDERLINE='\e[4m' +STY_BLINK='\e[5m' +STY_INVERT='\e[7m' +STY_RST='\e[00m' + +declare -g SUDO_PID="" \ No newline at end of file diff --git a/Scripts/Linux/lib/functions.sh b/Scripts/Linux/lib/functions.sh new file mode 100644 index 000000000..71ee96af7 --- /dev/null +++ b/Scripts/Linux/lib/functions.sh @@ -0,0 +1,131 @@ +#! This script is not meant for execution, so no need for execution permission or shebang. + +function v(){ + echo -e "${STY_YELLOW}${STY_BOLD}##############################################################################################${STY}" + echo -e "${STY_BLUE}[$0]: Next command:${STY_RST}" + echo -e "${STY_GREEN}$*${STY_RST}" + local execute=true + if $ask;then + while true;do + echo -e "${STY_BLUE}Execute? ${STY_RST}" + echo " y = Yes" + echo " e = Exit now" + echo " s = Skip this command (NOT recommended - your setup might not work correctly)" + echo " yesforall = Yes and don't ask again; NOT recommended unless you really sure 🫠" + local p; read -p "====> " p + case $p in + [yY]) echo -e "${STY_BLUE}OK, executing...${STY_RST}" ;break ;; + [eE]) echo -e "${STY_BLUE}Exiting...${STY_RST}" ;exit ;break ;; + [sS]) echo -e "${STY_BLUE}Alright, skipping this one...${STY_RST}" ;execute=false ;break ;; + "yesforall") echo -e "${STY_BLUE}Alright, won't ask again. Executing...${STY_RST}"; ask=false ;break ;; + *) echo -e "${STY_RED}Please enter [y/e/s/yesforall].${STY_RST}";; + esac + done + fi + if $execute;then x "$@";else + echo -e "${STY_YELLOW}[$0]: Skipped \"$*\"${STY_RST}" + fi +} +function x(){ + if "$@";then local cmdstatus=0;else local cmdstatus=1;fi + while [ $cmdstatus == 1 ] ;do + echo -e "${STY_RED}[$0]: Command \"${STY_GREEN}$*${STY_RED}\" has failed." + echo -e "You may need to resolve the problem manually BEFORE repeating this command." + echo " r = Repeat this command (DEFAULT)" + echo " e = Exit now" + echo " i = Ignore this error and continue (your setup might not work correctly)" + local p; read -p " [R/e/i]: " p + case $p in + [iI]) echo -e "${STY_BLUE}Alright, ignore and continue...${STY_RST}";cmdstatus=2;; + [eE]) echo -e "${STY_BLUE}Alright, will exit.${STY_RST}";break;; + *) echo -e "${STY_BLUE}OK, repeating...${STY_RST}" + if "$@";then cmdstatus=0;else cmdstatus=1;fi + ;; + esac + done + case $cmdstatus in + 0) echo -e "${STY_BLUE}[$0]: Command \"${STY_GREEN}$*${STY_BLUE}\" finished.${STY_RST}";; + 1) echo -e "${STY_RED}[$0]: Command \"${STY_GREEN}$*${STY_RED}\" has failed. Exiting...${STY_RST}";exit 1;; + 2) echo -e "${STY_RED}[$0]: Command \"${STY_GREEN}$*${STY_RED}\" has failed but ignored by user.${STY_RST}";; + esac +} + +# check for if the user is dumb enough to run the script using sudo privelages +function prevent_privelage_run(){ + case $(whoami) in + root) echo -e "${STY_RED}[$0]: This script is NOT to be executed with sudo or as root. Aborting...${STY_RST}";exit 1;; + esac +} + +# simple function to pause the script and ask if user want to proceed +function pause(){ + if [ ! "$ask" == "false" ];then + printf "${STY_FAINT}${STY_SLANT}" + local p; read -p "(Ctrl-C to abort, Enter to proceed)" p + printf "${STY_RST}" + fi +} + +# initialize a sudo session to install dependencies +function sudo_session(){ + # check for sudo + if ! command -v sudo > /dev/null 2>&1; then + printf "${STY_RED}sudo unavilable !${STY_RST}\n" + return 0 + fi + + # skip if repeated + if [[ -n "$SUDO_PID" ]] && kill -0 "$SUDO_PID" 2>/dev/null; then + printf "${STY_YELLOW}sudo session already running aborting... ${STY_RST}\n" + return 0 + fi + + echo -e "${STY_CYAN}[$0]: Requesting sudo privileges for installation...${STY_RST}" + if ! sudo true; then + echo -e "${STY_RED}[$0]: Failed to obtain sudo privileges. Aborting...${STY_RST}" + exit 1 + fi + ( + while true; do + sleep 60 + sudo true 2>/dev/null || exit 0 + done + ) & + SUDO_PID=$! + + echo -e "${STY_GREEN}[$0]: Sudo session initialized and will be kept alive (PID: $SUDO_PID)${STY_RST}" +} + +# stop the sudo session in background +function sudo_stop(){ + if [[ -n "$SUDO_PID" ]] && kill -0 "$SUDO_PID" 2>/dev/null; then + kill "$SUDO_PID" 2>/dev/null || true + wait "$SUDO_PID" 2>/dev/null || true + SUDO_PID="" + fi +} + +# Help output for the scipt and information on how to use it +function show_help(){ + printf "${STY_CYAN} +Script for checking dependency and ruuning XenevaOS with llvm. + +${STY_UNDERLINE}Usage:${STY_RST}${STY_CYAN} $0 [OPTION] + +${STY_UNDERLINE}Options:${STY_RST}${STY_CYAN} +-h, --help, help print help information. + +-d, --deps, deps check for dependencies and installs them. + sub-option: + --llvm, llvm install dependencis for llvm build. + --gcc, gcc install dependencies for gcc build. + +--llvm, llvm compile the XenevaOS for arm(for now) using llvm toolchain (needs llvm deps) +--gcc, gcc compile the XenevaOS for arm(for now) using gcc toolchain (needs gcc deps) + both gcc and llvm supports sub option for: + --build, build builds initrd2 image for XenevaOS + + +${STY_BOLD}${STY_CYAN}Access https://github.com/manaskamal/XenevaOS/blob/master/Docs/Index.md${STY_RST} ${STY_BOLD}${STY_CYAN}for documentation about XenevaOS.${STY_RST} +" +} \ No newline at end of file diff --git a/Scripts/Linux/lib/gcc.sh b/Scripts/Linux/lib/gcc.sh new file mode 100644 index 000000000..1d2a688c2 --- /dev/null +++ b/Scripts/Linux/lib/gcc.sh @@ -0,0 +1,10 @@ +#! This script is not meant for execution, so no need for execution permission or shebang. + + +printf "${STY_CYAN}compiling Xeneva for arm using gcc.${STY_RST}\n" +cd ../../BootAA64 +make clean +make + +cd ../KernelAA64 +make clean make \ No newline at end of file diff --git a/Scripts/Linux/lib/llvm.sh b/Scripts/Linux/lib/llvm.sh new file mode 100644 index 000000000..af4d9ef57 --- /dev/null +++ b/Scripts/Linux/lib/llvm.sh @@ -0,0 +1,13 @@ +#! This script is not meant for execution, so no need for execution permission or shebang. + + +printf "${STY_CYAN}compiling Xeneva for arm using llvm.${STY_RST}\n" +cd ../../BootAA64 +make clean +make llvm + +cd ../KernelAA64 +make clean +make llvm + +cd .. \ No newline at end of file diff --git a/Scripts/Linux/manager.sh b/Scripts/Linux/manager.sh new file mode 100755 index 000000000..3a731b215 --- /dev/null +++ b/Scripts/Linux/manager.sh @@ -0,0 +1,73 @@ +#!/bin/bash +cd "$(dirname "$0")" +REPO_ROOT="$(pwd)" + +source ./lib/enviorment_variables.sh +source ./lib/functions.sh +source ./lib/dist_determine.sh + + +prevent_privelage_run +set -e + +case $1 in + ""|-h|--help|help)show_help;exit;; + -d|--deps|deps) + + # call print_os function to see if the os is supported by the script + for function in ${print_os_group_id_functions[@]}; do + $function + done + pause + # initialize sudo session + sudo_session + trap sudo_stop EXIT INT TERM + source ./lib/distro/${OS_GROUP_ID}.sh + ;; + --llvm|--gcc|llvm|gcc) + echo "[+] Creating 512MB FAT32 image..." + cd ../.. + dd if=/dev/zero of=fat.img bs=1M count=512 + mkfs.vfat fat.img + echo "[+] Copying EFI Bootloader and Kernel via mtools..." + mmd -i fat.img ::/EFI + mmd -i fat.img ::/EFI/BOOT + mmd -i fat.img ::/EFI/XENEVA + cd Scripts/Linux + case $1 in + --llvm|llvm) + source ./lib/llvm.sh + ;; + --gcc|gcc) + source ./lib/gcc.sh + ;; + esac + if [[ $2 =~ ^(--build|build)$ ]]; then + echo "[+] Creating 64MB FAT32 initrd2.img and packing resources..." + cd ../.. + dd if=/dev/zero of=initrd2.img bs=1M count=64 + mkfs.vfat -F 32 initrd2.img + mcopy -o -i initrd2.img Resources/resources/* ::/ + mcopy -o -i initrd2.img Process/Init/init.exe ::/init.exe + fi + mcopy -o -i fat.img BootAA64/Build/EFI/BOOT/BOOTAA64.efi ::/EFI/BOOT/BOOTAA64.EFI + mcopy -o -i fat.img KernelAA64/KernelAA64.exe ::/EFI/XENEVA/xnkrnl.exe + mcopy -o -i fat.img initrd2.img ::/initrd2.img + echo "[+] Image ready! Booting QEMU..." + qemu-system-aarch64 -machine virt,gic-version=2 \ + -cpu cortex-a72 -m 1024M \ + -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \ + -drive file=fat.img,format=raw,if=none,id=hd0 \ + -device virtio-blk-pci,drive=hd0,disable-legacy=on \ + -drive file=/home/og/ext2.img,format=raw,if=none,id=hd1 \ + -device virtio-blk-pci,drive=hd1,disable-legacy=on \ + -device ramfb \ + -device virtio-keyboard-pci \ + -device virtio-tablet-pci \ + -device usb-ehci \ + -device usb-kbd \ + -serial stdio \ + -display gtk,zoom-to-fit=on + ;; + *)printf "${STY_RED}Unknown subcommand \"$1\".${STY_RST}\n";show_help;exit 1;; +esac \ No newline at end of file diff --git a/Solutions/Drivers.sln b/Solutions/Drivers.sln new file mode 100644 index 000000000..8b5fd47be --- /dev/null +++ b/Solutions/Drivers.sln @@ -0,0 +1,217 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.36107.64 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AHCI", "..\Drivers\AHCI\AHCI.vcxproj", "{C4794DDD-B777-49DF-8600-ED1D71F96EBE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "E1000", "..\Drivers\E1000\E1000.vcxproj", "{60C723A8-AED4-4689-B960-F0091B16466F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lcdif", "..\Drivers\fbset\lcdif\lcdif.vcxproj", "{F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtiogpu", "..\Drivers\GPU\virtiogpu\virtiogpu.vcxproj", "{7CDDFA23-2897-4297-B245-ACDE5031E9F3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hdmi", "..\Drivers\hdmi\hdmi.vcxproj", "{AD7FE42E-814F-4DC7-86DF-B6AD041251DB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtionet", "..\Drivers\Net\virtionet\virtionet.vcxproj", "{51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NVMe", "..\Drivers\NVMe\NVMe.vcxproj", "{B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IntelHDA", "..\Drivers\Sound\IntelHDA\IntelHDA.vcxproj", "{F6062DC1-AD86-4384-AAB0-3562A0FCFA51}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtiosnd", "..\Drivers\Sound\virtiosnd\virtiosnd.vcxproj", "{B5055A6B-3AF7-443B-9A60-5068D7A10D4A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dwc2-otg", "..\Drivers\USB\dwc2-otg\dwc2-otg.vcxproj", "{E121230A-7D08-42F0-966B-D96349EF976F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hid", "..\Drivers\USB\hid\hid.vcxproj", "{5D58F57E-75D1-483E-BBCD-C203BCB35D50}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msc", "..\Drivers\USB\msc\msc.vcxproj", "{B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "usbhci", "..\Drivers\USB\usbhci\usbhci.vcxproj", "{69F8AABD-ABEF-475C-88EB-AA69B2C4231C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "virtioblk", "..\Drivers\virtioblk\virtioblk.vcxproj", "{219C18BE-21F7-4653-A0A5-710DA04F1F9A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xHCI", "..\Drivers\xHCI\xHCI.vcxproj", "{D6BF34CD-F14A-49D0-A075-AB2024FF0A62}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|ARM64.ActiveCfg = Debug|Win32 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|x64.ActiveCfg = Debug|x64 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|x64.Build.0 = Debug|x64 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|x86.ActiveCfg = Debug|x64 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Debug|x86.Build.0 = Debug|x64 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|ARM64.ActiveCfg = Release|Win32 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|x64.ActiveCfg = Release|x64 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|x64.Build.0 = Release|x64 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|x86.ActiveCfg = Release|Win32 + {C4794DDD-B777-49DF-8600-ED1D71F96EBE}.Release|x86.Build.0 = Release|Win32 + {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|ARM64.ActiveCfg = Debug|Win32 + {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|x64.ActiveCfg = Debug|x64 + {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|x64.Build.0 = Debug|x64 + {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|x86.ActiveCfg = Debug|Win32 + {60C723A8-AED4-4689-B960-F0091B16466F}.Debug|x86.Build.0 = Debug|Win32 + {60C723A8-AED4-4689-B960-F0091B16466F}.Release|ARM64.ActiveCfg = Release|Win32 + {60C723A8-AED4-4689-B960-F0091B16466F}.Release|x64.ActiveCfg = Release|x64 + {60C723A8-AED4-4689-B960-F0091B16466F}.Release|x64.Build.0 = Release|x64 + {60C723A8-AED4-4689-B960-F0091B16466F}.Release|x86.ActiveCfg = Release|Win32 + {60C723A8-AED4-4689-B960-F0091B16466F}.Release|x86.Build.0 = Release|Win32 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|ARM64.Build.0 = Debug|ARM64 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|x64.ActiveCfg = Debug|x64 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|x64.Build.0 = Debug|x64 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|x86.ActiveCfg = Debug|Win32 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Debug|x86.Build.0 = Debug|Win32 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|ARM64.ActiveCfg = Release|ARM64 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|ARM64.Build.0 = Release|ARM64 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|x64.ActiveCfg = Release|x64 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|x64.Build.0 = Release|x64 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|x86.ActiveCfg = Release|Win32 + {F3C02000-9AF8-48EC-99B7-3C9A8B7D6BF1}.Release|x86.Build.0 = Release|Win32 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|ARM64.Build.0 = Debug|ARM64 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|x64.ActiveCfg = Debug|x64 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|x64.Build.0 = Debug|x64 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|x86.ActiveCfg = Debug|Win32 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Debug|x86.Build.0 = Debug|Win32 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|ARM64.ActiveCfg = Release|ARM64 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|ARM64.Build.0 = Release|ARM64 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|x64.ActiveCfg = Release|x64 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|x64.Build.0 = Release|x64 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|x86.ActiveCfg = Release|Win32 + {7CDDFA23-2897-4297-B245-ACDE5031E9F3}.Release|x86.Build.0 = Release|Win32 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|ARM64.Build.0 = Debug|ARM64 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|x64.ActiveCfg = Debug|x64 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|x64.Build.0 = Debug|x64 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|x86.ActiveCfg = Debug|Win32 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Debug|x86.Build.0 = Debug|Win32 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|ARM64.ActiveCfg = Release|ARM64 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|ARM64.Build.0 = Release|ARM64 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|x64.ActiveCfg = Release|x64 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|x64.Build.0 = Release|x64 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|x86.ActiveCfg = Release|Win32 + {AD7FE42E-814F-4DC7-86DF-B6AD041251DB}.Release|x86.Build.0 = Release|Win32 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|ARM64.Build.0 = Debug|ARM64 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|x64.ActiveCfg = Debug|x64 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|x64.Build.0 = Debug|x64 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|x86.ActiveCfg = Debug|Win32 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Debug|x86.Build.0 = Debug|Win32 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|ARM64.ActiveCfg = Release|ARM64 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|ARM64.Build.0 = Release|ARM64 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|x64.ActiveCfg = Release|x64 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|x64.Build.0 = Release|x64 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|x86.ActiveCfg = Release|Win32 + {51D1FDFC-3E19-428A-9D1A-9C82C9E5B5A5}.Release|x86.Build.0 = Release|Win32 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|ARM64.ActiveCfg = Debug|Win32 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|x64.ActiveCfg = Debug|x64 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|x64.Build.0 = Debug|x64 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|x86.ActiveCfg = Debug|Win32 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Debug|x86.Build.0 = Debug|Win32 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|ARM64.ActiveCfg = Release|Win32 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|x64.ActiveCfg = Release|x64 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|x64.Build.0 = Release|x64 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|x86.ActiveCfg = Release|Win32 + {B3D51D1A-09E7-47D9-A6A5-5E6059585D6E}.Release|x86.Build.0 = Release|Win32 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|ARM64.ActiveCfg = Debug|Win32 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|x64.ActiveCfg = Debug|x64 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|x64.Build.0 = Debug|x64 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|x86.ActiveCfg = Debug|Win32 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Debug|x86.Build.0 = Debug|Win32 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|ARM64.ActiveCfg = Release|Win32 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|x64.ActiveCfg = Release|x64 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|x64.Build.0 = Release|x64 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|x86.ActiveCfg = Release|Win32 + {F6062DC1-AD86-4384-AAB0-3562A0FCFA51}.Release|x86.Build.0 = Release|Win32 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|ARM64.Build.0 = Debug|ARM64 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|x64.ActiveCfg = Debug|x64 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|x64.Build.0 = Debug|x64 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|x86.ActiveCfg = Debug|Win32 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Debug|x86.Build.0 = Debug|Win32 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|ARM64.ActiveCfg = Release|ARM64 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|ARM64.Build.0 = Release|ARM64 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|x64.ActiveCfg = Release|x64 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|x64.Build.0 = Release|x64 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|x86.ActiveCfg = Release|Win32 + {B5055A6B-3AF7-443B-9A60-5068D7A10D4A}.Release|x86.Build.0 = Release|Win32 + {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|ARM64.Build.0 = Debug|ARM64 + {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|x64.ActiveCfg = Debug|x64 + {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|x64.Build.0 = Debug|x64 + {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|x86.ActiveCfg = Debug|Win32 + {E121230A-7D08-42F0-966B-D96349EF976F}.Debug|x86.Build.0 = Debug|Win32 + {E121230A-7D08-42F0-966B-D96349EF976F}.Release|ARM64.ActiveCfg = Release|ARM64 + {E121230A-7D08-42F0-966B-D96349EF976F}.Release|ARM64.Build.0 = Release|ARM64 + {E121230A-7D08-42F0-966B-D96349EF976F}.Release|x64.ActiveCfg = Release|x64 + {E121230A-7D08-42F0-966B-D96349EF976F}.Release|x64.Build.0 = Release|x64 + {E121230A-7D08-42F0-966B-D96349EF976F}.Release|x86.ActiveCfg = Release|Win32 + {E121230A-7D08-42F0-966B-D96349EF976F}.Release|x86.Build.0 = Release|Win32 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|ARM64.ActiveCfg = Debug|Win32 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|x64.ActiveCfg = Debug|x64 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|x64.Build.0 = Debug|x64 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|x86.ActiveCfg = Debug|Win32 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Debug|x86.Build.0 = Debug|Win32 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|ARM64.ActiveCfg = Release|Win32 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|x64.ActiveCfg = Release|x64 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|x64.Build.0 = Release|x64 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|x86.ActiveCfg = Release|Win32 + {5D58F57E-75D1-483E-BBCD-C203BCB35D50}.Release|x86.Build.0 = Release|Win32 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|ARM64.ActiveCfg = Debug|Win32 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|x64.ActiveCfg = Debug|x64 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|x64.Build.0 = Debug|x64 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|x86.ActiveCfg = Debug|Win32 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Debug|x86.Build.0 = Debug|Win32 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|ARM64.ActiveCfg = Release|Win32 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|x64.ActiveCfg = Release|x64 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|x64.Build.0 = Release|x64 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|x86.ActiveCfg = Release|Win32 + {B8C53F70-A4F1-4DA7-8580-B98077EEFCC1}.Release|x86.Build.0 = Release|Win32 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|ARM64.ActiveCfg = Debug|Win32 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|x64.ActiveCfg = Debug|x64 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|x64.Build.0 = Debug|x64 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|x86.ActiveCfg = Debug|Win32 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Debug|x86.Build.0 = Debug|Win32 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|ARM64.ActiveCfg = Release|Win32 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|x64.ActiveCfg = Release|x64 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|x64.Build.0 = Release|x64 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|x86.ActiveCfg = Release|Win32 + {69F8AABD-ABEF-475C-88EB-AA69B2C4231C}.Release|x86.Build.0 = Release|Win32 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|ARM64.Build.0 = Debug|ARM64 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|x64.ActiveCfg = Debug|x64 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|x64.Build.0 = Debug|x64 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|x86.ActiveCfg = Debug|Win32 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Debug|x86.Build.0 = Debug|Win32 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|ARM64.ActiveCfg = Release|ARM64 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|ARM64.Build.0 = Release|ARM64 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|x64.ActiveCfg = Release|x64 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|x64.Build.0 = Release|x64 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|x86.ActiveCfg = Release|Win32 + {219C18BE-21F7-4653-A0A5-710DA04F1F9A}.Release|x86.Build.0 = Release|Win32 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|ARM64.ActiveCfg = Debug|Win32 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|x64.ActiveCfg = Debug|x64 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|x64.Build.0 = Debug|x64 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|x86.ActiveCfg = Debug|Win32 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Debug|x86.Build.0 = Debug|Win32 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|ARM64.ActiveCfg = Release|Win32 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|x64.ActiveCfg = Release|x64 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|x64.Build.0 = Release|x64 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|x86.ActiveCfg = Release|Win32 + {D6BF34CD-F14A-49D0-A075-AB2024FF0A62}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ECB18E4A-71E1-4C39-BB16-E74ADB375157} + EndGlobalSection +EndGlobal diff --git a/Solutions/Process.sln b/Solutions/Process.sln new file mode 100644 index 000000000..3c12d372a --- /dev/null +++ b/Solutions/Process.sln @@ -0,0 +1,297 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.36107.64 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AudioPlayer", "..\Process\AudioPlayer\AudioPlayer.vcxproj", "{01D9EF82-5076-4E5C-95FF-C027864A8302}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Calculator", "..\Process\Calculator\Calculator.vcxproj", "{CAE7FB4D-2145-4D85-96FB-734576BA5F07}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Calender", "..\Process\Calender\Calender.vcxproj", "{156536F4-42E1-4125-A964-DB92D386E706}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cat", "..\Process\cat\cat.vcxproj", "{7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Control", "..\Process\Control\Control.vcxproj", "{20D3BAD1-1583-44C2-8625-46DAF5F0E975}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Deodhai", "..\Process\Deodhai\Deodhai.vcxproj", "{8363E128-4810-4036-B0C9-3537A3CDB90D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeodhaiAudio", "..\Process\DeodhaiAudio\DeodhaiAudio.vcxproj", "{6CEF9127-6B8C-4885-BA8D-C2B206EA7134}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DeodhaiXR", "..\Process\DeodhaiXR\DeodhaiXR.vcxproj", "{22A06C2D-60BB-4040-8214-30EA17701F94}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Files", "..\Process\Files\Files.vcxproj", "{CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glimpse", "..\Process\glimpse\glimpse.vcxproj", "{B44F1C3D-F499-49F4-940D-227B5D5F5DD2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Init", "..\Process\Init\Init.vcxproj", "{B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "monitor", "..\Process\monitor\monitor.vcxproj", "{E968999C-8FCA-497B-AFB5-1B6A7F9835A4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Namdapha", "..\Process\Namdapha\Namdapha.vcxproj", "{E423E38B-E351-4151-895D-5336D27C9A2F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NETMngr", "..\Process\NETMngr\NETMngr.vcxproj", "{567DA5F4-5B2E-4993-9370-C4A4F022C928}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nslook", "..\Process\nslook\nslook.vcxproj", "{4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ping", "..\Process\ping\ping.vcxproj", "{D106EC5D-389E-45A6-92FB-6E79550B0519}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "play", "..\Process\play\play.vcxproj", "{2DA5FF1E-745A-4C30-A73E-53849F22D18A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Terminal", "..\Process\Terminal\Terminal.vcxproj", "{9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XELnch", "..\Process\XELnch\XELnch.vcxproj", "{400E59EB-6E4C-461A-91B2-202F85F33D41}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEShell", "..\Process\XEShell\XEShell.vcxproj", "{B2711B30-AE9C-4015-AF37-8795C0EC9064}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|ARM64.Build.0 = Debug|ARM64 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|x64.ActiveCfg = Debug|x64 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|x64.Build.0 = Debug|x64 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|x86.ActiveCfg = Debug|Win32 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Debug|x86.Build.0 = Debug|Win32 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|ARM64.ActiveCfg = Release|ARM64 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|ARM64.Build.0 = Release|ARM64 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|x64.ActiveCfg = Release|x64 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|x64.Build.0 = Release|x64 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|x86.ActiveCfg = Release|Win32 + {01D9EF82-5076-4E5C-95FF-C027864A8302}.Release|x86.Build.0 = Release|Win32 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|ARM64.Build.0 = Debug|ARM64 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|x64.ActiveCfg = Debug|x64 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|x64.Build.0 = Debug|x64 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|x86.ActiveCfg = Debug|Win32 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Debug|x86.Build.0 = Debug|Win32 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|ARM64.ActiveCfg = Release|ARM64 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|ARM64.Build.0 = Release|ARM64 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|x64.ActiveCfg = Release|x64 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|x64.Build.0 = Release|x64 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|x86.ActiveCfg = Release|Win32 + {CAE7FB4D-2145-4D85-96FB-734576BA5F07}.Release|x86.Build.0 = Release|Win32 + {156536F4-42E1-4125-A964-DB92D386E706}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {156536F4-42E1-4125-A964-DB92D386E706}.Debug|ARM64.Build.0 = Debug|ARM64 + {156536F4-42E1-4125-A964-DB92D386E706}.Debug|x64.ActiveCfg = Debug|x64 + {156536F4-42E1-4125-A964-DB92D386E706}.Debug|x64.Build.0 = Debug|x64 + {156536F4-42E1-4125-A964-DB92D386E706}.Debug|x86.ActiveCfg = Debug|Win32 + {156536F4-42E1-4125-A964-DB92D386E706}.Debug|x86.Build.0 = Debug|Win32 + {156536F4-42E1-4125-A964-DB92D386E706}.Release|ARM64.ActiveCfg = Release|ARM64 + {156536F4-42E1-4125-A964-DB92D386E706}.Release|ARM64.Build.0 = Release|ARM64 + {156536F4-42E1-4125-A964-DB92D386E706}.Release|x64.ActiveCfg = Release|x64 + {156536F4-42E1-4125-A964-DB92D386E706}.Release|x64.Build.0 = Release|x64 + {156536F4-42E1-4125-A964-DB92D386E706}.Release|x86.ActiveCfg = Release|Win32 + {156536F4-42E1-4125-A964-DB92D386E706}.Release|x86.Build.0 = Release|Win32 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|ARM64.ActiveCfg = Debug|Win32 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|x64.ActiveCfg = Debug|x64 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|x64.Build.0 = Debug|x64 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|x86.ActiveCfg = Debug|Win32 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Debug|x86.Build.0 = Debug|Win32 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|ARM64.ActiveCfg = Release|Win32 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|x64.ActiveCfg = Release|x64 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|x64.Build.0 = Release|x64 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|x86.ActiveCfg = Release|Win32 + {7CDEF64B-6E81-46CC-AF2A-18BF136D4E9F}.Release|x86.Build.0 = Release|Win32 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|ARM64.ActiveCfg = Debug|Win32 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|x64.ActiveCfg = Debug|x64 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|x64.Build.0 = Debug|x64 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|x86.ActiveCfg = Debug|Win32 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Debug|x86.Build.0 = Debug|Win32 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|ARM64.ActiveCfg = Release|Win32 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|x64.ActiveCfg = Release|x64 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|x64.Build.0 = Release|x64 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|x86.ActiveCfg = Release|Win32 + {20D3BAD1-1583-44C2-8625-46DAF5F0E975}.Release|x86.Build.0 = Release|Win32 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|ARM64.Build.0 = Debug|ARM64 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|x64.ActiveCfg = Debug|x64 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|x64.Build.0 = Debug|x64 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|x86.ActiveCfg = Debug|Win32 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Debug|x86.Build.0 = Debug|Win32 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|ARM64.ActiveCfg = Release|ARM64 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|ARM64.Build.0 = Release|ARM64 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|x64.ActiveCfg = Release|x64 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|x64.Build.0 = Release|x64 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|x86.ActiveCfg = Release|Win32 + {8363E128-4810-4036-B0C9-3537A3CDB90D}.Release|x86.Build.0 = Release|Win32 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|ARM64.Build.0 = Debug|ARM64 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|x64.ActiveCfg = Debug|x64 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|x64.Build.0 = Debug|x64 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|x86.ActiveCfg = Debug|Win32 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Debug|x86.Build.0 = Debug|Win32 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|ARM64.ActiveCfg = Release|ARM64 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|ARM64.Build.0 = Release|ARM64 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|x64.ActiveCfg = Release|x64 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|x64.Build.0 = Release|x64 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|x86.ActiveCfg = Release|Win32 + {6CEF9127-6B8C-4885-BA8D-C2B206EA7134}.Release|x86.Build.0 = Release|Win32 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|ARM64.Build.0 = Debug|ARM64 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|x64.ActiveCfg = Debug|x64 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|x64.Build.0 = Debug|x64 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|x86.ActiveCfg = Debug|Win32 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Debug|x86.Build.0 = Debug|Win32 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|ARM64.ActiveCfg = Release|ARM64 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|ARM64.Build.0 = Release|ARM64 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|x64.ActiveCfg = Release|x64 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|x64.Build.0 = Release|x64 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|x86.ActiveCfg = Release|Win32 + {22A06C2D-60BB-4040-8214-30EA17701F94}.Release|x86.Build.0 = Release|Win32 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|ARM64.Build.0 = Debug|ARM64 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|x64.ActiveCfg = Debug|x64 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|x64.Build.0 = Debug|x64 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|x86.ActiveCfg = Debug|Win32 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Debug|x86.Build.0 = Debug|Win32 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|ARM64.ActiveCfg = Release|ARM64 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|ARM64.Build.0 = Release|ARM64 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|x64.ActiveCfg = Release|x64 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|x64.Build.0 = Release|x64 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|x86.ActiveCfg = Release|Win32 + {CB840DBD-BC3E-45DA-80A1-FF92E0DB3463}.Release|x86.Build.0 = Release|Win32 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|ARM64.Build.0 = Debug|ARM64 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|x64.ActiveCfg = Debug|x64 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|x64.Build.0 = Debug|x64 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|x86.ActiveCfg = Debug|Win32 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Debug|x86.Build.0 = Debug|Win32 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|ARM64.ActiveCfg = Release|ARM64 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|ARM64.Build.0 = Release|ARM64 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|x64.ActiveCfg = Release|x64 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|x64.Build.0 = Release|x64 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|x86.ActiveCfg = Release|Win32 + {B44F1C3D-F499-49F4-940D-227B5D5F5DD2}.Release|x86.Build.0 = Release|Win32 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|ARM64.Build.0 = Debug|ARM64 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|x64.ActiveCfg = Debug|x64 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|x64.Build.0 = Debug|x64 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|x86.ActiveCfg = Debug|Win32 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Debug|x86.Build.0 = Debug|Win32 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|ARM64.ActiveCfg = Release|ARM64 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|ARM64.Build.0 = Release|ARM64 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|x64.ActiveCfg = Release|x64 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|x64.Build.0 = Release|x64 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|x86.ActiveCfg = Release|Win32 + {B702D8E8-62F0-4DC1-9EC7-EACE0B76716A}.Release|x86.Build.0 = Release|Win32 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Debug|ARM64.Build.0 = Debug|ARM64 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Debug|x64.ActiveCfg = Debug|x64 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Debug|x64.Build.0 = Debug|x64 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Debug|x86.ActiveCfg = Debug|Win32 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Debug|x86.Build.0 = Debug|Win32 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Release|ARM64.ActiveCfg = Release|ARM64 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Release|ARM64.Build.0 = Release|ARM64 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Release|x64.ActiveCfg = Release|x64 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Release|x64.Build.0 = Release|x64 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Release|x86.ActiveCfg = Release|Win32 + {E968999C-8FCA-497B-AFB5-1B6A7F9835A4}.Release|x86.Build.0 = Release|Win32 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|ARM64.Build.0 = Debug|ARM64 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|x64.ActiveCfg = Debug|x64 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|x64.Build.0 = Debug|x64 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|x86.ActiveCfg = Debug|Win32 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Debug|x86.Build.0 = Debug|Win32 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|ARM64.ActiveCfg = Release|ARM64 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|ARM64.Build.0 = Release|ARM64 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|x64.ActiveCfg = Release|x64 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|x64.Build.0 = Release|x64 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|x86.ActiveCfg = Release|Win32 + {E423E38B-E351-4151-895D-5336D27C9A2F}.Release|x86.Build.0 = Release|Win32 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|ARM64.Build.0 = Debug|ARM64 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|x64.ActiveCfg = Debug|x64 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|x64.Build.0 = Debug|x64 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|x86.ActiveCfg = Debug|Win32 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Debug|x86.Build.0 = Debug|Win32 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|ARM64.ActiveCfg = Release|ARM64 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|ARM64.Build.0 = Release|ARM64 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|x64.ActiveCfg = Release|x64 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|x64.Build.0 = Release|x64 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|x86.ActiveCfg = Release|Win32 + {567DA5F4-5B2E-4993-9370-C4A4F022C928}.Release|x86.Build.0 = Release|Win32 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|ARM64.ActiveCfg = Debug|Win32 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|x64.ActiveCfg = Debug|x64 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|x64.Build.0 = Debug|x64 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|x86.ActiveCfg = Debug|Win32 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Debug|x86.Build.0 = Debug|Win32 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|ARM64.ActiveCfg = Release|Win32 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|x64.ActiveCfg = Release|x64 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|x64.Build.0 = Release|x64 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|x86.ActiveCfg = Release|Win32 + {4B0CA96B-1BED-45AB-B8AA-A1CDCD6F68C0}.Release|x86.Build.0 = Release|Win32 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|ARM64.Build.0 = Debug|ARM64 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|x64.ActiveCfg = Debug|x64 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|x64.Build.0 = Debug|x64 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|x86.ActiveCfg = Debug|Win32 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Debug|x86.Build.0 = Debug|Win32 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|ARM64.ActiveCfg = Release|ARM64 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|ARM64.Build.0 = Release|ARM64 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|x64.ActiveCfg = Release|x64 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|x64.Build.0 = Release|x64 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|x86.ActiveCfg = Release|Win32 + {D106EC5D-389E-45A6-92FB-6E79550B0519}.Release|x86.Build.0 = Release|Win32 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|ARM64.Build.0 = Debug|ARM64 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|x64.ActiveCfg = Debug|x64 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|x64.Build.0 = Debug|x64 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|x86.ActiveCfg = Debug|Win32 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Debug|x86.Build.0 = Debug|Win32 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|ARM64.ActiveCfg = Release|ARM64 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|ARM64.Build.0 = Release|ARM64 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|x64.ActiveCfg = Release|x64 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|x64.Build.0 = Release|x64 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|x86.ActiveCfg = Release|Win32 + {2DA5FF1E-745A-4C30-A73E-53849F22D18A}.Release|x86.Build.0 = Release|Win32 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|ARM64.Build.0 = Debug|ARM64 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|x64.ActiveCfg = Debug|x64 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|x64.Build.0 = Debug|x64 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|x86.ActiveCfg = Debug|Win32 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Debug|x86.Build.0 = Debug|Win32 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|ARM64.ActiveCfg = Release|ARM64 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|ARM64.Build.0 = Release|ARM64 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|x64.ActiveCfg = Release|x64 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|x64.Build.0 = Release|x64 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|x86.ActiveCfg = Release|Win32 + {9CAAF0AB-D0A2-4CA1-9AB0-881D1D12FD19}.Release|x86.Build.0 = Release|Win32 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|ARM64.Build.0 = Debug|ARM64 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|x64.ActiveCfg = Debug|x64 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|x64.Build.0 = Debug|x64 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|x86.ActiveCfg = Debug|Win32 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Debug|x86.Build.0 = Debug|Win32 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|ARM64.ActiveCfg = Release|ARM64 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|ARM64.Build.0 = Release|ARM64 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|x64.ActiveCfg = Release|x64 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|x64.Build.0 = Release|x64 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|x86.ActiveCfg = Release|Win32 + {400E59EB-6E4C-461A-91B2-202F85F33D41}.Release|x86.Build.0 = Release|Win32 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|ARM64.Build.0 = Debug|ARM64 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|x64.ActiveCfg = Debug|x64 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|x64.Build.0 = Debug|x64 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|x86.ActiveCfg = Debug|Win32 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Debug|x86.Build.0 = Debug|Win32 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|ARM64.ActiveCfg = Release|ARM64 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|ARM64.Build.0 = Release|ARM64 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|x64.ActiveCfg = Release|x64 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|x64.Build.0 = Release|x64 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|x86.ActiveCfg = Release|Win32 + {B2711B30-AE9C-4015-AF37-8795C0EC9064}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D2461135-062D-43D6-A4B3-6E355B540FC7} + EndGlobalSection +EndGlobal diff --git a/XELoader/XELoader.vcxproj b/XELoader/XELoader.vcxproj index ef2c90d5d..026e4da6c 100644 --- a/XELoader/XELoader.vcxproj +++ b/XELoader/XELoader.vcxproj @@ -1,4 +1,4 @@ - + @@ -193,10 +193,10 @@ false /filealign:4096 %(AdditionalOptions) - ..\x64\Debug + $(SolutionDir)Build\;..\x64\Debug - copy "..\Build\$(TargetName).exe" "M:\$(TargetName).exe + if exist M:\ ( copy "..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) @@ -242,10 +242,10 @@ /filealign:4096 %(AdditionalOptions) - ..\ARM64\Debug;%(AdditionalLibraryDirectories) + $(SolutionDir)Build\;..\ARM64\Debug;%(AdditionalLibraryDirectories) - copy "..\Build\$(TargetName).exe" M:\$(TargetName).exe" + if exist M:\ ( copy "..\Build\$(TargetName).exe" "M:\$(TargetName).exe" ) else ( echo M: drive not found, skipping copy ) diff --git a/XELoader/main.cpp b/XELoader/main.cpp index ed8a3eaeb..340edb875 100644 --- a/XELoader/main.cpp +++ b/XELoader/main.cpp @@ -124,7 +124,7 @@ int XELdrLoadObject(XELoaderObject *obj){ //int bytes = _KeReadFile(file, alloc, 4096); _KeFileStat(file, stat); if (stat->eof) { - _KePrint("File already ended \n"); + //_KePrint("File already ended \n"); //break; } //ret_bytes += bytes; @@ -231,7 +231,7 @@ int XELdrStartProc(char* filename, XELoaderObject *obj) { //int bytes = _KeReadFile(file, alloc, 4096); _KeFileStat(file, stat); if (stat->eof) { - _KePrint("File already ended \n"); + //_KePrint("File already ended \n"); } //ret_bytes += bytes; diff --git a/readme.md b/readme.md index 95cc481ba..1522fb219 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,8 @@ XenevaOS is an operating system built from scratch targeted at modern hardware. The OS is designed for both x86 and ARM architectures with plans for RISC-V implementation in the near future as well. Our OS is built on our very own hybrid kernel known as _'Aurora'_.
Please visit [Build Instructions](Docs/BuildInstructions.md) to build the project ## Documentation -Refer to [Documentation of XenevaOS](Docs/Introduction.md)
+Refer to the [Comprehensive Documentation Portal (Table of Contents)](Docs/Index.md) for architecture, build instructions, and guidelines.
+Refer to [Introduction to XenevaOS](Docs/Introduction.md) for a high-level overview.
Refer to [API Documentation of XenevaOS](https://bytejoseph.github.io/xeneva-source-reference/files.html). _Thanks to ByteJoseph for API docs_. ## Contributing to the project @@ -79,7 +80,7 @@ _And many more coming soon_ # Building the project -The project was originally built purely on a Windows Environment. Please visit [Build Instructions page (Windows)](Docs/BuildInstructions.md) for legacy information. +The project natively supports both Windows and Linux environments. Please visit [Build Instructions page (Windows)](Docs/BuildInstructions.md) for the MSVC build information. We are actively porting the project to Linux using GCC. For the new Linux GCC build instructions, please visit [Linux Build Instructions](Docs/BuildInstructions(Linux).md). # Purpose and Goals