Skip to content

Commit

Permalink
Обновление прав доступа
Browse files Browse the repository at this point in the history
  • Loading branch information
Aren committed Sep 30, 2023
1 parent 05d4a95 commit 95cd4ed
Show file tree
Hide file tree
Showing 11 changed files with 395 additions and 128 deletions.
267 changes: 267 additions & 0 deletions include/6x8_slim_font.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions include/arch.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace arch {
void init();
namespace arch {
void init();
}
4 changes: 2 additions & 2 deletions include/cpu.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace cpu {
void init();
namespace cpu {
void init();
}
4 changes: 2 additions & 2 deletions include/fb.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace fb {
void init();
namespace fb {
void init();
}
10 changes: 5 additions & 5 deletions include/tool.h
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);
}
32 changes: 16 additions & 16 deletions kernel/arch.cpp
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;
}
}
30 changes: 15 additions & 15 deletions kernel/cpu.cpp
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;
}
}
62 changes: 31 additions & 31 deletions kernel/fb.cpp
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 added kernel/mem.cpp
Empty file.
Empty file added kernel/sys.cpp
Empty file.
110 changes: 55 additions & 55 deletions kernel/tool.cpp
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++;
}
}
}

0 comments on commit 95cd4ed

Please sign in to comment.