mirror of
https://github.com/0Nera/BMOSP.git
synced 2025-01-08 22:02:01 +03:00
Небольшие исправления
This commit is contained in:
parent
5858814e6b
commit
af1d9d80a9
@ -66,7 +66,7 @@ void arch_init( );
|
||||
void task_init( );
|
||||
void task_after_init( );
|
||||
void task_switch( );
|
||||
uint64_t task_new_thread(void (*func)(void *), char *name);
|
||||
uint64_t task_new_thread(void (*func)(void *), char *name, void *arg);
|
||||
void task_del_current( );
|
||||
void task_del(uint64_t id);
|
||||
void cpu_init( );
|
||||
|
@ -43,6 +43,7 @@ void tool_memcpy(void *dest, void *src, uint64_t n);
|
||||
void *tool_memset(void *ptr, uint8_t n, uint64_t size);
|
||||
uint64_t tool_strlen(const char *str);
|
||||
void tool_strcpy(char *dest, char *src);
|
||||
int tool_strcmp(const char *s1, const char *s2);
|
||||
uint64_t tool_starts_with(const char *str, const char *prefix);
|
||||
uint64_t tool_str_contains(const char *str, const char *substr);
|
||||
void tool_format(void (*putc)(char c), const char *format_string, va_list args);
|
||||
|
@ -1,3 +1,3 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_BUILD 96
|
||||
#define VERSION_BUILD 107
|
||||
|
@ -44,7 +44,7 @@ void task_switch( ) {
|
||||
task_switch_asm(last, next);
|
||||
}
|
||||
|
||||
uint64_t task_new_thread(void (*func)(void *), char *name) {
|
||||
uint64_t task_new_thread(void (*func)(void *), char *name, void *arg) {
|
||||
LOG("Выделение потока\n");
|
||||
|
||||
uint64_t cr3;
|
||||
@ -64,6 +64,7 @@ uint64_t task_new_thread(void (*func)(void *), char *name) {
|
||||
stack[--stack_top] = (uint64_t)0;
|
||||
|
||||
new_task->rsp = (uint64_t)new_task->stack + sizeof(uint64_t) * stack_top;
|
||||
new_task->rdi = (uint64_t)arg;
|
||||
new_task->cpu_time = 500;
|
||||
new_task->cpu_time_expired = new_task->cpu_time;
|
||||
new_task->id = next_thread_id++;
|
||||
|
10
kernel/elf.c
10
kernel/elf.c
@ -8,7 +8,7 @@
|
||||
|
||||
#include <mod.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <tool.h>
|
||||
|
||||
elf64_header_t *elf64_get_header(void *data) {
|
||||
return (elf64_header_t *)(data);
|
||||
@ -53,7 +53,7 @@ unsigned long elf64_hash(unsigned char *name) {
|
||||
while (*name) {
|
||||
h = (h << 4) + *name++;
|
||||
// Проверка на overflow
|
||||
if (g = h & 0xf0000000) h ^= g >> 24;
|
||||
if (g = (h & 0xf0000000)) h ^= g >> 24;
|
||||
// Ограничение хэша
|
||||
h &= 0xffffffff;
|
||||
}
|
||||
@ -84,7 +84,7 @@ void import_test( ) {
|
||||
}
|
||||
|
||||
void *elf_parse(elf64_header_t *head) {
|
||||
elf64_section_header_t *symtab = NULL;
|
||||
// elf64_section_header_t *symtab = NULL;
|
||||
|
||||
if (head->e_ident[0] != ELFMAG0 || head->e_ident[1] != ELFMAG1 || head->e_ident[2] != ELFMAG2 ||
|
||||
head->e_ident[3] != ELFMAG3) {
|
||||
@ -123,8 +123,8 @@ void *elf_parse(elf64_header_t *head) {
|
||||
// log_printf("%u\n", tool_strcmp(string_table + sym->st_name, "import_test"));
|
||||
if (tool_strcmp(string_table + sym->st_name, "import_test") == 0) {
|
||||
log_printf("0x%x\n", head + sym->st_value);
|
||||
void (*imp)( ) = (void *)head + sym->st_value;
|
||||
// imp = &import_test;
|
||||
// void (*imp)( ) = (void *)head + sym->st_value;
|
||||
// imp = &import_test;
|
||||
}
|
||||
break;
|
||||
case STT_FUNC: log_printf("объект кода\n"); break;
|
||||
|
@ -120,6 +120,7 @@ typedef struct {
|
||||
uint64_t (*new_thread)(void (*func)(void *), char *name);
|
||||
void (*delete_thread)( );
|
||||
time_t (*get_time)( );
|
||||
module_info_t *ret;
|
||||
} __attribute__((packed)) env_t;
|
||||
|
||||
#endif // types.h
|
||||
|
@ -106,9 +106,9 @@ def create_hdd(IMAGE_NAME):
|
||||
os.system(f"sgdisk {IMAGE_NAME}.hdd -n 1:2048 -t 1:ef00")
|
||||
os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd")
|
||||
os.system(f"mformat -i {IMAGE_NAME}.hdd@@1M")
|
||||
os.system(f"mmd -i {IMAGE_NAME}.hdd@@1M ::/mod ::/EFI ::/EFI/BOOT")
|
||||
os.system(f"mmd -i {IMAGE_NAME}.hdd@@1M ::/EFI ::/EFI/BOOT")
|
||||
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 iso_root/mod/ ::/")
|
||||
os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M limine/BOOTX64.EFI limine/BOOTIA32.EFI ::/EFI/BOOT")
|
||||
os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user