summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-10-30 22:12:14 +0100
committerAnton Kling <anton@kling.gg>2023-10-31 00:18:38 +0100
commit8a9208612eec8ddae4c418485d848ecfa0613699 (patch)
tree2f4b29200c2f0c19ae52f45bdb9b38a41b356e30 /includes
parentca76600acc8bf7a02346efa5bd8f17072210ec01 (diff)
Meta: Move kernel and userland to their own folders.
This is to allow both the kernel and the userland to share certain header files and to make the folder structure a bit more clear.
Diffstat (limited to 'includes')
-rw-r--r--includes/defs.h5
-rw-r--r--includes/math.h2
-rw-r--r--includes/mmu.h61
-rw-r--r--includes/signal.h46
-rw-r--r--includes/sys/types.h2
5 files changed, 0 insertions, 116 deletions
diff --git a/includes/defs.h b/includes/defs.h
deleted file mode 100644
index 3a373b3..0000000
--- a/includes/defs.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef DEFS_H
-#define DEFS_H
-#define BYTE unsigned char
-#define BYTEPTR BYTE*
-#endif
diff --git a/includes/math.h b/includes/math.h
deleted file mode 100644
index 19fc595..0000000
--- a/includes/math.h
+++ /dev/null
@@ -1,2 +0,0 @@
-int min(int a, int b);
-int max(int a, int b);
diff --git a/includes/mmu.h b/includes/mmu.h
deleted file mode 100644
index 1df337d..0000000
--- a/includes/mmu.h
+++ /dev/null
@@ -1,61 +0,0 @@
-#ifndef PAGING_H
-#define PAGING_H
-#include "kmalloc.h"
-#include <stdint.h>
-
-typedef uint8_t mmu_flags;
-
-#define MMU_FLAG_RW (1 << 0)
-#define MMU_FLAG_KERNEL (1 << 1)
-
-void *next_page(void *a);
-void *align_page(void *a);
-
-typedef struct Page {
- uint32_t present : 1;
- uint32_t rw : 1;
- uint32_t user : 1;
- uint32_t accessed : 1;
- uint32_t dirty : 1;
- uint32_t unused : 7;
- uint32_t frame : 20;
-} __attribute__((packed)) Page;
-
-typedef struct PageTable {
- Page pages[1024];
-} __attribute__((packed)) PageTable;
-
-typedef struct PageDirectory {
- PageTable *tables[1024];
- uint32_t physical_tables[1024];
- uint32_t physical_address;
-} PageDirectory;
-
-int mmu_allocate_region(void *ptr, size_t n, mmu_flags flags, PageDirectory *pd);
-void mmu_allocate_shared_kernel_region(void *rc, size_t n);
-void *mmu_find_unallocated_virtual_range(void *addr, size_t length);
-void mmu_remove_virtual_physical_address_mapping(void *ptr, size_t length);
-void mmu_free_address_range(void *ptr, size_t length);
-void mmu_map_directories(void *dst, PageDirectory *d, void *src,
- PageDirectory *s, size_t length);
-uint32_t mmu_get_number_of_allocated_frames(void);
-void *mmu_map_frames(void *ptr, size_t s);
-void mmu_map_physical(void *dst, PageDirectory *d, void *physical,
- size_t length);
-void mmu_free_pages(void *a, uint32_t n);
-
-void flush_tlb(void);
-void paging_init(void);
-PageDirectory *get_active_pagedirectory(void);
-void move_stack(uint32_t new_stack_address, uint32_t size);
-void switch_page_directory(PageDirectory *directory);
-void *allocate_frame(Page *page, int rw, int is_kernel);
-PageDirectory *clone_directory(PageDirectory *original);
-void *virtual_to_physical(void *address, PageDirectory *directory);
-void *is_valid_userpointer(const void *const p, size_t s);
-void *is_valid_user_c_string(const char *ptr, size_t *size);
-void *ksbrk(size_t s);
-
-Page *get_page(void *ptr, PageDirectory *directory, int create_new_page,
- int set_user);
-#endif
diff --git a/includes/signal.h b/includes/signal.h
deleted file mode 100644
index 3de9998..0000000
--- a/includes/signal.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef SIGNAL_H
-#define SIGNAL_H
-#include <sys/types.h>
-#define SIGHUP 0
-#define SIGINT 1
-#define SIGWINCH 2
-#define SIGQUIT 3
-#define SIG_IGN 4
-typedef int pid_t;
-typedef int uid_t;
-typedef int sigset_t;
-
-union sigval {
- int sival_int; // Integer signal value.
- void *sival_ptr; // Pointer signal value.
-};
-
-struct siginfo {
- int si_signo; // Signal number.
- int si_code; // Signal code.
- int si_errno; // If non-zero, an errno value associated with
- // this signal, as described in <errno.h>.
- pid_t si_pid; // Sending process ID.
- uid_t si_uid; // Real user ID of sending process.
- void *si_addr; // Address of faulting instruction.
- int si_status; // Exit value or signal.
- long si_band; // Band event for SIGPOLL.
- union sigval si_value; // Signal value.
-};
-
-typedef struct siginfo siginfo_t;
-
-int kill(pid_t pid, int sig);
-
-struct sigaction {
- void (*sa_handler)(int); // Pointer to a signal-catching function or one of
- // the macros SIG_IGN or SIG_DFL.
- sigset_t sa_mask; // Additional set of signals to be blocked during execution
- // of signal-catching function.
- int sa_flags; // Special flags to affect behavior of signal.
- void (*sa_sigaction)(int, siginfo_t *,
- void *); // Pointer to a signal-catching function.
-};
-
-int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
-#endif // SIGNAL_H
diff --git a/includes/sys/types.h b/includes/sys/types.h
deleted file mode 100644
index 1ccbf63..0000000
--- a/includes/sys/types.h
+++ /dev/null
@@ -1,2 +0,0 @@
-typedef int time_t;
-typedef int pid_t;