From 5175bba9354443e24f46925e2a9c6f3c78f0d68f Mon Sep 17 00:00:00 2001 From: Aren Elchinyan Date: Mon, 16 Sep 2024 21:42:47 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BD=D0=BE=D0=B2=D1=8B=D0=B9=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +-- build.sh | 4 ++-- include/sys.h | 4 +++- include/version.h | 2 +- kernel/cpu/com.c | 2 +- kernel/cpu/cpu.c | 5 +---- kernel/cpu/task.c | 2 ++ kernel/elf.c | 23 ++++++++++++++++++-- kernel/mem.c | 15 ++++++++++++- kernel/mod.c | 45 ++++++++++++--------------------------- kernel/sys.c | 3 ++- modlib/lib/system.c | 3 +++ modules/cpubench/main.c | 25 +++++++++++----------- modules/helloworld/main.c | 25 +++++++++++----------- modules/imfs/main.c | 28 ++++++++++++------------ modules/ios/main.c | 25 +++++++++++----------- modules/pci/main.c | 29 ++++++++++++++----------- modules/pci/pci_data.c | 30 +++++++++++++++----------- modules/ps2/main.c | 23 ++++++++++---------- scripts/pbuild.py | 6 +++--- 20 files changed, 168 insertions(+), 134 deletions(-) diff --git a/.gitignore b/.gitignore index cb83d58..15fdbec 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,7 @@ limine/ ovmf/ iso_root/ output/ -sdk/ -_sdk/ +sdk*/ *.so *.o *.ko diff --git a/build.sh b/build.sh index cf81a5f..748859e 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,8 @@ dos2unix *.sh +python3 scripts/pbuild.py + cd modlib/lib/ dos2unix build.sh chmod +x build.sh @@ -22,5 +24,3 @@ for dir in */; do done cd .. - -python3 scripts/pbuild.py \ No newline at end of file diff --git a/include/sys.h b/include/sys.h index e9c38b5..64f5eb7 100644 --- a/include/sys.h +++ b/include/sys.h @@ -62,6 +62,7 @@ typedef struct { void *irq_handler; // Адрес обработчика прерываний void *(*get_func)(uint64_t id); void (*after_init)( ); + void *env; // env_t } __attribute__((packed)) module_info_t; typedef struct { @@ -76,9 +77,10 @@ typedef struct { sys_info_t *(*get_info)( ); module_info_t *(*get_module)(char *module_id); module_info_t *(*mod_list_get)(uint64_t *count); - uint64_t (*new_thread)(void (*func)(void *), char *name); + uint64_t (*new_thread)(void (*func)(void *), char *name, void *arg); void (*delete_thread)( ); time_t (*get_time)( ); + module_info_t *ret; } __attribute__((packed)) env_t; env_t *sys_install(env_t *module); diff --git a/include/version.h b/include/version.h index 06fc20e..2877895 100644 --- a/include/version.h +++ b/include/version.h @@ -1,3 +1,3 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 -#define VERSION_BUILD 107 +#define VERSION_BUILD 162 diff --git a/kernel/cpu/com.c b/kernel/cpu/com.c index 020db0c..907c2d0 100644 --- a/kernel/cpu/com.c +++ b/kernel/cpu/com.c @@ -12,7 +12,7 @@ static inline int com_is_transmit_empty(uint16_t com) { return inb(com + 5) & 0x20; } -void com_write_byte(uint8_t byte) { +void com_write_byte(char byte) { while (!com_is_transmit_empty(0x3F8)) {} outb(0x3F8, byte); diff --git a/kernel/cpu/cpu.c b/kernel/cpu/cpu.c index a179c08..23e31ec 100644 --- a/kernel/cpu/cpu.c +++ b/kernel/cpu/cpu.c @@ -14,6 +14,7 @@ #include static bool acpi_msrs_support = false; +static char fxsave_region[512] __attribute__((aligned(16))); static void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { asm volatile("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "a"(leaf)); @@ -143,8 +144,6 @@ void cpu_init( ) { brandname( ); - - uint32_t eax, ebx, ecx, edx; cpuid(1, &eax, &ebx, &ecx, &edx); if ((edx >> 0) & 1) { @@ -152,8 +151,6 @@ void cpu_init( ) { LOG("FPU(x87) поддерживается!\n"); } - if ((edx >> 23) & 1) { LOG("MMX поддерживается!\n"); } - if ((edx >> 25) & 1) { LOG("SSE2 поддерживается!\n"); LOG("Адрес региона fxsave 0x%x\n", &fxsave_region); diff --git a/kernel/cpu/task.c b/kernel/cpu/task.c index cb98a10..1003743 100644 --- a/kernel/cpu/task.c +++ b/kernel/cpu/task.c @@ -121,9 +121,11 @@ void task_del_current( ) { prev->next = next; next->last = prev; + LOG("Очистка потока ID: %u, %s\n", current_task->id, current_task->id_str); mem_free(current_task->stack); mem_free(current_task); + LOG("Смена ID: %u, %s\n", next->id, next->id_str); current_task = next; if (full_init) { task_switch( ); } } diff --git a/kernel/elf.c b/kernel/elf.c index b982359..5851038 100644 --- a/kernel/elf.c +++ b/kernel/elf.c @@ -107,26 +107,40 @@ void *elf_parse(elf64_header_t *head) { } if (symtab_section && string_table) { +#ifdef DEBUG_ELF LOG("\nТаблица символов:\n"); LOG("%s %s %s %s\n", "Индекс", "Значение", "Размер", "Наименование"); +#endif int num_symbols = symtab_section->sh_size / symtab_section->sh_entsize; for (int i = 0; i < num_symbols; i++) { elf64_sym_t *sym = elf64_get_symval(head, symtab_section - elf64_sheader(head), i); if (sym) { +#ifdef DEBUG_ELF LOG("%6u %8x %6x %18s ", i, sym->st_value, sym->st_size, string_table + sym->st_name); +#endif switch (ELF64_ST_TYPE(sym->st_info)) { - case STT_NOTYPE: log_printf("без типа\n"); break; + case STT_NOTYPE: + +#ifdef DEBUG_ELF + log_printf("без типа\n"); +#endif + break; case STT_OBJECT: +#ifdef DEBUG_ELF log_printf("объект данных\n"); +#endif if (!(string_table + sym->st_name)) { break; } // log_printf("%u\n", tool_strcmp(string_table + sym->st_name, "import_test")); if (tool_strcmp(string_table + sym->st_name, "import_test") == 0) { +#ifdef DEBUG_ELF log_printf("0x%x\n", head + sym->st_value); +#endif // void (*imp)( ) = (void *)head + sym->st_value; // imp = &import_test; } break; +#ifdef DEBUG_ELF case STT_FUNC: log_printf("объект кода\n"); break; case STT_SECTION: log_printf("символ раздела\n"); break; case STT_FILE: log_printf("имя файла\n"); break; @@ -134,7 +148,12 @@ void *elf_parse(elf64_header_t *head) { case STT_TLS: log_printf("объект данных локального потока\n"); break; case STT_NUM: log_printf("количество определенных типов\n"); break; case STT_GNU_IFUNC: log_printf("объект непрямого кода\n"); break; - default: log_printf("???\n"); break; +#endif + default: +#ifdef DEBUG_ELF + log_printf("???\n"); +#endif + break; } } } diff --git a/kernel/mem.c b/kernel/mem.c index c0d6ef7..139d899 100644 --- a/kernel/mem.c +++ b/kernel/mem.c @@ -51,9 +51,11 @@ static uint64_t mmmap_count = 0; extern task_t *current_task; extern uint64_t full_init; +#ifdef DEBUG_MEM static const char memory_types[8][82] = { "Доступно", "Зарезервировано", "ACPI, можно освободить", "ACPI NVS", "Плохая память", "Загрузчик, можно освободить", "Ядро и модули", "Буфер кадра" }; +#endif static struct limine_memmap_response *memmap_response; @@ -63,6 +65,7 @@ void mem_dump_memory( ) { mem_entry_t *curr = first_node; while (curr) { +#ifdef DEBUG_MEM if (curr->next) { LOG("->0x%x | %u мегабайт | %s | 0x%x | поток %u\n", &curr->data, (curr->size) / 1024 / 1024, curr->free ? memory_types[0] : memory_types[1], curr->next, curr->task_id); @@ -70,6 +73,7 @@ void mem_dump_memory( ) { LOG("->0x%x | %u мегабайт | %s | поток %u | Это последний блок\n", &curr->data, (curr->size) / 1024 / 1024, curr->free ? memory_types[0] : memory_types[1], curr->task_id); } +#endif curr = curr->next; } } @@ -284,8 +288,9 @@ void mem_init( ) { mmmap_count = memmap_response->entry_count; struct limine_memmap_entry **mmaps = memmap_response->entries; +#ifdef DEBUG_MEM LOG("Записей в карте памяти: %u\n", memmap_response->entry_count); - +#endif // Обработка каждой записи в карте памяти for (uint64_t i = 0; i < mmmap_count; i++) { available += mmaps[i]->length; @@ -293,9 +298,11 @@ void mem_init( ) { // LOG("\t%d: 0x%x\tдлина: 0x%x\tтип: %s\n", i + 1, mmaps[i]->base, mmaps[i]->length, // memory_types[mmaps[i]->type]); if (mmaps[i]->type == LIMINE_MEMMAP_FRAMEBUFFER) { +#ifdef DEBUG_MEM LOG("На видеопамять BIOS/UEFI выделено: %u мегабайт + %u " "килобайт\n", mmaps[i]->length / 1024 / 1024, (mmaps[i]->length / 1024) % 1024); +#endif } if (!(mmaps[i]->type == LIMINE_MEMMAP_USABLE)) { continue; } @@ -330,20 +337,26 @@ void mem_init( ) { for (uint64_t t = 0; t < mmaps[i]->length; t += BLOCK_SIZE) { mem_frame_free((void *)mmaps[i]->base + t, 1); } } +#ifdef DEBUG_MEM LOG("%u / %u блоков доступно\n", bitmap_available, bitmap_limit); LOG("Размер битовой карты: %u\n", bitmap_size); +#endif alloc_init(mem_frame_alloc(1024), 1024 * BLOCK_SIZE); +#ifdef DEBUG_MEM LOG("%u мегабайт выделено в динамичную память\n", (256 * 16 * BLOCK_SIZE + BLOCK_SIZE) / 1024 / 1024); +#endif // Выделяем по 4 мегабайта в аллокатор динамичной памяти for (uint64_t i = 0; i < 32; i += 8) { mem_add_block(mem_frame_alloc(1024), 1024 * BLOCK_SIZE); } mem_merge_all_blocks( ); mem_dump_memory( ); +#ifdef DEBUG_MEM LOG("%u МБ объем доступной памяти, %u МБ объем виртуальной памяти\n", (bitmap_available * BLOCK_SIZE) / 1024 / 1024, available / 1024 / 1024); LOG("%u / %u блоков доступно\n", bitmap_available, bitmap_limit); +#endif } \ No newline at end of file diff --git a/kernel/mod.c b/kernel/mod.c index 6db7e9f..8668e3e 100644 --- a/kernel/mod.c +++ b/kernel/mod.c @@ -24,7 +24,7 @@ module_info_t *module_list = NULL; static char *graphics_module_message = "Графический модуль-объект"; static char *other_module_message = "Неизвестный тип модуля"; -static env_t main_env; +static env_t *main_env = NULL; void *bootpng_ptr; uint64_t bootpng_size; @@ -49,7 +49,7 @@ void mod_after_init( ) { for (uint64_t i = 0; i < modules_count; i++) { if (module_list[i].after_init != 0) { LOG("%s.after_init( );\n", module_list[i].name); - task_new_thread(module_list[i].after_init, module_list[i].name); + task_new_thread(module_list[i].after_init, module_list[i].name, NULL); } } } @@ -125,37 +125,20 @@ void mod_init( ) { } // LOG("\t->Точка входа: 0x%x\n", module_init); + main_env = (env_t *)mem_alloc(sizeof(env_t)); + tool_memset(main_env, 0, sizeof(env_t)); + main_env->offset = (uint64_t)module_ptr->address; - main_env.offset = (uint64_t)module_ptr->address; - - sys_install(&main_env); - - uint64_t id = task_new_thread((void *)1, module_list[i].name); - - module_info_t ret = module_init(&main_env); - LOG("\t->%s\n", ret.message); - - task_del(id); - - module_list[modules_count].name = ret.name; - module_list[modules_count].message = ret.message; - module_list[modules_count].data_size = ret.data_size; - module_list[modules_count].data = ret.data; - module_list[modules_count].get_func = ret.get_func; - module_list[modules_count].after_init = ret.after_init; - - if (module_list[modules_count].after_init) { - task_new_thread(module_list[modules_count].after_init, module_list[modules_count].name); - } - - if (ret.irq != 0) { - if (ret.irq_handler != 0) { - LOG("Установлен обработчик прерывания [%u] по адресу 0x%x в модуле %s\n", ret.irq, ret.irq_handler, - ret.name); - idt_set_int(ret.irq, ret.irq_handler); - } - } + sys_install(main_env); + uint64_t id = task_new_thread((void (*)(void *))module_init, module_list[i].name, main_env); + module_list[modules_count].env = (void *)main_env; + module_list[modules_count].name = 0; + module_list[modules_count].message = 0; + module_list[modules_count].data_size = 0; + module_list[modules_count].data = 0; + module_list[modules_count].get_func = 0; + module_list[modules_count].after_init = 0; modules_count++; } LOG("Модулей обработано: %u\n", modules_count); diff --git a/kernel/sys.c b/kernel/sys.c index c3d563f..de928f7 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -60,9 +60,10 @@ env_t *sys_install(env_t *module) { module->get_info = &sys_get_info; module->get_module = &sys_get_module; module->mod_list_get = &mod_list_get; - module->new_thread = &task_new_thread; + module->new_thread = task_new_thread; module->delete_thread = &task_del_current; module->get_time = &rtc_get_time; + module->ret = NULL; return module; } diff --git a/modlib/lib/system.c b/modlib/lib/system.c index 69a8372..8c15e32 100644 --- a/modlib/lib/system.c +++ b/modlib/lib/system.c @@ -25,6 +25,9 @@ time_t (*get_time)( ); uint64_t offset; void init_env(env_t *loader_env) { + if (loader_env == NULL) { + for (;;) {} + } offset = loader_env->offset; log_printf = loader_env->log_printf; alloc = loader_env->alloc; diff --git a/modules/cpubench/main.c b/modules/cpubench/main.c index 4a314b1..4ae91dc 100644 --- a/modules/cpubench/main.c +++ b/modules/cpubench/main.c @@ -57,7 +57,7 @@ static void cpu_info( ) { log_printf(" Узлы на процессор: %u\n", nodes_per_processor); } -module_info_t __attribute__((section(".minit"))) init(env_t *env) { +void __attribute__((section(".minit"))) init(env_t *env) { uint32_t eax, ebx, ecx, edx; init_env(env); @@ -77,15 +77,16 @@ module_info_t __attribute__((section(".minit"))) init(env_t *env) { cpuid(0x80000000, &eax, &ebx, &ecx, &edx); if (eax >= 0x8000001E) { cpu_info( ); } - return (module_info_t){ .name = (char *)"CPUBENCH", - .message = (char *)"Дополнительная информация о процессоре", - .type = 0, - .data_size = 0, - .data = (void *)0, - .err_code = 0, - .module_id = 0, - .irq = 0, - .irq_handler = 0, - .get_func = 0, - .after_init = 0 }; + env->ret = &((module_info_t){ .name = (char *)"CPUBENCH", + .message = (char *)"Дополнительная информация о процессоре", + .type = 0, + .data_size = 0, + .data = (void *)0, + .err_code = 0, + .module_id = 0, + .irq = 0, + .irq_handler = 0, + .get_func = 0, + .after_init = 0 }); + delete_thread( ); } \ No newline at end of file diff --git a/modules/helloworld/main.c b/modules/helloworld/main.c index 04a4d41..aad9193 100644 --- a/modules/helloworld/main.c +++ b/modules/helloworld/main.c @@ -61,20 +61,21 @@ static int app_main( ) { return 2 + 2; } -module_info_t __attribute__((section(".minit"))) init(env_t *env) { +void __attribute__((section(".minit"))) init(env_t *env) { init_env(env); log_printf("[%s]\n", message); log_printf("%s\n", logo); log_printf("%s\n", logo_synapseos); - return (module_info_t){ .name = (char *)&name, - .message = (char *)&message, - .type = 0, - .data_size = 0, - .data = (void *)&app_main, - .err_code = 0, - .module_id = 0, - .irq = 0, - .irq_handler = 0, - .get_func = 0, - .after_init = 0 }; + env->ret = &((module_info_t){ .name = (char *)&name, + .message = (char *)&message, + .type = 0, + .data_size = 0, + .data = (void *)&app_main, + .err_code = 0, + .module_id = 0, + .irq = 0, + .irq_handler = 0, + .get_func = 0, + .after_init = 0 }); + delete_thread( ); } diff --git a/modules/imfs/main.c b/modules/imfs/main.c index e43434c..bd40ab2 100644 --- a/modules/imfs/main.c +++ b/modules/imfs/main.c @@ -142,7 +142,7 @@ void print_folder_contents(folder_t *folder, size_t depth) { } } -module_info_t __attribute__((section(".minit"))) init(env_t *env) { +void __attribute__((section(".minit"))) init(env_t *env) { init_env(env); create_folder("", NULL); @@ -154,17 +154,17 @@ module_info_t __attribute__((section(".minit"))) init(env_t *env) { file_t *readme = create_file("readme", "txt", root_folder); write_file(readme, "БМПОС 2023-2024", 21); - return (module_info_t){ - .name = (char *)"[FS][IMFS]", - .message = (char *)"IMFS (in memory filesystem) - файловая система работающая исключительно в ОЗУ.", - .type = 0, - .data_size = 0, - .data = (void *)0, - .err_code = 0, - .module_id = 0, - .irq = 0, - .irq_handler = 0, - .get_func = 0, - .after_init = 0 - }; + env->ret = &((module_info_t){ + .name = (char *)"[FS][IMFS]", + .message = (char *)"IMFS (in memory filesystem) - файловая система работающая исключительно в ОЗУ.", + .type = 0, + .data_size = 0, + .data = (void *)0, + .err_code = 0, + .module_id = 0, + .irq = 0, + .irq_handler = 0, + .get_func = 0, + .after_init = 0 }); + delete_thread( ); } diff --git a/modules/ios/main.c b/modules/ios/main.c index c6b4de1..018d5b2 100644 --- a/modules/ios/main.c +++ b/modules/ios/main.c @@ -98,18 +98,19 @@ static void main( ) { for (;;) { asm volatile("hlt"); } } -module_info_t __attribute__((section(".minit"))) init(env_t *env) { +void __attribute__((section(".minit"))) init(env_t *env) { init_env(env); - return (module_info_t){ .name = (char *)"[IOS]", - .message = (char *)"IOS (input-output shell) - оболочка ввода-вывода.", - .type = 0, - .data_size = 0, - .data = (void *)0, - .err_code = 0, - .module_id = 0, - .irq = 0, - .irq_handler = 0, - .get_func = 0, - .after_init = main }; + env->ret = &((module_info_t){ .name = (char *)"[IOS]", + .message = (char *)"IOS (input-output shell) - оболочка ввода-вывода.", + .type = 0, + .data_size = 0, + .data = (void *)0, + .err_code = 0, + .module_id = 0, + .irq = 0, + .irq_handler = 0, + .get_func = 0, + .after_init = main }); + delete_thread( ); } diff --git a/modules/pci/main.c b/modules/pci/main.c index c349ead..c9aeeef 100644 --- a/modules/pci/main.c +++ b/modules/pci/main.c @@ -114,10 +114,24 @@ static inline void scan( ) { } } -module_info_t __attribute__((section(".minit"))) init(env_t *env) { +module_info_t mod = { .name = (char *)"[PCI]", + .message = (char *)"PCI драйвер", + .type = 0, + .data_size = 0, + .data = (void *)0, + .err_code = 0, + .module_id = 0, + .irq = 0, + .irq_handler = 0, + .get_func = 0, + .after_init = 0 }; + +void __attribute__((section(".minit"))) init(env_t *env) { init_env(env); + log_printf("pci_data %x\n", 1); module_info_t *pci_data = get_module("[PCI][ADAPTER]"); + log_printf("pci_data %x\n", pci_data); if (pci_data == NULL) { log_printf("Адаптер PCI данных не найден!\n"); @@ -129,15 +143,6 @@ module_info_t __attribute__((section(".minit"))) init(env_t *env) { } scan( ); - return (module_info_t){ .name = (char *)"[PCI]", - .message = (char *)"PCI драйвер", - .type = 0, - .data_size = 0, - .data = (void *)0, - .err_code = 0, - .module_id = 0, - .irq = 0, - .irq_handler = 0, - .get_func = 0, - .after_init = 0 }; + env->ret = &mod; + delete_thread( ); } \ No newline at end of file diff --git a/modules/pci/pci_data.c b/modules/pci/pci_data.c index e679a4a..5433e63 100644 --- a/modules/pci/pci_data.c +++ b/modules/pci/pci_data.c @@ -59,7 +59,19 @@ static void print_vendors(uint64_t num_vendors, vendor_t **vendor_list) { } } -module_info_t __attribute__((section(".minit"))) init(env_t *env) { +module_info_t mod = { .name = (char *)"[PCI][ADAPTER]", + .message = (char *)"PCI данные", + .type = 0, + .data_size = 0, + .data = 0, + .err_code = 0, + .module_id = 0, + .irq = 0, + .irq_handler = 0, + .get_func = 0, + .after_init = 0 }; + +void __attribute__((section(".minit"))) init(env_t *env) { init_env(env); module_info_t *pci_data = get_module("[PCI][DATA][VENDORS]"); @@ -71,15 +83,9 @@ module_info_t __attribute__((section(".minit"))) init(env_t *env) { vendor_t **vendor_list = parse_file(pci_data->data, num_vendors, pci_data->data_size); // print_vendors(num_vendors, vendor_list); - return (module_info_t){ .name = (char *)"[PCI][ADAPTER]", - .message = (char *)"PCI данные", - .type = 0, - .data_size = num_vendors, - .data = vendor_list, - .err_code = 0, - .module_id = 0, - .irq = 0, - .irq_handler = 0, - .get_func = 0, - .after_init = 0 }; + mod.data_size = num_vendors; + mod.data = vendor_list; + env->ret = &mod; + log_printf("Готово22\n"); + delete_thread( ); } \ No newline at end of file diff --git a/modules/ps2/main.c b/modules/ps2/main.c index 8b02107..1eca59a 100644 --- a/modules/ps2/main.c +++ b/modules/ps2/main.c @@ -145,20 +145,21 @@ static void handler( ) { after_interrupt( ); } -module_info_t __attribute__((section(".minit"))) init(env_t *env) { +void __attribute__((section(".minit"))) init(env_t *env) { init_env(env); current_state = NORMAL_STATE; keyboard_buffer.ctrl_pressed = 0; keyboard_buffer.shift_pressed = 0; - return (module_info_t){ .name = (char *)"[KEYBOARD]", - .message = (char *)"PS/2 драйвер", - .type = 0, - .data_size = 0, - .data = (void *)0, - .err_code = 0, - .module_id = 0, - .irq = 33, - .irq_handler = &handler, - .get_func = __get_func }; + env->ret = &((module_info_t){ .name = (char *)"[KEYBOARD]", + .message = (char *)"PS/2 драйвер", + .type = 0, + .data_size = 0, + .data = (void *)0, + .err_code = 0, + .module_id = 0, + .irq = 33, + .irq_handler = &handler, + .get_func = __get_func }); + delete_thread( ); } \ No newline at end of file diff --git a/scripts/pbuild.py b/scripts/pbuild.py index 1ee7535..25e55ad 100644 --- a/scripts/pbuild.py +++ b/scripts/pbuild.py @@ -14,9 +14,9 @@ if "^.M" in output: ARCH_FLAGS = "-m64 -march=x86-64 -mabi=sysv -mno-red-zone -mcmodel=kernel -MMD -MP" 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" +PROTECT_FLAGS = "-O0 -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 -ffunction-sections -fdata-sections" +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"""