Remove kernel implementation of string.h
This commit is contained in:
parent
27682a9fe1
commit
2ec2af15b5
@ -1,7 +1,6 @@
|
|||||||
#include <stddef.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <memory.h>
|
#include <string.h>
|
||||||
#include <terminal.h>
|
#include <terminal.h>
|
||||||
|
|
||||||
void num2str(char *buf, uint64_t num, uint64_t base)
|
void num2str(char *buf, uint64_t num, uint64_t base)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <string.h>
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <cpu.h>
|
#include <cpu.h>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define IDT_INTERRUPT 0xE
|
#define IDT_INTERRUPT 0xE
|
||||||
#define IDT_DPL0 0x0
|
#define IDT_DPL0 0x0
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <memory.h>
|
|
||||||
#include <multiboot.h>
|
|
||||||
#include <framebuffer.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <memory.h>
|
||||||
|
#include <framebuffer.h>
|
||||||
|
|
||||||
gfx_context kernel_fb;
|
gfx_context kernel_fb;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
#include <terminal.h>
|
#include <terminal.h>
|
||||||
#include <memory.h>
|
|
||||||
|
|
||||||
#define FRAMEBUFFER 0x1
|
#define FRAMEBUFFER 0x1
|
||||||
#define EGA_TEXT 0x2
|
#define EGA_TEXT 0x2
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
|
// #include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
#include <terminal.h>
|
#include <terminal.h>
|
||||||
#include <memory.h>
|
|
||||||
#include <ports.h>
|
#include <ports.h>
|
||||||
|
#include <memory.h>
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
#include <stddef.h>
|
|
||||||
#include <debug.h>
|
|
||||||
|
|
||||||
#define VGA_ADDRESS_PORT 0x3D4
|
#define VGA_ADDRESS_PORT 0x3D4
|
||||||
#define VGA_DATA_PORT 0x3D5
|
#define VGA_DATA_PORT 0x3D5
|
||||||
|
@ -40,13 +40,6 @@
|
|||||||
uint64_t pmm_alloc();
|
uint64_t pmm_alloc();
|
||||||
uint64_t pmm_calloc();
|
uint64_t pmm_calloc();
|
||||||
|
|
||||||
// memory/string.c
|
|
||||||
void *memcpy(void *dst, const void *src, size_t n);
|
|
||||||
void *memset(void *s, int c, size_t n);
|
|
||||||
void *memmove(void *dest, const void *src, size_t n);
|
|
||||||
int memcmp(const void *s1, const void *s2, size_t n);
|
|
||||||
size_t strlen(const char *s);
|
|
||||||
|
|
||||||
// memory/kbrk.c
|
// memory/kbrk.c
|
||||||
long kbrk(long brk, long, long, long, long, long);
|
long kbrk(long brk, long, long, long, long, long);
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <multiboot.h>
|
|
||||||
#include <framebuffer.h>
|
#include <framebuffer.h>
|
||||||
|
|
||||||
#define VGA_COLS 80
|
#define VGA_COLS 80
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
// Physical address of next page
|
// Physical address of next page
|
||||||
uint64_t next = 0;
|
uint64_t next = 0;
|
||||||
|
@ -1,55 +0,0 @@
|
|||||||
#include <memory.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
void *memcpy(void *dst, const void *src, size_t n)
|
|
||||||
{
|
|
||||||
char *dp = dst;
|
|
||||||
const char *sp = src;
|
|
||||||
while(n--) *dp++ = *sp++;
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *memset(void *s, int c, size_t n)
|
|
||||||
{
|
|
||||||
unsigned char *p = s;
|
|
||||||
while(n--) *p++ = (unsigned char)c;
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *memmove(void *dst, const void *src, size_t n)
|
|
||||||
{
|
|
||||||
if(src == dst)
|
|
||||||
return dst;
|
|
||||||
|
|
||||||
const void *src_end = (const void *)((uintptr_t)src + n);
|
|
||||||
if(src < dst && dst < src_end)
|
|
||||||
{
|
|
||||||
char *dp = dst;
|
|
||||||
const char *sp = src;
|
|
||||||
while(n--)
|
|
||||||
dp[n] = sp[n];
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(dst, src, n);
|
|
||||||
return dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
int memcmp(const void *s1, const void *s2, size_t n)
|
|
||||||
{
|
|
||||||
const unsigned char *p1 = s1, *p2 = s2;
|
|
||||||
for(; n--; p1++, p2++)
|
|
||||||
{
|
|
||||||
if(*p1 != *p2)
|
|
||||||
return *p1 - *p2;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t strlen(const char *s)
|
|
||||||
{
|
|
||||||
size_t len = 0;
|
|
||||||
while(*s++) len++;
|
|
||||||
return len;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user