From cb1768e09fe32a315527009c75f325860ec03a46 Mon Sep 17 00:00:00 2001 From: Aren Elchinyan Date: Thu, 9 Jan 2025 14:09:07 +0300 Subject: [PATCH 1/2] Add qemu debug --- .gitignore | 1 + Makefile | 2 +- README.md | 2 ++ kernel/kernel.c | 11 ++++++++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c666f74..e40d53c 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ Mkfile.old dkms.conf *.iso /isodir +serial.log diff --git a/Makefile b/Makefile index 792a9c1..302421f 100644 --- a/Makefile +++ b/Makefile @@ -28,4 +28,4 @@ clean: find kernel/ -name "*.o" -delete run: - qemu-system-x86_64 -m 256 -cdrom cis-os.iso + qemu-system-x86_64 -m 256 -cdrom cis-os.iso -d guest_errors -serial file:serial.log diff --git a/README.md b/README.md index 4a70f36..b34dd03 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # kernel +[![C/C++ CI](https://github.com/CIS-osdev/kernel/actions/workflows/c-cpp.yml/badge.svg?branch=master)](https://github.com/CIS-osdev/kernel/actions/workflows/c-cpp.yml) + Это проект анархичной операционной системы ## Сборка и запуск diff --git a/kernel/kernel.c b/kernel/kernel.c index b8d6d70..e57ca3f 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -1,5 +1,13 @@ #include +static inline void outb(uint16_t port, uint8_t val) { + asm volatile("outb %0, %1" : : "a"(val), "Nd"(port)); +} + +void hal_write_byte_manual(uint8_t byte) { + outb(0x3f8, byte); +} + void puts(char *str) { char *video_memory = (char *)0xB8000; uint16_t *v = (uint16_t *)video_memory; @@ -11,6 +19,7 @@ void puts(char *str) { } void kernel_main64() { + hal_write_byte_manual('C'); puts("Hello, World from CIS! "); - while(1); + for(;;) {} } \ No newline at end of file From f59b0267e96ee5002f0882e346a4a8db5d699299 Mon Sep 17 00:00:00 2001 From: Aren Elchinyan Date: Thu, 9 Jan 2025 14:11:13 +0300 Subject: [PATCH 2/2] Fix CI, add missing package --- .github/workflows/c-cpp.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 1adb094..97c754d 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -14,6 +14,6 @@ jobs: steps: - uses: actions/checkout@v4 - name: configure - run: sudo apt install gcc build-essential grub2-common qemu-system-x86 + run: sudo apt install gcc build-essential grub2-common qemu-system-x86 xorriso mtools - name: make run: make diff --git a/README.md b/README.md index b34dd03..e67368f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ 1. Установите необходимые инструменты: ```bash -sudo apt install gcc build-essential grub2-common qemu +sudo apt install gcc build-essential grub2-common qemu-system-x86 xorriso mtools ``` 2. Соберите проект: