1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2024-11-27 11:24:34 -05:00

Don't use libc funcs from libkernaux

This commit is contained in:
Alex Kotov 2021-12-15 07:10:49 +05:00
parent cc1061d1e8
commit f8541b0467
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 12 additions and 8 deletions

View file

@ -9,6 +9,7 @@
#include "elf.h"
#include <kernaux/console.h>
#include <kernaux/libc.h>
#include <kernaux/multiboot2.h>
#include <kernaux/pfa.h>
#include <kernaux/stdlib.h>
@ -40,7 +41,7 @@ void main(
panic("Multiboot 2 info is invalid.");
}
kernaux_memset(&kinfo, 0, sizeof(struct Kernel_Info));
memset(&kinfo, 0, sizeof(struct Kernel_Info));
KernAux_PFA_initialize(&pfa);
@ -49,13 +50,13 @@ void main(
KernAux_Multiboot2_boot_cmd_line(multiboot2_info);
if (cmdline) {
unsigned int slen = kernaux_strlen(cmdline);
unsigned int slen = strlen(cmdline);
if (slen > KERNEL_INFO_CMDLINE_SLEN_MAX) {
panic("Multiboot 2 boot cmd line is too long.");
}
kernaux_strncpy(kinfo.cmdline, cmdline, slen);
strcpy(kinfo.cmdline, cmdline);
}
}
@ -123,7 +124,7 @@ void main(
panic("Too many modules in Multiboot 2 info.");
}
unsigned int slen = kernaux_strlen(tag->cmdline);
unsigned int slen = strlen(tag->cmdline);
if (slen > KERNEL_INFO_CMDLINE_SLEN_MAX) {
panic("Multiboot 2 module cmd line is too long.");
@ -132,7 +133,7 @@ void main(
struct Kernel_Info_Module *const module =
&kinfo.modules[kinfo.modules_count];
kernaux_strncpy(module->cmdline, tag->cmdline, slen);
strcpy(module->cmdline, tag->cmdline);
module->base = tag->mod_start;
module->limit = tag->mod_end;

View file

@ -3,6 +3,7 @@
#include "panic.h"
#include <kernaux/arch/i386.h>
#include <kernaux/libc.h>
#include <kernaux/stdlib.h>
// CR0 bits
@ -58,7 +59,7 @@ void paging_enable()
void paging_clear()
{
kernaux_memset(page_dir, 0, sizeof(page_dir));
memset(page_dir, 0, sizeof(page_dir));
}
void paging_identity()

View file

@ -7,6 +7,7 @@
#include "pic.h"
#include <kernaux/console.h>
#include <kernaux/libc.h>
#include <kernaux/stdlib.h>
struct GdtPointer {
@ -68,7 +69,7 @@ void protected_initialize(const struct Kernel_Info *const kinfo)
kernaux_console_print("[INFO] protected: Setup IDT.\n");
kernaux_memset(idt_entries, 0, sizeof(idt_entries));
memset(idt_entries, 0, sizeof(idt_entries));
idt_set_gate(0, (unsigned int)interrupt_0, 0x08, 0x8E);
idt_set_gate(1, (unsigned int)interrupt_1, 0x08, 0x8E);

View file

@ -2,6 +2,7 @@
#include "config.h"
#include <kernaux/libc.h>
#include <kernaux/stdlib.h>
struct gdt_entry_bits {
@ -80,7 +81,7 @@ void tss_write_to_gdt(const struct Kernel_Info *const kinfo, void *gdt_entry_ptr
g->big = 0;
g->gran = 0;
kernaux_memset(&tss, 0, sizeof(tss));
memset(&tss, 0, sizeof(tss));
tss.ss0 = GDT_KERNEL_DS_SELECTOR;
tss.esp0 = kinfo->kernel_stack_top;