mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
feat: Massive OS expansion with IPC, Sound & TTS, Block layer, FAT32/ext2/sysfs, Signals, Syscalls, Modules, Drivers & 50+ LazyBox applets
This commit is contained in:
1 parent
5662be29f5
commit
d680335f05
64 files changed
+2370
-166
No files matched your search
@@ -0,0 +1,28 @@
|
||||
#ifndef _KERNEL_MODULE_H
|
||||
#define _KERNEL_MODULE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define MODULE_NAME_LEN 32
|
||||
#define MAX_MODULES 16
|
||||
|
||||
typedef struct kernel_module {
|
||||
char name[MODULE_NAME_LEN];
|
||||
char description[64];
|
||||
char author[32];
|
||||
char version[16];
|
||||
size_t size;
|
||||
int (*init)(void);
|
||||
void (*cleanup)(void);
|
||||
bool loaded;
|
||||
} kernel_module_t;
|
||||
|
||||
void module_init_subsystem(void);
|
||||
int module_load(const char* name, int (*init_fn)(void), void (*cleanup_fn)(void), size_t size);
|
||||
int module_unload(const char* name);
|
||||
size_t module_get_count(void);
|
||||
const kernel_module_t* module_get(size_t index);
|
||||
|
||||
#endif // _KERNEL_MODULE_H
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef _KERNEL_SIGNAL_H
|
||||
#define _KERNEL_SIGNAL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define SIGHUP 1
|
||||
#define SIGINT 2
|
||||
#define SIGQUIT 3
|
||||
#define SIGILL 4
|
||||
#define SIGTRAP 5
|
||||
#define SIGABRT 6
|
||||
#define SIGFPE 8
|
||||
#define SIGKILL 9
|
||||
#define SIGSEGV 11
|
||||
#define SIGPIPE 13
|
||||
#define SIGALRM 14
|
||||
#define SIGTERM 15
|
||||
#define SIGCHLD 17
|
||||
#define SIGCONT 18
|
||||
#define SIGSTOP 19
|
||||
#define SIGTSTP 20
|
||||
#define SIGUSR1 10
|
||||
#define SIGUSR2 12
|
||||
|
||||
#define NSIG 32
|
||||
|
||||
typedef void (*sighandler_t)(int);
|
||||
|
||||
#define SIG_DFL ((sighandler_t)0)
|
||||
#define SIG_IGN ((sighandler_t)1)
|
||||
#define SIG_ERR ((sighandler_t)-1)
|
||||
|
||||
typedef uint32_t sigset_t;
|
||||
|
||||
struct sigaction {
|
||||
sighandler_t sa_handler;
|
||||
sigset_t sa_mask;
|
||||
int sa_flags;
|
||||
};
|
||||
|
||||
void signal_init(void);
|
||||
sighandler_t signal_set_handler(int signum, sighandler_t handler);
|
||||
int signal_send(uint32_t pid, int signum);
|
||||
void signal_deliver_pending(void);
|
||||
|
||||
#endif // _KERNEL_SIGNAL_H
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef _KERNEL_SYSCALL_H
|
||||
#define _KERNEL_SYSCALL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Linux x86_64 Standard Syscall Numbers */
|
||||
#define SYS_read 0
|
||||
#define SYS_write 1
|
||||
#define SYS_open 2
|
||||
#define SYS_close 3
|
||||
#define SYS_stat 4
|
||||
#define SYS_fstat 5
|
||||
#define SYS_lseek 8
|
||||
#define SYS_mmap 9
|
||||
#define SYS_munmap 11
|
||||
#define SYS_brk 12
|
||||
#define SYS_rt_sigaction 13
|
||||
#define SYS_pipe 22
|
||||
#define SYS_getpid 39
|
||||
#define SYS_fork 57
|
||||
#define SYS_execve 59
|
||||
#define SYS_exit 60
|
||||
#define SYS_kill 62
|
||||
#define SYS_mkdir 83
|
||||
#define SYS_rmdir 84
|
||||
#define SYS_unlink 87
|
||||
#define SYS_time 201
|
||||
#define SYS_reboot 169
|
||||
|
||||
typedef int64_t (*syscall_fn_t)(uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
|
||||
|
||||
void syscall_init(void);
|
||||
int64_t syscall_handler(uint64_t num, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5, uint64_t a6);
|
||||
|
||||
#endif // _KERNEL_SYSCALL_H
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef _KERNEL_TIMER_H
|
||||
#define _KERNEL_TIMER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef void (*timer_callback_t)(uint64_t data);
|
||||
|
||||
typedef struct timer_list {
|
||||
uint64_t expires;
|
||||
timer_callback_t function;
|
||||
uint64_t data;
|
||||
bool active;
|
||||
struct timer_list* next;
|
||||
} timer_list_t;
|
||||
|
||||
void timer_wheel_init(void);
|
||||
void timer_add(timer_list_t* timer);
|
||||
void timer_mod(timer_list_t* timer, uint64_t expires);
|
||||
void timer_del(timer_list_t* timer);
|
||||
void timer_tick(void);
|
||||
|
||||
#endif // _KERNEL_TIMER_H
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef _KERNEL_WORKQUEUE_H
|
||||
#define _KERNEL_WORKQUEUE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef void (*work_func_t)(void* data);
|
||||
|
||||
typedef struct work_struct {
|
||||
work_func_t func;
|
||||
void* data;
|
||||
bool pending;
|
||||
struct work_struct* next;
|
||||
} work_struct_t;
|
||||
|
||||
void workqueue_init(void);
|
||||
int schedule_work(work_struct_t* work);
|
||||
void workqueue_run_pending(void);
|
||||
|
||||
#endif // _KERNEL_WORKQUEUE_H
|
||||
Reference in new issue
Block a user