All: Cleanup all files

Add newline to end of files and remove whitespace from end of lines
This commit is contained in:
Bananymous 2024-01-24 14:43:46 +02:00
parent 3441f63298
commit dfe5a2d665
226 changed files with 466 additions and 460 deletions

View File

@ -249,11 +249,11 @@ namespace BAN
return {};
if (has_sso() && fits_in_sso(new_size))
return {};
char* new_data = (char*)allocator(new_size + 1);
if (new_data == nullptr)
return Error::from_errno(ENOMEM);
if (m_size)
memcpy(new_data, data(), m_size + 1);

View File

@ -193,4 +193,4 @@ namespace BAN
return m_data;
}
}
}

View File

@ -38,7 +38,7 @@ namespace BAN
}
BAN::Time from_unix_time(uint64_t unix_time)
{
{
BAN::Time time {};
time.second = unix_time % 60; unix_time /= 60;
@ -68,4 +68,4 @@ namespace BAN
return time;
}
}
}

View File

@ -39,7 +39,7 @@ namespace BAN
const Span<T> span() const { return Span(m_data, size()); }
constexpr size_type size() const;
const T* data() const { return m_data; }
T* data() { return m_data; }
@ -109,4 +109,4 @@ namespace BAN
return S;
}
}
}

View File

@ -39,4 +39,4 @@ namespace BAN
T m_value;
};
}
}

View File

@ -125,7 +125,7 @@ namespace BAN
}
value_type* data() { return m_data; }
const value_type* data() const { return m_data; }
const value_type* data() const { return m_data; }
size_type size() const { return m_size; }
@ -137,4 +137,4 @@ namespace BAN
using ByteSpan = ByteSpanGeneral<false>;
using ConstByteSpan = ByteSpanGeneral<true>;
}
}

View File

@ -32,7 +32,7 @@ namespace BAN
size_type size() const { return m_size; }
bool empty() const { return size() == 0; }
bool full() const { return size() == capacity(); }
static constexpr size_type capacity() { return S; }
private:
@ -110,4 +110,4 @@ namespace BAN
return (T*)(m_storage + index * sizeof(T));
}
}
}

View File

@ -77,4 +77,4 @@ namespace BAN
T raw;
};
}
}

View File

@ -192,7 +192,7 @@ namespace BAN::Formatter
if (sign)
*(--ptr) = '-';
print(putc, ptr);
}
@ -205,10 +205,10 @@ namespace BAN::Formatter
frac_part = -frac_part;
print_integer(putc, int_part, format);
if (format.percision > 0)
putc('.');
for (int i = 0; i < format.percision; i++)
{
frac_part *= format.base;

View File

@ -56,7 +56,7 @@ namespace BAN
return true;
return false;
}
void clear()
{
if (*this)
@ -145,4 +145,4 @@ namespace BAN
alignas(CallableBase) uint8_t m_storage[m_size] { 0 };
};
}
}

View File

@ -47,4 +47,4 @@ namespace BAN
}
};
}
}

View File

@ -66,7 +66,7 @@ namespace BAN
ErrorOr<void> rebucket(size_type);
LinkedList<Entry>& get_bucket(const Key&);
const LinkedList<Entry>& get_bucket(const Key&) const;
private:
Vector<LinkedList<Entry>> m_buckets;
size_type m_size = 0;

View File

@ -19,7 +19,7 @@ namespace BAN
using size_type = size_t;
using iterator = IteratorDouble<T, Vector, LinkedList, HashSet>;
using const_iterator = ConstIteratorDouble<T, Vector, LinkedList, HashSet>;
public:
HashSet() = default;
HashSet(const HashSet&);
@ -206,4 +206,4 @@ namespace BAN
template<typename T, typename HASH = hash<T>>
using HashSetUnstable = HashSet<T, HASH, false>;
}
}

View File

@ -9,4 +9,4 @@ namespace BAN
Break
};
}
}

View File

@ -287,7 +287,7 @@ namespace BAN
{
Node* node = (Node*)BAN::allocator(sizeof(Node));
if (node == nullptr)
return Error::from_errno(ENOMEM);
return Error::from_errno(ENOMEM);
return node;
}
@ -396,4 +396,4 @@ namespace BAN
return m_current;
}
}
}

View File

@ -119,4 +119,4 @@ namespace BAN::Math
return result;
}
}
}

View File

@ -72,7 +72,7 @@ namespace BAN
Optional<T>::Optional(const T& value)
: m_has_value(true)
{
new (m_storage) T(value);
new (m_storage) T(value);
}
template<typename T>
@ -192,4 +192,4 @@ namespace BAN
m_has_value = false;
}
}
}

View File

@ -225,4 +225,4 @@ namespace BAN
return {};
}
}
}

View File

@ -25,4 +25,4 @@ namespace BAN
bool m_enabled { true };
};
}
}

View File

@ -120,7 +120,7 @@ namespace BAN::sort
if (parent == 0)
break;
parent--;
}
}

View File

@ -131,4 +131,4 @@ namespace BAN
return Span(m_data + start, length);
}
}
}

View File

@ -44,7 +44,7 @@ namespace BAN
bool empty() const;
size_type size() const;
const char* data() const;
private:

View File

@ -34,4 +34,4 @@ namespace BAN::Formatter
print(putc, "{} {} {} {2}:{2}:{2} GMT+0 {4}", week_days[time.week_day], months[time.month], time.day, time.hour, time.minute, time.second, time.year);
}
}
}

View File

@ -102,4 +102,4 @@ namespace BAN
template<typename T> struct equal { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs == rhs; } };
template<typename T> struct greater { constexpr bool operator()(const T& lhs, const T& rhs) const { return lhs > rhs; } };
}
}

View File

@ -28,7 +28,7 @@ namespace BAN::UTF8
for (uint32_t i = 1; i < length; i++)
if ((bytes[i] & 0xC0) != 0x80)
return UTF8::invalid;
switch (length)
{
case 1: return ((bytes[0] & 0x80) != 0x00) ? UTF8::invalid : bytes[0];
@ -78,4 +78,4 @@ namespace BAN::UTF8
return true;
}
}
}

View File

@ -67,7 +67,7 @@ namespace BAN
T* operator->()
{
ASSERT(m_pointer);
return m_pointer;
return m_pointer;
}
const T* operator->() const
@ -95,4 +95,4 @@ namespace BAN
friend class UniqPtr;
};
}
}

View File

@ -140,14 +140,14 @@ namespace BAN
Variant(T&& value) requires (can_have<T>() && !is_lvalue_reference_v<T>)
: m_index(detail::index<T, Ts...>())
{
new (m_storage) T(move(value));
new (m_storage) T(move(value));
}
template<typename T>
Variant(const T& value) requires (can_have<T>() && !is_lvalue_reference_v<T>)
: m_index(detail::index<T, Ts...>())
{
new (m_storage) T(value);
new (m_storage) T(value);
}
~Variant()
@ -292,4 +292,4 @@ namespace BAN
size_t m_index { invalid_index() };
};
}
}

View File

@ -38,7 +38,7 @@ namespace BAN
ErrorOr<void> emplace(size_type, Args&&...);
ErrorOr<void> insert(size_type, T&&);
ErrorOr<void> insert(size_type, const T&);
iterator begin() { return iterator(m_data); }
iterator end() { return iterator(m_data + m_size); }
const_iterator begin() const { return const_iterator(m_data); }

View File

@ -104,4 +104,4 @@ namespace BAN
friend class Weakable<T>;
};
}
}

View File

@ -77,7 +77,7 @@ namespace LibELF
return BAN::Error::from_errno(EINVAL);
}
if (m_data[EI_MAG0] != ELFMAG0 ||
if (m_data[EI_MAG0] != ELFMAG0 ||
m_data[EI_MAG1] != ELFMAG1 ||
m_data[EI_MAG2] != ELFMAG2 ||
m_data[EI_MAG3] != ELFMAG3)
@ -252,7 +252,7 @@ namespace LibELF
break;
default:
ASSERT(false);
}
}
#endif
(void)header;
return true;
@ -375,7 +375,7 @@ namespace LibELF
break;
default:
ASSERT(false);
}
}
#endif
(void)header;
return true;

View File

@ -66,7 +66,7 @@ namespace LibELF
size_t nread = TRY(m_inode->read(0, BAN::ByteSpan::from(m_file_header)));
ASSERT(nread == sizeof(m_file_header));
if (m_file_header.e_ident[EI_MAG0] != ELFMAG0 ||
if (m_file_header.e_ident[EI_MAG0] != ELFMAG0 ||
m_file_header.e_ident[EI_MAG1] != ELFMAG1 ||
m_file_header.e_ident[EI_MAG2] != ELFMAG2 ||
m_file_header.e_ident[EI_MAG3] != ELFMAG3)
@ -93,7 +93,7 @@ namespace LibELF
if (m_file_header.e_ident[EI_CLASS] != ELFCLASS64)
#endif
{
dprintln("Not in native format");
dprintln("Not in native format");
return BAN::Error::from_errno(EINVAL);
}
@ -240,13 +240,13 @@ namespace LibELF
m_physical_page_count++;
memset((void*)vaddr, 0x00, PAGE_SIZE);
if (vaddr / PAGE_SIZE < BAN::Math::div_round_up<size_t>(program_header.p_vaddr + program_header.p_filesz, PAGE_SIZE))
{
size_t vaddr_offset = 0;
if (vaddr < program_header.p_vaddr)
vaddr_offset = program_header.p_vaddr - vaddr;
size_t file_offset = 0;
if (vaddr > program_header.p_vaddr)
file_offset = vaddr - program_header.p_vaddr;
@ -267,7 +267,7 @@ namespace LibELF
ASSERT_NOT_REACHED();
}
BAN::ErrorOr<BAN::UniqPtr<LoadableELF>> LoadableELF::clone(Kernel::PageTable& new_page_table)
{
auto* elf_ptr = new LoadableELF(new_page_table, m_inode);

View File

@ -68,7 +68,7 @@ namespace LibELF
{}
//#endif
BAN::ErrorOr<void> load();
bool parse_elf64_file_header(const Elf64FileHeader&);
bool parse_elf64_program_header(const Elf64ProgramHeader&);
bool parse_elf64_section_header(const Elf64SectionHeader&);
@ -86,4 +86,4 @@ namespace LibELF
//#endif
};
}
}

View File

@ -54,4 +54,4 @@ namespace LibELF
bool m_loaded { false };
};
}
}

View File

@ -183,4 +183,4 @@ namespace LibELF
using ElfNativeProgramHeader = Elf64ProgramHeader;
#endif
}
}

View File

@ -137,4 +137,4 @@ namespace LibELF
PF_MASKPROC = 0xFF000000,
};
}
}

View File

@ -31,7 +31,7 @@ check_a20:
movb $0xFF, %ds:(%si)
cmpb $0xFF, %es:(%di)
pop %ax
movb %al, %ds:(%si)
@ -40,7 +40,7 @@ check_a20:
movw $0, %ax
je .check_a20_done
movw $1, %ax
.check_a20_done:
@ -68,7 +68,7 @@ enable_a20_ps2:
call .enable_a20_ps2_wait1
movb $0xD0, %al
outb %al, $0x64
call .enable_a20_ps2_wait2
inb $0x60, %al
pushw %ax
@ -77,7 +77,7 @@ enable_a20_ps2:
call .enable_a20_ps2_wait1
movb $0xD1, %al
outb %al, $0x64
call .enable_a20_ps2_wait1
popw %ax
orw $2, %ax

View File

@ -418,7 +418,7 @@ find_root_partition:
decl %ecx
subl %ecx, %eax
sbbl $0, %ebx
# ecx: min(partition count, 0xFFFFFFFF)
movl $0xFFFFFFFF, %edx
movl %eax, %ecx

View File

@ -14,4 +14,4 @@ SECTIONS
. = ALIGN(512);
.bss : { *(.bss) }
}
}

View File

@ -42,4 +42,4 @@ int main(int argc, char** argv)
std::cout << "bootloader installed" << std::endl;
return 0;
}
}

View File

@ -63,7 +63,7 @@ namespace Kernel::GDT
uint8_t flags : 4;
uint8_t base3;
} __attribute__((packed));
struct
{
uint32_t low;
@ -101,7 +101,7 @@ namespace Kernel::GDT
{
s_tss = new TaskStateSegment();
ASSERT(s_tss);
memset(s_tss, 0x00, sizeof(TaskStateSegment));
s_tss->ss0 = 0x10;
s_tss->esp0 = (uintptr_t)g_boot_stack_top;
@ -127,7 +127,7 @@ namespace Kernel::GDT
void initialize()
{
constexpr uint32_t descriptor_count = 6;
s_gdt = new SegmentDescriptor[descriptor_count];
s_gdt = new SegmentDescriptor[descriptor_count];
ASSERT(s_gdt);
s_gdtr.address = (uint64_t)s_gdt;
@ -144,4 +144,4 @@ namespace Kernel::GDT
flush_tss(0x28);
}
}
}

View File

@ -123,7 +123,7 @@ namespace IDT
}
dprintln("Spurious irq");
return;
return;
found:
if (s_irq_handlers[irq])
s_irq_handlers[irq]();
@ -174,7 +174,7 @@ found:
"addl $16, %esp;"
"popw %es;"
"popw %ds;"
// NOTE: following instructions are same as in 'popa', except we skip eax
// since it holds the return value of the syscall.
"popl %edi;"
@ -185,7 +185,7 @@ found:
"popl %edx;"
"popl %ecx;"
"addl $4, %esp;"
"iret;"
);
@ -267,4 +267,4 @@ found:
flush_idt();
}
}
}

View File

@ -76,7 +76,7 @@ namespace Kernel
{
if (s_instance == nullptr)
return;
// Here we copy the s_instances paging structs since they are
// global for every process
@ -84,7 +84,7 @@ namespace Kernel
uint64_t* pdpt = (uint64_t*)kmalloc(sizeof(uint64_t) * 4, 32);
ASSERT(pdpt);
for (uint32_t pdpte = 0; pdpte < 4; pdpte++)
{
if (!(global_pdpt[pdpte] & Flags::Present))

View File

@ -16,4 +16,4 @@ spinlock_lock_asm:
spinlock_unlock_asm:
movl 4(%esp), %eax
movl $0, (%eax)
ret
ret

View File

@ -25,4 +25,4 @@ SECTIONS
}
g_kernel_end = .;
}
}

View File

@ -39,7 +39,7 @@ namespace Kernel::GDT
uint8_t flags : 4;
uint8_t base3;
} __attribute__((packed));
struct
{
uint32_t low;
@ -81,7 +81,7 @@ namespace Kernel::GDT
{
memset(&s_tss, 0x00, sizeof(TaskStateSegment));
s_tss.iopb = sizeof(TaskStateSegment);
uint64_t base = (uint64_t)&s_tss;
write_entry(s_tss_offset, (uint32_t)base, sizeof(TaskStateSegment), 0x89, 0x0);
@ -122,4 +122,4 @@ namespace Kernel::GDT
flush_tss();
}
}
}

View File

@ -121,7 +121,7 @@ namespace Kernel::IDT
uint32_t reserved2 : 16;
};
};
};
static_assert(sizeof(PageFaultError) == 4);
@ -290,7 +290,7 @@ namespace Kernel::IDT
break;
case ISR::PageFault:
signal = SIGSEGV;
break;
break;
default:
dwarnln("Unhandled exception");
signal = SIGABRT;
@ -305,7 +305,7 @@ namespace Kernel::IDT
}
ASSERT(Thread::current().state() != Thread::State::Terminated);
done:
return;
}

View File

@ -138,7 +138,7 @@ namespace Kernel
s_global_pml4e = V2P(allocate_zeroed_page_aligned_page());
m_highest_paging_struct = V2P(allocate_zeroed_page_aligned_page());
uint64_t* pml4 = (uint64_t*)P2V(m_highest_paging_struct);
pml4[511] = s_global_pml4e;
@ -436,7 +436,7 @@ namespace Kernel
ASSERT(vaddr % PAGE_SIZE == 0);
size_t page_count = range_page_count(vaddr, size);
LockGuard _(m_lock);
for (size_t page = 0; page < page_count; page++)
map_page_at(paddr + page * PAGE_SIZE, vaddr + page * PAGE_SIZE, flags);
@ -453,7 +453,7 @@ namespace Kernel
uint64_t pdpte = (uc_vaddr >> 30) & 0x1FF;
uint64_t pde = (uc_vaddr >> 21) & 0x1FF;
uint64_t pte = (uc_vaddr >> 12) & 0x1FF;
LockGuard _(m_lock);
uint64_t* pml4 = (uint64_t*)P2V(m_highest_paging_struct);
@ -533,7 +533,7 @@ namespace Kernel
const uint16_t e_pdpte = (uc_vaddr_end >> 30) & 0x1FF;
const uint16_t e_pde = (uc_vaddr_end >> 21) & 0x1FF;
const uint16_t e_pte = (uc_vaddr_end >> 12) & 0x1FF;
LockGuard _(m_lock);
// Try to find free page that can be mapped without
@ -714,7 +714,7 @@ namespace Kernel
if (!(pt[pte] & Flags::Used))
continue;
if (start == 0)
{
flags = parse_flags(pt[pte]);

View File

@ -192,4 +192,4 @@ syscall_asm:
addq $8, %rsp
popaq_no_rax
addq $8, %rsp
iretq
iretq

View File

@ -35,4 +35,4 @@ SECTIONS
*(.bss)
}
g_kernel_end = .;
}
}

View File

@ -46,8 +46,8 @@ void __cxa_finalize(void *f)
* TODO:
* Note well, however, that deleting a function from here that contains a __dso_handle
* means that one link to a shared object file has been terminated. In other words,
* We should monitor this list (optional, of course), since it tells us how many links to
* an object file exist at runtime in a particular application. This can be used to tell
* We should monitor this list (optional, of course), since it tells us how many links to
* an object file exist at runtime in a particular application. This can be used to tell
* when a shared object is no longer in use. It is one of many methods, however.
**/
//You may insert a prinf() here to tell you whether or not the function gets called. Testing
@ -59,7 +59,7 @@ void __cxa_finalize(void *f)
/* ^^^ That if statement is a safeguard...
* To make sure we don't call any entries that have already been called and unset at runtime.
* Those will contain a value of 0, and calling a function with value 0
* will cause undefined behaviour. Remember that linear address 0,
* will cause undefined behaviour. Remember that linear address 0,
* in a non-virtual address space (physical) contains the IVT and BDA.
*
* In a virtual environment, the kernel will receive a page fault, and then probably
@ -92,7 +92,7 @@ void __cxa_finalize(void *f)
**/
if (__atexit_funcs[i].destructor_func == f)
{
/*
/*
* Note that in the next line, not every destructor function is a class destructor.
* It is perfectly legal to register a non class destructor function as a simple cleanup
* function to be called on program termination, in which case, it would not NEED an
@ -113,7 +113,7 @@ void __cxa_finalize(void *f)
};
};
namespace __cxxabiv1
namespace __cxxabiv1
{
/* guard variables */
static Kernel::SpinLock s_spin_lock;

View File

@ -126,7 +126,7 @@ namespace Kernel
SDTHeader* as_header() { return (SDTHeader*)vaddr; }
};
BAN::Vector<MappedPage> m_mapped_headers;
BAN::Vector<MappedPage> m_mapped_headers;
};
}
@ -135,7 +135,7 @@ namespace BAN::Formatter
{
template<typename F>
void print_argument(F putc, const Kernel::ACPI::SDTHeader& header, const ValueFormat& format)
{
{
putc(header.signature[0]);
putc(header.signature[1]);
putc(header.signature[2]);

View File

@ -18,4 +18,4 @@ namespace Kernel::API
DirectoryEntry array[];
};
}
}

View File

@ -55,7 +55,7 @@ namespace Kernel
BAN::Vector<Processor> m_processors;
Kernel::paddr_t m_local_apic_paddr = 0;
Kernel::vaddr_t m_local_apic_vaddr = 0;
BAN::Vector<IOAPIC> m_io_apics;
BAN::Vector<IOAPIC> m_io_apics;
uint8_t m_irq_overrides[0x100] {};
uint8_t m_reserved_gsis[0x100 / 8] {};
};

View File

@ -7,38 +7,38 @@ namespace CPUID
enum Features : uint32_t
{
ECX_SSE3 = (uint32_t)1 << 0,
ECX_SSE3 = (uint32_t)1 << 0,
ECX_PCLMULQDQ = (uint32_t)1 << 1,
ECX_DTES64 = (uint32_t)1 << 2,
ECX_MONITOR = (uint32_t)1 << 3,
ECX_DS_CPL = (uint32_t)1 << 4,
ECX_VMX = (uint32_t)1 << 5,
ECX_SMX = (uint32_t)1 << 6,
ECX_EST = (uint32_t)1 << 7,
ECX_TM2 = (uint32_t)1 << 8,
ECX_SSSE3 = (uint32_t)1 << 9,
ECX_MONITOR = (uint32_t)1 << 3,
ECX_DS_CPL = (uint32_t)1 << 4,
ECX_VMX = (uint32_t)1 << 5,
ECX_SMX = (uint32_t)1 << 6,
ECX_EST = (uint32_t)1 << 7,
ECX_TM2 = (uint32_t)1 << 8,
ECX_SSSE3 = (uint32_t)1 << 9,
ECX_CNTX_ID = (uint32_t)1 << 10,
ECX_SDBG = (uint32_t)1 << 11,
ECX_FMA = (uint32_t)1 << 12,
ECX_CX16 = (uint32_t)1 << 13,
ECX_XTPR = (uint32_t)1 << 14,
ECX_PDCM = (uint32_t)1 << 15,
ECX_PCID = (uint32_t)1 << 17,
ECX_DCA = (uint32_t)1 << 18,
ECX_SSE4_1 = (uint32_t)1 << 19,
ECX_SSE4_2 = (uint32_t)1 << 20,
ECX_X2APIC = (uint32_t)1 << 21,
ECX_MOVBE = (uint32_t)1 << 22,
ECX_POPCNT = (uint32_t)1 << 23,
ECX_TSC_DEADLINE = (uint32_t)1 << 24,
ECX_AES = (uint32_t)1 << 25,
ECX_XSAVE = (uint32_t)1 << 26,
ECX_OSXSAVE = (uint32_t)1 << 27,
ECX_CX16 = (uint32_t)1 << 13,
ECX_XTPR = (uint32_t)1 << 14,
ECX_PDCM = (uint32_t)1 << 15,
ECX_PCID = (uint32_t)1 << 17,
ECX_DCA = (uint32_t)1 << 18,
ECX_SSE4_1 = (uint32_t)1 << 19,
ECX_SSE4_2 = (uint32_t)1 << 20,
ECX_X2APIC = (uint32_t)1 << 21,
ECX_MOVBE = (uint32_t)1 << 22,
ECX_POPCNT = (uint32_t)1 << 23,
ECX_TSC_DEADLINE = (uint32_t)1 << 24,
ECX_AES = (uint32_t)1 << 25,
ECX_XSAVE = (uint32_t)1 << 26,
ECX_OSXSAVE = (uint32_t)1 << 27,
ECX_AVX = (uint32_t)1 << 28,
ECX_F16C = (uint32_t)1 << 29,
ECX_RDRND = (uint32_t)1 << 30,
ECX_HYPERVISOR = (uint32_t)1 << 31,
EDX_FPU = (uint32_t)1 << 0,
EDX_VME = (uint32_t)1 << 1,
EDX_DE = (uint32_t)1 << 2,
@ -79,4 +79,4 @@ namespace CPUID
bool is_64_bit();
bool has_nxe();
}
}

View File

@ -27,4 +27,4 @@ namespace Kernel
size_t m_flags;
};
}
}

View File

@ -61,4 +61,4 @@ namespace Debug
static void lock();
static void unlock();
};
}
}

View File

@ -52,4 +52,4 @@ namespace Kernel
}
};
}
}

View File

@ -50,4 +50,4 @@ namespace Kernel
friend class FramebufferMemoryRegion;
};
}
}

View File

@ -27,4 +27,4 @@ namespace Kernel
const dev_t m_rdev;
};
}
}

View File

@ -25,4 +25,4 @@ namespace Kernel
const dev_t m_rdev;
};
}
}

View File

@ -33,4 +33,4 @@ namespace Kernel
BAN::StringView error_string(ErrorCode);
}
}

View File

@ -13,7 +13,7 @@ namespace Kernel
public:
static void initialize();
static DevFileSystem& get();
void initialize_device_updater();
void add_device(BAN::RefPtr<Device>);
@ -39,4 +39,4 @@ namespace Kernel
volatile bool m_should_sync { false };
};
}
}

View File

@ -259,4 +259,4 @@ namespace Kernel::Ext2
}
}
}

View File

@ -27,7 +27,7 @@ namespace Kernel
{
m_used = false;
}
size_t size() const { return m_buffer.size(); }
uint8_t* data() { return m_buffer.data(); }
@ -44,7 +44,7 @@ namespace Kernel
bool& m_used;
};
public:
public:
static BAN::ErrorOr<Ext2FS*> create(BAN::RefPtr<BlockDevice>);
virtual BAN::RefPtr<Inode> root_inode() override { return m_root_inode; }
@ -120,4 +120,4 @@ namespace Kernel
friend class Ext2Inode;
};
}
}

View File

@ -35,7 +35,7 @@ namespace Kernel
virtual BAN::ErrorOr<void> create_file_impl(BAN::StringView, mode_t, uid_t, gid_t) override;
virtual BAN::ErrorOr<void> create_directory_impl(BAN::StringView, mode_t, uid_t, gid_t) override;
virtual BAN::ErrorOr<void> unlink_impl(BAN::StringView) override;
virtual BAN::ErrorOr<BAN::String> link_target_impl() override;
virtual BAN::ErrorOr<size_t> read_impl(off_t, BAN::ByteSpan) override;
@ -81,4 +81,4 @@ namespace Kernel
friend class BAN::RefPtr<Ext2Inode>;
};
}
}

View File

@ -12,4 +12,4 @@ namespace Kernel
virtual BAN::RefPtr<Inode> root_inode() = 0;
};
}
}

View File

@ -131,4 +131,4 @@ namespace Kernel
friend class FileBackedRegion;
};
}
}

View File

@ -50,4 +50,4 @@ namespace Kernel
uint32_t m_writing_count { 1 };
};
}
}

View File

@ -20,4 +20,4 @@ namespace Kernel
ProcFileSystem();
};
}
}

View File

@ -47,7 +47,7 @@ namespace Kernel
private:
ProcROInode(Process&, size_t (Process::*)(off_t, BAN::ByteSpan) const, TmpFileSystem&, const TmpInodeInfo&);
private:
Process& m_process;
size_t (Process::*m_callback)(off_t, BAN::ByteSpan) const;

View File

@ -177,4 +177,4 @@ namespace Kernel
}
}
}
}

View File

@ -44,4 +44,4 @@ namespace Kernel
BAN::Vector<MountPoint> m_mount_points;
};
}
}

View File

@ -32,4 +32,4 @@ namespace Kernel
uint32_t m_pitch = 0;
};
}
}

View File

@ -13,4 +13,4 @@ namespace Kernel::GDT
void initialize();
void set_tss_stack(uintptr_t);
}
}

View File

@ -10,4 +10,4 @@ namespace Kernel::IDT
void initialize();
[[noreturn]] void force_triple_fault();
}
}

View File

@ -62,4 +62,4 @@ namespace IO
outb(0x80, 0);
}
}
}

View File

@ -95,4 +95,4 @@ namespace Kernel::Input
Key key_event_to_key(KeyEvent);
const char* key_to_utf8(Key key, uint16_t modifier);
}
}

View File

@ -42,7 +42,7 @@ namespace Kernel::Input
MouseButtonEvent button_event;
MouseMoveEvent move_event;
MouseScrollEvent scroll_event;
};
};
};
}
}

View File

@ -53,4 +53,4 @@ namespace Kernel
bool interrupts_enabled();
}
}

View File

@ -14,4 +14,4 @@ namespace Kernel
uint64_t ss;
};
}
}

View File

@ -15,7 +15,7 @@ namespace Kernel
LockGuard(Lock& lock)
: m_lock(lock)
{
m_lock.lock();
m_lock.lock();
}
~LockGuard()
@ -27,4 +27,4 @@ namespace Kernel
Lock& m_lock;
};
}
}

View File

@ -46,4 +46,4 @@ namespace MMIO
return *(volatile uint64_t*)addr;
}
}
}

View File

@ -4,7 +4,7 @@
namespace Kernel
{
class DMARegion
{
public:
@ -27,4 +27,4 @@ namespace Kernel
const paddr_t m_paddr;
};
}
}

View File

@ -46,4 +46,4 @@ namespace Kernel
BAN::RefPtr<SharedFileData> m_shared_data;
};
}
}

View File

@ -9,7 +9,7 @@ namespace Kernel
{
BAN_NON_COPYABLE(MemoryBackedRegion);
BAN_NON_MOVABLE(MemoryBackedRegion);
public:
static BAN::ErrorOr<BAN::UniqPtr<MemoryBackedRegion>> create(PageTable&, size_t size, AddressRange, Type, PageTable::flags_t);
~MemoryBackedRegion();
@ -29,4 +29,4 @@ namespace Kernel
MemoryBackedRegion(PageTable&, size_t size, Type, PageTable::flags_t);
};
}
}

View File

@ -48,7 +48,7 @@ namespace Kernel
BAN::ErrorOr<bool> allocate_page_containing(vaddr_t address);
virtual BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> clone(PageTable& new_page_table) = 0;
protected:
MemoryRegion(PageTable&, size_t size, Type type, PageTable::flags_t flags);
BAN::ErrorOr<void> initialize(AddressRange);
@ -64,4 +64,4 @@ namespace Kernel
size_t m_physical_page_count { 0 };
};
}
}

View File

@ -19,7 +19,7 @@ namespace Kernel
{
public:
using flags_t = uint16_t;
enum Flags : flags_t
enum Flags : flags_t
{
Present = (1 << 0),
ReadWrite = (1 << 1),
@ -107,7 +107,7 @@ namespace Kernel
uint64_t get_page_data(vaddr_t) const;
void initialize_kernel();
void map_kernel_memory();
void prepare_fast_page();
void prepare_fast_page();
static void invalidate(vaddr_t);
private:

View File

@ -30,4 +30,4 @@ namespace Kernel
PageTable& m_temp;
};
}
}

View File

@ -30,7 +30,7 @@ namespace Kernel
private:
unsigned long long* ull_bitmap_ptr() { return (unsigned long long*)m_vaddr; }
const unsigned long long* ull_bitmap_ptr() const { return (const unsigned long long*)m_vaddr; }
paddr_t paddr_for_bit(unsigned long long) const;
unsigned long long bit_for_paddr(paddr_t paddr) const;
@ -47,4 +47,4 @@ namespace Kernel
size_t m_free_pages { 0 };
};
}
}

View File

@ -20,4 +20,4 @@ namespace Kernel
using vaddr_t = uintptr_t;
using paddr_t = uintptr_t;
}
}

View File

@ -48,4 +48,4 @@ namespace Kernel
PageTable::flags_t m_flags { 0 };
};
}
}

View File

@ -1,6 +1,7 @@
#pragma once
#include <BAN/UniqPtr.h>
#include <kernel/InterruptController.h>
#include <kernel/Networking/NetworkDriver.h>
#include <kernel/PCI.h>
@ -10,7 +11,7 @@
namespace Kernel
{
class E1000 final : public NetworkDriver
class E1000 final : public NetworkDriver, public Interruptable
{
public:
static bool probe(PCI::Device&);
@ -23,9 +24,11 @@ namespace Kernel
virtual bool link_up() override { return m_link_up; }
virtual int link_speed() override;
virtual void handle_irq() override { ASSERT_NOT_REACHED(); }
private:
E1000() = default;
BAN::ErrorOr<void> initialize(PCI::Device&);
E1000(PCI::Device& pci_device) : m_pci_device(pci_device) {}
BAN::ErrorOr<void> initialize();
static void interrupt_handler();
@ -40,11 +43,12 @@ namespace Kernel
void initialize_tx();
void enable_link();
void enable_interrupts();
BAN::ErrorOr<void> enable_interrupts();
void handle_receive();
private:
PCI::Device& m_pci_device;
BAN::UniqPtr<PCI::BarRegion> m_bar_region;
bool m_has_eerprom { false };
uint8_t m_mac_address[6] {};

View File

@ -17,4 +17,4 @@ namespace Kernel
virtual int link_speed() = 0;
};
}
}

View File

@ -78,4 +78,4 @@ namespace Kernel
BAN::Array<BAN::RefPtr<OpenFileDescription>, OPEN_MAX> m_open_files;
};
}
}

View File

@ -130,7 +130,7 @@ namespace Kernel::PCI
public:
static void initialize();
static PCIManager& get();
const BAN::Vector<PCI::Device>& devices() const { return m_devices; }
static uint32_t read_config_dword(uint8_t bus, uint8_t dev, uint8_t func, uint8_t offset);
@ -153,4 +153,4 @@ namespace Kernel::PCI
BAN::Vector<PCI::Device> m_devices;
};
}
}

View File

@ -26,4 +26,4 @@ namespace Kernel::detail
__builtin_unreachable();
}
}
}

View File

@ -225,4 +225,4 @@ namespace Kernel
friend class Thread;
};
}
}

View File

@ -76,4 +76,4 @@ namespace Kernel
friend class Process;
};
}
}

View File

@ -10,4 +10,4 @@ namespace Kernel
void unblock();
};
}
}

View File

@ -43,7 +43,7 @@ namespace Kernel
{
BAN_NON_COPYABLE(RecursivePrioritySpinLock);
BAN_NON_MOVABLE(RecursivePrioritySpinLock);
public:
RecursivePrioritySpinLock() = default;
void lock();

Some files were not shown because too many files have changed in this diff Show More