1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:47:36 +00:00

Kernel: Switch static_asserts of a type size to AK::AssertSize

This will provide better debug ability when the size comparison fails.
This commit is contained in:
Brian Gianforcaro 2021-09-05 00:57:53 -07:00 committed by Andreas Kling
parent 112de58fe0
commit 472454cded
15 changed files with 25 additions and 19 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/StdLibExtras.h>
#include <AK/Types.h>
#include <Kernel/VirtualAddress.h>
@ -100,7 +101,7 @@ union [[gnu::packed]] Descriptor {
}
};
static_assert(sizeof(Descriptor) == 8);
static_assert(AssertSize<Descriptor, 8>());
enum class IDTEntryType {
TaskGate32 = 0b0101,
@ -174,6 +175,6 @@ struct [[gnu::packed]] IDTEntry
};
// clang-format on
static_assert(sizeof(IDTEntry) == 2 * sizeof(void*));
static_assert(AssertSize<IDTEntry, 2 * sizeof(void*)>());
}

View file

@ -132,8 +132,8 @@ private:
u64 m_raw;
};
static_assert(sizeof(PageDirectoryEntry) == 8);
static_assert(sizeof(PageTableEntry) == 8);
static_assert(AssertSize<PageDirectoryEntry, 8>());
static_assert(AssertSize<PageTableEntry, 8>());
class PageDirectoryPointerTable {
public:

View file

@ -121,7 +121,7 @@ struct [[gnu::packed]] RegisterState {
#else
# define REGISTER_STATE_SIZE (22 * 8)
#endif
static_assert(REGISTER_STATE_SIZE == sizeof(RegisterState));
static_assert(AssertSize<RegisterState, REGISTER_STATE_SIZE>());
inline void copy_kernel_registers_into_ptrace_registers(PtraceRegisters& ptrace_regs, const RegisterState& kernel_regs)
{

View file

@ -32,7 +32,7 @@ struct TrapFrame {
# define TRAP_FRAME_SIZE (3 * 8)
#endif
static_assert(TRAP_FRAME_SIZE == sizeof(TrapFrame));
static_assert(AssertSize<TrapFrame, TRAP_FRAME_SIZE>());
extern "C" void enter_trap_no_irq(TrapFrame* trap) __attribute__((used));
extern "C" void enter_trap(TrapFrame*) __attribute__((used));