-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Aren
committed
Sep 30, 2023
1 parent
05d4a95
commit 95cd4ed
Showing
11 changed files
with
395 additions
and
128 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace arch { | ||
void init(); | ||
namespace arch { | ||
void init(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace cpu { | ||
void init(); | ||
namespace cpu { | ||
void init(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
namespace fb { | ||
void init(); | ||
namespace fb { | ||
void init(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#include <stdarg.h> | ||
|
||
|
||
namespace tool { | ||
void format(void (*putc)(char c), const char *format_string, va_list args); | ||
#include <stdarg.h> | ||
|
||
|
||
namespace tool { | ||
void format(void (*putc)(char c), const char *format_string, va_list args); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
#include <limine.h> | ||
|
||
|
||
|
||
namespace arch { | ||
static volatile struct limine_kernel_address_request kernel_address_request = { | ||
.id = LIMINE_KERNEL_ADDRESS_REQUEST, | ||
.revision = 0, | ||
.response = (struct limine_kernel_address_response *)0 | ||
}; | ||
|
||
struct limine_kernel_address_response *kernel_address_response; | ||
|
||
void init() { | ||
kernel_address_response = kernel_address_request.response; | ||
} | ||
#include <limine.h> | ||
|
||
|
||
|
||
namespace arch { | ||
static volatile struct limine_kernel_address_request kernel_address_request = { | ||
.id = LIMINE_KERNEL_ADDRESS_REQUEST, | ||
.revision = 0, | ||
.response = (struct limine_kernel_address_response *)0 | ||
}; | ||
|
||
struct limine_kernel_address_response *kernel_address_response; | ||
|
||
void init() { | ||
kernel_address_response = kernel_address_request.response; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
|
||
namespace cpu { | ||
static bool x87_support = false; | ||
static bool sse_support = false; | ||
static bool avx_support = false; | ||
|
||
void init() { | ||
x87_support = false; | ||
sse_support = false; | ||
avx_support = false; | ||
} | ||
} | ||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
|
||
namespace cpu { | ||
static bool x87_support = false; | ||
static bool sse_support = false; | ||
static bool avx_support = false; | ||
|
||
void init() { | ||
x87_support = false; | ||
sse_support = false; | ||
avx_support = false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
#include <limine.h> | ||
|
||
|
||
|
||
namespace fb { | ||
static volatile struct limine_framebuffer_request framebuffer_request = { | ||
.id = LIMINE_FRAMEBUFFER_REQUEST, | ||
.revision = 0, | ||
.response = (struct limine_framebuffer_response *)0 | ||
}; | ||
|
||
struct limine_framebuffer_response *framebuffer_response; | ||
struct limine_framebuffer *boot_framebuffer; | ||
uint32_t *fb_addr; | ||
uint64_t width; | ||
uint64_t height; | ||
uint64_t pitch; | ||
uint16_t bpp; | ||
|
||
void init() { | ||
framebuffer_response = framebuffer_request.response; | ||
boot_framebuffer = framebuffer_response->framebuffers[0]; | ||
fb_addr = (uint32_t*)boot_framebuffer->address; | ||
width = boot_framebuffer->width; | ||
height = boot_framebuffer->height; | ||
bpp = boot_framebuffer->bpp; | ||
|
||
for (uint64_t i = 0; i < width * height; i++) { | ||
fb_addr[i] = 0x0000FF; | ||
} | ||
} | ||
#include <limine.h> | ||
|
||
|
||
|
||
namespace fb { | ||
static volatile struct limine_framebuffer_request framebuffer_request = { | ||
.id = LIMINE_FRAMEBUFFER_REQUEST, | ||
.revision = 0, | ||
.response = (struct limine_framebuffer_response *)0 | ||
}; | ||
|
||
struct limine_framebuffer_response *framebuffer_response; | ||
struct limine_framebuffer *boot_framebuffer; | ||
uint32_t *fb_addr; | ||
uint64_t width; | ||
uint64_t height; | ||
uint64_t pitch; | ||
uint16_t bpp; | ||
|
||
void init() { | ||
framebuffer_response = framebuffer_request.response; | ||
boot_framebuffer = framebuffer_response->framebuffers[0]; | ||
fb_addr = (uint32_t*)boot_framebuffer->address; | ||
width = boot_framebuffer->width; | ||
height = boot_framebuffer->height; | ||
bpp = boot_framebuffer->bpp; | ||
|
||
for (uint64_t i = 0; i < width * height; i++) { | ||
fb_addr[i] = 0x0000FF; | ||
} | ||
} | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,56 @@ | ||
#include <limine.h> | ||
#include <stdarg.h> | ||
#include <stdint.h> | ||
|
||
namespace tool { | ||
// Функция для форматированного вывода | ||
void format(void (*putc)(char c), const char *format_string, va_list args) { | ||
while (*format_string != '\0') { | ||
if (*format_string == '%') { | ||
format_string++; | ||
if (*format_string == '\0') { | ||
break; // Неожиданный конец строки формата | ||
} | ||
if (*format_string == '%') { | ||
putc('%'); // Вывод одного символа '%' | ||
} else if (*format_string == 'd') { | ||
int arg = va_arg(args, int); | ||
// Преобразование целочисленного аргумента в строку и вывод каждого символа | ||
if (arg < 0) { | ||
putc('-'); | ||
arg = -arg; | ||
} | ||
if (arg == 0) { | ||
putc('0'); | ||
} else { | ||
char buffer[10]; // Предполагаем, что максимальное число из 10 цифр | ||
int i = 0; | ||
|
||
while (arg > 0) { | ||
buffer[i++] = '0' + (arg % 10); | ||
arg /= 10; | ||
} | ||
|
||
while (i > 0) { | ||
putc(buffer[--i]); | ||
} | ||
} | ||
} else if (*format_string == 's') { | ||
const char* arg = va_arg(args, const char*); | ||
// Вывод каждого символа строки | ||
while (*arg != '\0') { | ||
putc(*arg); | ||
arg++; | ||
} | ||
} else { | ||
// Неподдерживаемый спецификатор формата | ||
putc('?'); | ||
} | ||
} else { | ||
putc(*format_string); | ||
} | ||
|
||
format_string++; | ||
} | ||
} | ||
#include <limine.h> | ||
#include <stdarg.h> | ||
#include <stdint.h> | ||
|
||
namespace tool { | ||
// Функция для форматированного вывода | ||
void format(void (*putc)(char c), const char *format_string, va_list args) { | ||
while (*format_string != '\0') { | ||
if (*format_string == '%') { | ||
format_string++; | ||
if (*format_string == '\0') { | ||
break; // Неожиданный конец строки формата | ||
} | ||
if (*format_string == '%') { | ||
putc('%'); // Вывод одного символа '%' | ||
} else if (*format_string == 'd') { | ||
int arg = va_arg(args, int); | ||
// Преобразование целочисленного аргумента в строку и вывод каждого символа | ||
if (arg < 0) { | ||
putc('-'); | ||
arg = -arg; | ||
} | ||
if (arg == 0) { | ||
putc('0'); | ||
} else { | ||
char buffer[10]; // Предполагаем, что максимальное число из 10 цифр | ||
int i = 0; | ||
|
||
while (arg > 0) { | ||
buffer[i++] = '0' + (arg % 10); | ||
arg /= 10; | ||
} | ||
|
||
while (i > 0) { | ||
putc(buffer[--i]); | ||
} | ||
} | ||
} else if (*format_string == 's') { | ||
const char* arg = va_arg(args, const char*); | ||
// Вывод каждого символа строки | ||
while (*arg != '\0') { | ||
putc(*arg); | ||
arg++; | ||
} | ||
} else { | ||
// Неподдерживаемый спецификатор формата | ||
putc('?'); | ||
} | ||
} else { | ||
putc(*format_string); | ||
} | ||
|
||
format_string++; | ||
} | ||
} | ||
} |