mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 07:19:20 +00:00
QoL and bug fixes
This commit is contained in:
@ -54,7 +54,6 @@ struct BootInfo
|
||||
__UINT32_TYPE__ Height;
|
||||
__UINT64_TYPE__ Pitch;
|
||||
__UINT16_TYPE__ BitsPerPixel;
|
||||
__UINT8_TYPE__ MemoryModel;
|
||||
__UINT8_TYPE__ RedMaskSize;
|
||||
__UINT8_TYPE__ RedMaskShift;
|
||||
__UINT8_TYPE__ GreenMaskSize;
|
||||
|
@ -143,7 +143,7 @@ namespace CPU
|
||||
{
|
||||
do
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("pause");
|
||||
#elif defined(aa64)
|
||||
asmv("yield");
|
||||
@ -154,7 +154,7 @@ namespace CPU
|
||||
/**
|
||||
* @brief Stop the CPU (infinite loop)
|
||||
*/
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
SafeFunction __noreturn __naked __used inline void Stop()
|
||||
{
|
||||
asmv("CPUStopLoop:\n"
|
||||
@ -178,7 +178,7 @@ namespace CPU
|
||||
{
|
||||
do
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("hlt");
|
||||
#elif defined(aa64)
|
||||
asmv("wfe");
|
||||
|
@ -26,7 +26,7 @@ namespace CPU
|
||||
{
|
||||
SafeFunction static inline void Barrier()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("" ::
|
||||
: "memory");
|
||||
#elif defined(aa64)
|
||||
@ -37,7 +37,7 @@ namespace CPU
|
||||
|
||||
SafeFunction static inline void Fence()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("mfence" ::
|
||||
: "memory");
|
||||
#elif defined(aa64)
|
||||
@ -48,7 +48,7 @@ namespace CPU
|
||||
|
||||
SafeFunction static inline void StoreFence()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("sfence" ::
|
||||
: "memory");
|
||||
#elif defined(aa64)
|
||||
@ -59,7 +59,7 @@ namespace CPU
|
||||
|
||||
SafeFunction static inline void LoadFence()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("lfence" ::
|
||||
: "memory");
|
||||
#elif defined(aa64)
|
||||
|
@ -38,12 +38,12 @@ namespace CPU
|
||||
/** @brief Basic CPU information */
|
||||
struct CPUID0x00000000
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x0));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -91,9 +91,9 @@ namespace CPU
|
||||
/** @brief Additional CPU information */
|
||||
struct CPUID0x00000001
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
@ -207,12 +207,12 @@ namespace CPU
|
||||
/** @brief Monitor and MWait Features */
|
||||
struct CPUID0x00000005
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x5));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -264,12 +264,12 @@ namespace CPU
|
||||
/** @brief Power Management Related Features */
|
||||
struct CPUID0x00000006
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x6));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -320,12 +320,12 @@ namespace CPU
|
||||
/** @brief Structured Extended Feature Identifiers */
|
||||
struct CPUID0x00000007
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x7));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -408,12 +408,12 @@ namespace CPU
|
||||
/** @brief Thread Level - Extended Topology Enumeration */
|
||||
struct CPUID0x0000000B_ECX_0
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0xB), "c"(0x0));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -465,12 +465,12 @@ namespace CPU
|
||||
/** @brief Core Level - Extended Topology Enumeration */
|
||||
struct CPUID0x0000000B_ECX_1
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0xB), "c"(0x1));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -522,12 +522,12 @@ namespace CPU
|
||||
/** @brief Processor Extended State Enumeration */
|
||||
struct CPUID0x0000000D_ECX_0
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0xD), "c"(0x0));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -575,12 +575,12 @@ namespace CPU
|
||||
/** @brief Processor Extended State Enumeration */
|
||||
struct CPUID0x0000000D_ECX_1
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0xD), "c"(0x1));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -645,12 +645,12 @@ namespace CPU
|
||||
/** @brief Processor Extended State Enumeration */
|
||||
struct CPUID0x0000000D_ECX_2
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0xD), "c"(0x2));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -698,12 +698,66 @@ namespace CPU
|
||||
/** @brief Processor Extended State Emulation */
|
||||
struct CPUID0x0000000D_ECX_11
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0xD), "c"(0x11));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
/** @brief Processor Extended State Emulation */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t CetSupervisorSize : 32;
|
||||
};
|
||||
cpuid_t raw;
|
||||
} EAX;
|
||||
|
||||
/** @brief Processor Extended State Emulation */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t CetSupervisorOffset : 32;
|
||||
};
|
||||
cpuid_t raw;
|
||||
} EBX;
|
||||
|
||||
/** @brief Processor Extended State Emulation */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t Reserved : 31;
|
||||
uint32_t US : 1;
|
||||
};
|
||||
cpuid_t raw;
|
||||
} ECX;
|
||||
|
||||
/** @brief Processor Extended State Emulation */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint32_t Unused : 32;
|
||||
};
|
||||
cpuid_t raw;
|
||||
} EDX;
|
||||
};
|
||||
|
||||
/** @brief Processor Extended State Emulation */
|
||||
struct CPUID0x0000000D_ECX_12
|
||||
{
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0xD), "c"(0x12));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -750,14 +804,14 @@ namespace CPU
|
||||
};
|
||||
|
||||
/** @brief Processor Extended State Enumeration */
|
||||
struct CPUID0x0000000D_ECX_3H
|
||||
struct CPUID0x0000000D_ECX_3E
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0xD), "c"(0x3E));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -805,12 +859,12 @@ namespace CPU
|
||||
/** @brief Maximum Extended Function Number and Vendor String */
|
||||
struct CPUID0x80000000
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000000));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -858,12 +912,12 @@ namespace CPU
|
||||
/** @brief Extended Processor and Processor Feature Identifiers */
|
||||
struct CPUID0x80000001
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000001));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -979,12 +1033,12 @@ namespace CPU
|
||||
/** @brief Extended Processor Name String */
|
||||
struct CPUID0x80000002
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000002));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1028,12 +1082,12 @@ namespace CPU
|
||||
/** @brief Extended Processor Name String */
|
||||
struct CPUID0x80000003
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000003));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1077,12 +1131,12 @@ namespace CPU
|
||||
/** @brief Extended Processor Name String */
|
||||
struct CPUID0x80000004
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000004));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1126,12 +1180,12 @@ namespace CPU
|
||||
/** @brief L1 Cache and TLB Information */
|
||||
struct CPUID0x80000005
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000005));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1191,12 +1245,12 @@ namespace CPU
|
||||
/** @brief L2 Cache and TLB and L3 Cache Information */
|
||||
struct CPUID0x80000006
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000006));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1257,12 +1311,12 @@ namespace CPU
|
||||
/** @brief Processor Power Management and RAS Capabilities */
|
||||
struct CPUID0x80000007
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000007));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1326,12 +1380,12 @@ namespace CPU
|
||||
/** @brief Processor Capacity Parameters and Extended Feature Identification */
|
||||
struct CPUID0x80000008
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000008));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1413,12 +1467,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x8000000A
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x8000000A));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1466,12 +1520,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x80000019
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000019));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1519,12 +1573,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x8000001A
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x8000001A));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1572,12 +1626,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x8000001B
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x8000001B));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1625,12 +1679,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x8000001C
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x8000001C));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1678,12 +1732,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x8000001D
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x8000001D));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1731,12 +1785,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x8000001E
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x8000001E));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1784,12 +1838,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x8000001F
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x8000001F));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1837,12 +1891,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x80000020
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000020));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1890,12 +1944,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x80000021
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000021));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1943,12 +1997,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x80000022
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000022));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1996,12 +2050,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x80000023
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000023));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -2049,12 +2103,12 @@ namespace CPU
|
||||
/** @brief TODO */
|
||||
struct CPUID0x80000026
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000026));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
|
@ -38,12 +38,12 @@ namespace CPU
|
||||
/** @brief Basic CPU information */
|
||||
struct CPUID0x00000000
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x0));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -84,9 +84,9 @@ namespace CPU
|
||||
/** @brief Additional CPU information */
|
||||
struct CPUID0x00000001
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
@ -206,12 +206,12 @@ namespace CPU
|
||||
/** @brief CPU cache and TLB */
|
||||
struct CPUID0x00000002
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x2));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -267,12 +267,12 @@ namespace CPU
|
||||
/** @brief CPU serial number */
|
||||
struct CPUID0x00000003
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x3));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -316,12 +316,12 @@ namespace CPU
|
||||
/** @brief Cache information */
|
||||
struct CPUID0x00000004_1
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x4), "c"(0x1)); /* FIXME */
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -373,12 +373,12 @@ namespace CPU
|
||||
/** @brief MONITOR information */
|
||||
struct CPUID0x00000005
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x5));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -431,12 +431,12 @@ namespace CPU
|
||||
/** @brief Thermal and power management information */
|
||||
struct CPUID0x00000006
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x6));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -483,12 +483,12 @@ namespace CPU
|
||||
/** @brief Extended feature flags enumeration */
|
||||
struct CPUID0x00000007_0
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x7), "c"(0x0)); /* FIXME */
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -709,12 +709,12 @@ namespace CPU
|
||||
/** @brief Extended feature flags enumeration */
|
||||
struct CPUID0x00000007_1
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x7), "c"(0x1)); /* FIXME */
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -815,12 +815,12 @@ namespace CPU
|
||||
/** @brief Performance monitors */
|
||||
struct CPUID0x0000000A
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0xA));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -876,12 +876,12 @@ namespace CPU
|
||||
/** @brief Get CPU frequency information */
|
||||
struct CPUID0x00000015
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x15));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -937,12 +937,12 @@ namespace CPU
|
||||
/** @brief Get CPU frequency information */
|
||||
struct CPUID0x00000016
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x16));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -998,12 +998,12 @@ namespace CPU
|
||||
/** @brief Extended CPU information */
|
||||
struct CPUID0x80000000
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000000));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1048,12 +1048,12 @@ namespace CPU
|
||||
/** @brief Extended CPU information */
|
||||
struct CPUID0x80000001
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000001));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1105,12 +1105,12 @@ namespace CPU
|
||||
/** @brief CPU brand string */
|
||||
struct CPUID0x80000002
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000002));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1155,12 +1155,12 @@ namespace CPU
|
||||
/** @brief CPU brand string */
|
||||
struct CPUID0x80000003
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000003));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1205,12 +1205,12 @@ namespace CPU
|
||||
/** @brief CPU brand string */
|
||||
struct CPUID0x80000004
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000004));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1255,12 +1255,12 @@ namespace CPU
|
||||
/** @brief CPU cache line information */
|
||||
struct CPUID0x80000006
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000006));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1314,12 +1314,12 @@ namespace CPU
|
||||
/** @brief Virtual and physical memory size */
|
||||
struct CPUID0x80000008
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x80000008));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
@ -1366,12 +1366,12 @@ namespace CPU
|
||||
/** @brief Secure virtual machine parameters */
|
||||
struct CPUID0x8000000A
|
||||
{
|
||||
void Get()
|
||||
__always_inline inline void Get()
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("cpuid"
|
||||
: "=a"(EAX.raw), "=b"(EBX.raw), "=c"(ECX.raw), "=d"(EDX.raw)
|
||||
: "a"(0x1));
|
||||
: "a"(0x8000000A));
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace Video
|
||||
{
|
||||
private:
|
||||
BootInfo::FramebufferInfo framebuffer;
|
||||
Font *CurrentFont;
|
||||
Font *CurrentFont = nullptr;
|
||||
ScreenBuffer Buffers[256];
|
||||
bool ColorIteration = false;
|
||||
int ColorPickerIteration = 0;
|
||||
|
@ -52,7 +52,7 @@ namespace Driver
|
||||
void *Address = nullptr;
|
||||
void *InterruptCallback = nullptr;
|
||||
Memory::MemMgr *MemTrk = nullptr;
|
||||
DriverInterruptHook *InterruptHook[16] = {nullptr};
|
||||
DriverInterruptHook *InterruptHook[16]{};
|
||||
};
|
||||
|
||||
class DriverInterruptHook : public Interrupts::Handler
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <types.h>
|
||||
#include <debug.h>
|
||||
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
#define MMX_FN_ATTR __always_inline __target("mmx")
|
||||
#define SSE_FN_ATTR __always_inline __target("sse")
|
||||
#define SSE2_FN_ATTR __always_inline __target("sse2")
|
||||
@ -86,7 +86,7 @@ namespace SMAP
|
||||
{
|
||||
void _clac(void)
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("clac" ::
|
||||
: "cc");
|
||||
#endif // a64 || a32
|
||||
@ -94,7 +94,7 @@ namespace SMAP
|
||||
|
||||
void _stac(void)
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
asmv("stac" ::
|
||||
: "cc");
|
||||
#endif // a64 || a32
|
||||
@ -103,7 +103,7 @@ namespace SMAP
|
||||
|
||||
namespace MMX
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8)));
|
||||
|
||||
typedef long long __v1di __attribute__((__vector_size__(8)));
|
||||
@ -120,7 +120,7 @@ namespace MMX
|
||||
|
||||
namespace SSE
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
typedef int __v4si __attribute__((__vector_size__(16)));
|
||||
typedef unsigned int __v4su __attribute__((__vector_size__(16)));
|
||||
typedef float __v4sf __attribute__((__vector_size__(16)));
|
||||
@ -144,7 +144,7 @@ namespace SSE
|
||||
|
||||
namespace SSE2
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
typedef double __v2df __attribute__((__vector_size__(16)));
|
||||
|
||||
typedef long long __v2di __attribute__((__vector_size__(16)));
|
||||
@ -205,19 +205,19 @@ namespace SSE2
|
||||
|
||||
namespace SSE3
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
namespace SSSE3
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
namespace SSE4_1
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
typedef long long __m128i __attribute__((__vector_size__(16), __aligned__(16)));
|
||||
|
||||
ST_IN SSE4_1_FN_ATTR __m128i _mm_cvtepu8_epi32(__m128i a);
|
||||
@ -229,19 +229,19 @@ namespace SSE4_1
|
||||
|
||||
namespace SSE4_2
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
namespace AVX
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
namespace AVX2
|
||||
{
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
#endif // a64 || a32
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#if defined(a64) || defined(a32)
|
||||
#if defined(a86)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
@ -232,6 +232,6 @@ extern "C"
|
||||
#define outw(Port, Data) outportw(Port, Data)
|
||||
#define outl(Port, Data) outportl(Port, Data)
|
||||
|
||||
#endif // defined(a64) || defined(a32)
|
||||
#endif // defined(a86)
|
||||
|
||||
#endif // !__FENNIX_KERNEL_IO_H__
|
||||
|
@ -62,7 +62,7 @@ extern uintptr_t _kernel_text_end, _kernel_data_end, _kernel_rodata_end;
|
||||
#define USER_STACK_SIZE 0x2000 // 8kb
|
||||
|
||||
// To pages
|
||||
#define TO_PAGES(d) ((d) / PAGE_SIZE + 1)
|
||||
#define TO_PAGES(d) (((d) + PAGE_SIZE - 1) / PAGE_SIZE)
|
||||
// From pages
|
||||
#define FROM_PAGES(d) ((d)*PAGE_SIZE)
|
||||
|
||||
@ -436,6 +436,18 @@ namespace Memory
|
||||
struct PageTable4
|
||||
{
|
||||
PageMapLevel4 Entries[511];
|
||||
|
||||
/**
|
||||
* @brief Update CR3 with this PageTable4
|
||||
*/
|
||||
void Update()
|
||||
{
|
||||
#if defined(a86)
|
||||
asmv("mov %0, %%cr3" ::"r"(this));
|
||||
#elif defined(aa64)
|
||||
asmv("msr ttbr0_el1, %0" ::"r"(this));
|
||||
#endif
|
||||
}
|
||||
} __aligned(0x1000);
|
||||
|
||||
struct __packed PageMapLevel5
|
||||
@ -460,11 +472,6 @@ namespace Memory
|
||||
uint64_t PageBitmapIndex = 0;
|
||||
Bitmap PageBitmap;
|
||||
|
||||
void ReservePage(void *Address);
|
||||
void ReservePages(void *Address, size_t PageCount);
|
||||
void UnreservePage(void *Address);
|
||||
void UnreservePages(void *Address, size_t PageCount);
|
||||
|
||||
public:
|
||||
Bitmap GetPageBitmap() { return PageBitmap; }
|
||||
|
||||
@ -549,6 +556,11 @@ namespace Memory
|
||||
*/
|
||||
void LockPages(void *Address, size_t PageCount);
|
||||
|
||||
void ReservePage(void *Address);
|
||||
void ReservePages(void *Address, size_t PageCount);
|
||||
void UnreservePage(void *Address);
|
||||
void UnreservePages(void *Address, size_t PageCount);
|
||||
|
||||
/**
|
||||
* @brief Request page
|
||||
*
|
||||
@ -869,7 +881,6 @@ void operator delete[](void *Pointer, long unsigned int Size);
|
||||
|
||||
extern Memory::Physical KernelAllocator;
|
||||
extern Memory::PageTable4 *KernelPageTable;
|
||||
extern Memory::PageTable4 *UserspaceKernelOnlyPageTable;
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
@ -45,7 +45,7 @@ struct CPUData
|
||||
uintptr_t TempStack; /* gs+0x8 */
|
||||
|
||||
/** @brief Used by CPU */
|
||||
uintptr_t Stack;
|
||||
uintptr_t Stack; /* gs+0x10 */
|
||||
|
||||
/** @brief CPU ID. */
|
||||
int ID;
|
||||
|
@ -44,6 +44,9 @@
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define inf_loop while (1)
|
||||
#define ilp inf_loop; /* Used for debugging */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define foreach for
|
||||
#define in :
|
||||
|
Reference in New Issue
Block a user