From 9da2650486ee7a8bd87f73ae603310a49fb2e685 Mon Sep 17 00:00:00 2001 From: EnderIce2 Date: Wed, 5 Mar 2025 17:39:42 +0000 Subject: [PATCH] build(kernel): fix compiling issues on i386 Signed-off-by: EnderIce2 --- Kernel/drivers/misc/vmware/vmware.cpp | 3 + Kernel/include/cpu.hpp | 135 +++++++++++++++++++++----- 2 files changed, 116 insertions(+), 22 deletions(-) diff --git a/Kernel/drivers/misc/vmware/vmware.cpp b/Kernel/drivers/misc/vmware/vmware.cpp index 487a8191..5888d389 100644 --- a/Kernel/drivers/misc/vmware/vmware.cpp +++ b/Kernel/drivers/misc/vmware/vmware.cpp @@ -176,6 +176,9 @@ namespace Driver::VMwareToolBox #elif defined(__i386__) +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#pragma GCC diagnostic ignored "-Wuninitialized" + #define VM_PORT(cmd, in_ebx, isi, idi, \ flags, magic, \ ax, bx, cx, dx, si, di) diff --git a/Kernel/include/cpu.hpp b/Kernel/include/cpu.hpp index cfb45352..713b4e69 100644 --- a/Kernel/include/cpu.hpp +++ b/Kernel/include/cpu.hpp @@ -488,29 +488,120 @@ namespace CPU struct FXState { - /** @brief FPU control word */ - uint16_t fcw; - /** @brief FPU status word */ - uint16_t fsw; - /** @brief FPU tag words */ - uint8_t ftw; - /** @brief Reserved (zero) */ - uint8_t Reserved; - /** @brief FPU opcode */ - uint16_t fop; - /** @brief PFU instruction pointer */ - uint64_t rip; - /** @brief FPU data pointer */ - uint64_t rdp; - /** @brief SSE control register */ - uint32_t mxcsr; - /** @brief SSE control register mask */ - uint32_t mxcsrmask; - /** @brief FPU registers (last 6 bytes reserved) */ + union + { + struct + { + /* #MF Exception Masks */ + uint16_t IM : 1; /** Invalid-Operation Exception Mask */ + uint16_t DM : 1; /** Denormalized-Operand Exception Mask */ + uint16_t ZM : 1; /** Zero-Divide Exception Mask */ + uint16_t OM : 1; /** Overflow Exception Mask */ + uint16_t UM : 1; /** Underflow Exception Mask */ + uint16_t PM : 1; /** Precision Exception Mask */ + uint16_t __reserved0 : 2; /** Reserved */ + + /** + * 00 Single precision + * 01 reserved + * 10 Double precision + * 11 Double-extended precision (default) + */ + uint16_t PC : 2; /** Precision Control */ + + /** + * 00 Round to nearest (default) + * 01 Round down + * 10 Round up + * 11 Round towards zero + */ + uint16_t RC : 2; /** Rounding Control */ + uint16_t Infinity : 1; /** Infinity Bit (80287 compatibility) */ + uint16_t Reserved2 : 3; /** Reserved */ + }; + uint16_t raw; + } FCW; /** FPU Control Word */ + + union + { + struct + { + uint16_t IE : 1; /** Invalid-Operation Exception */ + uint16_t DE : 1; /** Denormalized-Operand Exception */ + uint16_t ZE : 1; /** Zero-Divide Exception */ + uint16_t OE : 1; /** Overflow Exception */ + uint16_t UE : 1; /** Underflow Exception */ + uint16_t PE : 1; /** Precision Exception */ + uint16_t SF : 1; /** Stack Fault */ + uint16_t ES : 1; /** Exception Status */ + uint16_t C0 : 1; /** Condition Code 0 */ + uint16_t C1 : 1; /** Condition Code 1 */ + uint16_t C2 : 1; /** Condition Code 2 */ + uint16_t TOP : 3; /** Top of Stack Pointer */ + uint16_t C3 : 1; /** Condition Code 3 */ + uint16_t B : 1; /** x87 Floating-Point Unit Busy */ + }; + uint16_t raw; + } FSW; /** FPU Status Word */ + + /** + * Tag Values + * + * 00 = Valid + * 01 = Zero + * 10 = Special + * 11 = Empty + */ + uint8_t FTW; /** x87 Tag Word */ + + uint8_t __reserved0; + uint16_t FOP; /** FPU Op Code */ + uint32_t EIP; /** PFU Instruction Pointer */ + uint32_t EDP; /** PFU Data Pointer */ + + union + { + struct + { + /* Exception Flags */ + uint32_t IE : 1; /** Invalid-Operation Exception */ + uint32_t DE : 1; /** Denormalized-Operand Exception */ + uint32_t ZE : 1; /** Zero-Divide Exception */ + uint32_t OE : 1; /** Overflow Exception */ + uint32_t UE : 1; /** Underflow Exception */ + uint32_t PE : 1; /** Precision Exception */ + uint32_t DAZ : 1; /** Denormals Are Zeros */ + + /* Exception Masks */ + uint32_t IM : 1; /** Invalid-Operation Mask */ + uint32_t DM : 1; /** Denormalized-Operand Mask */ + uint32_t ZM : 1; /** Zero-Divide Mask */ + uint32_t OM : 1; /** Overflow Mask */ + uint32_t UM : 1; /** Underflow Mask */ + uint32_t PM : 1; /** Precision Mask */ + + /** + * 00 = round to nearest (default) + * 01 = round down + * 10 = round up + * 11 = round toward zero + */ + uint32_t RC : 2; /** Floating-Point Rounding Control */ + uint32_t FZ : 1; /** Flush-to-Zero for Masked Underflow */ + uint32_t __reserved3 : 1; + uint32_t MM : 1; /** Misaligned Exception Mask */ + uint32_t __reserved4 : 14; + }; + uint32_t raw; + } MXCSR; /** SSE Control Register */ + + uint32_t MXCSR_MASK; /** SSE Control Register Mask */ + + /** FPU registers (last 6 bytes reserved) */ uint8_t st[8][16]; - /** @brief XMM registers */ - uint8_t xmm[16][16]; - } __packed; + /** XMM registers */ + uint8_t xmm[8][16]; + } __packed __aligned(16); /** * @brief CPUID