mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 11:18:13 +00:00
Add clang-format file
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
This commit is contained in:
parent
c11351ac50
commit
0dc9af5f7e
286 changed files with 3244 additions and 2424 deletions
|
@ -1,27 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
#include "i386.h"
|
||||
#include <AK/Bitmap.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Bitmap.h>
|
||||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <Kernel/FileSystem/InodeIdentifier.h>
|
||||
#include <Kernel/LinearAddress.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
#include <Kernel/VM/Region.h>
|
||||
#include <Kernel/VM/VMObject.h>
|
||||
#include <Kernel/FileSystem/InodeIdentifier.h>
|
||||
|
||||
#define PAGE_ROUND_UP(x) ((((dword)(x)) + PAGE_SIZE-1) & (~(PAGE_SIZE-1)))
|
||||
#define PAGE_ROUND_UP(x) ((((dword)(x)) + PAGE_SIZE - 1) & (~(PAGE_SIZE - 1)))
|
||||
|
||||
class SynthFSInode;
|
||||
|
||||
enum class PageFaultResponse {
|
||||
enum class PageFaultResponse
|
||||
{
|
||||
ShouldCrash,
|
||||
Continue,
|
||||
};
|
||||
|
@ -36,6 +37,7 @@ class MemoryManager {
|
|||
friend class VMObject;
|
||||
friend ByteBuffer procfs$mm(InodeIdentifier);
|
||||
friend ByteBuffer procfs$memstat(InodeIdentifier);
|
||||
|
||||
public:
|
||||
[[gnu::pure]] static MemoryManager& the();
|
||||
|
||||
|
@ -54,7 +56,11 @@ public:
|
|||
bool validate_user_read(const Process&, LinearAddress) const;
|
||||
bool validate_user_write(const Process&, LinearAddress) const;
|
||||
|
||||
enum class ShouldZeroFill { No, Yes };
|
||||
enum class ShouldZeroFill
|
||||
{
|
||||
No,
|
||||
Yes
|
||||
};
|
||||
|
||||
RetainPtr<PhysicalPage> allocate_physical_page(ShouldZeroFill);
|
||||
RetainPtr<PhysicalPage> allocate_supervisor_physical_page();
|
||||
|
@ -106,7 +112,10 @@ private:
|
|||
PageDirectory& kernel_page_directory() { return *m_kernel_page_directory; }
|
||||
|
||||
struct PageDirectoryEntry {
|
||||
explicit PageDirectoryEntry(dword* pde) : m_pde(pde) { }
|
||||
explicit PageDirectoryEntry(dword* pde)
|
||||
: m_pde(pde)
|
||||
{
|
||||
}
|
||||
|
||||
dword* page_table_base() { return reinterpret_cast<dword*>(raw() & 0xfffff000u); }
|
||||
void set_page_table_base(dword value)
|
||||
|
@ -118,7 +127,8 @@ private:
|
|||
dword raw() const { return *m_pde; }
|
||||
dword* ptr() { return m_pde; }
|
||||
|
||||
enum Flags {
|
||||
enum Flags
|
||||
{
|
||||
Present = 1 << 0,
|
||||
ReadWrite = 1 << 1,
|
||||
UserSupervisor = 1 << 2,
|
||||
|
@ -153,7 +163,10 @@ private:
|
|||
};
|
||||
|
||||
struct PageTableEntry {
|
||||
explicit PageTableEntry(dword* pte) : m_pte(pte) { }
|
||||
explicit PageTableEntry(dword* pte)
|
||||
: m_pte(pte)
|
||||
{
|
||||
}
|
||||
|
||||
dword* physical_page_base() { return reinterpret_cast<dword*>(raw() & 0xfffff000u); }
|
||||
void set_physical_page_base(dword value)
|
||||
|
@ -165,7 +178,8 @@ private:
|
|||
dword raw() const { return *m_pte; }
|
||||
dword* ptr() { return m_pte; }
|
||||
|
||||
enum Flags {
|
||||
enum Flags
|
||||
{
|
||||
Present = 1 << 0,
|
||||
ReadWrite = 1 << 1,
|
||||
UserSupervisor = 1 << 2,
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <Kernel/VM/PhysicalPage.h>
|
||||
#include <Kernel/VM/RangeAllocator.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
|
||||
class PageDirectory : public Retainable<PageDirectory> {
|
||||
friend class MemoryManager;
|
||||
|
||||
public:
|
||||
static Retained<PageDirectory> create_for_userspace(const RangeAllocator* parent_range_allocator = nullptr) { return adopt(*new PageDirectory(parent_range_allocator)); }
|
||||
static Retained<PageDirectory> create_at_fixed_address(PhysicalAddress paddr) { return adopt(*new PageDirectory(paddr)); }
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Retained.h>
|
||||
#include <Kernel/Assertions.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <AK/Retained.h>
|
||||
|
||||
class PhysicalPage {
|
||||
friend class MemoryManager;
|
||||
friend class PageDirectory;
|
||||
friend class VMObject;
|
||||
|
||||
public:
|
||||
PhysicalAddress paddr() const { return m_paddr; }
|
||||
|
||||
|
@ -35,7 +36,7 @@ public:
|
|||
|
||||
private:
|
||||
PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist = true);
|
||||
~PhysicalPage() { }
|
||||
~PhysicalPage() {}
|
||||
|
||||
void return_to_freelist();
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <Kernel/LinearAddress.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/LinearAddress.h>
|
||||
|
||||
class Range {
|
||||
friend class RangeAllocator;
|
||||
|
||||
public:
|
||||
Range() { }
|
||||
Range() {}
|
||||
Range(LinearAddress base, size_t size)
|
||||
: m_base(base)
|
||||
, m_size(size)
|
||||
|
|
|
@ -10,6 +10,7 @@ class VMObject;
|
|||
|
||||
class Region : public Retainable<Region> {
|
||||
friend class MemoryManager;
|
||||
|
||||
public:
|
||||
Region(const Range&, String&&, bool r, bool w, bool cow = false);
|
||||
Region(const Range&, Retained<VMObject>&&, size_t offset_in_vmo, String&&, bool r, bool w, bool cow = false);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/RetainPtr.h>
|
||||
#include <AK/Retainable.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/PhysicalAddress.h>
|
||||
#include <Kernel/UnixTypes.h>
|
||||
|
@ -13,8 +13,10 @@
|
|||
class Inode;
|
||||
class PhysicalPage;
|
||||
|
||||
class VMObject : public Retainable<VMObject>, public Weakable<VMObject> {
|
||||
class VMObject : public Retainable<VMObject>
|
||||
, public Weakable<VMObject> {
|
||||
friend class MemoryManager;
|
||||
|
||||
public:
|
||||
static Retained<VMObject> create_file_backed(RetainPtr<Inode>&&);
|
||||
static Retained<VMObject> create_anonymous(size_t);
|
||||
|
@ -46,7 +48,8 @@ private:
|
|||
explicit VMObject(size_t);
|
||||
VMObject(PhysicalAddress, size_t);
|
||||
|
||||
template<typename Callback> void for_each_region(Callback);
|
||||
template<typename Callback>
|
||||
void for_each_region(Callback);
|
||||
|
||||
String m_name;
|
||||
bool m_allow_cpu_caching { true };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue