Squash commits for public release

This commit is contained in:
2025-02-12 09:54:05 -05:00
commit 7118adc514
1108 changed files with 80873 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
#ifdef __i386__
#include <platform/x86/i386/tasking/context.h>
#elif __x86_64__
#include <platform/x86/x86_64/tasking/context.h>
#endif

View File

@@ -0,0 +1,12 @@
#ifndef _KERNEL_PLATFORM_X86_TASKING_DUMP_IMPL_H
#define _KERNEL_PLATFORM_X86_TASKING_DUMP_IMPL_H
#include <libkern/types.h>
#include <tasking/bits/dump.h>
#include <tasking/tasking.h>
int dump_impl(dump_data_t* data);
int dump_kernel_impl(dump_data_t* dump_data, const char* err_desc);
int dump_kernel_impl_from_tf(dump_data_t* dump_data, const char* err_desc, trapframe_t* tf);
#endif // _KERNEL_PLATFORM_X86_TASKING_DUMP_IMPL_H

View File

@@ -0,0 +1,10 @@
#ifndef _KERNEL_PLATFORM_X86_TASKING_SIGNAL_IMPL_H
#define _KERNEL_PLATFORM_X86_TASKING_SIGNAL_IMPL_H
#include <libkern/types.h>
struct thread;
int signal_impl_prepare_stack(struct thread* thread, int signo, uintptr_t old_sp, uintptr_t magic);
int signal_impl_restore_stack(struct thread* thread, uintptr_t* old_sp, uintptr_t* magic);
#endif // _KERNEL_PLATFORM_X86_TASKING_SIGNAL_IMPL_H

View File

@@ -0,0 +1,9 @@
#ifndef _KERNEL_PLATFORM_X86_TASKING_SWITCHVM_H
#define _KERNEL_PLATFORM_X86_TASKING_SWITCHVM_H
#include <libkern/types.h>
#include <tasking/tasking.h>
void switch_uthreads(thread_t* thread);
#endif

View File

@@ -0,0 +1,5 @@
#ifdef __i386__
#include <platform/x86/i386/tasking/trapframe.h>
#elif __x86_64__
#include <platform/x86/x86_64/tasking/trapframe.h>
#endif

View File

@@ -0,0 +1,76 @@
#ifndef _KERNEL_PLATFORM_X86_TASKING_TSS_H
#define _KERNEL_PLATFORM_X86_TASKING_TSS_H
#include <libkern/c_attrs.h>
#include <libkern/types.h>
#define SEGTSS_TYPE 0x9 // defined in the Intel's manual 3a
#ifdef __i386__
struct PACKED tss {
uint32_t back_link : 16; // back link to prev tss
uint32_t zero1 : 16; // always zero
uint32_t esp0 : 32; // stack pointer at ring 0
uint32_t ss0 : 16; // stack segment at ring 0
uint32_t zero2 : 16; // always zero
uint32_t esp1 : 32; // stack pointer at ring 1
uint32_t ss1 : 16; // stack segment at ring 1
uint32_t zero3 : 16; // always zero
uint32_t esp2 : 32; // stack pointer at ring 2
uint32_t ss2 : 16; // stack segment at ring 2
uint32_t zero4 : 16; // always zero
uint32_t cr3 : 32;
uint32_t eip : 32;
uint32_t eflag : 32;
uint32_t eax : 32;
uint32_t ecx : 32;
uint32_t edx : 32;
uint32_t ebx : 32;
uint32_t esp : 32;
uint32_t ebp : 32;
uint32_t esi : 32;
uint32_t edi : 32;
uint32_t es : 16;
uint32_t zero5 : 16; // always zero
uint32_t cs : 16;
uint32_t zero6 : 16; // always zero
uint32_t ss : 16;
uint32_t zero7 : 16; // always zero
uint32_t ds : 16;
uint32_t zero8 : 16; // always zero
uint32_t fs : 16;
uint32_t zero9 : 16; // always zero
uint32_t gs : 16;
uint32_t zero10 : 16; // always zero
uint32_t ldt_selector : 16;
uint32_t zero11 : 16; // always zero
uint32_t t : 1;
uint32_t zero12 : 15; // always zero
uint32_t iomap_offset : 16;
};
#elif __x86_64__
struct PACKED tss {
uint32_t res1;
uint64_t rsp0;
uint64_t rsp1;
uint64_t rsp2;
uint64_t res2;
uint64_t ist1;
uint64_t ist2;
uint64_t ist3;
uint64_t ist4;
uint64_t ist5;
uint64_t ist6;
uint64_t ist7;
uint64_t res3;
uint16_t res4;
uint16_t iomap_offset;
};
#endif
typedef struct tss tss_t;
extern tss_t tss;
void set_ltr(uint16_t seg);
#endif //_KERNEL_PLATFORM_X86_TASKING_TSS_H