mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-27 15:11:44 +00:00
Kernel/tasking-test
This commit is contained in:
10
Kernel/Architecture/aarch64/Entry.cpp
Normal file
10
Kernel/Architecture/aarch64/Entry.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <types.h>
|
||||
|
||||
#include <debug.h>
|
||||
#include <cpu.hpp>
|
||||
|
||||
EXTERNC void arm64Entry(uint64_t dtb_ptr32, uint64_t x1, uint64_t x2, uint64_t x3)
|
||||
{
|
||||
trace("Hello, World!");
|
||||
CPU::Halt(true);
|
||||
}
|
14
Kernel/Architecture/aarch64/SystemCalls.cpp
Normal file
14
Kernel/Architecture/aarch64/SystemCalls.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <syscalls.hpp>
|
||||
|
||||
#include <cpu.hpp>
|
||||
|
||||
extern "C" __attribute__((naked, used, no_stack_protector)) void SystemCallHandlerStub()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
extern "C" uint64_t SystemCallsHandler(SyscallsFrame *regs);
|
||||
|
||||
void InitializeSystemCalls()
|
||||
{
|
||||
}
|
40
Kernel/Architecture/aarch64/cpu/SymmetricMultiprocessing.cpp
Normal file
40
Kernel/Architecture/aarch64/cpu/SymmetricMultiprocessing.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include <smp.hpp>
|
||||
|
||||
#include <interrupts.hpp>
|
||||
#include <memory.hpp>
|
||||
#include <cpu.hpp>
|
||||
|
||||
#include "../../../kernel.h"
|
||||
|
||||
volatile bool CPUEnabled = false;
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
static __attribute__((aligned(PAGE_SIZE))) CPUData CPUs[MAX_CPU] = {0};
|
||||
|
||||
CPUData *GetCPU(uint64_t id) { return &CPUs[id]; }
|
||||
|
||||
CPUData *GetCurrentCPU()
|
||||
{
|
||||
uint64_t ret = 0;
|
||||
|
||||
if (!CPUs[ret].IsActive)
|
||||
{
|
||||
error("CPU %d is not active!", ret);
|
||||
return &CPUs[0];
|
||||
}
|
||||
|
||||
if (CPUs[ret].Checksum != CPU_DATA_CHECKSUM)
|
||||
{
|
||||
error("CPU %d data is corrupted!", ret);
|
||||
return &CPUs[0];
|
||||
}
|
||||
return &CPUs[ret];
|
||||
}
|
||||
|
||||
namespace SMP
|
||||
{
|
||||
void Initialize(void *madt)
|
||||
{
|
||||
fixme("SMP::Initialize() is not implemented!");
|
||||
}
|
||||
}
|
42
Kernel/Architecture/aarch64/linker.ld
Normal file
42
Kernel/Architecture/aarch64/linker.ld
Normal file
@@ -0,0 +1,42 @@
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x80000;
|
||||
_kernel_start = .;
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.text.boot))
|
||||
*(.text .text.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_kernel_text_end = .;
|
||||
|
||||
.data :
|
||||
{
|
||||
*(.data .data.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_kernel_data_end = .;
|
||||
|
||||
.rodata :
|
||||
{
|
||||
*(.rodata .rodata.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_kernel_rodata_end = .;
|
||||
|
||||
.bss :
|
||||
{
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
. = ALIGN(4096);
|
||||
_kernel_end = .;
|
||||
_bss_size = _kernel_end - _kernel_rodata_end;
|
||||
|
||||
/DISCARD/ :
|
||||
{
|
||||
*(.comment*)
|
||||
*(.note*)
|
||||
}
|
||||
}
|
17
Kernel/Architecture/aarch64/runtime/crt0.S
Normal file
17
Kernel/Architecture/aarch64/runtime/crt0.S
Normal file
@@ -0,0 +1,17 @@
|
||||
// .section ".text.boot"
|
||||
//
|
||||
// .global _start
|
||||
// .org 0x80000
|
||||
// _start:
|
||||
// ldr x5, =_start
|
||||
// mov sp, x5
|
||||
// ldr x5, =_kernel_rodata_end
|
||||
// ldr w6, =_bss_size
|
||||
// 1: cbz w6, 2f
|
||||
// str xzr, [x5], #8
|
||||
// sub w6, w6, #1
|
||||
// cbnz w6, 1b
|
||||
// 2: bl arm64Entry
|
||||
// Halt:
|
||||
// wfe
|
||||
// b Halt
|
17
Kernel/Architecture/aarch64/runtime/crt1.S
Normal file
17
Kernel/Architecture/aarch64/runtime/crt1.S
Normal file
@@ -0,0 +1,17 @@
|
||||
.section ".text.boot"
|
||||
|
||||
.global _start
|
||||
.org 0x80000
|
||||
_start:
|
||||
ldr x5, =_start
|
||||
mov sp, x5
|
||||
ldr x5, =_kernel_rodata_end
|
||||
ldr w6, =_bss_size
|
||||
1: cbz w6, 2f
|
||||
str xzr, [x5], #8
|
||||
sub w6, w6, #1
|
||||
cbnz w6, 1b
|
||||
2: bl arm64Entry
|
||||
Halt:
|
||||
wfe
|
||||
b Halt
|
1
Kernel/Architecture/aarch64/runtime/crtbegin.c
Normal file
1
Kernel/Architecture/aarch64/runtime/crtbegin.c
Normal file
@@ -0,0 +1 @@
|
||||
// C++ constructor/destructor stuff
|
1
Kernel/Architecture/aarch64/runtime/crtend.c
Normal file
1
Kernel/Architecture/aarch64/runtime/crtend.c
Normal file
@@ -0,0 +1 @@
|
||||
// C++ constructor/destructor stuff
|
13
Kernel/Architecture/aarch64/runtime/crti.S
Normal file
13
Kernel/Architecture/aarch64/runtime/crti.S
Normal file
@@ -0,0 +1,13 @@
|
||||
.section .init
|
||||
.global _init
|
||||
.type _init, @function
|
||||
_init:
|
||||
// push %rbp
|
||||
// movq %rsp, %rbp
|
||||
|
||||
.section .fini
|
||||
.global _fini
|
||||
.type _fini, @function
|
||||
_fini:
|
||||
// push %rbp
|
||||
// movq %rsp, %rbp
|
7
Kernel/Architecture/aarch64/runtime/crtn.S
Normal file
7
Kernel/Architecture/aarch64/runtime/crtn.S
Normal file
@@ -0,0 +1,7 @@
|
||||
.section .init
|
||||
// popq %rbp
|
||||
ret
|
||||
|
||||
.section .fini
|
||||
// popq %rbp
|
||||
ret
|
Reference in New Issue
Block a user