-
Notifications
You must be signed in to change notification settings - Fork 0
Kernel API
NtinosTheGamer2324 edited this page Dec 11, 2025
·
1 revision
Internal kernel functions and interfaces.
// Initialize physical memory allocator
void phys_init(uint64_t total_mem, const void *usable_regions, size_t region_count);
// Allocate physical page (4KB)
void* phys_alloc_page(void);
// Allocate multiple contiguous pages
void* phys_alloc_pages(size_t count);
// Free physical page
void phys_free_page(void* addr);
// Free multiple pages
void phys_free_pages(void* addr, size_t count);
// Get memory statistics
uint64_t phys_get_total_memory(void);
uint64_t phys_get_used_memory(void);
uint64_t phys_get_free_memory(void);// Initialize paging
void paging_init(void);
// Map virtual address to physical
int paging_map_page(uint64_t virt_addr, uint64_t phys_addr, uint64_t flags);
// Unmap virtual address
void paging_unmap_page(uint64_t virt_addr);
// Get physical address from virtual
uint64_t paging_get_physical(uint64_t virt_addr);
// Identity map memory regions
void early_identity_map(void);
void early_identity_map_all(void);// Allocate memory
void* kmalloc(size_t size);
// Allocate aligned memory
void* kmalloc_aligned(size_t size, size_t alignment);
// Allocate zero-initialized memory
void* kzalloc(size_t size);
// Free memory
void kfree(void* ptr);
// Print heap statistics
void kheap_stats(void);// Initialize process system
void process_init(void);
// Create process
process_t* process_create(const char *name, void (*entry)(void), int priority);
process_t* process_create_with_args(const char *name, void (*entry)(void), int priority, int argc, char **argv);
// Process control
void process_exit(int exit_code);
void process_kill(uint32_t pid);
void process_yield(void);
void process_sleep(uint64_t milliseconds);
void process_wake(uint32_t pid);
// Process queries
process_t* process_get_current(void);
process_t* process_get_by_pid(uint32_t pid);// Initialize VFS
void fs_init(void);
// Mount operations
int fs_mount_drive(int drive_index, uint32_t partition_lba, fs_type_t type);
int fs_unmount_slot(int slot);
fs_mount_t* fs_get_mount(int slot);
// File operations
int fs_read_file(fs_mount_t* mount, const char* path, void* buffer, size_t buffer_size, size_t* bytes_read);
int fs_stat(fs_mount_t* mount, const char* path, fs_file_info_t* info);
int fs_file_exists(fs_mount_t* mount, const char* path);
// Directory operations
int fs_list_directory(fs_mount_t* mount, const char* path);
int fs_directory_exists(fs_mount_t* mount, const char* path);// Initialize IDT
void idt_init(void);
// Set IDT gate
void idt_set_gate(int num, void* handler, uint16_t selector, uint8_t flags);
// Initialize PIC
void pic_init(void);
// Send End of Interrupt
void pic_send_eoi(int irq);
// IRQ management
void irq_init(void);
void irq_register_handler(int irq, irq_handler_t handler);
// Timer
void pit_init(uint32_t frequency);- Syscall Reference - User-space API
- Driver API - Driver development
- Filesystem API - FS driver interface