Skip to content

Commit

Permalink
При нажатии на ESCAPE - выход из симуляции
Browse files Browse the repository at this point in the history
  • Loading branch information
0Nera committed Oct 29, 2023
1 parent ec3e07c commit 8b0ecd8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 29 deletions.
2 changes: 1 addition & 1 deletion include/version.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
#define VERSION_BUILD 356
#define VERSION_BUILD 366
10 changes: 8 additions & 2 deletions kernel/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
52 changes: 26 additions & 26 deletions pbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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""")
Expand Down

0 comments on commit 8b0ecd8

Please sign in to comment.