This commit is contained in:
nub31
2025-09-03 13:44:44 +02:00
parent 204c747c43
commit 08bbe517c5
20 changed files with 44 additions and 48 deletions

View File

@@ -13,3 +13,6 @@ CompileFlags:
- "-nostdlib"
- "-I"
- "/home/oliste/repos/nub-os/src/stdlib"
Style:
AngledHeaders: "src/stdlib/.*"

View File

@@ -1,17 +1,18 @@
#pragma once
#include "stdint.h"
#include <stddef.h>
#include <stdint.h>
typedef struct
{
uint64_t base_address;
uint64_t length;
size_t length;
} memory_region_t;
typedef struct
{
uint64_t num_regions;
memory_region_t* regions;
size_t num_regions;
} memory_map_t;
extern memory_map_t memory_map;

View File

@@ -1,7 +1,7 @@
#include "interrupts.h"
#include "../arch.h"
#include "stdio.h"
#include "util.h"
#include <stdio.h>
#define PIC1_COMMAND 0x20
#define PIC1_DATA 0x21

View File

@@ -1,7 +1,7 @@
#pragma once
#include "stdbool.h"
#include "stdint.h"
#include <stdbool.h>
#include <stdint.h>
typedef struct
{

View File

@@ -1,7 +1,7 @@
// #include "keyboard.h"
// #include "interrupts.h"
// #include "util.h"
// #include "stddef.h"
// #include <stddef.h>
// #define SCANCODE_LEFT_SHIFT 42
// #define SCANCODE_RIGHT_SHIFT 54

View File

@@ -1,7 +1,7 @@
// #pragma once
// #include "stdbool.h"
// #include "stdint.h"
// #include <stdbool.h>
// #include <stdint.h>
// typedef struct
// {

View File

@@ -1,7 +1,7 @@
#include "mmap.h"
#include "../mmap.h"
#include "stddef.h"
#include "stdio.h"
#include <stddef.h>
#include <stdio.h>
#define USABLE_REGION_SIZE 32

View File

@@ -1,6 +1,6 @@
#pragma once
#include "stdint.h"
#include <stdint.h>
enum
{

View File

@@ -1,5 +1,5 @@
#include "vga.h"
#include "stddef.h"
#include <stddef.h>
#define ROWS 25
#define COLUMNS 80

View File

@@ -1,6 +1,6 @@
#pragma once
#include "stdint.h"
#include <stdint.h>
#define VGA_BLACK 0
#define VGA_BLUE 1

View File

@@ -3,10 +3,9 @@
#include "interrupts.h"
#include "mmap.h"
#include "multiboot.h"
#include "stddef.h"
#include "stdio.h"
#include "util.h"
#include "vga.h"
#include <stdio.h>
void entry(multiboot_info_t* mbd)
{
@@ -14,7 +13,7 @@ void entry(multiboot_info_t* mbd)
map_memory(mbd);
remap_pic();
enable_interrupts();
kmain();
main();
}
void arch_callback()

View File

@@ -1,8 +1,8 @@
#include "kernel.h"
#include "pmm.h"
#include "stdio.h"
#include <stdio.h>
void kmain()
void main()
{
init_pmm();
printf("Welcome to nub OS :)\n");

View File

@@ -1,3 +1,3 @@
#pragma once
void kmain();
void main();

View File

@@ -1,8 +1,8 @@
#include "pmm.h"
#include "arch/mmap.h"
#include "mem.h"
#include "stddef.h"
#include "stdio.h"
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#define BITMAP_SIZE 32768 // Supports up to 1GB of RAM
#define USABLE_REGION_SIZE 32

View File

@@ -1,6 +1,6 @@
#pragma once
#include "stdint.h"
#include <stdint.h>
#define PAGE_SIZE 4096

View File

@@ -1,10 +0,0 @@
#include "mem.h"
#include "stdint.h"
void memset(void* destination, uint8_t value, size_t length)
{
for (size_t i = 0; i < length; i++)
{
((uint8_t*)destination)[i] = value;
}
}

View File

@@ -1,6 +0,0 @@
#pragma once
#include "stddef.h"
#include "stdint.h"
void memset(void* destination, uint8_t value, size_t length);

View File

@@ -1,9 +1,9 @@
#include "stdio.h"
#include "../arch/arch.h"
#include "stdarg.h"
#include "stdbool.h"
#include "stddef.h"
#include "string.h"
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
void printf(const char* fmt, ...)
{

View File

@@ -1,4 +1,12 @@
#include "string.h"
#include <string.h>
void memset(void* destination, uint8_t value, size_t length)
{
for (size_t i = 0; i < length; i++)
{
((uint8_t*)destination)[i] = value;
}
}
int strcmp(const char* a, const char* b)
{

View File

@@ -1,8 +1,9 @@
#pragma once
#include "stddef.h"
#include "stdint.h"
#include <stddef.h>
#include <stdint.h>
void memset(void* destination, uint8_t value, size_t length);
int strcmp(const char* a, const char* b);
void reverse(char* str, size_t length);
void uitoa64(uint64_t value, char* buffer);