Загрузка модулей исправлена

This commit is contained in:
Aren Elchinyan 2023-10-24 23:53:20 +03:00
parent 6ae0e82d92
commit fe63787821
11 changed files with 33 additions and 22 deletions

View File

@ -15,14 +15,17 @@ jobs:
- uses: actions/checkout@v3
- name: install depends
run: sudo apt install clang-format python3 git gdisk gcc g++ xorriso make mtools curl
run: sudo apt install clang-format python3 git gdisk gcc g++ xorriso make mtools curl dos2unix
- name: install limine
run: |
git clone https://github.com/limine-bootloader/limine.git --branch=v5.x-branch-binary --depth=1
- name: build
run: chmod +x build.sh && ./build.sh
run: |
dos2unix *.sh
chmod +x build.sh
./build.sh
- name: check root dir
run: ls -la

View File

@ -21,19 +21,18 @@ jobs:
git config --global user.email "github@github.com"
git config --global user.name "Build bot"
- name: install depends
run: sudo apt install clang-format python3 git gdisk gcc g++ xorriso make mtools curl
run: sudo apt install clang-format python3 git gdisk gcc g++ xorriso make mtools curl dos2unix
- name: install limine
run: |
git clone https://github.com/limine-bootloader/limine.git --branch=v5.x-branch-binary --depth=1
- name: Build
run: |
./build.sh
cp kernel.elf x86_64-kernel.elf
cp mseos.hdd x86_64-mseos.hdd
- name: build
run: |
dos2unix *.sh
chmod +x build.sh
./build.sh
- name: Add and commit files
uses: EndBug/add-and-commit@v9

View File

@ -96,7 +96,7 @@
### Ubuntu 18.04+
```bash
sudo apt install clang-format python3 git qemu-system-x86 gdisk
sudo apt install clang-format python3 git qemu-system-x86 gdisk dos2unix
git clone https://git.synapseos.ru/Aren/BMOSP.git
cd BMOSP/
chmod +x build.sh

View File

@ -1,5 +1,6 @@
#!/bin/sh
cd modules/
dos2unix */*.sh
cd helloworld/ && chmod +x build.sh && ./build.sh && cd ..
cd music/ && chmod +x build.sh && ./build.sh && cd ..
cd ..

View File

@ -15,11 +15,11 @@ BACKGROUND_PATH=boot:///boot.tga
KASLR=no
KERNEL_PATH=boot:///kernel.elf
MODULE_PATH=boot:///mod/music.so
MODULE_CMDLINE=[MOD]music.so
MODULE_PATH=boot:///boot.tga
MODULE_CMDLINE=[BOOTIMG]
MODULE_PATH=boot:///mod/hello.so
MODULE_CMDLINE=[MOD]hello.so
MODULE_PATH=boot:///boot.tga
MODULE_CMDLINE=[BOOTIMG]
MODULE_PATH=boot:///mod/music.so
MODULE_CMDLINE=[MOD]music.so

View File

@ -12,10 +12,6 @@
#include <stdint.h>
typedef struct {
void (*fb_printf)(char *str, ...);
} env_t;
typedef struct {
int reserved;
} framebuffer_t;
@ -54,4 +50,10 @@ typedef struct {
uint8_t second;
} time_t;
typedef struct {
uint64_t offset;
module_info_t *info;
void (*fb_printf)(char *str, ...);
} env_t;
#endif // sys.h

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 1
#define VERSION_BUILD 290
#define VERSION_BUILD 293

View File

@ -63,7 +63,6 @@ static struct limine_module_response *module_response;
static uint64_t modules_count = 0;
void mod_init( ) {
main_env.fb_printf = &fb_printf;
module_response = module_request.response;
uint64_t module_count = module_response->module_count;
struct limine_file *module_ptr = (struct limine_file *)0;
@ -92,6 +91,9 @@ void mod_init( ) {
fb_printf("\t->Точка входа: 0x%x\n", module_init);
main_env.offset = module_ptr->address;
main_env.info = (module_info_t *)0;
main_env.fb_printf = &fb_printf;
uint64_t ret = module_init(&main_env);
fb_printf("Инициализированно с кодом: %u\n", ret);

View File

@ -59,8 +59,10 @@ typedef struct {
void (*fb_printf)(char *str, ...);
} env_t;
void (*fb_printf)(char *str, ...);
extern module_info_t static_info;
static inline void init_env(env_t *loader_env) {}
static inline void init_env(env_t *loader_env) {
loader_env->info = (module_info_t *)&static_info + loader_env->offset;
}
#endif // system.h

View File

@ -8,5 +8,6 @@ module_info_t static_info = {
uint64_t init(env_t *env) {
init_env(env);
env->fb_printf("Модуль \"Привет мир!\" инициализирован!\n");
return 0;
}

View File

@ -18,6 +18,7 @@ static inline void play_sound(unsigned int frequency) {}
int init(env_t *env) {
init_env(env);
env->fb_printf("Программа инициализирована!\n");
return 0;
// Массив с нотами
unsigned int tetris_notes[] = { 0 };