mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:07:34 +00:00
Meta+Kernel: Make clang-format-10 clean
This commit is contained in:
parent
fa62c5595e
commit
64cc3f51d0
61 changed files with 123 additions and 118 deletions
|
@ -30,8 +30,8 @@
|
|||
#include <Kernel/ACPI/Parser.h>
|
||||
#include <Kernel/Interrupts/IRQHandler.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
|
||||
namespace Kernel {
|
||||
namespace ACPI {
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
#include <Kernel/ACPI/Definitions.h>
|
||||
#include <Kernel/ACPI/Initialize.h>
|
||||
#include <Kernel/FileSystem/File.h>
|
||||
#include <Kernel/VM/Region.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/VM/Region.h>
|
||||
#include <Kernel/VirtualAddress.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -415,7 +415,6 @@ void page_fault_handler(TrapFrame* trap)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
auto current_thread = Thread::current();
|
||||
if (!faulted_in_kernel && !MM.validate_user_stack(current_thread->process(), VirtualAddress(regs.userspace_esp))) {
|
||||
dbg() << "Invalid stack pointer: " << VirtualAddress(regs.userspace_esp);
|
||||
|
@ -1745,8 +1744,7 @@ bool Processor::smp_process_pending_messages()
|
|||
u32 prev_flags;
|
||||
enter_critical(prev_flags);
|
||||
|
||||
if (auto pending_msgs = atomic_exchange(&m_message_queue, nullptr, AK::MemoryOrder::memory_order_acq_rel))
|
||||
{
|
||||
if (auto pending_msgs = atomic_exchange(&m_message_queue, nullptr, AK::MemoryOrder::memory_order_acq_rel)) {
|
||||
// We pulled the stack of pending messages in LIFO order, so we need to reverse the list first
|
||||
auto reverse_list =
|
||||
[](ProcessorMessageEntry* list) -> ProcessorMessageEntry*
|
||||
|
@ -1833,8 +1831,7 @@ void Processor::smp_broadcast_message(ProcessorMessage& msg, bool async)
|
|||
atomic_store(&msg.refs, count() - 1, AK::MemoryOrder::memory_order_release);
|
||||
ASSERT(msg.refs > 0);
|
||||
for_each(
|
||||
[&](Processor& proc) -> IterationDecision
|
||||
{
|
||||
[&](Processor& proc) -> IterationDecision {
|
||||
if (&proc != &cur_proc) {
|
||||
if (proc.smp_queue_message(msg)) {
|
||||
// TODO: only send IPI to that CPU if we queued the first
|
||||
|
@ -1890,8 +1887,7 @@ void Processor::smp_broadcast_halt()
|
|||
// We don't want to use a message, because this could have been triggered
|
||||
// by being out of memory and we might not be able to get a message
|
||||
for_each(
|
||||
[&](Processor& proc) -> IterationDecision
|
||||
{
|
||||
[&](Processor& proc) -> IterationDecision {
|
||||
proc.m_halt_requested = true;
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
|
||||
extern "C" void interrupt_common_asm_entry();
|
||||
|
@ -40,6 +40,7 @@ extern "C" void interrupt_common_asm_entry();
|
|||
" pushw $0\n" \
|
||||
" jmp interrupt_common_asm_entry\n");
|
||||
|
||||
// clang-format off
|
||||
asm(
|
||||
".globl interrupt_common_asm_entry\n"
|
||||
"interrupt_common_asm_entry: \n"
|
||||
|
@ -81,3 +82,4 @@ asm(
|
|||
" addl $0x4, %esp\n" // skip exception_code, isr_number
|
||||
" iret\n"
|
||||
);
|
||||
// clang-format on
|
||||
|
|
|
@ -32,8 +32,7 @@ namespace Kernel {
|
|||
|
||||
class Processor;
|
||||
|
||||
class ProcessorInfo
|
||||
{
|
||||
class ProcessorInfo {
|
||||
Processor& m_processor;
|
||||
String m_cpuid;
|
||||
String m_brandstr;
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include <AK/Singleton.h>
|
||||
#include <Kernel/Console.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/kstdio.h>
|
||||
#include <Kernel/SpinLock.h>
|
||||
#include <Kernel/kstdio.h>
|
||||
|
||||
// Bytes output to 0xE9 end up on the Bochs console. It's very handy.
|
||||
#define CONSOLE_OUT_TO_E9
|
||||
|
|
|
@ -29,9 +29,9 @@
|
|||
#include <AK/CircularQueue.h>
|
||||
#include <AK/DoublyLinkedList.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/API/KeyCode.h>
|
||||
#include <Kernel/Devices/CharacterDevice.h>
|
||||
#include <Kernel/Interrupts/IRQHandler.h>
|
||||
#include <Kernel/API/KeyCode.h>
|
||||
#include <Kernel/Random.h>
|
||||
#include <LibKeyboard/CharacterMap.h>
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/Devices/PCSpeaker.h>
|
||||
#include <Kernel/Time/PIT.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Time/PIT.h>
|
||||
|
||||
void PCSpeaker::tone_on(int frequency)
|
||||
{
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/CircularQueue.h>
|
||||
#include <Kernel/API/MousePacket.h>
|
||||
#include <Kernel/Devices/CharacterDevice.h>
|
||||
#include <Kernel/Interrupts/IRQHandler.h>
|
||||
#include <Kernel/API/MousePacket.h>
|
||||
#include <Kernel/Random.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
#include <AK/Singleton.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/Devices/SB16.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/VM/AnonymousVMObject.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
#include <Kernel/IO.h>
|
||||
|
||||
//#define SB16_DEBUG
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
|
||||
#include <Kernel/Devices/CharacterDevice.h>
|
||||
#include <Kernel/Interrupts/IRQHandler.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
#include <Kernel/WaitQueue.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@
|
|||
#include <AK/OwnPtr.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/String.h>
|
||||
#include <Kernel/API/MousePacket.h>
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/CommandLine.h>
|
||||
#include <Kernel/Devices/VMWareBackdoor.h>
|
||||
#include <Kernel/API/MousePacket.h>
|
||||
#include <Kernel/IO.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -82,8 +82,7 @@ inline void vmware_high_bandwidth_get(VMWareCommand& command)
|
|||
: "+a"(command.ax), "+b"(command.bx), "+c"(command.cx), "+d"(command.dx), "+S"(command.si), "+D"(command.di));
|
||||
}
|
||||
|
||||
class VMWareBackdoorDetector
|
||||
{
|
||||
class VMWareBackdoorDetector {
|
||||
public:
|
||||
VMWareBackdoorDetector()
|
||||
{
|
||||
|
|
|
@ -86,8 +86,8 @@ private:
|
|||
};
|
||||
|
||||
ICRReg(u8 vector, DeliveryMode delivery_mode, DestinationMode destination_mode, Level level, TriggerMode trigger_mode, DestinationShorthand destinationShort, u8 destination = 0)
|
||||
: m_low(vector | (delivery_mode << 8) | (destination_mode << 11) | (level << 14) | (static_cast<u32>(trigger_mode) << 15) | (destinationShort << 18)),
|
||||
m_high((u32)destination << 24)
|
||||
: m_low(vector | (delivery_mode << 8) | (destination_mode << 11) | (level << 14) | (static_cast<u32>(trigger_mode) << 15) | (destinationShort << 18))
|
||||
, m_high((u32)destination << 24)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@ GenericInterruptHandler& GenericInterruptHandler::from(u8 interrupt_number)
|
|||
}
|
||||
|
||||
GenericInterruptHandler::GenericInterruptHandler(u8 interrupt_number, bool disable_remap)
|
||||
: m_interrupt_number(interrupt_number),
|
||||
m_disable_remap(disable_remap)
|
||||
: m_interrupt_number(interrupt_number)
|
||||
, m_disable_remap(disable_remap)
|
||||
{
|
||||
if (m_disable_remap)
|
||||
register_generic_interrupt_handler(m_interrupt_number, *this);
|
||||
|
|
|
@ -27,9 +27,9 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/Types.h>
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Interrupts/GenericInterruptHandler.h>
|
||||
#include <Kernel/Interrupts/PIC.h>
|
||||
#include <Kernel/IO.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ enum KSuccessTag {
|
|||
KSuccess
|
||||
};
|
||||
|
||||
class [[nodiscard]] KResult {
|
||||
class [[nodiscard]] KResult
|
||||
{
|
||||
public:
|
||||
ALWAYS_INLINE explicit KResult(int negative_e)
|
||||
: m_error(negative_e)
|
||||
|
@ -61,7 +62,8 @@ private:
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
class alignas(T) [[nodiscard]] KResultOr {
|
||||
class alignas(T) [[nodiscard]] KResultOr
|
||||
{
|
||||
public:
|
||||
KResultOr(KResult error)
|
||||
: m_error(error)
|
||||
|
@ -69,20 +71,29 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
// FIXME: clang-format gets confused about T. Why?
|
||||
// clang-format off
|
||||
ALWAYS_INLINE KResultOr(T&& value)
|
||||
// clang-format on
|
||||
{
|
||||
new (&m_storage) T(move(value));
|
||||
m_have_storage = true;
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
// FIXME: clang-format gets confused about U. Why?
|
||||
// clang-format off
|
||||
ALWAYS_INLINE KResultOr(U&& value)
|
||||
// clang-format on
|
||||
{
|
||||
new (&m_storage) T(move(value));
|
||||
m_have_storage = true;
|
||||
}
|
||||
|
||||
// FIXME: clang-format gets confused about KResultOr. Why?
|
||||
// clang-format off
|
||||
KResultOr(KResultOr&& other)
|
||||
// clang-format on
|
||||
{
|
||||
m_is_error = other.m_is_error;
|
||||
if (m_is_error)
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <Kernel/PCI/IOAccess.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/PCI/IOAccess.h>
|
||||
|
||||
namespace Kernel {
|
||||
namespace PCI {
|
||||
|
|
|
@ -26,12 +26,12 @@
|
|||
|
||||
#include <Kernel/ACPI/Parser.h>
|
||||
#include <Kernel/CommandLine.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Net/E1000NetworkAdapter.h>
|
||||
#include <Kernel/Net/RTL8139NetworkAdapter.h>
|
||||
#include <Kernel/PCI/IOAccess.h>
|
||||
#include <Kernel/PCI/Initializer.h>
|
||||
#include <Kernel/PCI/MMIOAccess.h>
|
||||
#include <Kernel/IO.h>
|
||||
|
||||
namespace Kernel {
|
||||
namespace PCI {
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <Kernel/API/Syscall.h>
|
||||
#include <Kernel/KResult.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/API/Syscall.h>
|
||||
#include <LibC/sys/arch/i386/regs.h>
|
||||
|
||||
namespace Ptrace {
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <Kernel/API/Syscall.h>
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Random.h>
|
||||
#include <Kernel/API/Syscall.h>
|
||||
#include <Kernel/ThreadTracer.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
||||
|
@ -36,6 +36,7 @@ namespace Kernel {
|
|||
extern "C" void syscall_handler(TrapFrame*);
|
||||
extern "C" void syscall_asm_entry();
|
||||
|
||||
// clang-format off
|
||||
asm(
|
||||
".globl syscall_asm_entry\n"
|
||||
"syscall_asm_entry:\n"
|
||||
|
@ -63,6 +64,7 @@ asm(
|
|||
" call syscall_handler \n"
|
||||
" movl %ebx, 0(%esp) \n" // push pointer to TrapFrame
|
||||
" jmp common_trap_exit \n");
|
||||
// clang-format on
|
||||
|
||||
namespace Syscall {
|
||||
|
||||
|
|
|
@ -91,8 +91,7 @@ KResult Process::poke_user_data(Userspace<u32*> address, u32 data)
|
|||
region->set_shared(false);
|
||||
}
|
||||
const bool was_writable = region->is_writable();
|
||||
if (!was_writable)
|
||||
{
|
||||
if (!was_writable) {
|
||||
region->set_writable(true);
|
||||
region->remap();
|
||||
}
|
||||
|
|
|
@ -510,7 +510,6 @@ ShouldUnblockThread Thread::dispatch_signal(u8 signal)
|
|||
klog() << "signal: dispatch signal " << signal << " to " << *this;
|
||||
#endif
|
||||
|
||||
|
||||
if (m_state == Invalid || !is_initialized()) {
|
||||
// Thread has barely been created, we need to wait until it is
|
||||
// at least in Runnable state and is_initialized() returns true,
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
*/
|
||||
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Interrupts/PIC.h>
|
||||
#include <Kernel/Scheduler.h>
|
||||
#include <Kernel/Thread.h>
|
||||
#include <Kernel/Time/PIT.h>
|
||||
#include <Kernel/Time/TimeManagement.h>
|
||||
#include <Kernel/IO.h>
|
||||
|
||||
#define IRQ_TIMER 0
|
||||
namespace Kernel {
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
|
||||
#include <Kernel/Arch/i386/CPU.h>
|
||||
#include <Kernel/CMOS.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Time/RTC.h>
|
||||
#include <Kernel/Time/TimeManagement.h>
|
||||
#include <Kernel/IO.h>
|
||||
|
||||
namespace Kernel {
|
||||
#define IRQ_TIMER 8
|
||||
|
|
|
@ -73,7 +73,6 @@ void TimeManagement::initialize()
|
|||
{
|
||||
ASSERT(!s_the.is_initialized());
|
||||
s_the.ensure_instance();
|
||||
|
||||
}
|
||||
time_t TimeManagement::seconds_since_boot() const
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <Kernel/Heap/kmalloc.h>
|
||||
#include <Kernel/Multiboot.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
#include <Kernel/VM/AnonymousVMObject.h>
|
||||
#include <Kernel/VM/ContiguousVMObject.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
@ -40,7 +41,6 @@
|
|||
#include <Kernel/VM/PhysicalRegion.h>
|
||||
#include <Kernel/VM/PurgeableVMObject.h>
|
||||
#include <Kernel/VM/SharedInodeVMObject.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
|
||||
//#define MM_DEBUG
|
||||
//#define PAGE_FAULT_DEBUG
|
||||
|
@ -235,6 +235,7 @@ PageTableEntry* MemoryManager::ensure_pte(PageDirectory& page_directory, Virtual
|
|||
// we're writing to the correct underlying physical page
|
||||
pd = quickmap_pd(page_directory, page_directory_table_index);
|
||||
ASSERT(&pde == &pd[page_directory_index]); // Sanity check
|
||||
|
||||
ASSERT(!pde.is_present()); // Should have not changed
|
||||
}
|
||||
#ifdef MM_DEBUG
|
||||
|
|
|
@ -238,5 +238,4 @@ inline unsigned prot_to_region_access_flags(int prot)
|
|||
return access;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
|
||||
WaitQueue::WaitQueue()
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue