При нажатии на ESCAPE - выход из симуляции

This commit is contained in:
Aren Elchinyan 2023-10-29 19:52:04 +03:00
parent ec3e07c611
commit 8b0ecd8e3a
3 changed files with 35 additions and 29 deletions

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 1 #define VERSION_MINOR 1
#define VERSION_BUILD 356 #define VERSION_BUILD 366

View File

@ -30,6 +30,12 @@ void _start( ) {
LOG("\t\t\t\t *** Дата сборки: %s %s ***\n", __DATE__, __TIME__); LOG("\t\t\t\t *** Дата сборки: %s %s ***\n", __DATE__, __TIME__);
mod_init( ); mod_init( );
pit_init( ); pit_init( );
LOG("Готово!\n"); LOG("Готово! Для выхода из симуляции: ESCAPE\n");
for (;;) { asm volatile("hlt"); } while (1) {
uint64_t byte = inb(0x60);
if (byte == 0x1) {
LOG("Exit!\n");
return;
}
}
} }

View File

@ -126,35 +126,35 @@ def check_tools():
def create_hdd(IMAGE_NAME): def create_hdd(IMAGE_NAME):
os.system("rm -f {}.hdd".format(IMAGE_NAME)) os.system(f"rm -f {IMAGE_NAME}.hdd".format())
os.system("dd if=/dev/zero bs=1M count=0 seek=4 of={}.hdd".format(IMAGE_NAME)) os.system(f"dd if=/dev/zero bs=1M count=0 seek=4 of={IMAGE_NAME}.hdd")
os.system("sgdisk {}.hdd -n 1:2048 -t 1:ef00".format(IMAGE_NAME)) os.system(f"sgdisk {IMAGE_NAME}.hdd -n 1:2048 -t 1:ef00")
os.system("./limine/limine bios-install {}.hdd".format(IMAGE_NAME)) os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd")
os.system("mformat -i {}.hdd@@1M".format(IMAGE_NAME)) os.system(f"mformat -i {IMAGE_NAME}.hdd@@1M")
os.system("mmd -i {}.hdd@@1M ::/mod ::/EFI ::/EFI/BOOT ::/user".format(IMAGE_NAME)) os.system(f"mmd -i {IMAGE_NAME}.hdd@@1M ::/mod ::/EFI ::/EFI/BOOT ::/user")
os.system("mcopy -i {}.hdd@@1M kernel.elf configs/limine.cfg limine/limine-bios.sys ::/".format(IMAGE_NAME)) os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M kernel.elf configs/limine.cfg limine/limine-bios.sys ::/")
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(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("mcopy -i {}.hdd@@1M limine/BOOTX64.EFI limine/BOOTIA32.EFI ::/EFI/BOOT".format(IMAGE_NAME)) os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M limine/BOOTX64.EFI limine/BOOTIA32.EFI ::/EFI/BOOT")
os.system("mcopy -i {}.hdd@@1M boot.tga ::/".format(IMAGE_NAME)) os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M boot.tga ::/")
os.system("./limine/limine bios-install {}.hdd".format(IMAGE_NAME)) os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd")
def create_iso(IMAGE_NAME): def create_iso(IMAGE_NAME):
os.system("rm -f {}.iso".format(IMAGE_NAME)) os.system(f"rm -f {IMAGE_NAME}.iso")
os.system("rm -rf iso_root") os.system(f"rm -rf iso_root")
os.system("mkdir -p iso_root") os.system(f"mkdir -p iso_root")
os.system("cp -v iso_root/") os.system(f"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(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("mkdir -p iso_root/EFI/BOOT") os.system(f"mkdir -p iso_root/EFI/BOOT")
os.system("mkdir -p iso_root/mod") os.system(f"mkdir -p iso_root/mod")
os.system("cp -v modules/helloworld/hello.ko iso_root/mod/") os.system(f"cp -v modules/helloworld/hello.ko iso_root/mod/")
os.system("cp -v modules/music/music.ko iso_root/mod/") os.system(f"cp -v modules/music/music.ko iso_root/mod/")
os.system("cp -v modules/simd/simd.ko iso_root/mod/") os.system(f"cp -v modules/simd/simd.ko iso_root/mod/")
os.system("cp -v modules/cpubench/cpubench.ko iso_root/mod/") os.system(f"cp -v modules/cpubench/cpubench.ko iso_root/mod/")
os.system("cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/") os.system(f"cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/")
os.system("cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT/") os.system(f"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(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("./limine/limine bios-install {}.iso".format(IMAGE_NAME)) os.system(f"./limine/limine bios-install {IMAGE_NAME}.iso")
if __name__ == "__main__": 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""") os.system("""find . \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) -print0 | xargs -0 clang-format -i -style=file""")