mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:47:45 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -33,8 +33,8 @@ inline u32 get_iopl_from_eflags(u32 eflags)
|
|||
return (eflags & iopl_mask) >> 12;
|
||||
}
|
||||
|
||||
const DescriptorTablePointer& get_gdtr();
|
||||
const DescriptorTablePointer& get_idtr();
|
||||
DescriptorTablePointer const& get_gdtr();
|
||||
DescriptorTablePointer const& get_idtr();
|
||||
|
||||
void handle_crash(RegisterState const&, char const* description, int signal, bool out_of_memory = false);
|
||||
|
||||
|
@ -48,7 +48,7 @@ constexpr FlatPtr page_base_of(FlatPtr address)
|
|||
return address & PAGE_MASK;
|
||||
}
|
||||
|
||||
inline FlatPtr page_base_of(const void* address)
|
||||
inline FlatPtr page_base_of(void const* address)
|
||||
{
|
||||
return page_base_of((FlatPtr)address);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ constexpr FlatPtr offset_in_page(FlatPtr address)
|
|||
return address & (~PAGE_MASK);
|
||||
}
|
||||
|
||||
inline FlatPtr offset_in_page(const void* address)
|
||||
inline FlatPtr offset_in_page(void const* address)
|
||||
{
|
||||
return offset_in_page((FlatPtr)address);
|
||||
}
|
||||
|
|
|
@ -133,12 +133,12 @@ public:
|
|||
|
||||
bool is_null() const { return m_address == 0; }
|
||||
|
||||
bool operator==(const IOAddress& other) const { return m_address == other.m_address; }
|
||||
bool operator!=(const IOAddress& other) const { return m_address != other.m_address; }
|
||||
bool operator>(const IOAddress& other) const { return m_address > other.m_address; }
|
||||
bool operator>=(const IOAddress& other) const { return m_address >= other.m_address; }
|
||||
bool operator<(const IOAddress& other) const { return m_address < other.m_address; }
|
||||
bool operator<=(const IOAddress& other) const { return m_address <= other.m_address; }
|
||||
bool operator==(IOAddress const& other) const { return m_address == other.m_address; }
|
||||
bool operator!=(IOAddress const& other) const { return m_address != other.m_address; }
|
||||
bool operator>(IOAddress const& other) const { return m_address > other.m_address; }
|
||||
bool operator>=(IOAddress const& other) const { return m_address >= other.m_address; }
|
||||
bool operator<(IOAddress const& other) const { return m_address < other.m_address; }
|
||||
bool operator<=(IOAddress const& other) const { return m_address <= other.m_address; }
|
||||
|
||||
private:
|
||||
u16 m_address { 0 };
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
void clear() { m_raw = 0; }
|
||||
|
||||
u64 raw() const { return m_raw; }
|
||||
void copy_from(Badge<Memory::PageDirectory>, const PageDirectoryEntry& other) { m_raw = other.m_raw; }
|
||||
void copy_from(Badge<Memory::PageDirectory>, PageDirectoryEntry const& other) { m_raw = other.m_raw; }
|
||||
|
||||
enum Flags {
|
||||
Present = 1 << 0,
|
||||
|
|
|
@ -182,7 +182,7 @@ public:
|
|||
|
||||
Descriptor& get_gdt_entry(u16 selector);
|
||||
void flush_gdt();
|
||||
const DescriptorTablePointer& get_gdtr();
|
||||
DescriptorTablePointer const& get_gdtr();
|
||||
|
||||
template<IteratorFunction<Processor&> Callback>
|
||||
static inline IterationDecision for_each(Callback callback)
|
||||
|
|
|
@ -128,7 +128,7 @@ static_assert(AssertSize<RegisterState, REGISTER_STATE_SIZE>());
|
|||
static_assert(AssertSize<RegisterState, REGISTER_STATE_SIZE>());
|
||||
#endif
|
||||
|
||||
inline void copy_kernel_registers_into_ptrace_registers(PtraceRegisters& ptrace_regs, const RegisterState& kernel_regs)
|
||||
inline void copy_kernel_registers_into_ptrace_registers(PtraceRegisters& ptrace_regs, RegisterState const& kernel_regs)
|
||||
{
|
||||
#if ARCH(I386)
|
||||
ptrace_regs.eax = kernel_regs.eax;
|
||||
|
@ -169,7 +169,7 @@ inline void copy_kernel_registers_into_ptrace_registers(PtraceRegisters& ptrace_
|
|||
ptrace_regs.gs = 0;
|
||||
}
|
||||
|
||||
inline void copy_ptrace_registers_into_kernel_registers(RegisterState& kernel_regs, const PtraceRegisters& ptrace_regs)
|
||||
inline void copy_ptrace_registers_into_kernel_registers(RegisterState& kernel_regs, PtraceRegisters const& ptrace_regs)
|
||||
{
|
||||
#if ARCH(I386)
|
||||
kernel_regs.eax = ptrace_regs.eax;
|
||||
|
@ -224,7 +224,7 @@ inline void read_debug_registers_into(DebugRegisterState& state)
|
|||
state.dr7 = read_dr7();
|
||||
}
|
||||
|
||||
inline void write_debug_registers_from(const DebugRegisterState& state)
|
||||
inline void write_debug_registers_from(DebugRegisterState const& state)
|
||||
{
|
||||
write_dr0(state.dr0);
|
||||
write_dr1(state.dr1);
|
||||
|
|
|
@ -14,16 +14,16 @@ namespace Kernel {
|
|||
|
||||
struct RegisterState;
|
||||
|
||||
[[nodiscard]] bool safe_memcpy(void* dest_ptr, const void* src_ptr, size_t n, void*& fault_at) __attribute__((used));
|
||||
[[nodiscard]] ssize_t safe_strnlen(const char* str, size_t max_n, void*& fault_at) __attribute__((used));
|
||||
[[nodiscard]] bool safe_memcpy(void* dest_ptr, void const* src_ptr, size_t n, void*& fault_at) __attribute__((used));
|
||||
[[nodiscard]] ssize_t safe_strnlen(char const* str, size_t max_n, void*& fault_at) __attribute__((used));
|
||||
[[nodiscard]] bool safe_memset(void* dest_ptr, int c, size_t n, void*& fault_at) __attribute__((used));
|
||||
[[nodiscard]] Optional<u32> safe_atomic_fetch_add_relaxed(volatile u32* var, u32 val) __attribute__((used));
|
||||
[[nodiscard]] Optional<u32> safe_atomic_exchange_relaxed(volatile u32* var, u32 val) __attribute__((used));
|
||||
[[nodiscard]] Optional<u32> safe_atomic_load_relaxed(volatile u32* var) __attribute__((used));
|
||||
[[nodiscard]] bool safe_atomic_store_relaxed(volatile u32* var, u32 val) __attribute__((used));
|
||||
[[nodiscard]] Optional<bool> safe_atomic_compare_exchange_relaxed(volatile u32* var, u32& expected, u32 val) __attribute__((used));
|
||||
[[nodiscard]] Optional<u32> safe_atomic_fetch_add_relaxed(u32 volatile* var, u32 val) __attribute__((used));
|
||||
[[nodiscard]] Optional<u32> safe_atomic_exchange_relaxed(u32 volatile* var, u32 val) __attribute__((used));
|
||||
[[nodiscard]] Optional<u32> safe_atomic_load_relaxed(u32 volatile* var) __attribute__((used));
|
||||
[[nodiscard]] bool safe_atomic_store_relaxed(u32 volatile* var, u32 val) __attribute__((used));
|
||||
[[nodiscard]] Optional<bool> safe_atomic_compare_exchange_relaxed(u32 volatile* var, u32& expected, u32 val) __attribute__((used));
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_and_relaxed(volatile u32* var, u32 val)
|
||||
[[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_and_relaxed(u32 volatile* var, u32 val)
|
||||
{
|
||||
auto expected_value = safe_atomic_load_relaxed(var);
|
||||
if (!expected_value.has_value())
|
||||
|
@ -41,7 +41,7 @@ struct RegisterState;
|
|||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_and_not_relaxed(volatile u32* var, u32 val)
|
||||
[[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_and_not_relaxed(u32 volatile* var, u32 val)
|
||||
{
|
||||
auto expected_value = safe_atomic_load_relaxed(var);
|
||||
if (!expected_value.has_value())
|
||||
|
@ -59,7 +59,7 @@ struct RegisterState;
|
|||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_or_relaxed(volatile u32* var, u32 val)
|
||||
[[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_or_relaxed(u32 volatile* var, u32 val)
|
||||
{
|
||||
auto expected_value = safe_atomic_load_relaxed(var);
|
||||
if (!expected_value.has_value())
|
||||
|
@ -77,7 +77,7 @@ struct RegisterState;
|
|||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_xor_relaxed(volatile u32* var, u32 val)
|
||||
[[nodiscard]] ALWAYS_INLINE Optional<u32> safe_atomic_fetch_xor_relaxed(u32 volatile* var, u32 val)
|
||||
{
|
||||
auto expected_value = safe_atomic_load_relaxed(var);
|
||||
if (!expected_value.has_value())
|
||||
|
|
|
@ -42,7 +42,7 @@ struct [[gnu::packed]] TSS64 {
|
|||
u32 rsp1h;
|
||||
u32 rsp2l;
|
||||
u32 rsp2h;
|
||||
u64 __2; //probably CR3 and EIP?
|
||||
u64 __2; // probably CR3 and EIP?
|
||||
u32 ist1l;
|
||||
u32 ist1h;
|
||||
u32 ist2l;
|
||||
|
|
|
@ -21,9 +21,9 @@ struct TrapFrame {
|
|||
RegisterState* regs; // must be last
|
||||
|
||||
TrapFrame() = delete;
|
||||
TrapFrame(const TrapFrame&) = delete;
|
||||
TrapFrame(TrapFrame const&) = delete;
|
||||
TrapFrame(TrapFrame&&) = delete;
|
||||
TrapFrame& operator=(const TrapFrame&) = delete;
|
||||
TrapFrame& operator=(TrapFrame const&) = delete;
|
||||
TrapFrame& operator=(TrapFrame&&) = delete;
|
||||
};
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
using namespace Kernel;
|
||||
|
||||
void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func)
|
||||
void __assertion_failed(char const* msg, char const* file, unsigned line, char const* func)
|
||||
{
|
||||
asm volatile("cli");
|
||||
critical_dmesgln("ASSERTION FAILED: {}", msg);
|
||||
|
|
|
@ -174,7 +174,7 @@ static EntropySource s_entropy_source_interrupts { EntropySource::Static::Interr
|
|||
|
||||
// clang-format on
|
||||
|
||||
static void dump(const RegisterState& regs)
|
||||
static void dump(RegisterState const& regs)
|
||||
{
|
||||
#if ARCH(I386)
|
||||
u16 ss;
|
||||
|
@ -522,7 +522,7 @@ void handle_interrupt(TrapFrame* trap)
|
|||
handler->eoi();
|
||||
}
|
||||
|
||||
const DescriptorTablePointer& get_idtr()
|
||||
DescriptorTablePointer const& get_idtr()
|
||||
{
|
||||
return s_idtr;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ READONLY_AFTER_INIT FPUState Processor::s_clean_fpu_state;
|
|||
|
||||
READONLY_AFTER_INIT static ProcessorContainer s_processors {};
|
||||
READONLY_AFTER_INIT Atomic<u32> Processor::g_total_processors;
|
||||
READONLY_AFTER_INIT static volatile bool s_smp_enabled;
|
||||
READONLY_AFTER_INIT static bool volatile s_smp_enabled;
|
||||
|
||||
static Atomic<ProcessorMessage*> s_message_pool;
|
||||
Atomic<u32> Processor::s_idle_cpu_mask { 0 };
|
||||
|
@ -775,7 +775,7 @@ void Processor::flush_gdt()
|
|||
: "memory");
|
||||
}
|
||||
|
||||
const DescriptorTablePointer& Processor::get_gdtr()
|
||||
DescriptorTablePointer const& Processor::get_gdtr()
|
||||
{
|
||||
return m_gdtr;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ ALWAYS_INLINE bool validate_canonical_address(size_t address)
|
|||
}
|
||||
|
||||
CODE_SECTION(".text.safemem")
|
||||
NEVER_INLINE bool safe_memcpy(void* dest_ptr, const void* src_ptr, size_t n, void*& fault_at)
|
||||
NEVER_INLINE bool safe_memcpy(void* dest_ptr, void const* src_ptr, size_t n, void*& fault_at)
|
||||
{
|
||||
fault_at = nullptr;
|
||||
size_t dest = (size_t)dest_ptr;
|
||||
|
@ -115,7 +115,7 @@ NEVER_INLINE bool safe_memcpy(void* dest_ptr, const void* src_ptr, size_t n, voi
|
|||
}
|
||||
|
||||
CODE_SECTION(".text.safemem")
|
||||
NEVER_INLINE ssize_t safe_strnlen(const char* str, size_t max_n, void*& fault_at)
|
||||
NEVER_INLINE ssize_t safe_strnlen(char const* str, size_t max_n, void*& fault_at)
|
||||
{
|
||||
if (!validate_canonical_address((size_t)str)) {
|
||||
fault_at = const_cast<char*>(str);
|
||||
|
@ -210,7 +210,7 @@ NEVER_INLINE bool safe_memset(void* dest_ptr, int c, size_t n, void*& fault_at)
|
|||
}
|
||||
|
||||
CODE_SECTION(".text.safemem.atomic")
|
||||
NEVER_INLINE Optional<u32> safe_atomic_fetch_add_relaxed(volatile u32* var, u32 val)
|
||||
NEVER_INLINE Optional<u32> safe_atomic_fetch_add_relaxed(u32 volatile* var, u32 val)
|
||||
{
|
||||
u32 result;
|
||||
bool error;
|
||||
|
@ -230,7 +230,7 @@ NEVER_INLINE Optional<u32> safe_atomic_fetch_add_relaxed(volatile u32* var, u32
|
|||
}
|
||||
|
||||
CODE_SECTION(".text.safemem.atomic")
|
||||
NEVER_INLINE Optional<u32> safe_atomic_exchange_relaxed(volatile u32* var, u32 val)
|
||||
NEVER_INLINE Optional<u32> safe_atomic_exchange_relaxed(u32 volatile* var, u32 val)
|
||||
{
|
||||
u32 result;
|
||||
bool error;
|
||||
|
@ -250,7 +250,7 @@ NEVER_INLINE Optional<u32> safe_atomic_exchange_relaxed(volatile u32* var, u32 v
|
|||
}
|
||||
|
||||
CODE_SECTION(".text.safemem.atomic")
|
||||
NEVER_INLINE Optional<u32> safe_atomic_load_relaxed(volatile u32* var)
|
||||
NEVER_INLINE Optional<u32> safe_atomic_load_relaxed(u32 volatile* var)
|
||||
{
|
||||
u32 result;
|
||||
bool error;
|
||||
|
@ -270,7 +270,7 @@ NEVER_INLINE Optional<u32> safe_atomic_load_relaxed(volatile u32* var)
|
|||
}
|
||||
|
||||
CODE_SECTION(".text.safemem.atomic")
|
||||
NEVER_INLINE bool safe_atomic_store_relaxed(volatile u32* var, u32 val)
|
||||
NEVER_INLINE bool safe_atomic_store_relaxed(u32 volatile* var, u32 val)
|
||||
{
|
||||
bool error;
|
||||
asm volatile(
|
||||
|
@ -287,7 +287,7 @@ NEVER_INLINE bool safe_atomic_store_relaxed(volatile u32* var, u32 val)
|
|||
}
|
||||
|
||||
CODE_SECTION(".text.safemem.atomic")
|
||||
NEVER_INLINE Optional<bool> safe_atomic_compare_exchange_relaxed(volatile u32* var, u32& expected, u32 val)
|
||||
NEVER_INLINE Optional<bool> safe_atomic_compare_exchange_relaxed(u32 volatile* var, u32& expected, u32 val)
|
||||
{
|
||||
// NOTE: accessing expected is NOT protected as it should always point
|
||||
// to a valid location in kernel memory!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue