Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions asm/boot.asm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ extern enable_sse

; Entry point for the BSP.
boot_bsp:
push 0
call enable_fpu
call enable_sse
mov rax, kmain
Expand Down
4 changes: 2 additions & 2 deletions src/basic/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,12 @@ void library_statement(struct basic_ctx* ctx)

/* Load the library file from VFS */
size_t library_len = file_info->size;
char* temp_library = kmalloc(library_len);
char* temp_library = kmalloc(library_len + 1);
if (!temp_library) {
tokenizer_error_print(ctx, "Not enough memory to load library file");
return;
}
char* clean_library = kmalloc(library_len);
char* clean_library = kmalloc(library_len + 1);
if (!clean_library) {
kfree_null(&temp_library);
tokenizer_error_print(ctx, "Not enough memory to load library file");
Expand Down
12 changes: 8 additions & 4 deletions src/memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,29 @@ void* memset(void* dest, char val, uint64_t len)

static inline void* movsb(void* dst, const void* src, size_t size)
{
__asm__ volatile("rep movsb" : "+D"(dst), "+S"(src), "+c"(size) : : "memory");
void *copy = dst;
__asm__ volatile("rep movsb" : "+D"(copy), "+S"(src), "+c"(size) : : "memory");
return dst;
}

static inline void* movsl(void* dst, const void* src, size_t size)
{
__asm__ volatile("rep movsl" : "+D"(dst), "+S"(src), "+c"(size) : : "memory");
void *copy = dst;
__asm__ volatile("rep movsl" : "+D"(copy), "+S"(src), "+c"(size) : : "memory");
return dst;
}

static inline void* movsw(void* dst, const void* src, size_t size)
{
__asm__ volatile("rep movsw" : "+D"(dst), "+S"(src), "+c"(size) : : "memory");
void *copy = dst;
__asm__ volatile("rep movsw" : "+D"(copy), "+S"(src), "+c"(size) : : "memory");
return dst;
}

static inline void* movsq(void* dst, const void* src, size_t size)
{
__asm__ volatile("rep movsq" : "+D"(dst), "+S"(src), "+c"(size) : : "memory");
void *copy = dst;
__asm__ volatile("rep movsq" : "+D"(copy), "+S"(src), "+c"(size) : : "memory");
return dst;
}

Expand Down
12 changes: 6 additions & 6 deletions src/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ char* strdup(const char* string)
if (!string) {
return NULL;
}
uint32_t len = strlen(string) + 1;
char* result = kmalloc(len);
strlcpy(result, string, len);
uint32_t len = strlen(string);
char* result = kmalloc(len + 1);
strlcpy(result, string, len + 1);
*(result + len) = 0;
return result;
}
Expand All @@ -246,9 +246,9 @@ char* gc_strdup(const char* string)
if (!string) {
return NULL;
}
uint32_t len = strlen(string) + 1;
char* result = kmalloc(len);
strlcpy(result, string, len);
uint32_t len = strlen(string);
char* result = kmalloc(len + 1);
strlcpy(result, string, len + 1);
*(result + len) = 0;

if (gc_list == NULL) {
Expand Down
8 changes: 5 additions & 3 deletions src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,14 @@ void init_console()
wait_forever();
}
rr_console_init_from_limine();
clearscreen(c);

struct limine_framebuffer* fb = framebuffer_request.response->framebuffers[0];

screen_graphics_x = fb->width;
screen_graphics_y = fb->height;

clearscreen(c);

dprintf("Bringing up flanterm...\n");

struct limine_module_response* mods = module_request.response;
Expand Down Expand Up @@ -211,8 +215,6 @@ void init_console()
flanterm_get_dimensions(ft_ctx, &x, &y);
screen_x = x;
screen_y = y;
screen_graphics_x = fb->width;
screen_graphics_y = fb->height;
dprintf("Framebuffer address: %llx x resolution=%d y resolution=%d\n", framebuffer_address(), screen_get_width(), screen_get_height());

setforeground(current_console, COLOUR_LIGHTYELLOW);
Expand Down
Loading