mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-25 14:04:36 +00:00
Rename "SafeFunction" macro to "NoSecurityAnalysis"
This commit is contained in:
parent
11221b205a
commit
b0575ba4f2
@ -84,7 +84,7 @@ __naked __used __no_stack_protector void InitLimine()
|
||||
asmv("jmp InitLimineAfterStack");
|
||||
}
|
||||
|
||||
SafeFunction NIF void InitLimineAfterStack()
|
||||
nsa NIF void InitLimineAfterStack()
|
||||
{
|
||||
struct BootInfo binfo = {};
|
||||
struct limine_bootloader_info_response *BootloaderInfoResponse = BootloaderInfoRequest.response;
|
||||
|
@ -38,14 +38,14 @@ union __attribute__((packed)) PageTableEntry
|
||||
};
|
||||
uint64_t raw;
|
||||
|
||||
__always_inline inline SafeFunction NIF void SetAddress(uintptr_t _Address)
|
||||
__always_inline inline nsa NIF void SetAddress(uintptr_t _Address)
|
||||
{
|
||||
_Address &= 0x000000FFFFFFFFFF;
|
||||
this->raw &= 0xFFF0000000000FFF;
|
||||
this->raw |= (_Address << 12);
|
||||
}
|
||||
|
||||
__always_inline inline SafeFunction NIF uintptr_t GetAddress() { return (this->raw & 0x000FFFFFFFFFF000) >> 12; }
|
||||
__always_inline inline nsa NIF uintptr_t GetAddress() { return (this->raw & 0x000FFFFFFFFFF000) >> 12; }
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) PageTableEntryPtr
|
||||
@ -72,14 +72,14 @@ union __attribute__((packed)) PageDirectoryEntry
|
||||
};
|
||||
uint64_t raw;
|
||||
|
||||
__always_inline inline SafeFunction NIF void SetAddress(uintptr_t _Address)
|
||||
__always_inline inline nsa NIF void SetAddress(uintptr_t _Address)
|
||||
{
|
||||
_Address &= 0x000000FFFFFFFFFF;
|
||||
this->raw &= 0xFFF0000000000FFF;
|
||||
this->raw |= (_Address << 12);
|
||||
}
|
||||
|
||||
__always_inline inline SafeFunction NIF uintptr_t GetAddress() { return (this->raw & 0x000FFFFFFFFFF000) >> 12; }
|
||||
__always_inline inline nsa NIF uintptr_t GetAddress() { return (this->raw & 0x000FFFFFFFFFF000) >> 12; }
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) PageDirectoryEntryPtr
|
||||
@ -106,14 +106,14 @@ union __attribute__((packed)) PageDirectoryPointerTableEntry
|
||||
};
|
||||
uint64_t raw;
|
||||
|
||||
__always_inline inline SafeFunction NIF void SetAddress(uintptr_t _Address)
|
||||
__always_inline inline nsa NIF void SetAddress(uintptr_t _Address)
|
||||
{
|
||||
_Address &= 0x000000FFFFFFFFFF;
|
||||
this->raw &= 0xFFF0000000000FFF;
|
||||
this->raw |= (_Address << 12);
|
||||
}
|
||||
|
||||
__always_inline inline SafeFunction NIF uintptr_t GetAddress() { return (this->raw & 0x000FFFFFFFFFF000) >> 12; }
|
||||
__always_inline inline nsa NIF uintptr_t GetAddress() { return (this->raw & 0x000FFFFFFFFFF000) >> 12; }
|
||||
};
|
||||
|
||||
struct __attribute__((packed)) PageDirectoryPointerTableEntryPtr
|
||||
@ -140,14 +140,14 @@ union __attribute__((packed)) PageMapLevel4
|
||||
};
|
||||
uint64_t raw;
|
||||
|
||||
__always_inline inline SafeFunction NIF void SetAddress(uintptr_t _Address)
|
||||
__always_inline inline nsa NIF void SetAddress(uintptr_t _Address)
|
||||
{
|
||||
_Address &= 0x000000FFFFFFFFFF;
|
||||
this->raw &= 0xFFF0000000000FFF;
|
||||
this->raw |= (_Address << 12);
|
||||
}
|
||||
|
||||
__always_inline inline SafeFunction NIF uintptr_t GetAddress() { return (this->raw & 0x000FFFFFFFFFF000) >> 12; }
|
||||
__always_inline inline nsa NIF uintptr_t GetAddress() { return (this->raw & 0x000FFFFFFFFFF000) >> 12; }
|
||||
};
|
||||
|
||||
struct PageTable4
|
||||
@ -161,7 +161,7 @@ extern uintptr_t _kernel_start, _kernel_end;
|
||||
__attribute__((section(".bootstrap.data"))) static PageTable4 *BPTable = (PageTable4 *)BootPageTable;
|
||||
__attribute__((section(".bootstrap.data"))) static size_t BPT_Allocated = 0x4000;
|
||||
|
||||
__always_inline inline SafeFunction NIF void *RequestPage()
|
||||
__always_inline inline nsa NIF void *RequestPage()
|
||||
{
|
||||
void *Page = (void *)(BootPageTable + BPT_Allocated);
|
||||
BPT_Allocated += 0x1000;
|
||||
@ -180,7 +180,7 @@ public:
|
||||
uintptr_t PDPTEIndex = 0;
|
||||
uintptr_t PDEIndex = 0;
|
||||
uintptr_t PTEIndex = 0;
|
||||
__always_inline inline SafeFunction NIF PageMapIndexer(uintptr_t VirtualAddress)
|
||||
__always_inline inline nsa NIF PageMapIndexer(uintptr_t VirtualAddress)
|
||||
{
|
||||
uintptr_t Address = VirtualAddress;
|
||||
Address >>= 12;
|
||||
@ -194,7 +194,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
__attribute__((section(".bootstrap.text"))) SafeFunction NIF void MB2_64_Map(void *VirtualAddress, void *PhysicalAddress, uint64_t Flags)
|
||||
__attribute__((section(".bootstrap.text"))) nsa NIF void MB2_64_Map(void *VirtualAddress, void *PhysicalAddress, uint64_t Flags)
|
||||
{
|
||||
PageMapIndexer Index = PageMapIndexer((uintptr_t)VirtualAddress);
|
||||
// Clear any flags that are not 1 << 0 (Present) - 1 << 5 (Accessed) because rest are for page table entries only
|
||||
@ -280,7 +280,7 @@ __attribute__((section(".bootstrap.text"))) SafeFunction NIF void MB2_64_Map(voi
|
||||
: "memory");
|
||||
}
|
||||
|
||||
EXTERNC __attribute__((section(".bootstrap.text"))) SafeFunction NIF __attribute__((section(".bootstrap.text"))) void UpdatePageTable64()
|
||||
EXTERNC __attribute__((section(".bootstrap.text"))) nsa NIF __attribute__((section(".bootstrap.text"))) void UpdatePageTable64()
|
||||
{
|
||||
BPTable = (PageTable4 *)BootPageTable;
|
||||
|
||||
|
@ -120,7 +120,7 @@ namespace GlobalDescriptorTable
|
||||
|
||||
void *CPUStackPointer[MAX_CPU];
|
||||
|
||||
SafeFunction void Init(int Core)
|
||||
nsa void Init(int Core)
|
||||
{
|
||||
GDTEntries[Core] = GDTEntriesTemplate;
|
||||
gdt[Core] =
|
||||
@ -194,7 +194,7 @@ namespace GlobalDescriptorTable
|
||||
debug("Global Descriptor Table initialized");
|
||||
}
|
||||
|
||||
SafeFunction void SetKernelStack(void *Stack)
|
||||
nsa void SetKernelStack(void *Stack)
|
||||
{
|
||||
long CPUID = GetCurrentCPU()->ID;
|
||||
if (Stack != nullptr)
|
||||
|
@ -46,9 +46,9 @@ std::atomic_bool CPUEnabled = false;
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
static __aligned(PAGE_SIZE) CPUData CPUs[MAX_CPU] = {0};
|
||||
|
||||
SafeFunction CPUData *GetCPU(long id) { return &CPUs[id]; }
|
||||
nsa CPUData *GetCPU(long id) { return &CPUs[id]; }
|
||||
|
||||
SafeFunction CPUData *GetCurrentCPU()
|
||||
nsa CPUData *GetCurrentCPU()
|
||||
{
|
||||
if (unlikely(!Interrupts::apic[0]))
|
||||
return &CPUs[0]; /* No APIC means we are on the BSP. */
|
||||
|
@ -155,7 +155,7 @@ namespace GlobalDescriptorTable
|
||||
|
||||
void *CPUStackPointer[MAX_CPU];
|
||||
|
||||
SafeFunction void Init(int Core)
|
||||
nsa void Init(int Core)
|
||||
{
|
||||
memcpy(&GDTEntries[Core], &GDTEntriesTemplate, sizeof(GlobalDescriptorTableEntries));
|
||||
gdt[Core] = {.Length = sizeof(GlobalDescriptorTableEntries) - 1, .Entries = &GDTEntries[Core]};
|
||||
@ -253,7 +253,7 @@ namespace GlobalDescriptorTable
|
||||
debug("Global Descriptor Table initialized");
|
||||
}
|
||||
|
||||
SafeFunction void SetKernelStack(void *Stack)
|
||||
nsa void SetKernelStack(void *Stack)
|
||||
{
|
||||
stub;
|
||||
}
|
||||
|
@ -43,9 +43,9 @@ std::atomic_bool CPUEnabled = false;
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
static __aligned(PAGE_SIZE) CPUData CPUs[MAX_CPU] = {0};
|
||||
|
||||
SafeFunction CPUData *GetCPU(long id) { return &CPUs[id]; }
|
||||
nsa CPUData *GetCPU(long id) { return &CPUs[id]; }
|
||||
|
||||
SafeFunction CPUData *GetCurrentCPU()
|
||||
nsa CPUData *GetCurrentCPU()
|
||||
{
|
||||
if (unlikely(!Interrupts::apic[0]))
|
||||
return &CPUs[0]; /* No APIC means we are on the BSP. */
|
||||
|
@ -42,79 +42,79 @@ static const char *PageFaultDescriptions[8] = {
|
||||
"User process tried to write to a non-present page entry\n",
|
||||
"User process tried to write a page and caused a protection fault\n"};
|
||||
|
||||
SafeFunction void DivideByZeroExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void DivideByZeroExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Divide by zero exception\n");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void DebugExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void DebugExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
CrashHandler::EHPrint("Kernel triggered debug exception.\n");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void NonMaskableInterruptExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void NonMaskableInterruptExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("NMI exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void BreakpointExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void BreakpointExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Breakpoint exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void OverflowExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void OverflowExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Overflow exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void BoundRangeExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void BoundRangeExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Bound range exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void InvalidOpcodeExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void InvalidOpcodeExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
CrashHandler::EHPrint("Kernel tried to execute an invalid opcode.\n");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void DeviceNotAvailableExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void DeviceNotAvailableExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Device not available exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void DoubleFaultExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void DoubleFaultExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Double fault exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void CoprocessorSegmentOverrunExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void CoprocessorSegmentOverrunExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Coprocessor segment overrun exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void InvalidTSSExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void InvalidTSSExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Invalid TSS exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void SegmentNotPresentExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void SegmentNotPresentExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Segment not present exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void StackFaultExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void StackFaultExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
CPU::x64::SelectorErrorCode SelCode = {.raw = Frame->ErrorCode};
|
||||
#if defined(a64)
|
||||
@ -129,7 +129,7 @@ SafeFunction void StackFaultExceptionHandler(CPU::TrapFrame *Frame)
|
||||
CrashHandler::EHPrint("Error code: %#lx\n", Frame->ErrorCode);
|
||||
}
|
||||
|
||||
SafeFunction void GeneralProtectionExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void GeneralProtectionExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
CPU::x64::SelectorErrorCode SelCode = {.raw = Frame->ErrorCode};
|
||||
// switch (SelCode.Table)
|
||||
@ -156,7 +156,7 @@ SafeFunction void GeneralProtectionExceptionHandler(CPU::TrapFrame *Frame)
|
||||
CrashHandler::EHPrint("Index: %#x\n", SelCode.Idx);
|
||||
}
|
||||
|
||||
SafeFunction void PageFaultExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void PageFaultExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
CPU::x64::PageFaultErrorCode params = {.raw = (uint32_t)Frame->ErrorCode};
|
||||
#if defined(a64)
|
||||
@ -305,43 +305,43 @@ SafeFunction void PageFaultExceptionHandler(CPU::TrapFrame *Frame)
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction void x87FloatingPointExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void x87FloatingPointExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("x87 floating point exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void AlignmentCheckExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void AlignmentCheckExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Alignment check exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void MachineCheckExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void MachineCheckExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Machine check exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void SIMDFloatingPointExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void SIMDFloatingPointExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("SIMD floating point exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void VirtualizationExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void VirtualizationExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Virtualization exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void SecurityExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void SecurityExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Security exception");
|
||||
UNUSED(Frame);
|
||||
}
|
||||
|
||||
SafeFunction void UnknownExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa void UnknownExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("Unknown exception");
|
||||
UNUSED(Frame);
|
||||
|
@ -51,13 +51,13 @@ namespace CrashHandler
|
||||
int SBIdx = 255;
|
||||
CrashKeyboardDriver *kbd;
|
||||
|
||||
SafeFunction void printfWrapper(char c, void *unused)
|
||||
nsa void printfWrapper(char c, void *unused)
|
||||
{
|
||||
Display->Print(c, SBIdx, true);
|
||||
UNUSED(unused);
|
||||
}
|
||||
|
||||
SafeFunction void EHPrint(const char *Format, ...)
|
||||
nsa void EHPrint(const char *Format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, Format);
|
||||
@ -65,7 +65,7 @@ namespace CrashHandler
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
SafeFunction void EHDumpData(void *Address, unsigned long Length)
|
||||
nsa void EHDumpData(void *Address, unsigned long Length)
|
||||
{
|
||||
EHPrint("-------------------------------------------------------------------------\n");
|
||||
Display->SetBuffer(SBIdx);
|
||||
@ -101,7 +101,7 @@ namespace CrashHandler
|
||||
Display->SetBuffer(SBIdx);
|
||||
}
|
||||
|
||||
SafeFunction char *TrimWhiteSpace(char *str)
|
||||
nsa char *TrimWhiteSpace(char *str)
|
||||
{
|
||||
char *end;
|
||||
while (*str == ' ')
|
||||
@ -117,7 +117,7 @@ namespace CrashHandler
|
||||
|
||||
CRData crashdata{};
|
||||
|
||||
SafeFunction void DisplayTopOverlay()
|
||||
nsa void DisplayTopOverlay()
|
||||
{
|
||||
Video::ScreenBuffer *sb = Display->GetBuffer(SBIdx);
|
||||
Video::Font *f = Display->GetCurrentFont();
|
||||
@ -252,7 +252,7 @@ namespace CrashHandler
|
||||
}
|
||||
}
|
||||
|
||||
SafeFunction void DisplayBottomOverlay()
|
||||
nsa void DisplayBottomOverlay()
|
||||
{
|
||||
Video::ScreenBuffer *sb = Display->GetBuffer(SBIdx);
|
||||
Video::Font *f = Display->GetCurrentFont();
|
||||
@ -266,7 +266,7 @@ namespace CrashHandler
|
||||
EHPrint("\eAAAAAA> \eFAFAFA");
|
||||
}
|
||||
|
||||
SafeFunction void ArrowInput(uint8_t key)
|
||||
nsa void ArrowInput(uint8_t key)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
@ -337,7 +337,7 @@ namespace CrashHandler
|
||||
Display->SetBuffer(SBIdx);
|
||||
}
|
||||
|
||||
SafeFunction void UserInput(char *Input)
|
||||
nsa void UserInput(char *Input)
|
||||
{
|
||||
SmartCriticalSection(UserInputLock);
|
||||
Display->ClearBuffer(SBIdx);
|
||||
@ -816,7 +816,7 @@ namespace CrashHandler
|
||||
Display->SetBuffer(SBIdx);
|
||||
}
|
||||
|
||||
SafeFunction void StopAllCores()
|
||||
nsa void StopAllCores()
|
||||
{
|
||||
#if defined(a86)
|
||||
/* FIXME: Can't send IPIs to other cores
|
||||
@ -862,7 +862,7 @@ namespace CrashHandler
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction inline bool Handle_x86_64(CPU::TrapFrame *Frame)
|
||||
nsa inline bool Handle_x86_64(CPU::TrapFrame *Frame)
|
||||
{
|
||||
#ifdef a64
|
||||
trace("Exception at %#lx(%s)", Frame->rip,
|
||||
@ -960,7 +960,7 @@ namespace CrashHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
SafeFunction inline bool Handle_x86_32(CPU::TrapFrame *Frame)
|
||||
nsa inline bool Handle_x86_32(CPU::TrapFrame *Frame)
|
||||
{
|
||||
#ifdef a32
|
||||
trace("Exception at %#lx(%s)", Frame->eip,
|
||||
@ -1059,7 +1059,7 @@ namespace CrashHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
SafeFunction inline void Print_x86_64(CPU::TrapFrame *Frame)
|
||||
nsa inline void Print_x86_64(CPU::TrapFrame *Frame)
|
||||
{
|
||||
#ifdef a64
|
||||
CPU::x64::CR0 cr0 = CPU::x64::readcr0();
|
||||
@ -1132,7 +1132,7 @@ namespace CrashHandler
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction inline void Print_x86_32(CPU::TrapFrame *Frame)
|
||||
nsa inline void Print_x86_32(CPU::TrapFrame *Frame)
|
||||
{
|
||||
#ifdef a32
|
||||
CPU::x32::CR0 cr0 = CPU::x32::readcr0();
|
||||
@ -1192,7 +1192,7 @@ namespace CrashHandler
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction void Handle(void *Data)
|
||||
nsa void Handle(void *Data)
|
||||
{
|
||||
// TODO: SUPPORT SMP
|
||||
CPU::Interrupts(CPU::Disable);
|
||||
|
@ -236,7 +236,7 @@ namespace CrashHandler
|
||||
int BackSpaceLimit = 0;
|
||||
static char UserInputBuffer[1024];
|
||||
|
||||
SafeFunction void CrashKeyboardDriver::OnInterruptReceived(CPU::TrapFrame *Frame)
|
||||
nsa void CrashKeyboardDriver::OnInterruptReceived(CPU::TrapFrame *Frame)
|
||||
{
|
||||
#if defined(a86)
|
||||
UNUSED(Frame);
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace CrashHandler
|
||||
{
|
||||
SafeFunction void DisplayConsoleScreen(CRData data)
|
||||
nsa void DisplayConsoleScreen(CRData data)
|
||||
{
|
||||
EHPrint("TODO");
|
||||
UNUSED(data);
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace CrashHandler
|
||||
{
|
||||
SafeFunction void DisplayDetailsScreen(CRData data)
|
||||
nsa void DisplayDetailsScreen(CRData data)
|
||||
{
|
||||
if (data.Process)
|
||||
EHPrint("\e7981FCCurrent Process: %s(%ld)\n",
|
||||
|
@ -44,7 +44,7 @@ static const char *PagefaultDescriptions[8] = {
|
||||
|
||||
namespace CrashHandler
|
||||
{
|
||||
SafeFunction void DisplayMainScreen(CRData data)
|
||||
nsa void DisplayMainScreen(CRData data)
|
||||
{
|
||||
CPU::TrapFrame *Frame = data.Frame;
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
namespace CrashHandler
|
||||
{
|
||||
SafeFunction void DisplayStackFrameScreen(CRData data)
|
||||
nsa void DisplayStackFrameScreen(CRData data)
|
||||
{
|
||||
EHPrint("\eFAFAFATracing 10 frames...");
|
||||
TraceFrames(data, 10, KernelSymbolTable, true);
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
namespace CrashHandler
|
||||
{
|
||||
SafeFunction void DisplayTasksScreen(CRData data)
|
||||
nsa void DisplayTasksScreen(CRData data)
|
||||
{
|
||||
const char *StatusColor[] = {
|
||||
"FF0000", // Unknown
|
||||
|
@ -42,7 +42,7 @@ namespace CrashHandler
|
||||
uintptr_t rip;
|
||||
};
|
||||
|
||||
SafeFunction void TraceFrames(CRData data, int Count,
|
||||
nsa void TraceFrames(CRData data, int Count,
|
||||
SymbolResolver::Symbols *SymHandle,
|
||||
bool Kernel)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "../../kernel.h"
|
||||
|
||||
SafeFunction bool UserModeExceptionHandler(CPU::TrapFrame *Frame)
|
||||
nsa bool UserModeExceptionHandler(CPU::TrapFrame *Frame)
|
||||
{
|
||||
CPUData *CurCPU = GetCurrentCPU();
|
||||
Tasking::PCB *CurProc = CurCPU->CurrentProcess;
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include "crashhandler.hpp"
|
||||
#include "../kernel.h"
|
||||
|
||||
extern "C" SafeFunction void ExceptionHandler(void *Data)
|
||||
extern "C" nsa void ExceptionHandler(void *Data)
|
||||
{
|
||||
CrashHandler::Handle(Data);
|
||||
}
|
||||
@ -192,7 +192,7 @@ namespace Interrupts
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction void RemoveAll()
|
||||
nsa void RemoveAll()
|
||||
{
|
||||
forItr(itr, RegisteredEvents)
|
||||
{
|
||||
@ -280,7 +280,7 @@ namespace Interrupts
|
||||
warn("IRQ%d not found.", InterruptNumber);
|
||||
}
|
||||
|
||||
extern "C" SafeFunction void MainInterruptHandler(void *Data)
|
||||
extern "C" nsa void MainInterruptHandler(void *Data)
|
||||
{
|
||||
#if defined(a64)
|
||||
CPU::x64::TrapFrame *Frame = (CPU::x64::TrapFrame *)Data;
|
||||
|
@ -54,7 +54,7 @@ namespace UniversalAsynchronousReceiverTransmitter
|
||||
|
||||
/* TODO: Serial Port implementation needs reword. https://wiki.osdev.org/Serial_Ports */
|
||||
|
||||
SafeFunction NIF UART::UART(SerialPorts Port)
|
||||
nsa NIF UART::UART(SerialPorts Port)
|
||||
{
|
||||
#if defined(a86)
|
||||
if (Port == COMNULL)
|
||||
@ -132,9 +132,9 @@ namespace UniversalAsynchronousReceiverTransmitter
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction NIF UART::~UART() {}
|
||||
nsa NIF UART::~UART() {}
|
||||
|
||||
SafeFunction NIF void UART::Write(uint8_t Char)
|
||||
nsa NIF void UART::Write(uint8_t Char)
|
||||
{
|
||||
if (!this->IsAvailable)
|
||||
return;
|
||||
@ -148,7 +148,7 @@ namespace UniversalAsynchronousReceiverTransmitter
|
||||
e->OnSent(Char);
|
||||
}
|
||||
|
||||
SafeFunction NIF uint8_t UART::Read()
|
||||
nsa NIF uint8_t UART::Read()
|
||||
{
|
||||
if (!this->IsAvailable)
|
||||
return 0;
|
||||
@ -168,13 +168,13 @@ namespace UniversalAsynchronousReceiverTransmitter
|
||||
}
|
||||
}
|
||||
|
||||
SafeFunction NIF Events::Events(SerialPorts Port)
|
||||
nsa NIF Events::Events(SerialPorts Port)
|
||||
{
|
||||
this->Port = Port;
|
||||
RegisteredEvents.push_back(this);
|
||||
}
|
||||
|
||||
SafeFunction NIF Events::~Events()
|
||||
nsa NIF Events::~Events()
|
||||
{
|
||||
forItr(itr, RegisteredEvents)
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Pause the CPU
|
||||
*/
|
||||
SafeFunction static __always_inline inline void Pause(bool Loop = false)
|
||||
nsa static __always_inline inline void Pause(bool Loop = false)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -154,7 +154,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Stop the CPU (infinite loop)
|
||||
*/
|
||||
SafeFunction __noreturn __used inline void Stop()
|
||||
nsa __noreturn __used inline void Stop()
|
||||
{
|
||||
#if defined(a86)
|
||||
asmv("CPUStopLoop:\n"
|
||||
@ -174,7 +174,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Halt the CPU
|
||||
*/
|
||||
SafeFunction static __always_inline inline void Halt(bool Loop = false)
|
||||
nsa static __always_inline inline void Halt(bool Loop = false)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -444,7 +444,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void lgdt(void *gdt)
|
||||
nsa static inline void lgdt(void *gdt)
|
||||
{
|
||||
#ifdef a32
|
||||
asmv("lgdt (%0)"
|
||||
@ -455,7 +455,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void lidt(void *idt)
|
||||
nsa static inline void lidt(void *idt)
|
||||
{
|
||||
#ifdef a32
|
||||
asmv("lidt (%0)"
|
||||
@ -466,7 +466,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void ltr(uint16_t Segment)
|
||||
nsa static inline void ltr(uint16_t Segment)
|
||||
{
|
||||
#ifdef a32
|
||||
asmv("ltr %0"
|
||||
@ -477,7 +477,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void invlpg(void *Address)
|
||||
nsa static inline void invlpg(void *Address)
|
||||
{
|
||||
#ifdef a32
|
||||
asmv("invlpg (%0)"
|
||||
@ -489,7 +489,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void fxsave(void *FXSaveArea)
|
||||
nsa static inline void fxsave(void *FXSaveArea)
|
||||
{
|
||||
#ifdef a32
|
||||
if (!FXSaveArea)
|
||||
@ -504,7 +504,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void fxrstor(void *FXRstorArea)
|
||||
nsa static inline void fxrstor(void *FXRstorArea)
|
||||
{
|
||||
#ifdef a32
|
||||
if (!FXRstorArea)
|
||||
@ -831,7 +831,7 @@ namespace CPU
|
||||
uint8_t xmm[16][16];
|
||||
} __packed __aligned(16);
|
||||
|
||||
SafeFunction static inline void lgdt(void *gdt)
|
||||
nsa static inline void lgdt(void *gdt)
|
||||
{
|
||||
#ifdef a64
|
||||
asmv("lgdt (%0)"
|
||||
@ -840,7 +840,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void lidt(void *idt)
|
||||
nsa static inline void lidt(void *idt)
|
||||
{
|
||||
#ifdef a64
|
||||
asmv("lidt (%0)"
|
||||
@ -849,7 +849,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void ltr(uint16_t Segment)
|
||||
nsa static inline void ltr(uint16_t Segment)
|
||||
{
|
||||
#ifdef a64
|
||||
asmv("ltr %0"
|
||||
@ -858,7 +858,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void invlpg(void *Address)
|
||||
nsa static inline void invlpg(void *Address)
|
||||
{
|
||||
#ifdef a64
|
||||
asmv("invlpg (%0)"
|
||||
@ -877,7 +877,7 @@ namespace CPU
|
||||
* @param ecx ECX
|
||||
* @param edx EDX
|
||||
*/
|
||||
SafeFunction static inline void cpuid(uint32_t Function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
|
||||
nsa static inline void cpuid(uint32_t Function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
|
||||
{
|
||||
#ifdef a64
|
||||
asmv("cpuid"
|
||||
@ -893,14 +893,14 @@ namespace CPU
|
||||
*
|
||||
* @return uint32_t
|
||||
*/
|
||||
SafeFunction static inline uint32_t GetHighestLeaf()
|
||||
nsa static inline uint32_t GetHighestLeaf()
|
||||
{
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
cpuid(0x0, &eax, &ebx, &ecx, &edx);
|
||||
return eax;
|
||||
}
|
||||
|
||||
SafeFunction static inline void fxsave(void *FXSaveArea)
|
||||
nsa static inline void fxsave(void *FXSaveArea)
|
||||
{
|
||||
#ifdef a64
|
||||
if (!FXSaveArea || FXSaveArea >= (char *)0xfffffffffffff000)
|
||||
@ -913,7 +913,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void fxrstor(void *FXRstorArea)
|
||||
nsa static inline void fxrstor(void *FXRstorArea)
|
||||
{
|
||||
#ifdef a64
|
||||
if (!FXRstorArea || FXRstorArea >= (char *)0xfffffffffffff000)
|
||||
|
@ -24,7 +24,7 @@ namespace CPU
|
||||
{
|
||||
namespace MemBar
|
||||
{
|
||||
SafeFunction static inline void Barrier()
|
||||
nsa static inline void Barrier()
|
||||
{
|
||||
#if defined(a86)
|
||||
asmv("" ::
|
||||
@ -35,7 +35,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void Fence()
|
||||
nsa static inline void Fence()
|
||||
{
|
||||
#if defined(a86)
|
||||
asmv("mfence" ::
|
||||
@ -46,7 +46,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void StoreFence()
|
||||
nsa static inline void StoreFence()
|
||||
{
|
||||
#if defined(a86)
|
||||
asmv("sfence" ::
|
||||
@ -57,7 +57,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction static inline void LoadFence()
|
||||
nsa static inline void LoadFence()
|
||||
{
|
||||
#if defined(a86)
|
||||
asmv("lfence" ::
|
||||
|
@ -152,7 +152,7 @@ namespace CPU
|
||||
uint32_t raw;
|
||||
} CR8;
|
||||
#if defined(a32)
|
||||
SafeFunction static inline CR0 readcr0()
|
||||
nsa static inline CR0 readcr0()
|
||||
{
|
||||
uint32_t Result = 0;
|
||||
asmv("mov %%cr0, %[Result]"
|
||||
@ -160,7 +160,7 @@ namespace CPU
|
||||
return (CR0){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline CR2 readcr2()
|
||||
nsa static inline CR2 readcr2()
|
||||
{
|
||||
uint32_t Result = 0;
|
||||
asmv("mov %%cr2, %[Result]"
|
||||
@ -168,7 +168,7 @@ namespace CPU
|
||||
return (CR2){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline CR3 readcr3()
|
||||
nsa static inline CR3 readcr3()
|
||||
{
|
||||
uint32_t Result = 0;
|
||||
asmv("mov %%cr3, %[Result]"
|
||||
@ -176,7 +176,7 @@ namespace CPU
|
||||
return (CR3){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline CR4 readcr4()
|
||||
nsa static inline CR4 readcr4()
|
||||
{
|
||||
uint32_t Result = 0;
|
||||
asmv("mov %%cr4, %[Result]"
|
||||
@ -184,7 +184,7 @@ namespace CPU
|
||||
return (CR4){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline CR8 readcr8()
|
||||
nsa static inline CR8 readcr8()
|
||||
{
|
||||
uint32_t Result = 0;
|
||||
asmv("mov %%cr8, %[Result]"
|
||||
@ -192,7 +192,7 @@ namespace CPU
|
||||
return (CR8){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr0(CR0 ControlRegister)
|
||||
nsa static inline void writecr0(CR0 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr0"
|
||||
:
|
||||
@ -200,7 +200,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr2(CR2 ControlRegister)
|
||||
nsa static inline void writecr2(CR2 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr2"
|
||||
:
|
||||
@ -208,7 +208,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr3(CR3 ControlRegister)
|
||||
nsa static inline void writecr3(CR3 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr3"
|
||||
:
|
||||
@ -216,7 +216,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr4(CR4 ControlRegister)
|
||||
nsa static inline void writecr4(CR4 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr4"
|
||||
:
|
||||
@ -224,7 +224,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr8(CR8 ControlRegister)
|
||||
nsa static inline void writecr8(CR8 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr8"
|
||||
:
|
||||
|
@ -401,7 +401,7 @@ namespace CPU
|
||||
};
|
||||
|
||||
#if defined(a32)
|
||||
SafeFunction static inline uint64_t rdmsr(uint32_t msr)
|
||||
nsa static inline uint64_t rdmsr(uint32_t msr)
|
||||
{
|
||||
uint32_t Low, High;
|
||||
asmv("rdmsr"
|
||||
@ -411,7 +411,7 @@ namespace CPU
|
||||
return ((uint64_t)Low) | (((uint64_t)High) << 32);
|
||||
}
|
||||
|
||||
SafeFunction static inline void wrmsr(uint32_t msr, uint64_t Value)
|
||||
nsa static inline void wrmsr(uint32_t msr, uint64_t Value)
|
||||
{
|
||||
uint32_t Low = (uint32_t)Value, High = (uint32_t)(Value >> 32);
|
||||
asmv("wrmsr"
|
||||
|
@ -190,7 +190,7 @@ namespace CPU
|
||||
} XCR0;
|
||||
|
||||
#if defined(a64)
|
||||
SafeFunction static inline CR0 readcr0()
|
||||
nsa static inline CR0 readcr0()
|
||||
{
|
||||
uint64_t Result = 0;
|
||||
asmv("mov %%cr0, %[Result]"
|
||||
@ -198,7 +198,7 @@ namespace CPU
|
||||
return (CR0){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline CR2 readcr2()
|
||||
nsa static inline CR2 readcr2()
|
||||
{
|
||||
uint64_t Result = 0;
|
||||
asmv("mov %%cr2, %[Result]"
|
||||
@ -206,7 +206,7 @@ namespace CPU
|
||||
return (CR2){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline CR3 readcr3()
|
||||
nsa static inline CR3 readcr3()
|
||||
{
|
||||
uint64_t Result = 0;
|
||||
asmv("mov %%cr3, %[Result]"
|
||||
@ -214,7 +214,7 @@ namespace CPU
|
||||
return (CR3){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline CR4 readcr4()
|
||||
nsa static inline CR4 readcr4()
|
||||
{
|
||||
uint64_t Result = 0;
|
||||
asmv("mov %%cr4, %[Result]"
|
||||
@ -222,7 +222,7 @@ namespace CPU
|
||||
return (CR4){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline CR8 readcr8()
|
||||
nsa static inline CR8 readcr8()
|
||||
{
|
||||
uint64_t Result = 0;
|
||||
asmv("mov %%cr8, %[Result]"
|
||||
@ -230,7 +230,7 @@ namespace CPU
|
||||
return (CR8){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline XCR0 readxcr0()
|
||||
nsa static inline XCR0 readxcr0()
|
||||
{
|
||||
uint64_t Result = 0;
|
||||
asmv("xgetbv"
|
||||
@ -240,7 +240,7 @@ namespace CPU
|
||||
return (XCR0){.raw = Result};
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr0(CR0 ControlRegister)
|
||||
nsa static inline void writecr0(CR0 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr0"
|
||||
:
|
||||
@ -248,7 +248,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr2(CR2 ControlRegister)
|
||||
nsa static inline void writecr2(CR2 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr2"
|
||||
:
|
||||
@ -256,7 +256,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr3(CR3 ControlRegister)
|
||||
nsa static inline void writecr3(CR3 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr3"
|
||||
:
|
||||
@ -264,7 +264,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr4(CR4 ControlRegister)
|
||||
nsa static inline void writecr4(CR4 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr4"
|
||||
:
|
||||
@ -272,7 +272,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writecr8(CR8 ControlRegister)
|
||||
nsa static inline void writecr8(CR8 ControlRegister)
|
||||
{
|
||||
asmv("mov %[ControlRegister], %%cr8"
|
||||
:
|
||||
@ -280,7 +280,7 @@ namespace CPU
|
||||
: "memory");
|
||||
}
|
||||
|
||||
SafeFunction static inline void writexcr0(XCR0 ControlRegister)
|
||||
nsa static inline void writexcr0(XCR0 ControlRegister)
|
||||
{
|
||||
asmv("xsetbv"
|
||||
:
|
||||
|
@ -402,7 +402,7 @@ namespace CPU
|
||||
};
|
||||
|
||||
#if defined(a64)
|
||||
SafeFunction static inline uint64_t rdmsr(uint32_t msr)
|
||||
nsa static inline uint64_t rdmsr(uint32_t msr)
|
||||
{
|
||||
uint32_t Low, High;
|
||||
asmv("rdmsr"
|
||||
@ -412,7 +412,7 @@ namespace CPU
|
||||
return ((uint64_t)Low) | (((uint64_t)High) << 32);
|
||||
}
|
||||
|
||||
SafeFunction static inline void wrmsr(uint32_t msr, uint64_t Value)
|
||||
nsa static inline void wrmsr(uint32_t msr, uint64_t Value)
|
||||
{
|
||||
uint32_t Low = s_cst(uint32_t, Value), High = s_cst(uint32_t, Value >> 32);
|
||||
asmv("wrmsr"
|
||||
|
@ -413,7 +413,8 @@ typedef uint48_t uint_fast48_t;
|
||||
#define PUBLIC __visibility("default")
|
||||
#define PRIVATE __visibility("hidden")
|
||||
|
||||
#define SafeFunction __no_stack_protector __no_sanitize_address __no_sanitize_undefined __no_address_safety_analysis __no_sanitize_thread
|
||||
#define NoSecurityAnalysis __no_stack_protector __no_sanitize_address __no_sanitize_undefined __no_address_safety_analysis __no_sanitize_thread
|
||||
#define nsa NoSecurityAnalysis
|
||||
|
||||
#define NIF __no_instrument_function
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace UniversalAsynchronousReceiverTransmitter
|
||||
* @brief Get the Registered Port object
|
||||
* @return SerialPorts
|
||||
*/
|
||||
SafeFunction NIF SerialPorts GetRegisteredPort() { return this->Port; }
|
||||
nsa NIF SerialPorts GetRegisteredPort() { return this->Port; }
|
||||
|
||||
/**
|
||||
* @brief Called when a character is sent.
|
||||
|
@ -28,7 +28,7 @@ unsigned int Level = 0;
|
||||
using namespace UniversalAsynchronousReceiverTransmitter;
|
||||
UART com2(COM2);
|
||||
|
||||
static inline SafeFunction NIF void profiler_uart_wrapper(char c, void *unused)
|
||||
static inline nsa NIF void profiler_uart_wrapper(char c, void *unused)
|
||||
{
|
||||
bool renable = EnableProfiler;
|
||||
EnableProfiler = false;
|
||||
@ -38,7 +38,7 @@ static inline SafeFunction NIF void profiler_uart_wrapper(char c, void *unused)
|
||||
EnableProfiler = true;
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __cyg_profile_func_enter(void *Function, void *CallSite)
|
||||
EXTERNC nsa NIF void __cyg_profile_func_enter(void *Function, void *CallSite)
|
||||
{
|
||||
if (!EnableProfiler)
|
||||
return;
|
||||
@ -75,7 +75,7 @@ EXTERNC SafeFunction NIF void __cyg_profile_func_enter(void *Function, void *Cal
|
||||
Wait = false;
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __cyg_profile_func_exit(void *Function, void *CallSite)
|
||||
EXTERNC nsa NIF void __cyg_profile_func_exit(void *Function, void *CallSite)
|
||||
{
|
||||
if (!EnableProfiler)
|
||||
return;
|
||||
|
@ -55,7 +55,7 @@ struct gcov_info
|
||||
struct gcov_ctr_info counts[0];
|
||||
};
|
||||
|
||||
static inline SafeFunction NIF void gcov_uart_wrapper(char c, void *unused)
|
||||
static inline nsa NIF void gcov_uart_wrapper(char c, void *unused)
|
||||
{
|
||||
UART(COM2).Write(c);
|
||||
UNUSED(unused);
|
||||
@ -63,25 +63,25 @@ static inline SafeFunction NIF void gcov_uart_wrapper(char c, void *unused)
|
||||
|
||||
// TODO: Implement
|
||||
|
||||
EXTERNC SafeFunction NIF void __gcov_init(gcov_info *p __unused)
|
||||
EXTERNC nsa NIF void __gcov_init(gcov_info *p __unused)
|
||||
{
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __gcov_exit(void)
|
||||
EXTERNC nsa NIF void __gcov_exit(void)
|
||||
{
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __gcov_flush(void)
|
||||
EXTERNC nsa NIF void __gcov_flush(void)
|
||||
{
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
|
||||
EXTERNC nsa NIF void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
UNUSED(counters);
|
||||
UNUSED(n_counters);
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
|
||||
EXTERNC nsa NIF void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
UNUSED(counters);
|
||||
UNUSED(n_counters);
|
||||
|
@ -23,13 +23,13 @@
|
||||
|
||||
using namespace UniversalAsynchronousReceiverTransmitter;
|
||||
|
||||
static inline SafeFunction NIF void gprof_uart_wrapper(char c, void *unused)
|
||||
static inline nsa NIF void gprof_uart_wrapper(char c, void *unused)
|
||||
{
|
||||
UART(COM2).Write(c);
|
||||
UNUSED(unused);
|
||||
}
|
||||
|
||||
EXTERNC SafeFunction NIF void mcount(unsigned long frompc, unsigned long selfpc)
|
||||
EXTERNC nsa NIF void mcount(unsigned long frompc, unsigned long selfpc)
|
||||
{
|
||||
// TODO: Implement
|
||||
/* https://docs.kernel.org/trace/ftrace-design.html */
|
||||
|
@ -106,7 +106,7 @@
|
||||
#define wut_schedbg(m, ...)
|
||||
#endif
|
||||
|
||||
extern "C" SafeFunction NIF void TaskingScheduler_OneShot(int TimeSlice)
|
||||
extern "C" nsa NIF void TaskingScheduler_OneShot(int TimeSlice)
|
||||
{
|
||||
if (TimeSlice == 0)
|
||||
TimeSlice = Tasking::TaskPriority::Normal;
|
||||
@ -125,7 +125,7 @@ extern "C" SafeFunction NIF void TaskingScheduler_OneShot(int TimeSlice)
|
||||
namespace Tasking
|
||||
{
|
||||
#if defined(a86)
|
||||
SafeFunction NIF bool Task::FindNewProcess(void *CPUDataPointer)
|
||||
nsa NIF bool Task::FindNewProcess(void *CPUDataPointer)
|
||||
{
|
||||
CPUData *CurrentCPU = (CPUData *)CPUDataPointer;
|
||||
fnp_schedbg("%d processes", ProcessList.size());
|
||||
@ -178,7 +178,7 @@ namespace Tasking
|
||||
return false;
|
||||
}
|
||||
|
||||
SafeFunction NIF bool Task::GetNextAvailableThread(void *CPUDataPointer)
|
||||
nsa NIF bool Task::GetNextAvailableThread(void *CPUDataPointer)
|
||||
{
|
||||
CPUData *CurrentCPU = (CPUData *)CPUDataPointer;
|
||||
|
||||
@ -237,7 +237,7 @@ namespace Tasking
|
||||
return false;
|
||||
}
|
||||
|
||||
SafeFunction NIF bool Task::GetNextAvailableProcess(void *CPUDataPointer)
|
||||
nsa NIF bool Task::GetNextAvailableProcess(void *CPUDataPointer)
|
||||
{
|
||||
CPUData *CurrentCPU = (CPUData *)CPUDataPointer;
|
||||
|
||||
@ -297,7 +297,7 @@ namespace Tasking
|
||||
return false;
|
||||
}
|
||||
|
||||
SafeFunction NIF bool Task::SchedulerSearchProcessThread(void *CPUDataPointer)
|
||||
nsa NIF bool Task::SchedulerSearchProcessThread(void *CPUDataPointer)
|
||||
{
|
||||
CPUData *CurrentCPU = (CPUData *)CPUDataPointer;
|
||||
|
||||
@ -342,7 +342,7 @@ namespace Tasking
|
||||
return false;
|
||||
}
|
||||
|
||||
SafeFunction NIF void Task::UpdateProcessState()
|
||||
nsa NIF void Task::UpdateProcessState()
|
||||
{
|
||||
foreach (auto process in ProcessList)
|
||||
{
|
||||
@ -378,7 +378,7 @@ namespace Tasking
|
||||
}
|
||||
}
|
||||
|
||||
SafeFunction NIF void Task::WakeUpThreads()
|
||||
nsa NIF void Task::WakeUpThreads()
|
||||
{
|
||||
foreach (auto process in ProcessList)
|
||||
{
|
||||
@ -418,7 +418,7 @@ namespace Tasking
|
||||
}
|
||||
}
|
||||
|
||||
SafeFunction NIF void Task::CleanupTerminated()
|
||||
nsa NIF void Task::CleanupTerminated()
|
||||
{
|
||||
foreach (auto pcb in ProcessList)
|
||||
{
|
||||
@ -473,7 +473,7 @@ namespace Tasking
|
||||
"SchedulerSearchProcessThread",
|
||||
};
|
||||
|
||||
SafeFunction NIF void OnScreenTaskManagerUpdate()
|
||||
nsa NIF void OnScreenTaskManagerUpdate()
|
||||
{
|
||||
TimeManager->Sleep(10, Time::Units::Milliseconds);
|
||||
Video::ScreenBuffer *sb = Display->GetBuffer(0);
|
||||
@ -513,7 +513,7 @@ namespace Tasking
|
||||
}
|
||||
#endif
|
||||
|
||||
SafeFunction NIF void Task::Schedule(CPU::TrapFrame *Frame)
|
||||
nsa NIF void Task::Schedule(CPU::TrapFrame *Frame)
|
||||
{
|
||||
if (unlikely(StopScheduler))
|
||||
{
|
||||
@ -725,37 +725,37 @@ namespace Tasking
|
||||
CurrentCPU->CurrentProcess->PageTable->Update();
|
||||
}
|
||||
|
||||
SafeFunction NIF void Task::OnInterruptReceived(CPU::TrapFrame *Frame)
|
||||
nsa NIF void Task::OnInterruptReceived(CPU::TrapFrame *Frame)
|
||||
{
|
||||
SmartCriticalSection(SchedulerLock);
|
||||
this->Schedule(Frame);
|
||||
}
|
||||
#elif defined(aa64)
|
||||
SafeFunction bool Task::FindNewProcess(void *CPUDataPointer)
|
||||
nsa bool Task::FindNewProcess(void *CPUDataPointer)
|
||||
{
|
||||
fixme("unimplemented");
|
||||
}
|
||||
|
||||
SafeFunction bool Task::GetNextAvailableThread(void *CPUDataPointer)
|
||||
nsa bool Task::GetNextAvailableThread(void *CPUDataPointer)
|
||||
{
|
||||
fixme("unimplemented");
|
||||
}
|
||||
|
||||
SafeFunction bool Task::GetNextAvailableProcess(void *CPUDataPointer)
|
||||
nsa bool Task::GetNextAvailableProcess(void *CPUDataPointer)
|
||||
{
|
||||
fixme("unimplemented");
|
||||
}
|
||||
|
||||
SafeFunction bool Task::SchedulerSearchProcessThread(void *CPUDataPointer)
|
||||
nsa bool Task::SchedulerSearchProcessThread(void *CPUDataPointer)
|
||||
{
|
||||
fixme("unimplemented");
|
||||
}
|
||||
|
||||
SafeFunction void Task::Schedule(CPU::TrapFrame *Frame)
|
||||
nsa void Task::Schedule(CPU::TrapFrame *Frame)
|
||||
{
|
||||
fixme("unimplemented");
|
||||
}
|
||||
|
||||
SafeFunction void Task::OnInterruptReceived(CPU::TrapFrame *Frame) { this->Schedule(Frame); }
|
||||
nsa void Task::OnInterruptReceived(CPU::TrapFrame *Frame) { this->Schedule(Frame); }
|
||||
#endif
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace Tasking
|
||||
#endif
|
||||
}
|
||||
|
||||
SafeFunction bool Task::InvalidPCB(PCB *pcb)
|
||||
nsa bool Task::InvalidPCB(PCB *pcb)
|
||||
{
|
||||
if (!pcb)
|
||||
return true;
|
||||
@ -81,7 +81,7 @@ namespace Tasking
|
||||
return false;
|
||||
}
|
||||
|
||||
SafeFunction bool Task::InvalidTCB(TCB *tcb)
|
||||
nsa bool Task::InvalidTCB(TCB *tcb)
|
||||
{
|
||||
if (!tcb)
|
||||
return true;
|
||||
@ -101,7 +101,7 @@ namespace Tasking
|
||||
return false;
|
||||
}
|
||||
|
||||
SafeFunction bool Task::RemoveThread(TCB *Thread)
|
||||
nsa bool Task::RemoveThread(TCB *Thread)
|
||||
{
|
||||
debug("Thread \"%s\"(%d) removed from process \"%s\"(%d)",
|
||||
Thread->Name, Thread->ID, Thread->Parent->Name,
|
||||
@ -111,7 +111,7 @@ namespace Tasking
|
||||
return true;
|
||||
}
|
||||
|
||||
SafeFunction bool Task::RemoveProcess(PCB *Process)
|
||||
nsa bool Task::RemoveProcess(PCB *Process)
|
||||
{
|
||||
if (unlikely(InvalidPCB(Process)))
|
||||
return false;
|
||||
@ -131,7 +131,7 @@ namespace Tasking
|
||||
return true;
|
||||
}
|
||||
|
||||
SafeFunction void Task::UpdateUsage(TaskInfo *Info, TaskExecutionMode Mode, int Core)
|
||||
nsa void Task::UpdateUsage(TaskInfo *Info, TaskExecutionMode Mode, int Core)
|
||||
{
|
||||
UNUSED(Core);
|
||||
uint64_t CurrentTime = TimeManager->GetCounter();
|
||||
|
Loading…
x
Reference in New Issue
Block a user