From dd45b2ef6c6de4ae8f63a8a64d174f894acc49eb Mon Sep 17 00:00:00 2001 From: Aren Elchinyan Date: Thu, 7 Dec 2023 13:17:05 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=B2?= =?UTF-8?q?=D1=81=D0=B5=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B8=20-=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=82=D0=B8=D1=87=D0=BD=D0=BE=20=D1=81=D0=BE?= =?UTF-8?q?=D0=B1=D0=B8=D1=80=D0=B0=D1=8E=D1=82=D1=81=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/mod.c | 10 +++++++--- modules/cpubench/build.sh | 2 +- modules/helloworld/build.sh | 2 +- modules/music/build.sh | 2 +- modules/pci/build.sh | 2 +- modules/simd/build.sh | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/kernel/mod.c b/kernel/mod.c index 0bc33b5..23d2f80 100644 --- a/kernel/mod.c +++ b/kernel/mod.c @@ -33,8 +33,12 @@ uint64_t bootpng_size; static void *elf_entry(elf64_header_t *module_bin) { // Приводим заголовок ELF файла к типу elf64_header_t elf64_header_t *elf_header = (elf64_header_t *)module_bin; - LOG("(uint64_t)elf_header->e_entry = 0x%x\n", - (uint64_t)elf_header->e_entry); + LOG("(uint64_t)elf_header->e_entry = 0x%x, type = %u\n", + (uint64_t)elf_header->e_entry, elf_header->e_type); + if (elf_header->e_type != 2) { + fb_printf("\t\tОшибка! Модуль неправильно собран!\n"); + for (;;) {} + } // Возвращаем указатель на точку входа return (void *)((uint64_t)elf_header->e_entry + (uint64_t)module_bin); } @@ -99,7 +103,7 @@ void mod_init( ) { continue; } - module_info_t (*module_init)(env_t *env) = + module_info_t (*module_init)(env_t * env) = (module_info_t(*)(env_t * env)) elf_entry((elf64_header_t *)module_ptr->address); diff --git a/modules/cpubench/build.sh b/modules/cpubench/build.sh index cb462b2..7a38324 100755 --- a/modules/cpubench/build.sh +++ b/modules/cpubench/build.sh @@ -3,7 +3,7 @@ echo "Название: CPUBENCH" echo "Лицензия: Публичное достояние" CC="gcc" -ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -shared -nostdlib " +ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -static -nostdlib " if [ -d "../../sdk" ]; then CC="../../sdk/bin/x86_64-elf-gcc" diff --git a/modules/helloworld/build.sh b/modules/helloworld/build.sh index 8510403..3bc1afa 100755 --- a/modules/helloworld/build.sh +++ b/modules/helloworld/build.sh @@ -3,7 +3,7 @@ echo "Название: Hello world" echo "Лицензия: Публичное достояние" CC="gcc" -ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -shared -nostdlib " +ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -static -nostdlib " if [ -d "../../sdk" ]; then CC="../../sdk/bin/x86_64-elf-gcc" diff --git a/modules/music/build.sh b/modules/music/build.sh index b07817d..c1a415c 100755 --- a/modules/music/build.sh +++ b/modules/music/build.sh @@ -3,7 +3,7 @@ echo "Название: Мелодия из тетриса" echo "Лицензия: Публичное достояние" CC="gcc" -ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -shared -nostdlib " +ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -static -nostdlib " if [ -d "../../sdk" ]; then CC="../../sdk/bin/x86_64-elf-gcc" diff --git a/modules/pci/build.sh b/modules/pci/build.sh index 6b2939f..4092c16 100755 --- a/modules/pci/build.sh +++ b/modules/pci/build.sh @@ -4,7 +4,7 @@ echo "Лицензия: Публичное достояние" CC="gcc" -ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -shared -nostdlib " +ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -static -nostdlib " if [ -d "../../sdk" ]; then CC="../../sdk/bin/x86_64-elf-gcc" diff --git a/modules/simd/build.sh b/modules/simd/build.sh index 9721e95..30ef716 100755 --- a/modules/simd/build.sh +++ b/modules/simd/build.sh @@ -3,7 +3,7 @@ echo "Название: SIMD" echo "Лицензия: Публичное достояние" CC="gcc" -ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -shared -nostdlib " +ARCH_FLAGS="-ffreestanding -O0 -g -fPIC -static -nostdlib " if [ -d "../../sdk" ]; then CC="../../sdk/bin/x86_64-elf-gcc"