major restructuring, prepare for smp
This commit is contained in:
1 parent
b3569a2b90
commit
6bff37746d
229 files changed
+1617
-1489
No files matched your search
Binary file not shown.
@@ -3,6 +3,13 @@ setlocal enabledelayedexpansion
|
||||
|
||||
set ROOT=%~dp0.
|
||||
set SRC=%ROOT%\code
|
||||
set PUBLIC=%SRC%\public
|
||||
set COMMON=%SRC%\common
|
||||
set KERNEL=%SRC%\kernel
|
||||
set HAL=%KERNEL%\hal
|
||||
set USER=%SRC%\user
|
||||
set DRIVERS=%SRC%\drivers
|
||||
set THIRD_PARTY=%SRC%\third_party
|
||||
set VHD=%~dp0disk.vhd
|
||||
|
||||
if not exist "%VHD%" (
|
||||
@@ -36,43 +43,46 @@ mkdir "obj\doom" 2>nul
|
||||
mkdir "obj\video" 2>nul
|
||||
mkdir "bin" 2>nul
|
||||
|
||||
set CFLAGS=/nologo /W3 /WX /Od /GS- /Gs999999 /Gz /Gy /EHsc- /GR- /Oi /Zi /std:c17 /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS /I"%SRC%\kernel" /I"%SRC%\hal" /I"%SRC%\syscall"
|
||||
set INCLUDES=/I"%PUBLIC%" /I"%COMMON%\include" /I"%KERNEL%\include"
|
||||
set CFLAGS=/nologo /W3 /WX /Od /GS- /Gs999999 /Gz /Gy /EHsc- /GR- /Oi /Zi /std:c17 /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_WARNINGS %INCLUDES%
|
||||
set KERNEL_CFLAGS=%CFLAGS%
|
||||
|
||||
rem lwIP is third-party freestanding C. Compile it into lwip.sys without /WX,
|
||||
rem and silence expected MSVC warnings from packed protocol headers and macros.
|
||||
set LWIP_DRIVER_CFLAGS=%CFLAGS:/WX =% /I"%SRC%\drivers\lwip\include" /I"%SRC%\third_party\lwip\src\include" /wd4005 /wd4100 /wd4103 /wd4127 /wd4244 /wd4267 /wd4706
|
||||
set LWIP_ROOT=%DRIVERS%\net\lwip
|
||||
set LWIP_DRIVER_CFLAGS=%CFLAGS:/WX =% /I"%LWIP_ROOT%\include" /I"%THIRD_PARTY%\lwip\src\include" /wd4005 /wd4100 /wd4103 /wd4127 /wd4244 /wd4267 /wd4706
|
||||
|
||||
set LFLAGS=/nologo /NODEFAULTLIB /DEBUG
|
||||
|
||||
:: ---- Assemble ASM files ----
|
||||
echo Assembling...
|
||||
ml64 /nologo /c /Fo"obj\kernel\ke_switch.obj" "%SRC%\kernel\ke_switch.asm" || exit /b 1
|
||||
ml64 /nologo /c /Fo"obj\kernel\ke_syscall_asm.obj" "%SRC%\kernel\ke_syscall.asm" || exit /b 1
|
||||
ml64 /nologo /c /Fo"obj\kernel\ke_gdt_reload.obj" "%SRC%\kernel\ke_gdt_reload.asm" || exit /b 1
|
||||
ml64 /nologo /c /Fo"obj\syscall\stubs.obj" "%SRC%\syscall\syscall_stubs.asm" || exit /b 1
|
||||
ml64 /nologo /c /Fo"obj\kernel\ke_switch.obj" "%KERNEL%\ke_switch.asm" || exit /b 1
|
||||
ml64 /nologo /c /Fo"obj\kernel\ke_syscall_asm.obj" "%KERNEL%\ke_syscall.asm" || exit /b 1
|
||||
ml64 /nologo /c /Fo"obj\kernel\ke_gdt_reload.obj" "%KERNEL%\ke_gdt_reload.asm" || exit /b 1
|
||||
for %%f in (%SRC%\boot\uefi\*.asm) do (
|
||||
ml64 /nologo /c /Fo"obj\boot\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
ml64 /nologo /c /Fo"obj\syscall\stubs.obj" "%USER%\syscall\syscall_stubs.asm" || exit /b 1
|
||||
|
||||
:: ---- Compile libc ----
|
||||
cl /nologo /c /Fo"obj\libc.obj" "%SRC%\libc.c" || exit /b 1
|
||||
:: ---- Compile printf ----
|
||||
cl %CFLAGS% /c /Fo"obj\printf.obj" "%SRC%\printf.c" || exit /b 1
|
||||
:: ---- Compile ini parser ----
|
||||
cl %CFLAGS% /c /Fo"obj\ini_parser.obj" "%SRC%\ini_parser.c" || exit /b 1
|
||||
:: ---- Compile shared freestanding support ----
|
||||
cl /nologo /c /Fo"obj\libc.obj" "%COMMON%\libc.c" || exit /b 1
|
||||
cl %CFLAGS% /c /Fo"obj\printf.obj" "%COMMON%\printf.c" || exit /b 1
|
||||
cl %CFLAGS% /c /Fo"obj\ini_parser.obj" "%COMMON%\ini_parser.c" || exit /b 1
|
||||
|
||||
:: ---- Compile bootloader ----
|
||||
echo Compiling bootloader...
|
||||
for %%f in (%SRC%\boot\*.c) do (
|
||||
cl %CFLAGS% /c /I"%SRC%\boot\include" /Fo"obj\boot\%%~nf.obj" "%%f" || exit /b 1
|
||||
for %%f in (%SRC%\boot\uefi\*.c) do (
|
||||
cl %CFLAGS% /c /I"%SRC%\boot\uefi\include" /Fo"obj\boot\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
|
||||
:: ---- Link bootloader ----
|
||||
echo Linking bootx64.efi...
|
||||
link %LFLAGS% /SUBSYSTEM:EFI_APPLICATION /ENTRY:UefiMain /OUT:"bin\bootx64.efi" ^
|
||||
/PDB:"bin\bootx64.pdb" %SRC%\boot\efilib.lib obj\ini_parser.obj obj\libc.obj obj\boot\*.obj || exit /b 1
|
||||
/PDB:"bin\bootx64.pdb" %SRC%\boot\uefi\efilib.lib obj\ini_parser.obj obj\libc.obj obj\boot\*.obj || exit /b 1
|
||||
|
||||
:: ---- Compile HAL ----
|
||||
echo Compiling hal...
|
||||
for %%f in (%SRC%\hal\*.c) do (
|
||||
for %%f in (%HAL%\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\hal\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
|
||||
@@ -82,7 +92,7 @@ link %LFLAGS% /DLL /OUT:"bin\hal.dll" /ENTRY:HalInitialize /IGNORE:4216 obj\prin
|
||||
|
||||
:: ---- Compile kernel ----
|
||||
echo Compiling kernel...
|
||||
for %%f in (%SRC%\kernel\*.c) do (
|
||||
for %%f in (%KERNEL%\*.c) do (
|
||||
cl %KERNEL_CFLAGS% /c /Fo"obj\kernel\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
|
||||
@@ -98,7 +108,7 @@ link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL ^
|
||||
|
||||
:: ---- Compile win32.dll ----
|
||||
echo Compiling win32.dll...
|
||||
for %%f in (%SRC%\win32\*.c) do (
|
||||
for %%f in (%USER%\personalities\win32\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\win32\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL ^
|
||||
@@ -106,7 +116,7 @@ link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL ^
|
||||
|
||||
:: ---- Compile posix.dll ----
|
||||
echo Compiling posix.dll...
|
||||
for %%f in (%SRC%\posix\*.c) do (
|
||||
for %%f in (%USER%\personalities\posix\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\posix\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL ^
|
||||
@@ -115,22 +125,22 @@ link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL ^
|
||||
:: ---- Compile drivers ----
|
||||
echo Compiling drivers...
|
||||
echo Compiling ide.sys...
|
||||
cl %CFLAGS% /I"%SRC%\hal" /c /Fo"obj\drivers\ide.obj" "%SRC%\drivers\ide\ide.c" || exit /b 1
|
||||
cl %CFLAGS% /c /Fo"obj\drivers\ide.obj" "%DRIVERS%\storage\ide\ide.c" || exit /b 1
|
||||
link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:"bin\ide.sys" /ENTRY:DriverEntry ^
|
||||
bin\hal.lib bin\kernel.lib obj\libc.obj obj\drivers\ide.obj || exit /b 1
|
||||
|
||||
echo Compiling ahci.sys...
|
||||
cl %CFLAGS% /I"%SRC%\hal" /c /Fo"obj\drivers\ahci.obj" "%SRC%\drivers\ahci\ahci.c" || exit /b 1
|
||||
cl %CFLAGS% /c /Fo"obj\drivers\ahci.obj" "%DRIVERS%\storage\ahci\ahci.c" || exit /b 1
|
||||
link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:"bin\ahci.sys" /ENTRY:DriverEntry ^
|
||||
bin\hal.lib bin\kernel.lib obj\libc.obj obj\drivers\ahci.obj || exit /b 1
|
||||
|
||||
echo Compiling fat32.sys...
|
||||
cl %CFLAGS% /I"%SRC%\fat32" /c /Fo"obj\drivers\fat32.obj" "%SRC%\drivers\fat32\fat32.c" || exit /b 1
|
||||
cl %CFLAGS% /c /Fo"obj\drivers\fat32.obj" "%DRIVERS%\fs\fat32\fat32.c" || exit /b 1
|
||||
link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:"bin\fat32.sys" /ENTRY:DriverEntry ^
|
||||
bin\hal.lib bin\kernel.lib obj\libc.obj obj\drivers\fat32.obj || exit /b 1
|
||||
|
||||
echo Compiling lwip.sys...
|
||||
for /f "usebackq tokens=* delims=" %%f in ("%SRC%\drivers\lwip\lwip_sources.txt") do (
|
||||
for /f "usebackq tokens=* delims=" %%f in ("%LWIP_ROOT%\lwip_sources.txt") do (
|
||||
set "LWIP_FILE=%%f"
|
||||
if not "!LWIP_FILE!"=="" if not "!LWIP_FILE:~0,1!"=="#" (
|
||||
set "LWIP_WIN_FILE=!LWIP_FILE:/=\!"
|
||||
@@ -143,23 +153,23 @@ link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:"bin\lwip.sys" /ENTRY:Dri
|
||||
bin\hal.lib bin\kernel.lib obj\libc.obj obj\lwip\*.obj || exit /b 1
|
||||
|
||||
echo Compiling usb.sys...
|
||||
cl %CFLAGS% /I"%SRC%\usb" /c /Fo"obj\drivers\usb.obj" "%SRC%\drivers\usb\usb.c" || exit /b 1
|
||||
cl %CFLAGS% /c /Fo"obj\drivers\usb.obj" "%DRIVERS%\bus\usb\usb.c" || exit /b 1
|
||||
link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:"bin\usb.sys" /ENTRY:DriverEntry ^
|
||||
bin\hal.lib bin\kernel.lib obj\libc.obj obj\drivers\usb.obj || exit /b 1
|
||||
|
||||
echo Compiling rtl816x.sys...
|
||||
cl %CFLAGS% /I"%SRC%\rtl816x" /c /Fo"obj\drivers\rtl816x.obj" "%SRC%\drivers\rtl816x\rtl816x.c" || exit /b 1
|
||||
cl %CFLAGS% /c /Fo"obj\drivers\rtl816x.obj" "%DRIVERS%\net\rtl816x\rtl816x.c" || exit /b 1
|
||||
link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:"bin\rtl816x.sys" /ENTRY:DriverEntry ^
|
||||
bin\hal.lib bin\kernel.lib obj\libc.obj obj\drivers\rtl816x.obj || exit /b 1
|
||||
|
||||
echo Compiling rtl8139.sys...
|
||||
cl %CFLAGS% /I"%SRC%\rtl8139" /c /Fo"obj\drivers\rtl8139.obj" "%SRC%\drivers\rtl8139\rtl8139.c" || exit /b 1
|
||||
cl %CFLAGS% /c /Fo"obj\drivers\rtl8139.obj" "%DRIVERS%\net\rtl8139\rtl8139.c" || exit /b 1
|
||||
link /nologo /SUBSYSTEM:NATIVE /NODEFAULTLIB /DLL /OUT:"bin\rtl8139.sys" /ENTRY:DriverEntry ^
|
||||
bin\hal.lib bin\kernel.lib obj\libc.obj obj\drivers\rtl8139.obj || exit /b 1
|
||||
|
||||
:: ---- Compile init ----
|
||||
echo Compiling init...
|
||||
for %%f in (%SRC%\init\*.c) do (
|
||||
for %%f in (%USER%\system\init\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\init\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:_start ^
|
||||
@@ -167,7 +177,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:_start ^
|
||||
|
||||
:: ---- Compile shell_win32 ----
|
||||
echo Compiling shell_win32...
|
||||
for %%f in (%SRC%\shell_win32\*.c) do (
|
||||
for %%f in (%USER%\apps\shell_win32\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\shell_win32\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -175,7 +185,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile shell_posix ----
|
||||
echo Compiling shell_posix...
|
||||
for %%f in (%SRC%\shell_posix\*.c) do (
|
||||
for %%f in (%USER%\apps\shell_posix\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\shell_posix\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -183,7 +193,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile shell_native ----
|
||||
echo Compiling shell_native...
|
||||
for %%f in (%SRC%\shell_native\*.c) do (
|
||||
for %%f in (%USER%\apps\shell_native\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\shell_native\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -191,7 +201,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile async_apc ----
|
||||
echo Compiling async_apc...
|
||||
for %%f in (%SRC%\async_apc\*.c) do (
|
||||
for %%f in (%USER%\tests\async_apc\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\async_apc\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -199,7 +209,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile async_cancel ----
|
||||
echo Compiling async_cancel...
|
||||
for %%f in (%SRC%\async_cancel\*.c) do (
|
||||
for %%f in (%USER%\tests\async_cancel\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\async_cancel\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -207,7 +217,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile edit ----
|
||||
echo Compiling edit...
|
||||
for %%f in (%SRC%\edit\*.c) do (
|
||||
for %%f in (%USER%\apps\edit\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\edit\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -215,7 +225,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile httpget ----
|
||||
echo Compiling httpget...
|
||||
for %%f in (%SRC%\httpget\*.c) do (
|
||||
for %%f in (%USER%\apps\httpget\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\httpget\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -223,7 +233,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile tcpserve ----
|
||||
echo Compiling tcpserve...
|
||||
for %%f in (%SRC%\tcpserve\*.c) do (
|
||||
for %%f in (%USER%\apps\tcpserve\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\tcpserve\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -231,7 +241,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile udp ----
|
||||
echo Compiling udp...
|
||||
for %%f in (%SRC%\udp\*.c) do (
|
||||
for %%f in (%USER%\apps\udp\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\udp\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -239,7 +249,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile resolve ----
|
||||
echo Compiling resolve...
|
||||
for %%f in (%SRC%\resolve\*.c) do (
|
||||
for %%f in (%USER%\apps\resolve\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\resolve\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -247,7 +257,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile ping ----
|
||||
echo Compiling ping...
|
||||
for %%f in (%SRC%\ping\*.c) do (
|
||||
for %%f in (%USER%\apps\ping\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\ping\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -255,7 +265,7 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile doom ----
|
||||
echo Compiling doom...
|
||||
for %%f in (%SRC%\doom\*.c) do (
|
||||
for %%f in (%USER%\apps\doom\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\doom\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
@@ -263,11 +273,11 @@ link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
|
||||
:: ---- Compile video player ----
|
||||
echo Compiling video...
|
||||
for %%f in (%SRC%\video\*.c) do (
|
||||
for %%f in (%USER%\apps\video\*.c) do (
|
||||
cl %CFLAGS% /c /Fo"obj\video\%%~nf.obj" "%%f" || exit /b 1
|
||||
)
|
||||
link %LFLAGS% /SUBSYSTEM:NATIVE /ENTRY:main ^
|
||||
/OUT:"bin\video.exe" /PDB:"bin\video.pdb" bin\win32.lib obj\libc.obj %SRC%\video\bink2w64.lib obj\video\*.obj || exit /b 1
|
||||
/OUT:"bin\video.exe" /PDB:"bin\video.pdb" bin\win32.lib obj\libc.obj %USER%\apps\video\bink2w64.lib obj\video\*.obj || exit /b 1
|
||||
|
||||
:: ---- Mount disk image ----
|
||||
echo Mounting disk.vhd...
|
||||
@@ -330,10 +340,10 @@ copy /y "bin\ping.exe" "%DEST%\apps\"
|
||||
copy /y "bin\doom.exe" "%DEST%\apps\"
|
||||
copy /y "bin\video.exe" "%DEST%\apps\"
|
||||
copy /y "%SRC%\boot.ini" "%DEST%\"
|
||||
copy /y "%SRC%\drivers\drivers.ini" "%DEST%\drivers\"
|
||||
if exist "%SRC%\video\bink2w64.dll" copy /y "%SRC%\video\bink2w64.dll" "%DEST%\apps\"
|
||||
if exist "%SRC%\video\video.bk2" copy /y "%SRC%\video\video.bk2" "%DEST%\apps\"
|
||||
if exist "%SRC%\doom\doom1.wad" copy /y "%SRC%\doom\doom1.wad" "%DEST%\apps\"
|
||||
copy /y "%DRIVERS%\drivers.ini" "%DEST%\drivers\"
|
||||
if exist "%USER%\apps\video\bink2w64.dll" copy /y "%USER%\apps\video\bink2w64.dll" "%DEST%\apps\"
|
||||
if exist "%USER%\apps\video\video.bk2" copy /y "%USER%\apps\video\video.bk2" "%DEST%\apps\"
|
||||
if exist "%USER%\apps\doom\doom1.wad" copy /y "%USER%\apps\doom\doom1.wad" "%DEST%\apps\"
|
||||
|
||||
:: ---- Unmount disk image ----
|
||||
echo Unmounting disk.vhd...
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
[kernel]
|
||||
; bitmask: 1 = debug prints, 2 = self check
|
||||
debug = 3
|
||||
debug = 0
|
||||
[init]
|
||||
commandline = apps/shell_native.exe
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -17,9 +17,9 @@
|
||||
#include <efilib.h>
|
||||
#include <stdbool.h>
|
||||
#include <intrin.h>
|
||||
#include <boot_info.h>
|
||||
#include <memory_map.h>
|
||||
#include <ini_parser.h>
|
||||
#include <ntlite/boot_info.h>
|
||||
#include <ntlite/memory_map.h>
|
||||
#include <common/ini_parser.h>
|
||||
|
||||
int _fltused = 0;
|
||||
|
||||
@@ -395,7 +395,7 @@ EFI_STATUS LoadPeImage(UINT8* rawFile, UINT64 virtDest, EFI_PHYSICAL_ADDRESS* ou
|
||||
UINT8* ntHeaders = rawFile + peOff;
|
||||
|
||||
// Validate Signature
|
||||
if (*(UINT32*)ntHeaders != 0x00004550) { Print(L"no\n"); return EFI_INVALID_PARAMETER; } // "PE\0\0"
|
||||
if (*(UINT32*)ntHeaders != 0x00004550) { Print(L"Signature mismatch\n"); return EFI_INVALID_PARAMETER; } // "PE\0\0"
|
||||
|
||||
UINT16 sizeOfOptHeader = *(UINT16*)(ntHeaders + 20);
|
||||
UINT16 numSections = *(UINT16*)(ntHeaders + 6);
|
||||
@@ -581,7 +581,7 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
return Status;
|
||||
}
|
||||
|
||||
Print(L"1\n");
|
||||
//Print(L"1\n");
|
||||
|
||||
// --- Parse boot.ini ---
|
||||
UINTN sz;
|
||||
@@ -594,7 +594,7 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
FreePool(bootIniRaw);
|
||||
}
|
||||
|
||||
Print(L"2\n");
|
||||
//Print(L"2\n");
|
||||
|
||||
// --- Parse drivers/drivers.ini ---
|
||||
UINT8* drvIniRaw = LoadFile(L"drivers\\drivers.ini", &sz);
|
||||
@@ -605,7 +605,7 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
FreePool(drvIniRaw);
|
||||
}
|
||||
|
||||
Print(L"3\n");
|
||||
//Print(L"3\n");
|
||||
|
||||
BOOT_INFO* bi = AllocateZeroPool(sizeof(BOOT_INFO));
|
||||
bi->Magic = BOOT_INFO_MAGIC;
|
||||
@@ -617,7 +617,7 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
// Current mapping cursor for upper half.
|
||||
UINT64 virtCursor = KERNEL_VIRT_BASE;
|
||||
|
||||
Print(L"4\n");
|
||||
//Print(L"4\n");
|
||||
|
||||
// --- Load and validate PE images ---
|
||||
typedef struct {
|
||||
@@ -629,11 +629,11 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
|
||||
MODULE_LOAD_INFO core[] = {
|
||||
{ L"system\\colonel.exe", "kernel.exe", NULL, KERNEL_VIRT_BASE },
|
||||
{ L"system\\hal.dll", "hal.dll", NULL, 0 /* Calculated dynamically */ },
|
||||
{ L"system\\hal.dll", "hal.dll", NULL, 0 /* Calculated dynamically */ },
|
||||
};
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
Print(L"Loading %s...\n", core[i].path);
|
||||
//Print(L"Loading %s...\n", core[i].path);
|
||||
UINTN rawSize;
|
||||
UINT8* rawBuf = LoadFile(core[i].path, &rawSize);
|
||||
if (!rawBuf) {
|
||||
@@ -683,7 +683,7 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
while(true);
|
||||
}
|
||||
|
||||
Print(L"5\n");
|
||||
//Print(L"5\n");
|
||||
|
||||
// Load driver .sys files into raw buffers
|
||||
for (int i = 0; i < ps.driverCount; i++) {
|
||||
@@ -708,7 +708,7 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
mod->VirtBase = 0; // Kernel will map this later
|
||||
}
|
||||
|
||||
Print(L"6\n");
|
||||
//Print(L"6\n");
|
||||
|
||||
// Query GOP FIRST, before the GetMemoryMap loop
|
||||
EFI_GRAPHICS_OUTPUT_PROTOCOL* gop;
|
||||
@@ -736,7 +736,7 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
}
|
||||
}
|
||||
|
||||
Print(L"7\n");
|
||||
//Print(L"7\n");
|
||||
|
||||
// --- Map physical RAM as direct window AND identity map ---
|
||||
UINTN mapSize = 0, descSz = 0, mapKey; UINT32 descVer;
|
||||
@@ -835,7 +835,7 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
Map4K(PHYS_MAP_BASE + phys, phys, 0x03); // Physical Window Map
|
||||
}
|
||||
|
||||
Print(L"8\n");
|
||||
//Print(L"8\n");
|
||||
|
||||
// --- Convert EFI memory map -> MEMORY_MAP ---
|
||||
ConvertMemoryMap(&bi->MemoryMap);
|
||||
@@ -880,12 +880,12 @@ EFI_STATUS EFIAPI UefiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE* SystemTable
|
||||
}
|
||||
|
||||
// Print it out to verify the bootloader actually found it before launching the kernel
|
||||
Print(L"Found RSDP at: 0x%llx\n", bi->RsdpPhysical);
|
||||
//Print(L"Found RSDP at: 0x%llx\n", bi->RsdpPhysical);
|
||||
|
||||
bi->PhysicalMapBase = PHYS_MAP_BASE;
|
||||
bi->Debug = (UINT32)ps.debug;
|
||||
|
||||
Print(L"9\n");
|
||||
//Print(L"9\n");
|
||||
|
||||
// --- ExitBootServices ---
|
||||
gBS->GetMemoryMap(&mapSize, NULL, &mapKey, &descSz, &descVer);
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,53 +1,53 @@
|
||||
// ini_parser.c - minimal [section] key=value parser
|
||||
// Used by the bootloader to read boot.ini and drivers/drivers.ini.
|
||||
// No heap; caller provides fixed-size output buffers.
|
||||
#include <string.h>
|
||||
#include <ini_parser.h>
|
||||
|
||||
static inline int IsWs(char c) { return c == ' ' || c == '\t' || c == '\r'; }
|
||||
|
||||
static char* TrimLeft(char* s) {
|
||||
while (*s && IsWs(*s)) s++;
|
||||
return s;
|
||||
}
|
||||
|
||||
static void TrimRight(char* s) {
|
||||
char* e = s + strlen(s);
|
||||
while (e > s && IsWs(*(e-1))) *--e = '\0';
|
||||
}
|
||||
|
||||
// Parse 'buf' (null-terminated) for [section] / key=value.
|
||||
// Calls cb(section, key, value, userdata) for each key found.
|
||||
void IniParse(char* buf, IniCallback cb, void* userdata) {
|
||||
char section[64] = "";
|
||||
char* line = buf;
|
||||
|
||||
while (*line) {
|
||||
char* end = line;
|
||||
while (*end && *end != '\n') end++;
|
||||
char saved = *end;
|
||||
*end = '\0';
|
||||
|
||||
char* p = TrimLeft(line);
|
||||
if (*p == '[') {
|
||||
p++;
|
||||
char* close = strchr(p, ']');
|
||||
if (close) { *close = '\0'; strncpy(section, p, 63); section[63] = '\0'; }
|
||||
} else if (*p && *p != ';' && *p != '#') {
|
||||
char* eq = strchr(p, '=');
|
||||
if (eq) {
|
||||
*eq = '\0';
|
||||
char* key = p; TrimRight(key);
|
||||
char* val = TrimLeft(eq + 1); TrimRight(val);
|
||||
cb(section, key, val, userdata);
|
||||
} else {
|
||||
// Key with no value (e.g., a driver filename in drivers.ini).
|
||||
TrimRight(p);
|
||||
if (*p) cb(section, p, "", userdata);
|
||||
}
|
||||
}
|
||||
|
||||
*end = saved;
|
||||
line = end + (*end ? 1 : 0);
|
||||
}
|
||||
}
|
||||
// ini_parser.c - minimal [section] key=value parser
|
||||
// Used by the bootloader to read boot.ini and drivers/drivers.ini.
|
||||
// No heap; caller provides fixed-size output buffers.
|
||||
#include <string.h>
|
||||
#include <common/ini_parser.h>
|
||||
|
||||
static inline int IsWs(char c) { return c == ' ' || c == '\t' || c == '\r'; }
|
||||
|
||||
static char* TrimLeft(char* s) {
|
||||
while (*s && IsWs(*s)) s++;
|
||||
return s;
|
||||
}
|
||||
|
||||
static void TrimRight(char* s) {
|
||||
char* e = s + strlen(s);
|
||||
while (e > s && IsWs(*(e-1))) *--e = '\0';
|
||||
}
|
||||
|
||||
// Parse 'buf' (null-terminated) for [section] / key=value.
|
||||
// Calls cb(section, key, value, userdata) for each key found.
|
||||
void IniParse(char* buf, IniCallback cb, void* userdata) {
|
||||
char section[64] = "";
|
||||
char* line = buf;
|
||||
|
||||
while (*line) {
|
||||
char* end = line;
|
||||
while (*end && *end != '\n') end++;
|
||||
char saved = *end;
|
||||
*end = '\0';
|
||||
|
||||
char* p = TrimLeft(line);
|
||||
if (*p == '[') {
|
||||
p++;
|
||||
char* close = strchr(p, ']');
|
||||
if (close) { *close = '\0'; strncpy(section, p, 63); section[63] = '\0'; }
|
||||
} else if (*p && *p != ';' && *p != '#') {
|
||||
char* eq = strchr(p, '=');
|
||||
if (eq) {
|
||||
*eq = '\0';
|
||||
char* key = p; TrimRight(key);
|
||||
char* val = TrimLeft(eq + 1); TrimRight(val);
|
||||
cb(section, key, val, userdata);
|
||||
} else {
|
||||
// Key with no value (e.g., a driver filename in drivers.ini).
|
||||
TrimRight(p);
|
||||
if (*p) cb(section, p, "", userdata);
|
||||
}
|
||||
}
|
||||
|
||||
*end = saved;
|
||||
line = end + (*end ? 1 : 0);
|
||||
}
|
||||
}
|
||||
File renamed without changes.
@@ -33,8 +33,8 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "printf.h"
|
||||
#include "syscall/sys_string.h"
|
||||
#include <common/printf.h>
|
||||
#include <ntlite/string_view.h>
|
||||
|
||||
|
||||
// define this globally (e.g. gcc -DPRINTF_INCLUDE_CONFIG_H ...) to include the
|
||||
@@ -1,9 +1,9 @@
|
||||
#include <hal_api.h>
|
||||
#include <ke_status.h>
|
||||
#include <ke_debug.h>
|
||||
|
||||
KSTATUS DriverEntry(const HAL_API* hal) {
|
||||
(void)hal;
|
||||
DbgPrint("Test runtime driver\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#include <ntlite/ddi/hal_api.h>
|
||||
#include <ntlite/status.h>
|
||||
#include <kernel/ke_debug.h>
|
||||
|
||||
KSTATUS DriverEntry(const HAL_API* hal) {
|
||||
(void)hal;
|
||||
DbgPrint("Test runtime driver\n");
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@@ -40,15 +40,15 @@
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <io_driver.h>
|
||||
#include <hal_api.h>
|
||||
#include <io_file.h>
|
||||
#include <mm_virt.h>
|
||||
#include <ke_debug.h>
|
||||
#include <ke_irp.h>
|
||||
#include <ke_semaphore.h>
|
||||
#include <ke_thread.h>
|
||||
#include <ke_sched.h>
|
||||
#include <ntlite/ddi/io_driver.h>
|
||||
#include <ntlite/ddi/hal_api.h>
|
||||
#include <kernel/io_file.h>
|
||||
#include <kernel/mm_virt.h>
|
||||
#include <kernel/ke_debug.h>
|
||||
#include <kernel/ke_irp.h>
|
||||
#include <kernel/ke_semaphore.h>
|
||||
#include <kernel/ke_thread.h>
|
||||
#include <kernel/ke_sched.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// On-disk structures
|
||||
File renamed without changes.
File renamed without changes.
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <ke_debug.h>
|
||||
#include <kernel/ke_debug.h>
|
||||
|
||||
#ifndef LITTLE_ENDIAN
|
||||
#define LITTLE_ENDIAN 1234
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 229 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user