mirror of
https://github.com/0Nera/BMOSP.git
synced 2024-12-22 22:06:56 +03:00
Merge pull request #14 from 0Nera/feature
Исправлена работа модулей, повышена стабильность системы
This commit is contained in:
commit
a93ca306ce
5
.github/workflows/build.yml
vendored
5
.github/workflows/build.yml
vendored
@ -3,8 +3,6 @@ name: CI BUILD
|
||||
on:
|
||||
push:
|
||||
branches-ignore: [ "pages" ]
|
||||
pull_request:
|
||||
branches-ignore: [ "pages" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -28,7 +26,8 @@ jobs:
|
||||
- name: build
|
||||
run: |
|
||||
dos2unix *.sh
|
||||
chmod +x build.sh
|
||||
chmod +x *.sh
|
||||
./build_mods.sh
|
||||
./build.sh
|
||||
|
||||
- name: check root dir
|
||||
|
10
.github/workflows/codeql.yml
vendored
10
.github/workflows/codeql.yml
vendored
@ -13,9 +13,7 @@ name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
branches-ignore: [ "pages" ]
|
||||
schedule:
|
||||
- cron: '28 15 * * 1'
|
||||
|
||||
@ -40,7 +38,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'c-cpp', 'python' ]
|
||||
language: [ 'c-cpp']
|
||||
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
|
||||
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
|
||||
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
|
||||
@ -71,7 +69,9 @@ jobs:
|
||||
sudo apt upgrade
|
||||
sudo apt install clang-format python3 unzip git qemu-system-x86 qemu-system-gui gdisk dos2unix xorriso
|
||||
sudo apt install libc6
|
||||
chmod +x build.sh
|
||||
dos2unix *.sh
|
||||
chmod +x *.sh
|
||||
./build_mods.sh
|
||||
./build.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
|
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@ -25,7 +25,8 @@ jobs:
|
||||
- name: build
|
||||
run: |
|
||||
dos2unix *.sh
|
||||
chmod +x build.sh
|
||||
chmod +x *.sh
|
||||
./build_mods.sh
|
||||
./build.sh
|
||||
|
||||
- name: save
|
||||
@ -36,11 +37,6 @@ jobs:
|
||||
cp ${{ github.workspace }}/bmosp.iso ${{ github.workspace }}/rel/
|
||||
cp ${{ github.workspace }}/LICENSE ${{ github.workspace }}/rel/
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bmosp.hdd
|
||||
path: ${{ github.workspace }}/bmosp.hdd
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: bmosp.iso
|
||||
|
21
build.sh
21
build.sh
@ -3,24 +3,3 @@
|
||||
dos2unix *.sh
|
||||
|
||||
python3 scripts/pbuild.py
|
||||
|
||||
cd modlib/lib/
|
||||
dos2unix build.sh
|
||||
chmod +x build.sh
|
||||
./build.sh
|
||||
cd ../..
|
||||
|
||||
cd modules/
|
||||
mkdir -p bin
|
||||
dos2unix */*.sh
|
||||
chmod +x */build.sh
|
||||
|
||||
for dir in */; do
|
||||
if [ $dir != "bin/" ]; then
|
||||
cd $dir
|
||||
./build.sh
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
|
24
build_mods.sh
Normal file
24
build_mods.sh
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
dos2unix *.sh
|
||||
|
||||
cd modlib/lib/
|
||||
dos2unix build.sh
|
||||
chmod +x build.sh
|
||||
./build.sh
|
||||
cd ../..
|
||||
|
||||
cd modules/
|
||||
mkdir -p bin
|
||||
dos2unix */*.sh
|
||||
chmod +x */build.sh
|
||||
|
||||
for dir in */; do
|
||||
if [ $dir != "bin/" ]; then
|
||||
cd $dir
|
||||
./build.sh
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
@ -11,7 +11,7 @@ TERM_WALLPAPER=boot:///mod/boot.jpg
|
||||
:BMOSP (KASLR off)
|
||||
#RESOLUTION=640x480
|
||||
#RESOLUTION=1024x768
|
||||
RESOLUTION=1280x720
|
||||
RESOLUTION=1280x720x32
|
||||
PROTOCOL=limine
|
||||
KASLR=no
|
||||
KERNEL_PATH=boot:///kernel.elf
|
||||
@ -34,5 +34,8 @@ TERM_WALLPAPER=boot:///mod/boot.jpg
|
||||
MODULE_PATH=boot:///mod/hello.ko
|
||||
MODULE_CMDLINE=[MOD]hello.ko
|
||||
|
||||
MODULE_PATH=boot:///mod/doom.ko
|
||||
MODULE_CMDLINE=[MOD]doom.ko
|
||||
|
||||
MODULE_PATH=boot:///mod/ios.ko
|
||||
MODULE_CMDLINE=[MOD][IO]ios.ko
|
@ -16,7 +16,8 @@ sudo apt install unzip
|
||||
sudo apt install clang-format python3 git qemu-system-x86 qemu-system-gui gdisk dos2unix xorriso libc6 gcc make curl mtools
|
||||
git clone https://git.synapseos.ru/Aren/BMOSP.git
|
||||
cd BMOSP/
|
||||
chmod +x build.sh
|
||||
chmod +x *.sh
|
||||
./build_mods.sh
|
||||
./build.sh
|
||||
```
|
||||
|
||||
@ -29,7 +30,9 @@ chmod +x build.sh
|
||||
sudo apt install clang-format python3.7 git qemu-system-x86 gdisk dos2unix xorriso libc6 gcc make curl mtools
|
||||
git clone https://git.synapseos.ru/Aren/BMOSP.git
|
||||
cd BMOSP/
|
||||
python3.7 pbuild.py
|
||||
chmod +x *.sh
|
||||
./build_mods.sh
|
||||
./build.sh
|
||||
```
|
||||
|
||||
## Запуск
|
||||
|
@ -127,6 +127,26 @@ static inline void *hal_memset_32(void *s, uint32_t c, int64_t count) {
|
||||
return s;
|
||||
}
|
||||
|
||||
static inline void *hal_memcpy(void *dest, const void *src, int64_t count) {
|
||||
int64_t d0, d1;
|
||||
asm volatile("rep\n\t"
|
||||
"movsb"
|
||||
: "=&c"(d0), "=&D"(d1)
|
||||
: "S"(src), "0"(count), "1"(dest)
|
||||
: "memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
static inline void *hal_memcpy32(void *dest, const void *src, int64_t count) {
|
||||
int64_t d0, d1;
|
||||
asm volatile("rep\n\t"
|
||||
"movsl"
|
||||
: "=&c"(d0), "=&D"(d1)
|
||||
: "S"(src), "0"(count), "1"(dest)
|
||||
: "memory");
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define GET_TICK_BIG arch_get_tick_b( )
|
||||
#define GET_TICK_lOW arch_get_tick_l( )
|
||||
|
||||
|
@ -31,6 +31,7 @@ extern int fb_init_status;
|
||||
extern uint32_t *fb_addr;
|
||||
extern uint64_t width;
|
||||
extern uint64_t height;
|
||||
extern uint16_t bpp;
|
||||
|
||||
#define SCREEN_WIDTH width
|
||||
#define SCREEN_HEIGHT height
|
||||
|
@ -21,7 +21,6 @@
|
||||
void log_init( );
|
||||
void log_init_mem( );
|
||||
void log_printf(char *str, ...);
|
||||
char *utf8cp(char *str);
|
||||
|
||||
#ifndef NO_DEBUG
|
||||
#define LOG(...) \
|
||||
|
@ -81,6 +81,7 @@ typedef struct env_t_s {
|
||||
module_info_t *(*mod_list_get)(uint64_t *count);
|
||||
uint64_t (*new_thread)(void (*func)(void *), char *name, void *arg);
|
||||
void (*delete_thread)( );
|
||||
void (*task_switch)( );
|
||||
time_t (*get_time)( );
|
||||
void (*set_int)(uint8_t vector, void (*handler)(void *));
|
||||
void (*mod_update_info)(struct env_t_s *ret);
|
||||
|
@ -1,3 +1,3 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_BUILD 202
|
||||
#define VERSION_BUILD 257
|
||||
|
@ -146,15 +146,9 @@ void cpu_init( ) {
|
||||
|
||||
cpuid(1, &eax, &ebx, &ecx, &edx);
|
||||
|
||||
if ((edx >> 0) & 1) {
|
||||
asm volatile("finit");
|
||||
LOG("FPU(x87) поддерживается!\n");
|
||||
}
|
||||
|
||||
if ((edx >> 25) & 1) {
|
||||
LOG("SSE2 поддерживается!\n");
|
||||
LOG("Адрес региона fxsave 0x%x\n", &fxsave_region);
|
||||
asm volatile(" fxsave %0 " ::"m"(fxsave_region));
|
||||
fpu_initialize( );
|
||||
uint32_t sse_version = (ecx >> 25) & 0x7;
|
||||
LOG("SSE%u включен\n", sse_version);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ uint64_t task_new_thread(void (*func)(void *), char *name, void *arg) {
|
||||
current_task->next->last = new_task;
|
||||
current_task->next = new_task;
|
||||
|
||||
LOG("Создан новый поток с ID: %u\n", new_task->id);
|
||||
LOG("Создан новый поток с ID: %u (%s)\n", new_task->id, name);
|
||||
|
||||
if (full_init == 0) { current_task = new_task; }
|
||||
|
||||
|
@ -25,3 +25,23 @@ task_switch_asm:
|
||||
popfq
|
||||
sti
|
||||
retq
|
||||
|
||||
.global fpu_initialize
|
||||
fpu_initialize:
|
||||
clts
|
||||
mov %cr0, %rax
|
||||
and $0xFFFD, %ax
|
||||
or $0x10, %ax
|
||||
mov %rax, %cr0
|
||||
fninit
|
||||
mov %cr0, %rax
|
||||
and $0xfffb, %ax
|
||||
or $0x0002, %ax
|
||||
mov %rax, %cr0
|
||||
mov %cr4, %rax
|
||||
or $0x600, %rax
|
||||
mov %rax, %cr4
|
||||
pushq $0x1F80
|
||||
ldmxcsr (%rsp)
|
||||
addq $8, %rsp
|
||||
ret
|
||||
|
@ -118,7 +118,7 @@ void log_init_mem( ) {
|
||||
tool_memcpy(log_buffer, start_buffer, buf_max);
|
||||
buf_max = ((SCREEN_WIDTH - 4) / FONT_WIDTH) * (SCREEN_HEIGHT / FONT_HEIGHT);
|
||||
LOG("Размер буффера: %u символов\n", buf_max);
|
||||
LOG("%ux%u\n", width, height);
|
||||
LOG("%ux%u %u\n", width, height, bpp);
|
||||
redraw_screen( );
|
||||
lock_release(log_lock);
|
||||
}
|
||||
|
15
kernel/mod.c
15
kernel/mod.c
@ -31,8 +31,9 @@ uint64_t bootpng_size;
|
||||
|
||||
// Вывод списка модулей в отладчик
|
||||
void mod_list_show( ) {
|
||||
LOG("Список модулей:\n");
|
||||
for (uint64_t i = 0; i < modules_count; i++) {
|
||||
LOG("Имя: %s\n", module_list[i].name ? module_list[i].name : "(NULL)");
|
||||
LOG("Имя: %s | ID: %u \n", module_list[i].name ? module_list[i].name : "(NULL)", i);
|
||||
LOG("Описание модуля: %s\n", module_list[i].message ? module_list[i].message : "(NULL)");
|
||||
LOG("Тип модуля: %u\n", module_list[i].type);
|
||||
LOG("Код ошибки модуля: %u\n", module_list[i].err_code);
|
||||
@ -44,16 +45,6 @@ void mod_list_show( ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Запуск модулей имеющих дополнительную точку входа
|
||||
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, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Запуск модулей имеющих дополнительную точку входа
|
||||
module_info_t *mod_list_get(uint64_t *count) {
|
||||
*count = modules_count;
|
||||
@ -133,7 +124,7 @@ void mod_init( ) {
|
||||
main_env->id = modules_count;
|
||||
sys_install(main_env);
|
||||
|
||||
uint64_t id = task_new_thread((void (*)(void *))module_init, module_list[i].name, main_env);
|
||||
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;
|
||||
|
@ -43,29 +43,27 @@ void _start( ) {
|
||||
full_init = 1;
|
||||
|
||||
task_after_init( );
|
||||
mem_get_stat( );
|
||||
|
||||
LOG("Готово! Для выхода из симуляции удерживайте: ESCAPE\n");
|
||||
asm volatile("sti");
|
||||
|
||||
for (;;) {
|
||||
task_t *task = current_task;
|
||||
|
||||
// Поиск задачи по ID
|
||||
do {
|
||||
task = task->next;
|
||||
if (task->status == 0) {
|
||||
LOG("УДАЛЕНИЕ %u(%s)\n", task->id, task->id_str);
|
||||
// LOG("УДАЛЕНИЕ %u(%s)\n", task->id, task->id_str);
|
||||
task_t *prev = task->last;
|
||||
task_t *next = task->next;
|
||||
|
||||
// Обновляем связи в двусвязном списке
|
||||
prev->next = next;
|
||||
next->last = prev;
|
||||
|
||||
// Освобождаем память, выделенную под стек и структуру текущего потока
|
||||
mem_free(task->stack);
|
||||
mem_free(task);
|
||||
}
|
||||
} while (task->id != 0);
|
||||
|
||||
task_switch( );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ env_t *sys_install(env_t *module) {
|
||||
module->mod_list_get = &mod_list_get;
|
||||
module->new_thread = &task_new_thread;
|
||||
module->delete_thread = &task_del_current;
|
||||
module->task_switch = &task_switch;
|
||||
module->get_time = &rtc_get_time;
|
||||
module->set_int = &idt_set_int;
|
||||
module->mod_update_info = &mod_update_info;
|
||||
|
@ -21,6 +21,7 @@ int (*get_error)( );
|
||||
sys_info_t *(*get_info)( );
|
||||
uint64_t (*new_thread)(void (*func)(void *), char *name, void *arg);
|
||||
void (*delete_thread)( );
|
||||
void (*task_switch)( );
|
||||
time_t (*get_time)( );
|
||||
void (*mod_update_info)(env_t *ret);
|
||||
void (*set_int)(uint8_t vector, void (*func)(void *));
|
||||
@ -43,6 +44,7 @@ void init_env(env_t *loader_env) {
|
||||
get_info = loader_env->get_info;
|
||||
new_thread = loader_env->new_thread;
|
||||
delete_thread = loader_env->delete_thread;
|
||||
task_switch = loader_env->task_switch;
|
||||
get_time = loader_env->get_time;
|
||||
mod_update_info = loader_env->mod_update_info;
|
||||
set_int = loader_env->set_int;
|
||||
|
@ -24,6 +24,7 @@ extern int (*get_error)( );
|
||||
extern sys_info_t *(*get_info)( );
|
||||
extern uint64_t (*new_thread)(void (*func)(void *), char *name, void *arg);
|
||||
extern void (*delete_thread)( );
|
||||
extern void (*task_switch)( );
|
||||
extern time_t (*get_time)( );
|
||||
extern void (*mod_update_info)(env_t *ret);
|
||||
extern void (*set_int)(uint8_t vector, void (*func)(void *));
|
||||
|
@ -121,6 +121,7 @@ typedef struct env_t_s {
|
||||
module_info_t *(*mod_list_get)(uint64_t *count);
|
||||
uint64_t (*new_thread)(void (*func)(void *), char *name, void *arg);
|
||||
void (*delete_thread)( );
|
||||
void (*task_switch)( );
|
||||
time_t (*get_time)( );
|
||||
void (*set_int)(uint8_t vector, int_entry_t handler);
|
||||
void (*mod_update_info)(struct env_t_s *ret);
|
||||
|
2
modules/doom/.gitignore
vendored
Normal file
2
modules/doom/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
PureDOOM.h
|
||||
*.wad
|
20
modules/doom/build.sh
Normal file
20
modules/doom/build.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#/bin/sh
|
||||
echo "Название: DOOM"
|
||||
echo "Лицензия: Публичное достояние"
|
||||
|
||||
CC=${CC:-gcc}
|
||||
ARCH_FLAGS="-fno-stack-protector -ffreestanding -O0 -g -fPIC -static -nostdlib "
|
||||
|
||||
if [ -d "../../sdk" ]; then
|
||||
CC="../../sdk/bin/x86_64-elf-gcc"
|
||||
fi
|
||||
|
||||
wget https://github.com/Daivuk/PureDOOM/raw/refs/heads/master/PureDOOM.h
|
||||
wget https://github.com/Daivuk/PureDOOM/raw/refs/heads/master/doom1.wad
|
||||
|
||||
$CC $ARCH_FLAGS -I../../modlib -finput-charset=UTF-8 -fexec-charset=cp1251 -c main.c -o doom.o
|
||||
$CC $ARCH_FLAGS -Wl,--entry=init,--build-id=none -T ../link.ld doom.o -L../../modlib/lib/ -lmod -o doom.ko
|
||||
|
||||
cp doom.ko ../bin/
|
||||
cp doom1.wad ../bin/
|
||||
echo "Сборка завершена, файл: doom.ko"
|
27
modules/doom/main.c
Normal file
27
modules/doom/main.c
Normal file
@ -0,0 +1,27 @@
|
||||
#include "PureDOOM.h"
|
||||
#include <system.h>
|
||||
|
||||
static const char name[] = "[APP]DOOM";
|
||||
static const char message[] = "DOOM :)";
|
||||
|
||||
static int app_main( ) {
|
||||
log_printf("[%s]\n", message);
|
||||
return 2 + 2;
|
||||
}
|
||||
|
||||
void __attribute__((section(".minit"))) init(env_t *env) {
|
||||
init_env(env);
|
||||
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 });
|
||||
mod_update_info(env);
|
||||
delete_thread( );
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
#include <system.h>
|
||||
|
||||
static module_info_t *mod_list = NULL;
|
||||
static uint64_t *mod_count = NULL;
|
||||
static uint64_t mod_count = 0;
|
||||
static uint64_t app_count = 0;
|
||||
static module_info_t *app_list = NULL;
|
||||
static char (*getc)( ) = NULL;
|
||||
@ -64,39 +64,37 @@ void ios_main( ) {
|
||||
|
||||
static void main( ) {
|
||||
log_printf("IOS (input-output shell) - оболочка ввода-вывода\n");
|
||||
mod_count = alloc(sizeof(uint64_t));
|
||||
mod_list = mod_list_get(mod_count);
|
||||
mod_list = mod_list_get(&mod_count);
|
||||
|
||||
app_list = alloc((*mod_count) * sizeof(module_info_t));
|
||||
app_list = alloc((mod_count) * sizeof(module_info_t));
|
||||
|
||||
if (app_list == NULL) {
|
||||
log_printf("Ошибка выделения памяти для app_list!\n");
|
||||
delete_thread( );
|
||||
mod_update_info(env);
|
||||
for (;;) { asm volatile("hlt"); }
|
||||
}
|
||||
|
||||
app_count = 0;
|
||||
|
||||
for (uint64_t i = 0; i < *mod_count; i++) {
|
||||
if (str_contains(mod_list[i].name, "[APP]")) {
|
||||
// log_printf("%u. %s\n", app_count, mod_list[i].name);
|
||||
app_list[app_count] = mod_list[i];
|
||||
app_count++;
|
||||
log_printf("%u модулей\n", mod_count);
|
||||
for (uint64_t i = 0; i < mod_count; i++) {
|
||||
if (mod_list[i].name) {
|
||||
if (str_contains(mod_list[i].name, "[APP]")) {
|
||||
// log_printf("%u. %s\n", app_count, mod_list[i].name);
|
||||
app_list[app_count] = mod_list[i];
|
||||
app_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(mod_count);
|
||||
|
||||
if (app_count < 1) {
|
||||
log_printf("Модулей-программ не обнаружено!\n");
|
||||
free(app_list);
|
||||
delete_thread( );
|
||||
mod_update_info(env);
|
||||
} else {
|
||||
app_list = realloc(app_list, app_count * sizeof(module_info_t));
|
||||
ios_main( );
|
||||
for (;;) { asm volatile("hlt"); }
|
||||
for (;;) { delete_thread( ); }
|
||||
}
|
||||
|
||||
for (;;) { asm volatile("hlt"); }
|
||||
@ -118,5 +116,7 @@ void __attribute__((section(".minit"))) init(env_t *envm) {
|
||||
.get_func = 0,
|
||||
.after_init = main });
|
||||
mod_update_info(env);
|
||||
delete_thread( );
|
||||
task_switch( );
|
||||
main( );
|
||||
for (;;) { delete_thread( ); }
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ echo "Лицензия: Публичное достояние"
|
||||
|
||||
|
||||
CC=${CC:-gcc}
|
||||
ARCH_FLAGS="-fno-stack-protector -ffreestanding -O0 -g -fPIC -static -nostdlib "
|
||||
ARCH_FLAGS="-fno-stack-protector -fdata-sections -fno-stack-check -ffreestanding -O0 -g -fPIC -static -nostdlib "
|
||||
|
||||
if [ -d "../../sdk" ]; then
|
||||
CC="../../sdk/bin/x86_64-elf-gcc"
|
||||
|
@ -114,18 +114,6 @@ static inline void scan( ) {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -143,7 +131,17 @@ void __attribute__((section(".minit"))) init(env_t *env) {
|
||||
}
|
||||
|
||||
scan( );
|
||||
env->ret = &mod;
|
||||
env->ret = &((module_info_t){ .name = "[PCI]",
|
||||
.message = "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 });
|
||||
mod_update_info(env);
|
||||
delete_thread( );
|
||||
}
|
@ -59,33 +59,32 @@ static void print_vendors(uint64_t num_vendors, vendor_t **vendor_list) {
|
||||
}
|
||||
}
|
||||
|
||||
module_info_t mod = { .name = "[PCI][ADAPTER]",
|
||||
.message = "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]");
|
||||
|
||||
if (pci_data == NULL) { log_printf("База PCI не найдена!\n"); }
|
||||
if (pci_data == NULL) {
|
||||
log_printf("[PCI][DATA]База PCI не найдена!\n");
|
||||
delete_thread( );
|
||||
}
|
||||
|
||||
uint64_t num_vendors = count_chars(pci_data->data, ';');
|
||||
log_printf("Количество вендоров: %u\n", num_vendors);
|
||||
log_printf("[PCI][DATA]Количество вендоров: %u\n", num_vendors);
|
||||
|
||||
vendor_t **vendor_list = parse_file(pci_data->data, num_vendors, pci_data->data_size);
|
||||
// print_vendors(num_vendors, vendor_list);
|
||||
mod.data_size = num_vendors;
|
||||
mod.data = vendor_list;
|
||||
env->ret = &mod;
|
||||
env->ret = &((module_info_t){ .name = "[PCI][ADAPTER]",
|
||||
.message = "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 });
|
||||
log_printf("Готово %x\n", vendor_list);
|
||||
mod_update_info(env);
|
||||
delete_thread( );
|
||||
|
@ -161,6 +161,8 @@ void __attribute__((section(".minit"))) init(env_t *env) {
|
||||
.irq = 33,
|
||||
.irq_handler = &handler,
|
||||
.get_func = __get_func });
|
||||
log_printf("Драйвер PS/2 клавиатуры установлен\n");
|
||||
set_int(33, handler);
|
||||
mod_update_info(env);
|
||||
delete_thread( );
|
||||
}
|
@ -14,8 +14,8 @@ 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 -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"
|
||||
PROTECT_FLAGS = "-O0 -pipe -ffreestanding -fno-stack-protector -fdata-sections -fno-lto -fno-stack-check -fno-PIC -fno-PIE"
|
||||
PROTECT_FLAGS += " -mno-mmx -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"""
|
||||
|
Loading…
Reference in New Issue
Block a user