Merge branch 'main' of git.chauvet.pro:starnakin/42_KFS

This commit is contained in:
2024-10-17 16:11:40 +02:00
10 changed files with 95 additions and 16 deletions

View File

@ -1,10 +1,18 @@
#pragma once
#include "kprintf.h"
#include <stdint.h>
#define PRINT_VAR(var) kprintf("%s: %d\n", #var, var)
struct function_entry {
uint32_t addr;
char name[64];
};
struct stackframe {
struct stackframe *ebp;
uint32_t eip;
};
void print_stack(void);
void print_stack(void);

View File

@ -8,6 +8,7 @@
#define ACCESSED (1 << 4)
#define INIT_FLAGS (PRESENT | RW | SUPERVISOR)
#define PAGE_SIZE 4096
#define KERN_START 0xC0000000
void init_memory(void);
void *alloc_frames(size_t size);

54
headers/signal.h Normal file
View File

@ -0,0 +1,54 @@
#pragma once
#define SIG_DFL -1
#define SIG_IGN 0
enum {
SIGABRT, // Abort signal from abort(3)
SIGALRM, // Timer signal from alarm(2)
SIGBUS, // Bus error (bad memory access)
SIGCHLD, // Child stopped or terminated
SIGCLD, // A synonym for SIGCHLD
SIGCONT, // Continue if stopped
SIGEMT, // Emulator trap
SIGFPE, // Floating-point exception
SIGHUP, // Hangup detected on controlling terminal or death of
// controlling process
SIGILL, // Illegal Instruction
SIGINFO, // A synonym for SIGPWR
SIGINT, // Interrupt from keyboard
SIGIO, // I/O now possible (4.2BSD)
SIGIOT, // IOT trap. A synonym for SIGABRT
SIGKILL, // Kill signal
SIGLOST, // File lock lost (unused)
SIGPIPE, // Broken pipe: write to pipe with no readers; see pipe(7)
SIGPOLL, // Pollable event (Sys V); synonym for SIGIO
SIGPROF, // Profiling timer expired
SIGPWR, // Power failure (System V)
SIGQUIT, // Quit from keyboard
SIGSEGV, // Invalid memory reference
SIGSTKFLT, // Stack fault on coprocessor (unused)
SIGSTOP, // Stop process
SIGTSTP, // Stop typed at terminal
SIGSYS, // Bad system call (SVr4); see also seccomp(2)
SIGTERM, // Termination signal
SIGTRAP, // Trace/breakpoint trap
SIGTTIN, // Terminal input for background process
SIGTTOU, // Terminal output for background process
SIGUNUSED, // Synonymous with SIGSYS
SIGURG, // Urgent condition on socket (4.2BSD)
SIGUSR1, // User-defined signal 1
SIGUSR2, // User-defined signal 2
SIGVTALRM, // Virtual alarm clock (4.2BSD)
SIGXCPU, // CPU time limit exceeded (4.2BSD); see setrlimit(2)
SIGXFSZ, // File size limit exceeded (4.2BSD); see setrlimit(2)
SIGWINCH, // Window resize signal (4.3BSD, Sun)
SIG_INT, // Interrupt from keyboard
};
typedef void (*sighandler_t)(int);
struct signal {
int signum;
sighandler_t handler;
};

View File

@ -1,7 +1,6 @@
#pragma once
#include "keyboard.h"
#include "kprintf.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
@ -58,4 +57,4 @@ void terminal_set_default_fg_color(uint8_t fg_color);
void terminal_set_default_bg_color(uint8_t fg_color);
void terminal_change_default_fg_color(uint8_t color);
uint8_t terminal_get_default_color(void);
uint8_t terminal_get_char(int column, int row);
uint8_t terminal_get_char(int column, int row);