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:
parent
cc1061d1e8
commit
f8541b0467
4 changed files with 12 additions and 8 deletions
|
@ -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;
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue