Squash commits for public release
This commit is contained in:
67
kernel/include/platform/generic/cpu.h
Normal file
67
kernel/include/platform/generic/cpu.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#ifndef _KERNEL_PLATFORM_GENERIC_CPU_H
|
||||
#define _KERNEL_PLATFORM_GENERIC_CPU_H
|
||||
|
||||
#include <libkern/types.h>
|
||||
#include <mem/kmemzone.h>
|
||||
#include <mem/vmm.h>
|
||||
#include <platform/generic/fpu/fpu.h>
|
||||
#include <platform/generic/tasking/context.h>
|
||||
#include <tasking/bits/sched.h>
|
||||
|
||||
#define MAX_CPU_CNT 4
|
||||
#define THIS_CPU (&cpus[system_cpu_id()])
|
||||
|
||||
// TODO: Add support for RiscV FPU.
|
||||
#ifndef __riscv
|
||||
#define FPU_ENABLED
|
||||
#endif
|
||||
|
||||
typedef uint32_t cpufeat_flags_t;
|
||||
|
||||
struct thread;
|
||||
typedef int cpu_state_t;
|
||||
enum CPU_STATE {
|
||||
CPU_IN_KERNEL,
|
||||
CPU_IN_USERLAND,
|
||||
};
|
||||
|
||||
typedef int data_access_type_t;
|
||||
enum DATA_ACCESS_TYPE {
|
||||
DATA_ACCESS_REGULAR,
|
||||
DATA_ACCESS_KERNEL, // Allows umem_copy on kernel addresses.
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
int int_depth_counter;
|
||||
|
||||
vm_address_space_t* active_address_space;
|
||||
kmemzone_t sched_stack_zone;
|
||||
context_t* sched_context; // context of sched's registers
|
||||
struct thread* running_thread;
|
||||
cpu_state_t current_state;
|
||||
data_access_type_t data_access_type;
|
||||
struct thread* idle_thread;
|
||||
|
||||
sched_data_t sched;
|
||||
|
||||
/* Stat */
|
||||
time_t stat_ticks_since_boot;
|
||||
time_t stat_system_and_idle_ticks;
|
||||
time_t stat_user_ticks;
|
||||
|
||||
#ifdef FPU_ENABLED
|
||||
// Information about current state of fpu.
|
||||
struct thread* fpu_for_thread;
|
||||
pid_t fpu_for_pid;
|
||||
#endif // FPU_ENABLED
|
||||
#ifdef KASAN_ENABLED
|
||||
int kasan_depth_counter;
|
||||
#endif
|
||||
|
||||
cpufeat_flags_t cpufeat;
|
||||
} cpu_t;
|
||||
|
||||
extern cpu_t cpus[MAX_CPU_CNT];
|
||||
|
||||
#endif // _KERNEL_PLATFORM_GENERIC_CPU_H
|
||||
9
kernel/include/platform/generic/cpuinfo.h
Normal file
9
kernel/include/platform/generic/cpuinfo.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/cpuinfo.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/cpuinfo.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/cpuinfo.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/cpuinfo.h>
|
||||
#endif
|
||||
7
kernel/include/platform/generic/fpu/fpu.h
Normal file
7
kernel/include/platform/generic/fpu/fpu.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/fpu/fpu.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/fpu/fpuv4.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/fpu/fpu.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/init.h
Normal file
9
kernel/include/platform/generic/init.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/init.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/init.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/init.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/init.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/pmm/settings.h
Normal file
9
kernel/include/platform/generic/pmm/settings.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/pmm/settings.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/pmm/settings.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/pmm/settings.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/pmm/settings.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/registers.h
Normal file
9
kernel/include/platform/generic/registers.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/registers.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/registers.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/registers.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/registers.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/syscalls/params.h
Normal file
9
kernel/include/platform/generic/syscalls/params.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/syscalls/params.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/syscalls/params.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/syscalls/params.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/syscalls/params.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/system.h
Normal file
9
kernel/include/platform/generic/system.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/system.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/system.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/system.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/system.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/tasking/context.h
Normal file
9
kernel/include/platform/generic/tasking/context.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/tasking/context.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/tasking/context.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/tasking/context.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/tasking/context.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/tasking/dump_impl.h
Normal file
9
kernel/include/platform/generic/tasking/dump_impl.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/tasking/dump_impl.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/tasking/dump_impl.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/tasking/dump_impl.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/tasking/dump_impl.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/tasking/signal_impl.h
Normal file
9
kernel/include/platform/generic/tasking/signal_impl.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/tasking/signal_impl.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/tasking/signal_impl.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/tasking/signal_impl.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/tasking/signal_impl.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/tasking/trapframe.h
Normal file
9
kernel/include/platform/generic/tasking/trapframe.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/tasking/trapframe.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/tasking/trapframe.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/tasking/trapframe.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/tasking/trapframe.h>
|
||||
#endif
|
||||
9
kernel/include/platform/generic/vmm/consts.h
Normal file
9
kernel/include/platform/generic/vmm/consts.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/vmm/consts.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/vmm/consts.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/vmm/consts.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/vmm/consts.h>
|
||||
#endif
|
||||
17
kernel/include/platform/generic/vmm/mapping_table.h
Normal file
17
kernel/include/platform/generic/vmm/mapping_table.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#ifndef _KERNEL_PLATFORM_GENERIC_VMM_MAPPING_TABLE_H
|
||||
#define _KERNEL_PLATFORM_GENERIC_VMM_MAPPING_TABLE_H
|
||||
|
||||
#include <libkern/types.h>
|
||||
|
||||
struct mapping_entry {
|
||||
uintptr_t paddr;
|
||||
uintptr_t vaddr;
|
||||
size_t pages;
|
||||
uint32_t flags;
|
||||
uint32_t last; // 1 if an element is the last.
|
||||
};
|
||||
typedef struct mapping_entry mapping_entry_t;
|
||||
|
||||
extern mapping_entry_t extern_mapping_table[]; // Maps after kernel tables are ready, so can be outside kernelspace
|
||||
|
||||
#endif // _KERNEL_PLATFORM_GENERIC_VMM_MAPPING_TABLE_H
|
||||
9
kernel/include/platform/generic/vmm/mmu.h
Normal file
9
kernel/include/platform/generic/vmm/mmu.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
#include <platform/x86/vmm/mmu.h>
|
||||
#elif __arm__
|
||||
#include <platform/arm32/vmm/mmu.h>
|
||||
#elif __aarch64__
|
||||
#include <platform/arm64/vmm/mmu.h>
|
||||
#elif defined(__riscv) && (__riscv_xlen == 64)
|
||||
#include <platform/riscv64/vmm/mmu.h>
|
||||
#endif
|
||||
Reference in New Issue
Block a user