Изменение структуры

This commit is contained in:
Aren Elchinyan 2023-12-12 21:11:06 +03:00
parent a540661cf4
commit fa67828241
22 changed files with 118 additions and 218 deletions

View File

@ -1,4 +1,4 @@
ColumnLimit: 80 ColumnLimit: 120
IndentWidth: 4 IndentWidth: 4
UseTab: ForIndentation UseTab: ForIndentation
TabWidth: 4 TabWidth: 4

View File

@ -15,4 +15,4 @@ done
cd .. cd ..
python3 pbuild.py python3 scripts/pbuild.py

View File

@ -21,8 +21,7 @@
#define FONT_6X8_SLIM_CHAR_WIDTH 6 #define FONT_6X8_SLIM_CHAR_WIDTH 6
#define FONT_6X8_SLIM_CHAR_HEIGHT 8 #define FONT_6X8_SLIM_CHAR_HEIGHT 8
#define FONT_6X8_SLIM_FONT_TYPE (FONT_TYPE_MONOSPACED) #define FONT_6X8_SLIM_FONT_TYPE (FONT_TYPE_MONOSPACED)
#define FONT_6X8_SLIM_ARRAY_LENGTH \ #define FONT_6X8_SLIM_ARRAY_LENGTH (FONT_6X8_SLIM_LENGTH * FONT_6X8_SLIM_CHAR_HEIGHT)
(FONT_6X8_SLIM_LENGTH * FONT_6X8_SLIM_CHAR_HEIGHT)
static const unsigned char font_6x8_slim[FONT_6X8_SLIM_ARRAY_LENGTH] = { static const unsigned char font_6x8_slim[FONT_6X8_SLIM_ARRAY_LENGTH] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Символ 32 < > 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Символ 32 < >

View File

@ -35,8 +35,7 @@ enum colors {
#ifndef NO_DEBUG #ifndef NO_DEBUG
#define LOG(...) \ #define LOG(...) \
fb_printf("[%u]%s() (%s:%d) ", GET_TICK_BIG, __func__, __FILE__, \ fb_printf("[%u]%s() (%s:%d) ", GET_TICK_BIG, __func__, __FILE__, __LINE__); \
__LINE__); \
fb_printf(__VA_ARGS__) fb_printf(__VA_ARGS__)
#else #else
#define LOG(...) #define LOG(...)

View File

@ -18,16 +18,14 @@
#define assert(check) \ #define assert(check) \
do { \ do { \
if (!(check)) { \ if (!(check)) { \
fb_printf("\nassert() failed in %s() (%s:%d)\n", __func__, \ fb_printf("\nassert() failed in %s() (%s:%d)\n", __func__, __FILE__, __LINE__); \
__FILE__, __LINE__); \
for (;;) asm volatile("hlt"); \ for (;;) asm volatile("hlt"); \
} \ } \
} while (0) } while (0)
#define ALIGN_UP(NUM, ALIGN) (((NUM) + ALIGN - 1) & ~(ALIGN - 1)) #define ALIGN_UP(NUM, ALIGN) (((NUM) + ALIGN - 1) & ~(ALIGN - 1))
#define ALIGN_DOWN(NUM, ALIGN) ((NUM) & ~(ALIGN - 1)) #define ALIGN_DOWN(NUM, ALIGN) ((NUM) & ~(ALIGN - 1))
#define CONTAINER_OF(PTR, TYPE, MEMBER) \ #define CONTAINER_OF(PTR, TYPE, MEMBER) ((TYPE *)((void *)PTR - offsetof(TYPE, MEMBER)))
((TYPE *)((void *)PTR - offsetof(TYPE, MEMBER)))
#define BIT_SET(BIT) (bitmap[(BIT) / 8] |= (1 << ((BIT) % 8))) #define BIT_SET(BIT) (bitmap[(BIT) / 8] |= (1 << ((BIT) % 8)))
#define BIT_CLEAR(BIT) (bitmap[(BIT) / 8] &= ~(1 << ((BIT) % 8))) #define BIT_CLEAR(BIT) (bitmap[(BIT) / 8] &= ~(1 << ((BIT) % 8)))

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 1 #define VERSION_MINOR 1
#define VERSION_BUILD 769 #define VERSION_BUILD 771

View File

@ -14,19 +14,15 @@
static bool acpi_msrs_support = false; static bool acpi_msrs_support = false;
static void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, static void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) {
uint32_t *edx) { asm volatile("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "a"(leaf));
asm volatile("cpuid"
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
: "a"(leaf));
} }
static void msr_get(uint32_t msr, uint32_t *lo, uint32_t *hi) { static void msr_get(uint32_t msr, uint32_t *lo, uint32_t *hi) {
asm volatile("rdmsr" : "=a"(*lo), "=d"(*hi) : "c"(msr)); asm volatile("rdmsr" : "=a"(*lo), "=d"(*hi) : "c"(msr));
} }
static void __attribute__((unused)) static void __attribute__((unused)) msr_set(uint32_t msr, uint32_t lo, uint32_t hi) {
msr_set(uint32_t msr, uint32_t lo, uint32_t hi) {
asm volatile("wrmsr" : : "a"(lo), "d"(hi), "c"(msr)); asm volatile("wrmsr" : : "a"(lo), "d"(hi), "c"(msr));
} }
@ -71,8 +67,7 @@ static void brandname( ) {
uint32_t manufacturer[4]; uint32_t manufacturer[4];
char manufacturer_string[13]; char manufacturer_string[13];
cpuid(0, &manufacturer[3], &manufacturer[0], &manufacturer[2], cpuid(0, &manufacturer[3], &manufacturer[0], &manufacturer[2], &manufacturer[1]);
&manufacturer[1]);
tool_memcpy(manufacturer_string, manufacturer, 12); tool_memcpy(manufacturer_string, manufacturer, 12);
brand_string[48] = 0; brand_string[48] = 0;
@ -93,10 +88,7 @@ static void brandname( ) {
} }
void cpu_idle( ) { void cpu_idle( ) {
if (acpi_msrs_support) { if (acpi_msrs_support) { LOG("Температура: %d (в QEMU/KVM всегда 0)\n", get_cpu_temperature_intel( )); }
LOG("Температура: %d (в QEMU/KVM всегда 0)\n",
get_cpu_temperature_intel( ));
}
} }
void cpu_init( ) { void cpu_init( ) {
@ -111,8 +103,7 @@ void cpu_init( ) {
if ((edx >> 22) & 1) { if ((edx >> 22) & 1) {
acpi_msrs_support = true; acpi_msrs_support = true;
LOG("Встроенный терморегулятор MSRS для ACPI\n"); LOG("Встроенный терморегулятор MSRS для ACPI\n");
LOG("Температура: %d (в QEMU/KVM всегда 0)\n", LOG("Температура: %d (в QEMU/KVM всегда 0)\n", get_cpu_temperature_intel( ));
get_cpu_temperature_intel( ));
} }
cpuid(0x80000000, &eax, &ebx, &ecx, &edx); cpuid(0x80000000, &eax, &ebx, &ecx, &edx);
@ -128,9 +119,7 @@ void cpu_init( ) {
"поддерживается!\n"); "поддерживается!\n");
} }
if ((edx >> 10) & 1) { if ((edx >> 10) & 1) { LOG("SYSCALL/SYSRET(для AMD семейства 5 линейки 7) подерживаются!\n"); }
LOG("SYSCALL/SYSRET(для AMD семейства 5 линейки 7) подерживаются!\n");
}
if ((edx >> 11) & 1) { LOG("SYSCALL/SYSRET подерживаются!\n"); } if ((edx >> 11) & 1) { LOG("SYSCALL/SYSRET подерживаются!\n"); }
if ((edx >> 29) & 1) { LOG("AMD64 поддерживается!\n"); } if ((edx >> 29) & 1) { LOG("AMD64 поддерживается!\n"); }
@ -138,12 +127,8 @@ void cpu_init( ) {
cpuid(0x80000007, &eax, &ebx, &ecx, &edx); cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
if ((edx >> 0) & 1) { LOG("Датчик температуры поддерживается!\n"); } if ((edx >> 0) & 1) { LOG("Датчик температуры поддерживается!\n"); }
if ((edx >> 4) & 1) { if ((edx >> 4) & 1) { LOG("Аппаратный терморегулятор (HTC) поддерживается!\n"); }
LOG("Аппаратный терморегулятор (HTC) поддерживается!\n"); if ((edx >> 5) & 1) { LOG("Программный терморегулятор (STC) поддерживается!\n"); }
}
if ((edx >> 5) & 1) {
LOG("Программный терморегулятор (STC) поддерживается!\n");
}
brandname( ); brandname( );
} }

View File

@ -38,8 +38,7 @@ void gdt_load( ) {
load_gdt((uint64_t)&gdtr); load_gdt((uint64_t)&gdtr);
} }
void set_gdt_entry(gdt_entry_t *entry, uint16_t limit, uint64_t base, void set_gdt_entry(gdt_entry_t *entry, uint16_t limit, uint64_t base, uint8_t access, uint8_t granularity) {
uint8_t access, uint8_t granularity) {
entry->limit = limit; entry->limit = limit;
entry->base_16 = base & 0xFFFF; entry->base_16 = base & 0xFFFF;
entry->base_middle_16 = (base >> 16) & 0xFF; entry->base_middle_16 = (base >> 16) & 0xFF;

View File

@ -66,17 +66,15 @@ void exception_handler(struct frame state) {
" RIP=%x RFLAGS=%x\n" " RIP=%x RFLAGS=%x\n"
" CS=%x SS=%x\n" " CS=%x SS=%x\n"
" ERR=%x INT=%u", " ERR=%x INT=%u",
state.rax, state.rbx, state.rcx, state.rdx, state.rsi, state.rdi, state.rax, state.rbx, state.rcx, state.rdx, state.rsi, state.rdi, state.rbp, state.rsp, state.r8, state.r9,
state.rbp, state.rsp, state.r8, state.r9, state.r10, state.r11, state.r10, state.r11, state.r12, state.r13, state.r14, state.r15, state.rip, state.rflags, state.cs, state.ss,
state.r12, state.r13, state.r14, state.r15, state.rip, state.rflags, state.err, state.int_number);
state.cs, state.ss, state.err, state.int_number);
LOG("stack_top = %x\n", stack_top); LOG("stack_top = %x\n", stack_top);
asm volatile("cli; hlt"); asm volatile("cli; hlt");
} }
static void idt_desc_setup(struct idt_desc *desc, unsigned sel, uintptr_t offs, static void idt_desc_setup(struct idt_desc *desc, unsigned sel, uintptr_t offs, unsigned flags) {
unsigned flags) {
desc->offs0 = offs & 0xfffful; desc->offs0 = offs & 0xfffful;
desc->offs1 = (offs >> 16) & 0xfffful; desc->offs1 = (offs >> 16) & 0xfffful;
desc->offs2 = (offs >> 32) & 0xfffffffful; desc->offs2 = (offs >> 32) & 0xfffffffful;
@ -92,8 +90,7 @@ static void idt_load( ) {
} }
void idt_set_int(uint8_t vector, void *int_handler) { void idt_set_int(uint8_t vector, void *int_handler) {
idt_desc_setup(&IDT[vector], KERNEL_CS, (uintptr_t)int_handler, idt_desc_setup(&IDT[vector], KERNEL_CS, (uintptr_t)int_handler, IDT_INTERRUPT_FLAGS);
IDT_INTERRUPT_FLAGS);
idt_load( ); idt_load( );
} }
@ -112,8 +109,7 @@ void idt_init( ) {
idt_desc_setup(&IDT[i], KERNEL_CS, handler, IDT_INTERRUPT_FLAGS); idt_desc_setup(&IDT[i], KERNEL_CS, handler, IDT_INTERRUPT_FLAGS);
} }
idt_desc_setup(&IDT[255], KERNEL_CS, (uintptr_t)isr_stubs[255], idt_desc_setup(&IDT[255], KERNEL_CS, (uintptr_t)isr_stubs[255], IDT_SPURIOUS_FLAGS);
IDT_SPURIOUS_FLAGS);
idt_load( ); idt_load( );
LOG("IDT инициализирован\n"); LOG("IDT инициализирован\n");

View File

@ -16,9 +16,7 @@
#include <tool.h> #include <tool.h>
static volatile struct limine_framebuffer_request framebuffer_request = { static volatile struct limine_framebuffer_request framebuffer_request = {
.id = LIMINE_FRAMEBUFFER_REQUEST, .id = LIMINE_FRAMEBUFFER_REQUEST, .revision = 0, .response = (struct limine_framebuffer_response *)0
.revision = 0,
.response = (struct limine_framebuffer_response *)0
}; };
static struct limine_framebuffer_response *framebuffer_response; static struct limine_framebuffer_response *framebuffer_response;
@ -58,24 +56,18 @@ void fb_init( ) {
if (framebuffer_response->framebuffer_count == 1) { return; } if (framebuffer_response->framebuffer_count == 1) { return; }
LOG("Инициализация дополнительных: %u мониторов\n", LOG("Инициализация дополнительных: %u мониторов\n", framebuffer_response->framebuffer_count);
framebuffer_response->framebuffer_count);
for (uint64_t i = 1; i < framebuffer_response->framebuffer_count; i++) { for (uint64_t i = 1; i < framebuffer_response->framebuffer_count; i++) {
struct limine_framebuffer *framebuffer = struct limine_framebuffer *framebuffer = framebuffer_response->framebuffers[i];
framebuffer_response->framebuffers[i];
uint32_t *framebuffer_addr = (uint32_t *)framebuffer->address; uint32_t *framebuffer_addr = (uint32_t *)framebuffer->address;
LOG("[%u]->0x%x %ux%u\n", i, framebuffer->address, framebuffer->width, LOG("[%u]->0x%x %ux%u\n", i, framebuffer->address, framebuffer->width, framebuffer->height);
framebuffer->height); for (uint64_t ij = 0; ij < width * height; ij++) { framebuffer_addr[ij] = background; }
for (uint64_t ij = 0; ij < width * height; ij++) {
framebuffer_addr[ij] = background;
}
} }
} }
// Отрисовка буффера по координатам (полезно для картинок) // Отрисовка буффера по координатам (полезно для картинок)
void fb_print_buf(uint64_t x, uint64_t y, uint64_t h, uint64_t w, void fb_print_buf(uint64_t x, uint64_t y, uint64_t h, uint64_t w, uint32_t *buf) {
uint32_t *buf) {
for (uint64_t j = 0; j < h; j++) { for (uint64_t j = 0; j < h; j++) {
for (uint64_t i = 0; i < w; i++) { for (uint64_t i = 0; i < w; i++) {
uint64_t where = (i + x) + (j + y) * width; uint64_t where = (i + x) + (j + y) * width;
@ -86,9 +78,7 @@ void fb_print_buf(uint64_t x, uint64_t y, uint64_t h, uint64_t w,
static inline void print_bits(size_t x, size_t y, uint8_t num) { static inline void print_bits(size_t x, size_t y, uint8_t num) {
for (size_t i = 0; i <= 7; i++) { for (size_t i = 0; i <= 7; i++) {
if ((num >> i) & 1) { if ((num >> i) & 1) { SCREEN_BUFFER[x + i + y * SCREEN_WIDTH] = text_color; }
SCREEN_BUFFER[x + i + y * SCREEN_WIDTH] = text_color;
}
} }
} }
@ -105,20 +95,15 @@ static void print_char(int x, int y, char glyth) {
} }
void scroll_fb( ) { void scroll_fb( ) {
size_t last_line_index = size_t last_line_index = (SCREEN_HEIGHT - (FONT_6X8_SLIM_CHAR_HEIGHT)) * SCREEN_WIDTH;
(SCREEN_HEIGHT - (FONT_6X8_SLIM_CHAR_HEIGHT)) * SCREEN_WIDTH;
for (uint64_t y = 0; y < SCREEN_HEIGHT - (FONT_6X8_SLIM_CHAR_HEIGHT); y++) { for (uint64_t y = 0; y < SCREEN_HEIGHT - (FONT_6X8_SLIM_CHAR_HEIGHT); y++) {
for (uint64_t x = 0; x < SCREEN_WIDTH; x++) { for (uint64_t x = 0; x < SCREEN_WIDTH; x++) {
SCREEN_BUFFER[x + y * SCREEN_WIDTH] = SCREEN_BUFFER[x + y * SCREEN_WIDTH] = SCREEN_BUFFER[x + (y + (FONT_6X8_SLIM_CHAR_HEIGHT)) * SCREEN_WIDTH];
SCREEN_BUFFER[x +
(y + (FONT_6X8_SLIM_CHAR_HEIGHT)) * SCREEN_WIDTH];
} }
} }
for (uint64_t i = last_line_index; i < SCREEN_HEIGHT * SCREEN_WIDTH; i++) { for (uint64_t i = last_line_index; i < SCREEN_HEIGHT * SCREEN_WIDTH; i++) { SCREEN_BUFFER[i] = background; }
SCREEN_BUFFER[i] = background;
}
} }
// Вывод одного символа // Вывод одного символа

View File

@ -31,24 +31,21 @@ typedef struct {
unsigned int *tga_parse(unsigned char *ptr, int size) { unsigned int *tga_parse(unsigned char *ptr, int size) {
unsigned int *data; unsigned int *data;
int i, j, k, x, y, w = (ptr[13] << 8) + ptr[12], int i, j, k, x, y, w = (ptr[13] << 8) + ptr[12], h = (ptr[15] << 8) + ptr[14], o = (ptr[11] << 8) + ptr[10];
h = (ptr[15] << 8) + ptr[14],
o = (ptr[11] << 8) + ptr[10];
int m = ((ptr[1] ? (ptr[7] >> 3) * ptr[5] : 0) + 18); int m = ((ptr[1] ? (ptr[7] >> 3) * ptr[5] : 0) + 18);
if (w < 1 || h < 1) return NULL; if (w < 1 || h < 1) return NULL;
data = (unsigned int *)mem_alloc((w * h + 2) * sizeof(unsigned int)); data = (unsigned int *)mem_alloc((w * h + 2) * sizeof(unsigned int));
if (!data) { if (!data) {
LOG("Ошибка декодирования TGA на строчке: %u, %x, %u kb\n", __LINE__, LOG("Ошибка декодирования TGA на строчке: %u, %x, %u kb\n", __LINE__, data,
data, ((w * h + 2) * sizeof(unsigned int)) / 1024); ((w * h + 2) * sizeof(unsigned int)) / 1024);
return NULL; return NULL;
} }
switch (ptr[2]) { switch (ptr[2]) {
case 1: case 1:
if (ptr[6] != 0 || ptr[4] != 0 || ptr[3] != 0 || if (ptr[6] != 0 || ptr[4] != 0 || ptr[3] != 0 || (ptr[7] != 24 && ptr[7] != 32)) {
(ptr[7] != 24 && ptr[7] != 32)) {
TGA_ERR( ); TGA_ERR( );
mem_free(data); mem_free(data);
return NULL; return NULL;
@ -57,15 +54,13 @@ unsigned int *tga_parse(unsigned char *ptr, int size) {
k = ((!o ? h - y - 1 : y) * w); k = ((!o ? h - y - 1 : y) * w);
for (x = 0; x < w; x++) { for (x = 0; x < w; x++) {
j = ptr[m + k++] * (ptr[7] >> 3) + 18; j = ptr[m + k++] * (ptr[7] >> 3) + 18;
data[2 + i++] = ((ptr[7] == 32 ? ptr[j + 3] : 0xFF) << 24) | data[2 + i++] =
(ptr[j + 2] << 16) | (ptr[j + 1] << 8) | ((ptr[7] == 32 ? ptr[j + 3] : 0xFF) << 24) | (ptr[j + 2] << 16) | (ptr[j + 1] << 8) | ptr[j];
ptr[j];
} }
} }
break; break;
case 2: case 2:
if (ptr[5] != 0 || ptr[6] != 0 || ptr[1] != 0 || if (ptr[5] != 0 || ptr[6] != 0 || ptr[1] != 0 || (ptr[16] != 24 && ptr[16] != 32)) {
(ptr[16] != 24 && ptr[16] != 32)) {
TGA_ERR( ); TGA_ERR( );
mem_free(data); mem_free(data);
return NULL; return NULL;
@ -74,15 +69,13 @@ unsigned int *tga_parse(unsigned char *ptr, int size) {
j = ((!o ? h - y - 1 : y) * w * (ptr[16] >> 3)); j = ((!o ? h - y - 1 : y) * w * (ptr[16] >> 3));
for (x = 0; x < w; x++) { for (x = 0; x < w; x++) {
data[2 + i++] = data[2 + i++] =
((ptr[16] == 32 ? ptr[j + 3] : 0xFF) << 24) | ((ptr[16] == 32 ? ptr[j + 3] : 0xFF) << 24) | (ptr[j + 2] << 16) | (ptr[j + 1] << 8) | ptr[j];
(ptr[j + 2] << 16) | (ptr[j + 1] << 8) | ptr[j];
j += ptr[16] >> 3; j += ptr[16] >> 3;
} }
} }
break; break;
case 9: case 9:
if (ptr[6] != 0 || ptr[4] != 0 || ptr[3] != 0 || if (ptr[6] != 0 || ptr[4] != 0 || ptr[3] != 0 || (ptr[7] != 24 && ptr[7] != 32)) {
(ptr[7] != 24 && ptr[7] != 32)) {
TGA_ERR( ); TGA_ERR( );
mem_free(data); mem_free(data);
return NULL; return NULL;
@ -99,9 +92,8 @@ unsigned int *tga_parse(unsigned char *ptr, int size) {
i = ((!o ? h - y - 1 : y) * w); i = ((!o ? h - y - 1 : y) * w);
y++; y++;
} }
data[2 + i++] = data[2 + i++] = ((ptr[7] == 32 ? ptr[j + 3] : 0xFF) << 24) | (ptr[j + 2] << 16) |
((ptr[7] == 32 ? ptr[j + 3] : 0xFF) << 24) | (ptr[j + 1] << 8) | ptr[j];
(ptr[j + 2] << 16) | (ptr[j + 1] << 8) | ptr[j];
} }
} else { } else {
k++; k++;
@ -112,16 +104,14 @@ unsigned int *tga_parse(unsigned char *ptr, int size) {
i = ((!o ? h - y - 1 : y) * w); i = ((!o ? h - y - 1 : y) * w);
y++; y++;
} }
data[2 + i++] = data[2 + i++] = ((ptr[7] == 32 ? ptr[j + 3] : 0xFF) << 24) | (ptr[j + 2] << 16) |
((ptr[7] == 32 ? ptr[j + 3] : 0xFF) << 24) | (ptr[j + 1] << 8) | ptr[j];
(ptr[j + 2] << 16) | (ptr[j + 1] << 8) | ptr[j];
} }
} }
} }
break; break;
case 10: case 10:
if (ptr[5] != 0 || ptr[6] != 0 || ptr[1] != 0 || if (ptr[5] != 0 || ptr[6] != 0 || ptr[1] != 0 || (ptr[16] != 24 && ptr[16] != 32)) {
(ptr[16] != 24 && ptr[16] != 32)) {
TGA_ERR( ); TGA_ERR( );
mem_free(data); mem_free(data);
return NULL; return NULL;
@ -137,9 +127,8 @@ unsigned int *tga_parse(unsigned char *ptr, int size) {
i = ((!o ? h - y - 1 : y) * w); i = ((!o ? h - y - 1 : y) * w);
y++; y++;
} }
data[2 + i++] = data[2 + i++] = ((ptr[16] == 32 ? ptr[m + 3] : 0xFF) << 24) | (ptr[m + 2] << 16) |
((ptr[16] == 32 ? ptr[m + 3] : 0xFF) << 24) | (ptr[m + 1] << 8) | ptr[m];
(ptr[m + 2] << 16) | (ptr[m + 1] << 8) | ptr[m];
} }
m += ptr[16] >> 3; m += ptr[16] >> 3;
} else { } else {
@ -150,9 +139,8 @@ unsigned int *tga_parse(unsigned char *ptr, int size) {
i = ((!o ? h - y - 1 : y) * w); i = ((!o ? h - y - 1 : y) * w);
y++; y++;
} }
data[2 + i++] = data[2 + i++] = ((ptr[16] == 32 ? ptr[m + 3] : 0xFF) << 24) | (ptr[m + 2] << 16) |
((ptr[16] == 32 ? ptr[m + 3] : 0xFF) << 24) | (ptr[m + 1] << 8) | ptr[m];
(ptr[m + 2] << 16) | (ptr[m + 1] << 8) | ptr[m];
m += ptr[16] >> 3; m += ptr[16] >> 3;
} }
} }
@ -176,9 +164,7 @@ void main( ) {
tga_header_t *head = (tga_header_t *)bootpng_ptr; tga_header_t *head = (tga_header_t *)bootpng_ptr;
if (res != NULL) { if (res != NULL) { LOG("Размер экрана загрузки: %ux%u \n", res[0], res[1]); }
LOG("Размер экрана загрузки: %ux%u \n", res[0], res[1]);
}
LOG("Размер экрана загрузки: %ux%u \n", head->h, head->w); LOG("Размер экрана загрузки: %ux%u \n", head->h, head->w);
mem_dump_memory( ); mem_dump_memory( );

View File

@ -13,16 +13,12 @@
#include <stdbool.h> #include <stdbool.h>
#include <tool.h> #include <tool.h>
static volatile struct limine_memmap_request memmap_request = { static volatile struct limine_memmap_request memmap_request = { .id = LIMINE_MEMMAP_REQUEST,
.id = LIMINE_MEMMAP_REQUEST,
.revision = 0, .revision = 0,
.response = (struct limine_memmap_response *)0 .response = (struct limine_memmap_response *)0 };
}; static volatile struct limine_hhdm_request hhdm_request = { .id = LIMINE_HHDM_REQUEST,
static volatile struct limine_hhdm_request hhdm_request = {
.id = LIMINE_HHDM_REQUEST,
.revision = 0, .revision = 0,
.response = (struct limine_hhdm_response *)0 .response = (struct limine_hhdm_response *)0 };
};
struct mem_entry { struct mem_entry {
struct mem_entry *next; struct mem_entry *next;
@ -50,11 +46,9 @@ static uint64_t highest = 0;
// Количество записей в карте памяти // Количество записей в карте памяти
static uint64_t mmmap_count = 0; static uint64_t mmmap_count = 0;
static const char memory_types[8][82] = { static const char memory_types[8][82] = { "Доступно", "Зарезервировано", "ACPI, можно освободить",
"Доступно", "Зарезервировано", "ACPI, можно освободить",
"ACPI NVS", "Плохая память", "Загрузчик, можно освободить", "ACPI NVS", "Плохая память", "Загрузчик, можно освободить",
"Ядро и модули", "Буфер кадра" "Ядро и модули", "Буфер кадра" };
};
static struct limine_memmap_response *memmap_response; static struct limine_memmap_response *memmap_response;
@ -65,13 +59,10 @@ void mem_dump_memory( ) {
while (curr) { while (curr) {
if (curr->next) { if (curr->next) {
fb_printf("->0x%x | %u килобайт | %s | 0x%x\n", &curr->data, fb_printf("->0x%x | %u килобайт | %s | 0x%x\n", &curr->data, (curr->size) / 1024,
(curr->size) / 1024, curr->free ? memory_types[0] : memory_types[1], curr->next);
curr->free ? memory_types[0] : memory_types[1],
curr->next);
} else { } else {
fb_printf("->0x%x | %u килобайт | %s | Это последний блок\n", fb_printf("->0x%x | %u килобайт | %s | Это последний блок\n", &curr->data, (curr->size) / 1024,
&curr->data, (curr->size) / 1024,
curr->free ? memory_types[0] : memory_types[1]); curr->free ? memory_types[0] : memory_types[1]);
} }
curr = curr->next; curr = curr->next;
@ -270,8 +261,7 @@ void mem_init( ) {
if (mmaps[i]->type == LIMINE_MEMMAP_FRAMEBUFFER) { if (mmaps[i]->type == LIMINE_MEMMAP_FRAMEBUFFER) {
LOG("На видеопамять BIOS/UEFI выделено: %u мегабайт + %u " LOG("На видеопамять BIOS/UEFI выделено: %u мегабайт + %u "
"килобайт\n", "килобайт\n",
mmaps[i]->length / 1024 / 1024, mmaps[i]->length / 1024 / 1024, (mmaps[i]->length / 1024) % 1024);
(mmaps[i]->length / 1024) % 1024);
} }
if (!(mmaps[i]->type == LIMINE_MEMMAP_USABLE)) { continue; } if (!(mmaps[i]->type == LIMINE_MEMMAP_USABLE)) { continue; }
@ -299,22 +289,17 @@ void mem_init( ) {
// Освобождаем все доступные фреймы памяти // Освобождаем все доступные фреймы памяти
for (uint64_t i = 0; i < mmmap_count; i++) { for (uint64_t i = 0; i < mmmap_count; i++) {
for (uint64_t t = 0; t < mmaps[i]->length; t += BLOCK_SIZE) { for (uint64_t t = 0; t < mmaps[i]->length; t += BLOCK_SIZE) { bitmap_limit++; }
bitmap_limit++;
}
if (!(mmaps[i]->type == LIMINE_MEMMAP_USABLE)) { continue; } if (!(mmaps[i]->type == LIMINE_MEMMAP_USABLE)) { continue; }
for (uint64_t t = 0; t < mmaps[i]->length; t += BLOCK_SIZE) { for (uint64_t t = 0; t < mmaps[i]->length; t += BLOCK_SIZE) { mem_frame_free((void *)mmaps[i]->base + t, 1); }
mem_frame_free((void *)mmaps[i]->base + t, 1);
}
} }
LOG("%u / %u блоков доступно\n", bitmap_available, bitmap_limit); LOG("%u / %u блоков доступно\n", bitmap_available, bitmap_limit);
LOG("Размер битовой карты: %u\n", bitmap_size); LOG("Размер битовой карты: %u\n", bitmap_size);
alloc_init(mem_frame_alloc(1), BLOCK_SIZE); alloc_init(mem_frame_alloc(1), BLOCK_SIZE);
LOG("%u мегабайт выделено в динамичную память\n", LOG("%u мегабайт выделено в динамичную память\n", (256 * 16 * BLOCK_SIZE + BLOCK_SIZE) / 1024 / 1024);
(256 * 16 * BLOCK_SIZE + BLOCK_SIZE) / 1024 / 1024);
// Выделяем по 4 мегабайта в аллокатор динамичной памяти // Выделяем по 4 мегабайта в аллокатор динамичной памяти
for (int64_t i = 0; i < 16; i += 4) { for (int64_t i = 0; i < 16; i += 4) {
@ -323,8 +308,8 @@ void mem_init( ) {
} }
mem_merge_all_blocks( ); mem_merge_all_blocks( );
mem_dump_memory( ); mem_dump_memory( );
LOG("%u МБ объем доступной памяти, %u МБ объем виртуальной памяти\n", LOG("%u МБ объем доступной памяти, %u МБ объем виртуальной памяти\n", (bitmap_available * BLOCK_SIZE) / 1024 / 1024,
(bitmap_available * BLOCK_SIZE) / 1024 / 1024, available / 1024 / 1024); available / 1024 / 1024);
LOG("%u / %u блоков доступно\n", bitmap_available, bitmap_limit); LOG("%u / %u блоков доступно\n", bitmap_available, bitmap_limit);
} }

View File

@ -13,11 +13,9 @@
#include <sys.h> #include <sys.h>
#include <tool.h> #include <tool.h>
static volatile struct limine_module_request module_request = { static volatile struct limine_module_request module_request = { .id = LIMINE_MODULE_REQUEST,
.id = LIMINE_MODULE_REQUEST,
.revision = 0, .revision = 0,
.response = (struct limine_module_response *)0 .response = (struct limine_module_response *)0 };
};
static struct limine_module_response *module_response; static struct limine_module_response *module_response;
uint64_t modules_count = 0; uint64_t modules_count = 0;
@ -33,8 +31,7 @@ uint64_t bootpng_size;
static void *elf_entry(elf64_header_t *module_bin) { static void *elf_entry(elf64_header_t *module_bin) {
// Приводим заголовок ELF файла к типу elf64_header_t // Приводим заголовок ELF файла к типу elf64_header_t
elf64_header_t *elf_header = (elf64_header_t *)module_bin; elf64_header_t *elf_header = (elf64_header_t *)module_bin;
LOG("(uint64_t)elf_header->e_entry = 0x%x, type = %u\n", LOG("(uint64_t)elf_header->e_entry = 0x%x, type = %u\n", (uint64_t)elf_header->e_entry, elf_header->e_type);
(uint64_t)elf_header->e_entry, elf_header->e_type);
if (elf_header->e_type != 2) { if (elf_header->e_type != 2) {
fb_printf("\t\tОшибка! Модуль неправильно собран!\n"); fb_printf("\t\tОшибка! Модуль неправильно собран!\n");
for (;;) {} for (;;) {}
@ -58,9 +55,7 @@ void mod_list_show( ) {
module_info_t *mod_find(char *tag) { module_info_t *mod_find(char *tag) {
for (uint64_t i = 0; i < modules_count; i++) { for (uint64_t i = 0; i < modules_count; i++) {
if (tool_starts_with(module_list[i].name, tag)) { if (tool_starts_with(module_list[i].name, tag)) { return &module_list[i]; }
return &module_list[i];
}
} }
return (module_info_t *)NULL; return (module_info_t *)NULL;
} }
@ -73,8 +68,8 @@ void mod_init( ) {
for (uint64_t i = 0; i < module_count; i++) { for (uint64_t i = 0; i < module_count; i++) {
module_ptr = module_response->modules[i]; module_ptr = module_response->modules[i];
LOG("[%d] %s [%s] 0x%x Размер: %u\n", i, module_ptr->path, LOG("[%d] %s [%s] 0x%x Размер: %u\n", i, module_ptr->path, module_ptr->cmdline, module_ptr->address,
module_ptr->cmdline, module_ptr->address, module_ptr->size); module_ptr->size);
if (modules_count >= MOD_MAX) { if (modules_count >= MOD_MAX) {
LOG("Модуль не обработан. Максимум %u модулей!\n", MOD_MAX); LOG("Модуль не обработан. Максимум %u модулей!\n", MOD_MAX);
@ -104,8 +99,7 @@ void mod_init( ) {
} }
module_info_t (*module_init)(env_t * env) = module_info_t (*module_init)(env_t * env) =
(module_info_t(*)(env_t * env)) (module_info_t(*)(env_t * env)) elf_entry((elf64_header_t *)module_ptr->address);
elf_entry((elf64_header_t *)module_ptr->address);
LOG("\t->Точка входа: 0x%x\n", module_init); LOG("\t->Точка входа: 0x%x\n", module_init);

View File

@ -87,10 +87,7 @@ void tool_int_to_str(int64_t i, uint8_t base, char *buf) {
int64_t remainder = i % base; int64_t remainder = i % base;
// Преобразовываем остаток в символ и добавляем его в строку // Преобразовываем остаток в символ и добавляем его в строку
buf[index++] = buf[index++] =
(remainder > 9) (remainder > 9) ? (remainder - 10) + 'A' : remainder + '0'; // Если остаток > 9, добавляем заглавную букву А
? (remainder - 10) + 'A'
: remainder +
'0'; // Если остаток > 9, добавляем заглавную букву А
i /= base; i /= base;
} while (i > 0); } while (i > 0);
@ -113,10 +110,7 @@ void tool_uint_to_str(uint64_t i, uint8_t base, char *buf) {
uint64_t remainder = i % base; uint64_t remainder = i % base;
// Преобразовываем остаток в символ и добавляем его в строку // Преобразовываем остаток в символ и добавляем его в строку
buf[index++] = buf[index++] =
(remainder > 9) (remainder > 9) ? (remainder - 10) + 'A' : remainder + '0'; // Если остаток > 9, добавляем заглавную букву А
? (remainder - 10) + 'A'
: remainder +
'0'; // Если остаток > 9, добавляем заглавную букву А
i /= base; i /= base;
} while (i > 0); } while (i > 0);
@ -128,8 +122,7 @@ void tool_uint_to_str(uint64_t i, uint8_t base, char *buf) {
} }
// Функция для форматированного вывода // Функция для форматированного вывода
void tool_format(void (*putc)(char c), const char *format_string, void tool_format(void (*putc)(char c), const char *format_string, va_list args) {
va_list args) {
while (*format_string != '\0') { while (*format_string != '\0') {
if (*format_string == '%') { if (*format_string == '%') {
char buf[48]; char buf[48];

View File

@ -2,11 +2,8 @@
static char fxsave_region[512] __attribute__((aligned(16))); static char fxsave_region[512] __attribute__((aligned(16)));
static inline void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, static inline void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) {
uint32_t *ecx, uint32_t *edx) { asm volatile("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "a"(leaf));
asm volatile("cpuid"
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
: "a"(leaf));
} }
static inline void L1_cache_size( ) { static inline void L1_cache_size( ) {
@ -16,9 +13,8 @@ static inline void L1_cache_size( ) {
fb_printf("L1 кэш недоступен\n"); fb_printf("L1 кэш недоступен\n");
return; return;
} }
fb_printf( fb_printf("L1: Размер строки: %u B, Тип ассоциации: %u, Размер кэша: %u КБ\n", ecx & 0xff, (ecx >> 12) & 0x07,
"L1: Размер строки: %u B, Тип ассоциации: %u, Размер кэша: %u КБ\n", (ecx >> 16) & 0xffff);
ecx & 0xff, (ecx >> 12) & 0x07, (ecx >> 16) & 0xffff);
} }
static inline void L2_cache_size( ) { static inline void L2_cache_size( ) {
@ -28,9 +24,8 @@ static inline void L2_cache_size( ) {
fb_printf("L2 кэш недоступен\n"); fb_printf("L2 кэш недоступен\n");
return; return;
} }
fb_printf( fb_printf("L2: Размер строки: %u B, Тип ассоциации: %u, Размер кэша: %u КБ\n", ecx & 0xff, (ecx >> 12) & 0x0F,
"L2: Размер строки: %u B, Тип ассоциации: %u, Размер кэша: %u КБ\n", (ecx >> 16) & 0xFFFF);
ecx & 0xff, (ecx >> 12) & 0x0F, (ecx >> 16) & 0xFFFF);
} }
static inline void L3_cache_size( ) { static inline void L3_cache_size( ) {
@ -40,9 +35,8 @@ static inline void L3_cache_size( ) {
fb_printf("L3 кэш недоступен\n"); fb_printf("L3 кэш недоступен\n");
return; return;
} }
fb_printf( fb_printf("L3: Размер строки: %u B, Тип ассоциации: %u, Размер кэша: %u КБ\n", edx & 0xff, (edx >> 12) & 0x0F,
"L3: Размер строки: %u B, Тип ассоциации: %u, Размер кэша: %u КБ\n", (edx >> 16) & 0xFFFF);
edx & 0xff, (edx >> 12) & 0x0F, (edx >> 16) & 0xFFFF);
} }
module_info_t __attribute__((section(".minit"))) init(env_t *env) { module_info_t __attribute__((section(".minit"))) init(env_t *env) {

View File

@ -25,40 +25,34 @@ static inline void outl(uint16_t port, uint32_t data) {
asm volatile("outl %0, %1" : : "a"(data), "Nd"(port)); asm volatile("outl %0, %1" : : "a"(data), "Nd"(port));
} }
static inline uint16_t pci_read_word(uint16_t bus, uint16_t slot, uint16_t func, static inline uint16_t pci_read_word(uint16_t bus, uint16_t slot, uint16_t func, uint16_t offset) {
uint16_t offset) {
uint64_t address; uint64_t address;
uint64_t lbus = (uint64_t)bus; uint64_t lbus = (uint64_t)bus;
uint64_t lslot = (uint64_t)slot; uint64_t lslot = (uint64_t)slot;
uint64_t lfunc = (uint64_t)func; uint64_t lfunc = (uint64_t)func;
uint16_t tmp = 0; uint16_t tmp = 0;
address = (uint64_t)((lbus << 16) | (lslot << 11) | (lfunc << 8) | address = (uint64_t)((lbus << 16) | (lslot << 11) | (lfunc << 8) | (offset & 0xFC) | ((uint32_t)0x80000000));
(offset & 0xFC) | ((uint32_t)0x80000000));
outl(0xCF8, address); outl(0xCF8, address);
tmp = (uint16_t)((inl(0xCFC) >> ((offset & 2) * 8)) & 0xFFFF); tmp = (uint16_t)((inl(0xCFC) >> ((offset & 2) * 8)) & 0xFFFF);
return (tmp); return (tmp);
} }
static inline uint16_t get_vendor_id(uint16_t bus, uint16_t device, static inline uint16_t get_vendor_id(uint16_t bus, uint16_t device, uint16_t function) {
uint16_t function) {
uint32_t r0 = pci_read_word(bus, device, function, 0); uint32_t r0 = pci_read_word(bus, device, function, 0);
return r0; return r0;
} }
static inline uint16_t get_device_id(uint16_t bus, uint16_t device, static inline uint16_t get_device_id(uint16_t bus, uint16_t device, uint16_t function) {
uint16_t function) {
uint32_t r0 = pci_read_word(bus, device, function, 2); uint32_t r0 = pci_read_word(bus, device, function, 2);
return r0; return r0;
} }
static inline uint16_t get_class_id(uint16_t bus, uint16_t device, static inline uint16_t get_class_id(uint16_t bus, uint16_t device, uint16_t function) {
uint16_t function) {
uint32_t r0 = pci_read_word(bus, device, function, 0xA); uint32_t r0 = pci_read_word(bus, device, function, 0xA);
return (r0 & ~0x00FF) >> 8; return (r0 & ~0x00FF) >> 8;
} }
static inline uint16_t get_sub_class_id(uint16_t bus, uint16_t device, static inline uint16_t get_sub_class_id(uint16_t bus, uint16_t device, uint16_t function) {
uint16_t function) {
uint32_t r0 = pci_read_word(bus, device, function, 0xA); uint32_t r0 = pci_read_word(bus, device, function, 0xA);
return (r0 & ~0xFF00); return (r0 & ~0xFF00);
} }
@ -102,8 +96,7 @@ static inline void scan( ) {
char *name = find_vendor(vendor); char *name = find_vendor(vendor);
fb_printf("[%u] %x [%s], устройство: %x, класс: %u, " fb_printf("[%u] %x [%s], устройство: %x, класс: %u, "
"%u.%u.%u\n", "%u.%u.%u\n",
devices, vendor, name, device_id, class_id, bus, slot, devices, vendor, name, device_id, class_id, bus, slot, function);
function);
fb_printf("\t\\->%s\n", get_class_name(class_id)); fb_printf("\t\\->%s\n", get_class_name(class_id));
devices++; devices++;

View File

@ -6,13 +6,10 @@ typedef struct {
} vendor_t; } vendor_t;
static vendor_t **parse_file(char *str, uint64_t num_vendors, uint64_t size) { static vendor_t **parse_file(char *str, uint64_t num_vendors, uint64_t size) {
vendor_t **vendor_list = vendor_t **vendor_list = (vendor_t **)alloc(num_vendors * sizeof(vendor_t *));
(vendor_t **)alloc(num_vendors * sizeof(vendor_t *));
if (vendor_list == NULL) { return NULL; } if (vendor_list == NULL) { return NULL; }
for (uint64_t i = 0; i < num_vendors; i++) { for (uint64_t i = 0; i < num_vendors; i++) { vendor_list[i] = (vendor_t *)alloc(sizeof(vendor_t)); }
vendor_list[i] = (vendor_t *)alloc(sizeof(vendor_t));
}
uint64_t i = 0; uint64_t i = 0;
@ -72,8 +69,7 @@ module_info_t __attribute__((section(".minit"))) init(env_t *env) {
uint64_t num_vendors = count_chars(pci_data->data, ';'); uint64_t num_vendors = count_chars(pci_data->data, ';');
fb_printf("Количество вендоров: %u\n", num_vendors); fb_printf("Количество вендоров: %u\n", num_vendors);
vendor_t **vendor_list = vendor_t **vendor_list = parse_file(pci_data->data, num_vendors, pci_data->data_size);
parse_file(pci_data->data, num_vendors, pci_data->data_size);
// print_vendors(num_vendors, vendor_list); // print_vendors(num_vendors, vendor_list);
return (module_info_t){ return (module_info_t){
.name = (char *)"[PCI][ADAPTER]", .name = (char *)"[PCI][ADAPTER]",

View File

@ -2,11 +2,8 @@
static char fxsave_region[512] __attribute__((aligned(16))); static char fxsave_region[512] __attribute__((aligned(16)));
static inline void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, static inline void cpuid(uint32_t leaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) {
uint32_t *ecx, uint32_t *edx) { asm volatile("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "a"(leaf));
asm volatile("cpuid"
: "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
: "a"(leaf));
} }
module_info_t __attribute__((section(".minit"))) init(env_t *env) { module_info_t __attribute__((section(".minit"))) init(env_t *env) {

1
run.sh
View File

@ -1,5 +1,6 @@
#!/bin/sh #!/bin/sh
qemu-system-x86_64 -name "БМПОС" -cpu max -m 1G -smp 1 \ qemu-system-x86_64 -name "БМПОС" -cpu max -m 1G -smp 1 \
-bios ovmf/OVMF.fd \
-drive file=bmosp.hdd,if=none,id=sata_drive -device ahci \ -drive file=bmosp.hdd,if=none,id=sata_drive -device ahci \
-device virtio-blk-pci,drive=sata_drive --no-reboot -device virtio-blk-pci,drive=sata_drive --no-reboot
#qemu-system-x86_64 -name "БМПОС" -cpu max -m 1G -smp 1 -hda bmosp.hdd --no-reboot #qemu-system-x86_64 -name "БМПОС" -cpu max -m 1G -smp 1 -hda bmosp.hdd --no-reboot

View File

@ -144,7 +144,7 @@ def create_hdd(IMAGE_NAME):
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 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 modules/bin/* ::/mod")
os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M limine/BOOTX64.EFI limine/BOOTIA32.EFI ::/EFI/BOOT") os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M limine/BOOTX64.EFI limine/BOOTIA32.EFI ::/EFI/BOOT")
os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M boot.jpg boot.tga ::/") os.system(f"mcopy -i {IMAGE_NAME}.hdd@@1M boot.tga ::/")
os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd") os.system(f"./limine/limine bios-install {IMAGE_NAME}.hdd")
@ -152,7 +152,7 @@ def create_iso(IMAGE_NAME):
os.system(f"rm -f {IMAGE_NAME}.iso") os.system(f"rm -f {IMAGE_NAME}.iso")
os.system(f"rm -rf iso_root") os.system(f"rm -rf iso_root")
os.system(f"mkdir -p iso_root") os.system(f"mkdir -p iso_root")
os.system(f"cp -v kernel.elf boot.jpg boot.tga configs/limine.cfg limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/") os.system(f"cp -v kernel.elf boot.tga configs/limine.cfg limine/limine-bios.sys limine/limine-bios-cd.bin limine/limine-uefi-cd.bin iso_root/")
os.system(f"mkdir -p iso_root/EFI/BOOT") os.system(f"mkdir -p iso_root/EFI/BOOT")
shutil.copytree("modules/bin", "iso_root/mod") shutil.copytree("modules/bin", "iso_root/mod")
os.system(f"cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/") os.system(f"cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT/")