mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 07:19:20 +00:00
Changed a lot of files. Summary: profiler support; "SafeFunction"; UnlockDeadLock kernel config; Code optimization & more
This commit is contained in:
@ -143,7 +143,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Pause the CPU
|
||||
*/
|
||||
__no_stack_protector static inline void Pause(bool Loop = false)
|
||||
SafeFunction static inline void Pause(bool Loop = false)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -158,7 +158,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Stop the CPU (infinite loop)
|
||||
*/
|
||||
__no_stack_protector static inline void Stop()
|
||||
SafeFunction static inline void Stop()
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
@ -177,7 +177,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Halt the CPU
|
||||
*/
|
||||
__no_stack_protector static inline void Halt(bool Loop = false)
|
||||
SafeFunction static inline void Halt(bool Loop = false)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -213,7 +213,7 @@ namespace CPU
|
||||
|
||||
namespace MemBar
|
||||
{
|
||||
__no_stack_protector static inline void Barrier()
|
||||
SafeFunction static inline void Barrier()
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
asmv("" ::
|
||||
@ -224,7 +224,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void Fence()
|
||||
SafeFunction static inline void Fence()
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
asmv("mfence" ::
|
||||
@ -235,7 +235,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void StoreFence()
|
||||
SafeFunction static inline void StoreFence()
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
asmv("sfence" ::
|
||||
@ -246,7 +246,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void LoadFence()
|
||||
SafeFunction static inline void LoadFence()
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
asmv("lfence" ::
|
||||
@ -549,7 +549,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void invlpg(void *Address)
|
||||
SafeFunction static inline void invlpg(void *Address)
|
||||
{
|
||||
#if defined(__i386__)
|
||||
asmv("invlpg (%0)"
|
||||
@ -1670,7 +1670,7 @@ namespace CPU
|
||||
uint64_t raw;
|
||||
} SelectorErrorCode;
|
||||
|
||||
__no_stack_protector static inline void lgdt(void *gdt)
|
||||
SafeFunction static inline void lgdt(void *gdt)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("lgdt (%0)"
|
||||
@ -1679,7 +1679,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void lidt(void *idt)
|
||||
SafeFunction static inline void lidt(void *idt)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("lidt (%0)"
|
||||
@ -1688,7 +1688,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void ltr(uint16_t Segment)
|
||||
SafeFunction static inline void ltr(uint16_t Segment)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("ltr %0"
|
||||
@ -1697,7 +1697,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void invlpg(void *Address)
|
||||
SafeFunction static inline void invlpg(void *Address)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("invlpg (%0)"
|
||||
@ -1716,7 +1716,7 @@ namespace CPU
|
||||
* @param ecx ECX
|
||||
* @param edx EDX
|
||||
*/
|
||||
__no_stack_protector static inline void cpuid(uint32_t Function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
|
||||
SafeFunction static inline void cpuid(uint32_t Function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("cpuid"
|
||||
@ -1732,14 +1732,14 @@ namespace CPU
|
||||
*
|
||||
* @return uint32_t
|
||||
*/
|
||||
__no_stack_protector static inline uint32_t GetHighestLeaf()
|
||||
SafeFunction static inline uint32_t GetHighestLeaf()
|
||||
{
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
cpuid(0x0, &eax, &ebx, &ecx, &edx);
|
||||
return eax;
|
||||
}
|
||||
|
||||
__no_stack_protector static inline uint64_t rdmsr(uint32_t msr)
|
||||
SafeFunction static inline uint64_t rdmsr(uint32_t msr)
|
||||
{
|
||||
uint32_t Low, High;
|
||||
#if defined(__amd64__)
|
||||
@ -1751,7 +1751,7 @@ namespace CPU
|
||||
return ((uint64_t)Low) | (((uint64_t)High) << 32);
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void wrmsr(uint32_t msr, uint64_t Value)
|
||||
SafeFunction static inline void wrmsr(uint32_t msr, uint64_t Value)
|
||||
{
|
||||
uint32_t Low = Value, High = Value >> 32;
|
||||
#if defined(__amd64__)
|
||||
@ -1762,7 +1762,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline CR0 readcr0()
|
||||
SafeFunction static inline CR0 readcr0()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1772,7 +1772,7 @@ namespace CPU
|
||||
return (CR0){.raw = Result};
|
||||
}
|
||||
|
||||
__no_stack_protector static inline CR2 readcr2()
|
||||
SafeFunction static inline CR2 readcr2()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1782,7 +1782,7 @@ namespace CPU
|
||||
return (CR2){.raw = Result};
|
||||
}
|
||||
|
||||
__no_stack_protector static inline CR3 readcr3()
|
||||
SafeFunction static inline CR3 readcr3()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1792,7 +1792,7 @@ namespace CPU
|
||||
return (CR3){.raw = Result};
|
||||
}
|
||||
|
||||
__no_stack_protector static inline CR4 readcr4()
|
||||
SafeFunction static inline CR4 readcr4()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1802,7 +1802,7 @@ namespace CPU
|
||||
return (CR4){.raw = Result};
|
||||
}
|
||||
|
||||
__no_stack_protector static inline CR8 readcr8()
|
||||
SafeFunction static inline CR8 readcr8()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1812,7 +1812,7 @@ namespace CPU
|
||||
return (CR8){.raw = Result};
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void writecr0(CR0 ControlRegister)
|
||||
SafeFunction static inline void writecr0(CR0 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr0"
|
||||
@ -1822,7 +1822,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void writecr2(CR2 ControlRegister)
|
||||
SafeFunction static inline void writecr2(CR2 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr2"
|
||||
@ -1832,7 +1832,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void writecr3(CR3 ControlRegister)
|
||||
SafeFunction static inline void writecr3(CR3 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr3"
|
||||
@ -1842,7 +1842,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void writecr4(CR4 ControlRegister)
|
||||
SafeFunction static inline void writecr4(CR4 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr4"
|
||||
@ -1852,7 +1852,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void writecr8(CR8 ControlRegister)
|
||||
SafeFunction static inline void writecr8(CR8 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr8"
|
||||
@ -1862,7 +1862,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void fxsave(char *FXSaveArea)
|
||||
SafeFunction static inline void fxsave(char *FXSaveArea)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
if (!FXSaveArea || FXSaveArea >= (char *)0xfffffffffffff000)
|
||||
@ -1876,7 +1876,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__no_stack_protector static inline void fxrstor(char *FXRstorArea)
|
||||
SafeFunction static inline void fxrstor(char *FXRstorArea)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
if (!FXRstorArea || FXRstorArea >= (char *)0xfffffffffffff000)
|
||||
|
Reference in New Issue
Block a user