From 8b0ecd8e3aa80577a8f06da62b2e65d4fc46aa19 Mon Sep 17 00:00:00 2001 From: Aren Elchinyan Date: Sun, 29 Oct 2023 19:52:04 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B8=20=D0=BD=D0=B0=D0=B6=D0=B0?= =?UTF-8?q?=D1=82=D0=B8=D0=B8=20=D0=BD=D0=B0=20ESCAPE=20-=20=D0=B2=D1=8B?= =?UTF-8?q?=D1=85=D0=BE=D0=B4=20=D0=B8=D0=B7=20=D1=81=D0=B8=D0=BC=D1=83?= =?UTF-8?q?=D0=BB=D1=8F=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/version.h | 2 +- kernel/start.c | 10 +++++++-- pbuild.py | 52 +++++++++++++++++++++++------------------------ 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/include/version.h b/include/version.h index 3c0c649..e74f57d 100644 --- a/include/version.h +++ b/include/version.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 1 -#define VERSION_BUILD 356 +#define VERSION_BUILD 366 diff --git a/kernel/start.c b/kernel/start.c index 3f0b21c..dc75b93 100644 --- a/kernel/start.c +++ b/kernel/start.c @@ -30,6 +30,12 @@ void _start( ) { LOG("\t\t\t\t *** Дата сборки: %s %s ***\n", __DATE__, __TIME__); mod_init( ); pit_init( ); - LOG("Готово!\n"); - for (;;) { asm volatile("hlt"); } + LOG("Готово! Для выхода из симуляции: ESCAPE\n"); + while (1) { + uint64_t byte = inb(0x60); + if (byte == 0x1) { + LOG("Exit!\n"); + return; + } + } } \ No newline at end of file diff --git a/pbuild.py b/pbuild.py index 040da80..e877622 100644 --- a/pbuild.py +++ b/pbuild.py @@ -126,35 +126,35 @@ def check_tools(): def create_hdd(IMAGE_NAME): - os.system("rm -f {}.hdd".format(IMAGE_NAME)) - os.system("dd if=/dev/zero bs=1M count=0 seek=4 of={}.hdd".format(IMAGE_NAME)) - os.system("sgdisk {}.hdd -n 1:2048 -t 1:ef00".format(IMAGE_NAME)) - os.system("./limine/limine bios-install {}.hdd".format(IMAGE_NAME)) - os.system("mformat -i {}.hdd@@1M".format(IMAGE_NAME)) - os.system("mmd -i {}.hdd@@1M ::/mod ::/EFI ::/EFI/BOOT ::/user".format(IMAGE_NAME)) - os.system("mcopy -i {}.hdd@@1M kernel.elf configs/limine.cfg limine/limine-bios.sys ::/".format(IMAGE_NAME)) - os.system("mcopy -i {}.hdd@@1M modules/music/music.ko modules/simd/simd.ko modules/cpubench/cpubench.ko modules/helloworld/hello.ko ::/mod".format(IMAGE_NAME)) - os.system("mcopy -i {}.hdd@@1M limine/BOOTX64.EFI limine/BOOTIA32.EFI ::/EFI/BOOT".format(IMAGE_NAME)) - os.system("mcopy -i {}.hdd@@1M boot.tga ::/".format(IMAGE_NAME)) - os.system("./limine/limine bios-install {}.hdd".format(IMAGE_NAME)) + os.system(f"rm -f {IMAGE_NAME}.hdd".format()) + os.system(f"dd if=/dev/zero bs=1M count=0 seek=4 of={IMAGE_NAME}.hdd") + os.system(f"sgdisk {IMAGE_NAME}.hdd -n 1:2048 -t 1:ef00") + os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd") + os.system(f"mformat -i {IMAGE_NAME}.hdd@@1M") + os.system(f"mmd -i {IMAGE_NAME}.hdd@@1M ::/mod ::/EFI ::/EFI/BOOT ::/user") + os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M kernel.elf configs/limine.cfg limine/limine-bios.sys ::/") + os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M modules/music/music.ko modules/simd/simd.ko modules/cpubench/cpubench.ko modules/helloworld/hello.ko ::/mod") + os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M limine/BOOTX64.EFI limine/BOOTIA32.EFI ::/EFI/BOOT") + os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M boot.tga ::/") + os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd") def create_iso(IMAGE_NAME): - os.system("rm -f {}.iso".format(IMAGE_NAME)) - os.system("rm -rf iso_root") - os.system("mkdir -p iso_root") - os.system("cp -v iso_root/") - os.system("cp -v kernel.elf boot.tga configs/limine.cfg limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/") - os.system("mkdir -p iso_root/EFI/BOOT") - os.system("mkdir -p iso_root/mod") - os.system("cp -v modules/helloworld/hello.ko iso_root/mod/") - os.system("cp -v modules/music/music.ko iso_root/mod/") - os.system("cp -v modules/simd/simd.ko iso_root/mod/") - os.system("cp -v modules/cpubench/cpubench.ko iso_root/mod/") - os.system("cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/") - os.system("cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT/") - os.system("xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label iso_root -o {}.iso".format(IMAGE_NAME)) - os.system("./limine/limine bios-install {}.iso".format(IMAGE_NAME)) + os.system(f"rm -f {IMAGE_NAME}.iso") + os.system(f"rm -rf iso_root") + os.system(f"mkdir -p iso_root") + os.system(f"cp -v iso_root/") + os.system(f"cp -v kernel.elf boot.tga configs/limine.cfg limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/") + os.system(f"mkdir -p iso_root/EFI/BOOT") + os.system(f"mkdir -p iso_root/mod") + os.system(f"cp -v modules/helloworld/hello.ko iso_root/mod/") + os.system(f"cp -v modules/music/music.ko iso_root/mod/") + os.system(f"cp -v modules/simd/simd.ko iso_root/mod/") + os.system(f"cp -v modules/cpubench/cpubench.ko iso_root/mod/") + os.system(f"cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/") + os.system(f"cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT/") + os.system(f"xorriso -as mkisofs -b limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label iso_root -o {IMAGE_NAME}.iso") + os.system(f"./limine/limine bios-install {IMAGE_NAME}.iso") if __name__ == "__main__": os.system("""find . \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) -print0 | xargs -0 clang-format -i -style=file""")