Исправление мелких ошибок

This commit is contained in:
Aren Elchinyan 2023-12-15 00:23:23 +03:00
parent 7fb682ba9e
commit 1d06b2443d
7 changed files with 29 additions and 12 deletions

View File

@ -1,9 +1,8 @@
GRAPHICS=yes
TIMEOUT=0
TIMEOUT=5
DEFAULT_ENTRY=0
INTERFACE_BRANDING=git.synapseos.ru/Aren/bmosp
BACKGROUND_STYLE=stretched
BACKGROUND_PATH=boot:///boot.tga
TERM_WALLPAPER=boot:///boot.jpg
#TERM_FONT=boot:///CYRILL2.F16
#TERM_FONT_SIZE=8x16

View File

@ -56,6 +56,8 @@ typedef struct {
void *data;
int64_t err_code;
uint64_t module_id;
uint8_t irq; // Номер прерывания
void *irq_handler; // Адрес обработчика прерываний
} __attribute__((packed)) module_info_t;
typedef struct {

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
#define VERSION_BUILD 852
#define VERSION_BUILD 870

View File

@ -51,12 +51,17 @@ static void exception_handler(struct frame state) {
}
void isr_generic(struct frame state) {
if (state.int_number > 255) { return; }
if (state.int_number != 32) { LOG("Обработка прерывания %u\n", state.int_number); }
if (state.int_number < 32) {
exception_handler(state);
} else {
// LOG("Обработка прерывания %u\n", state.int_number);
isr[state.int_number](&state);
outb(0x20, 0x20);
if (isr[state.int_number]) { isr[state.int_number](&state); }
if (state.int_number >= 39) { outb(0xA0, 0x20); }
// outb(0x20, 0x20);
}
}

View File

@ -17,7 +17,7 @@ static volatile uint64_t test_color = 0x00D000;
extern uint32_t width;
static volatile void isr_local( ) {
static void isr_local( ) {
if (test_color >= 0xFFFFFF) { test_color = 0x00D000; }
uint32_t last = fb_get_text_color( );
fb_set_text_color(test_color);

View File

@ -40,10 +40,14 @@ void _start( ) {
asm volatile("sti");
while (1) {
for (;;) {
if (!(inb(0x64) & 1)) {
io_wait( );
continue;
}
uint64_t byte = inb(0x60);
switch (byte) {
case 0x1:
case 0x1: // Клавиша "ESCAPE"
LOG("Выход для Bochs\n");
outw(0xB004, 0x2000);
@ -56,11 +60,17 @@ void _start( ) {
LOG("Выход для облачного гипервизора\n");
outw(0x600, 0x34);
break;
case 0x4F:
case 0x4F: // Клавиша "END"
LOG("Вызов прерывания переключения задач!\n");
asm volatile("int $32");
break;
default: break;
}
uint8_t status = inb(0x61);
status |= 1;
outb(0x61, status);
}
}

View File

@ -15,6 +15,7 @@ ARCH_FLAGS = "-m64 -march=x86-64 -mabi=sysv -mno-red-zone -mcmodel=kernel -MMD -
WARN_FLAGS = "-Wall -Wextra -nostdlib"
STANDART_FLAGS = f"-std=gnu11 -DKERNEL_GIT_TAG=\\\"{__VERSION}\\\"" # -DNO_DEBUG=1
PROTECT_FLAGS = "-O0 -g -pipe -ffreestanding -fno-stack-protector -fno-lto -fno-stack-check -fno-PIC -fno-PIE"
PROTECT_FLAGS += " -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx"
CHARSET_FLAGS = "-finput-charset=UTF-8 -fexec-charset=cp1251"
LIBS_FLAGS = "-Ilimine -Iinclude"
FORMAT_CMD = """find . \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) -print0 | xargs -0 clang-format -i -style=file"""
@ -144,7 +145,7 @@ def create_hdd(IMAGE_NAME):
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/bin/* ::/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"mcopy -i {IMAGE_NAME}.hdd@@1M boot.tga boot.jpg ::/")
os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd")
@ -152,7 +153,7 @@ def create_iso(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 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 boot.jpg 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")
shutil.copytree("modules/bin", "iso_root/mod")
os.system(f"cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/")