mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 07:19:20 +00:00
Improved crash screen
This commit is contained in:
@ -143,7 +143,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Pause the CPU
|
||||
*/
|
||||
__attribute__((no_stack_protector)) static inline void Pause(bool Loop = false)
|
||||
__no_stack_protector static inline void Pause(bool Loop = false)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -158,7 +158,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Stop the CPU (infinite loop)
|
||||
*/
|
||||
__attribute__((no_stack_protector)) static inline void Stop()
|
||||
__no_stack_protector static inline void Stop()
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
@ -177,7 +177,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Halt the CPU
|
||||
*/
|
||||
__attribute__((no_stack_protector)) static inline void Halt(bool Loop = false)
|
||||
__no_stack_protector static inline void Halt(bool Loop = false)
|
||||
{
|
||||
do
|
||||
{
|
||||
@ -213,7 +213,7 @@ namespace CPU
|
||||
|
||||
namespace MemBar
|
||||
{
|
||||
__attribute__((no_stack_protector)) static inline void Barrier()
|
||||
__no_stack_protector static inline void Barrier()
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
asmv("" ::
|
||||
@ -224,7 +224,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void Fence()
|
||||
__no_stack_protector static inline void Fence()
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
asmv("mfence" ::
|
||||
@ -235,7 +235,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void StoreFence()
|
||||
__no_stack_protector static inline void StoreFence()
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
asmv("sfence" ::
|
||||
@ -246,7 +246,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void LoadFence()
|
||||
__no_stack_protector static inline void LoadFence()
|
||||
{
|
||||
#if defined(__amd64__) || defined(__i386__)
|
||||
asmv("lfence" ::
|
||||
@ -1390,7 +1390,7 @@ namespace CPU
|
||||
uint64_t raw;
|
||||
} SelectorErrorCode;
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void lgdt(void *gdt)
|
||||
__no_stack_protector static inline void lgdt(void *gdt)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("lgdt (%0)"
|
||||
@ -1399,7 +1399,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void lidt(void *idt)
|
||||
__no_stack_protector static inline void lidt(void *idt)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("lidt (%0)"
|
||||
@ -1408,7 +1408,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void ltr(uint16_t Segment)
|
||||
__no_stack_protector static inline void ltr(uint16_t Segment)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("ltr %0"
|
||||
@ -1417,7 +1417,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void invlpg(void *Address)
|
||||
__no_stack_protector static inline void invlpg(void *Address)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("invlpg (%0)"
|
||||
@ -1436,7 +1436,7 @@ namespace CPU
|
||||
* @param ecx ECX
|
||||
* @param edx EDX
|
||||
*/
|
||||
__attribute__((no_stack_protector)) static inline void cpuid(uint32_t Function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
|
||||
__no_stack_protector static inline void cpuid(uint32_t Function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("cpuid"
|
||||
@ -1452,14 +1452,14 @@ namespace CPU
|
||||
*
|
||||
* @return uint32_t
|
||||
*/
|
||||
__attribute__((no_stack_protector)) static inline uint32_t GetHighestLeaf()
|
||||
__no_stack_protector static inline uint32_t GetHighestLeaf()
|
||||
{
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
cpuid(0x0, &eax, &ebx, &ecx, &edx);
|
||||
return eax;
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline uint64_t rdmsr(uint32_t msr)
|
||||
__no_stack_protector static inline uint64_t rdmsr(uint32_t msr)
|
||||
{
|
||||
uint32_t Low, High;
|
||||
#if defined(__amd64__)
|
||||
@ -1471,7 +1471,7 @@ namespace CPU
|
||||
return ((uint64_t)Low) | (((uint64_t)High) << 32);
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void wrmsr(uint32_t msr, uint64_t Value)
|
||||
__no_stack_protector static inline void wrmsr(uint32_t msr, uint64_t Value)
|
||||
{
|
||||
uint32_t Low = Value, High = Value >> 32;
|
||||
#if defined(__amd64__)
|
||||
@ -1482,7 +1482,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline CR0 readcr0()
|
||||
__no_stack_protector static inline CR0 readcr0()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1492,7 +1492,7 @@ namespace CPU
|
||||
return (CR0){.raw = Result};
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline CR2 readcr2()
|
||||
__no_stack_protector static inline CR2 readcr2()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1502,7 +1502,7 @@ namespace CPU
|
||||
return (CR2){.raw = Result};
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline CR3 readcr3()
|
||||
__no_stack_protector static inline CR3 readcr3()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1512,7 +1512,7 @@ namespace CPU
|
||||
return (CR3){.raw = Result};
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline CR4 readcr4()
|
||||
__no_stack_protector static inline CR4 readcr4()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1522,7 +1522,7 @@ namespace CPU
|
||||
return (CR4){.raw = Result};
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline CR8 readcr8()
|
||||
__no_stack_protector static inline CR8 readcr8()
|
||||
{
|
||||
uint64_t Result;
|
||||
#if defined(__amd64__)
|
||||
@ -1532,7 +1532,7 @@ namespace CPU
|
||||
return (CR8){.raw = Result};
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void writecr0(CR0 ControlRegister)
|
||||
__no_stack_protector static inline void writecr0(CR0 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr0"
|
||||
@ -1542,7 +1542,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void writecr2(CR2 ControlRegister)
|
||||
__no_stack_protector static inline void writecr2(CR2 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr2"
|
||||
@ -1552,7 +1552,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void writecr3(CR3 ControlRegister)
|
||||
__no_stack_protector static inline void writecr3(CR3 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr3"
|
||||
@ -1562,7 +1562,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void writecr4(CR4 ControlRegister)
|
||||
__no_stack_protector static inline void writecr4(CR4 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr4"
|
||||
@ -1572,7 +1572,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void writecr8(CR8 ControlRegister)
|
||||
__no_stack_protector static inline void writecr8(CR8 ControlRegister)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
asmv("mov %[ControlRegister], %%cr8"
|
||||
@ -1582,7 +1582,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void fxsave(char *FXSaveArea)
|
||||
__no_stack_protector static inline void fxsave(char *FXSaveArea)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
if (!FXSaveArea || FXSaveArea >= (char *)0xfffffffffffff000)
|
||||
@ -1596,7 +1596,7 @@ namespace CPU
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) static inline void fxrstor(char *FXRstorArea)
|
||||
__no_stack_protector static inline void fxrstor(char *FXRstorArea)
|
||||
{
|
||||
#if defined(__amd64__)
|
||||
if (!FXRstorArea || FXRstorArea >= (char *)0xfffffffffffff000)
|
||||
|
@ -172,7 +172,7 @@ namespace Tasking
|
||||
PCB *IdleProcess = nullptr;
|
||||
TCB *IdleThread = nullptr;
|
||||
|
||||
__attribute__((no_stack_protector)) bool InvalidPCB(PCB *pcb)
|
||||
__no_stack_protector bool InvalidPCB(PCB *pcb)
|
||||
{
|
||||
if (pcb >= (PCB *)0xfffffffffffff000)
|
||||
return true;
|
||||
@ -181,7 +181,7 @@ namespace Tasking
|
||||
return false;
|
||||
}
|
||||
|
||||
__attribute__((no_stack_protector)) bool InvalidTCB(TCB *tcb)
|
||||
__no_stack_protector bool InvalidTCB(TCB *tcb)
|
||||
{
|
||||
if (tcb >= (TCB *)0xfffffffffffff000)
|
||||
return true;
|
||||
@ -211,8 +211,11 @@ namespace Tasking
|
||||
void Schedule(void *Frame);
|
||||
void OnInterruptReceived(void *Frame);
|
||||
#endif
|
||||
bool StopSheduler = false;
|
||||
|
||||
public:
|
||||
Vector<PCB *> GetProcessList() { return ListProcess; }
|
||||
void Panic() { StopSheduler = true; }
|
||||
void Schedule();
|
||||
long GetUsage(int Core) { return 100 - IdleProcess->Info.Usage[Core]; }
|
||||
void KillThread(TCB *tcb, int Code)
|
||||
|
@ -240,5 +240,17 @@ typedef __SIZE_TYPE__ size_t;
|
||||
#define __constructor __attribute__((constructor))
|
||||
#define __destructor __attribute__((destructor))
|
||||
#define __cleanup(x) __attribute__((cleanup(x)))
|
||||
#define __fallthrough __attribute__((fallthrough))
|
||||
#define __nonnull(x) __attribute__((nonnull x))
|
||||
#define __nonnull_all __attribute__((nonnull))
|
||||
#define __returns_nonnull __attribute__((returns_nonnull))
|
||||
#define __sentinel __attribute__((sentinel))
|
||||
#define __sentinel_all __attribute__((sentinel(0)))
|
||||
#define __format(x, y, z) __attribute__((format(x, y, z)))
|
||||
#define __format_arg(x) __attribute__((format_arg(x)))
|
||||
#define __nonnull_params(x) __attribute__((nonnull x))
|
||||
#define __nonnull_all __attribute__((nonnull))
|
||||
#define __warn_unused_result __attribute__((warn_unused_result))
|
||||
#define __no_stack_protector __attribute__((no_stack_protector))
|
||||
|
||||
#endif // !__FENNIX_KERNEL_TYPES_H__
|
||||
|
Reference in New Issue
Block a user