Move string functions/utils from HAL to std/string

This commit is contained in:
2025-11-11 19:54:09 +01:00
parent f5dae4984d
commit 344952fb5f
27 changed files with 200 additions and 228 deletions

View File

@ -3,6 +3,7 @@
#include "compiler/attr.h"
#include "hal/hal.h"
#include "gdt.h"
#include "std/string.h"
#define GDT_PRESENT 0x80
#define GDT_TSS 0x89
@ -43,7 +44,7 @@ void gdt_setentry(GdtEntry *ent, uint32_t base, uint32_t limit, uint8_t acc, uin
}
void gdt_init(void) {
hal_memset(&tss, 0, sizeof(tss));
memset(&tss, 0, sizeof(tss));
tss.iopb_off = sizeof(tss);
tss.rsp0 = (uint64_t)(kernelstack + sizeof(kernelstack));

View File

@ -8,6 +8,7 @@
#include "proc/proc.h"
#include "kprintf.h"
#include "spinlock/spinlock.h"
#include "std/string.h"
uint64_t KERNEL_CR3 = 0;
SpinLock spinlock;
@ -41,7 +42,7 @@ uint64_t *hal_vmm_nexttable(uint64_t *table, uint64_t ent, bool alloc) {
uint8_t *newphys = pmm_alloc(1);
phys = (uint64_t)newphys;
hal_memset(VIRT(phys), 0, HAL_PAGE_SIZE);
memset(VIRT(phys), 0, HAL_PAGE_SIZE);
table[ent] = phys | HAL_PG_USER | HAL_PG_RW | HAL_PG_PRESENT;
}
return (uint64_t *)((uint8_t *)VIRT(phys));
@ -112,7 +113,7 @@ void hal_vmm_map_kern(uint64_t targetcr3) {
uint64_t hal_vmm_userproc_pml4_phys(void) {
uint8_t *cr3phys = pmm_alloc(1);
uint64_t phys = (uint64_t)cr3phys;
hal_memset(VIRT(phys), 0, HAL_PAGE_SIZE);
memset(VIRT(phys), 0, HAL_PAGE_SIZE);
uint64_t *kcr3 = (uint64_t *)VIRT(KERNEL_CR3);
uint64_t *pml4 = (uint64_t *)VIRT(phys);