mirror of
https://github.com/0Nera/BMOSP.git
synced 2024-12-23 14:26:50 +03:00
Изменение логики загрузки модулей
This commit is contained in:
parent
c2aef230fc
commit
c8347f0d5f
44
include/sys.h
Normal file
44
include/sys.h
Normal file
@ -0,0 +1,44 @@
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
void (*fb_printf)(char *str, ...);
|
||||
} env_t;
|
||||
|
||||
typedef struct {
|
||||
int reserved;
|
||||
} framebuffer_t;
|
||||
|
||||
typedef struct {
|
||||
int reserved;
|
||||
} sys_info_t;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
void *addr;
|
||||
} module_func_t;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *message;
|
||||
int err_code;
|
||||
uint64_t func_count;
|
||||
module_func_t *func[];
|
||||
} module_info_t;
|
||||
|
||||
typedef struct {
|
||||
int reserved;
|
||||
} func_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t a[4];
|
||||
uint8_t b[4];
|
||||
uint8_t c[4];
|
||||
uint8_t d[4];
|
||||
} uid_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t year;
|
||||
uint8_t month;
|
||||
uint8_t day;
|
||||
uint8_t second;
|
||||
} time_t;
|
@ -1,3 +1,3 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 1
|
||||
#define VERSION_BUILD 40
|
||||
#define VERSION_BUILD 61
|
||||
|
@ -48,6 +48,8 @@ void init( ) {
|
||||
bpp = boot_framebuffer->bpp;
|
||||
|
||||
for (uint64_t i = 0; i < width * height; i++) { fb_addr[i] = background; }
|
||||
|
||||
fb::printf("0x%x %ux%u\n", fb_addr, width, height);
|
||||
}
|
||||
|
||||
static inline void print_bits(size_t x, size_t y, uint8_t num) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <fb.h>
|
||||
#include <limine.h>
|
||||
#include <mod.h>
|
||||
#include <sys.h>
|
||||
|
||||
// Структуры соответствующие ELF заголовкам
|
||||
typedef struct {
|
||||
@ -86,15 +87,16 @@ void init( ) {
|
||||
module_ptr->mbr_disk_id, module_ptr->tftp_ip,
|
||||
module_ptr->tftp_port);
|
||||
|
||||
long long (*module_init)(env_t * env) = (long long (*)(env_t * env))
|
||||
elf_entry(module_ptr->address, module_ptr->size);
|
||||
module_info_t *(*module_init)(env_t * env) =
|
||||
(module_info_t * (*)(env_t * env))
|
||||
elf_entry(module_ptr->address, module_ptr->size);
|
||||
|
||||
fb::printf("\t->Точка входа: 0x%x\n", module_init);
|
||||
|
||||
int ret = module_init(&main_env);
|
||||
module_info_t *ret = module_init(&main_env);
|
||||
|
||||
fb::printf("Инициализированно с кодом: %x\n", ret);
|
||||
fb::printf("Сообщение из модуля: %s\n\n", (char *)ret);
|
||||
fb::printf("Инициализированно с кодом: %u\n", ret->err_code);
|
||||
fb::printf("Сообщение из модуля: %s\n\n", ret->message);
|
||||
}
|
||||
}
|
||||
} // namespace mod
|
@ -1,34 +1,5 @@
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct {
|
||||
int reserved;
|
||||
} framebuffer_t;
|
||||
|
||||
typedef struct {
|
||||
int reserved;
|
||||
} sys_info_t;
|
||||
|
||||
typedef struct {
|
||||
int reserved;
|
||||
} module_info_t;
|
||||
|
||||
typedef struct {
|
||||
int reserved;
|
||||
} func_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t a[4];
|
||||
uint8_t b[4];
|
||||
uint8_t c[4];
|
||||
uint8_t d[4];
|
||||
} uid_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t year;
|
||||
uint8_t month;
|
||||
uint8_t day;
|
||||
uint8_t second;
|
||||
} time_t;
|
||||
#include <sys.h>
|
||||
|
||||
namespace sys {
|
||||
void init( ) {}
|
||||
|
Loading…
Reference in New Issue
Block a user