Compare commits

..

No commits in common. "1941885cfdcb553ca73a201b852c4db777e49e61" and "793c0368f2e96cf4392f5d90e66629bfe8ccff0d" have entirely different histories.

11 changed files with 13 additions and 39 deletions

View File

@ -84,7 +84,7 @@ namespace BAN
return Span<S>(reinterpret_cast<S*>(m_data), m_size / sizeof(S)); return Span<S>(reinterpret_cast<S*>(m_data), m_size / sizeof(S));
} }
[[nodiscard]] ByteSpanGeneral slice(size_type offset, size_type length = size_type(-1)) const ByteSpanGeneral slice(size_type offset, size_type length = size_type(-1)) const
{ {
ASSERT(m_data); ASSERT(m_data);
ASSERT(m_size >= offset); ASSERT(m_size >= offset);

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include <BAN/Formatter.h> #include <BAN/Formatter.h>
#include <BAN/NoCopyMove.h>
#include <BAN/Variant.h> #include <BAN/Variant.h>
#include <errno.h> #include <errno.h>
@ -98,7 +97,6 @@ namespace BAN
template<typename T> template<typename T>
class [[nodiscard]] ErrorOr class [[nodiscard]] ErrorOr
{ {
BAN_NON_COPYABLE(ErrorOr);
public: public:
ErrorOr(const T& value) ErrorOr(const T& value)
: m_data(value) : m_data(value)
@ -112,14 +110,6 @@ namespace BAN
ErrorOr(Error&& error) ErrorOr(Error&& error)
: m_data(move(error)) : m_data(move(error))
{} {}
ErrorOr(ErrorOr&& other)
: m_data(move(other.m_data))
{}
ErrorOr& operator=(ErrorOr&& other)
{
m_data = move(other.m_data);
return *this;
}
bool is_error() const { return m_data.template has<Error>(); } bool is_error() const { return m_data.template has<Error>(); }
const Error& error() const { return m_data.template get<Error>(); } const Error& error() const { return m_data.template get<Error>(); }

View File

@ -10,11 +10,14 @@ namespace BAN::Formatter
struct ValueFormat; struct ValueFormat;
template<typename F>
inline void print(F putc, const char* format);
template<typename F, typename Arg, typename... Args>
inline void print(F putc, const char* format, Arg&& arg, Args&&... args);
template<typename F, typename... Args> template<typename F, typename... Args>
concept PrintableArguments = requires(F putc, Args&&... args, const ValueFormat& format) inline void println(F putc, const char* format, Args&&... args);
{
(print_argument(putc, BAN::forward<Args>(args), format), ...);
};
template<typename F, typename T> template<typename F, typename T>
inline void print_argument(F putc, T value, const ValueFormat& format); inline void print_argument(F putc, T value, const ValueFormat& format);
@ -50,7 +53,7 @@ namespace BAN::Formatter
} }
} }
template<typename F, typename Arg, typename... Args> requires PrintableArguments<F, Arg, Args...> template<typename F, typename Arg, typename... Args>
inline void print(F putc, const char* format, Arg&& arg, Args&&... args) inline void print(F putc, const char* format, Arg&& arg, Args&&... args)
{ {
while (*format && *format != '{') while (*format && *format != '{')

View File

@ -19,12 +19,6 @@ namespace BAN
, value(forward<Args>(args)...) , value(forward<Args>(args)...)
{} {}
template<typename... Args>
Entry(Key&& key, Args&&... args) requires is_constructible_v<T, Args...>
: key(BAN::move(key))
, value(forward<Args>(args)...)
{}
Key key; Key key;
T value; T value;
}; };

View File

@ -272,9 +272,6 @@ namespace Kernel
PageTable::~PageTable() PageTable::~PageTable()
{ {
if (m_highest_paging_struct == 0)
return;
uint64_t* pdpt = reinterpret_cast<uint64_t*>(P2V(m_highest_paging_struct)); uint64_t* pdpt = reinterpret_cast<uint64_t*>(P2V(m_highest_paging_struct));
for (uint32_t pdpte = 0; pdpte < 3; pdpte++) for (uint32_t pdpte = 0; pdpte < 3; pdpte++)

View File

@ -576,9 +576,6 @@ namespace Kernel
PageTable::~PageTable() PageTable::~PageTable()
{ {
if (m_highest_paging_struct == 0)
return;
// NOTE: we only loop until 256 since after that is hhdm // NOTE: we only loop until 256 since after that is hhdm
const uint64_t* pml4 = P2V(m_highest_paging_struct); const uint64_t* pml4 = P2V(m_highest_paging_struct);
for (uint64_t pml4e = 0; pml4e < 256; pml4e++) for (uint64_t pml4e = 0; pml4e < 256; pml4e++)

View File

@ -22,9 +22,6 @@ namespace Kernel
class PageTable class PageTable
{ {
BAN_NON_COPYABLE(PageTable);
BAN_NON_MOVABLE(PageTable);
public: public:
using flags_t = uint16_t; using flags_t = uint16_t;
enum Flags : flags_t enum Flags : flags_t

View File

@ -47,7 +47,7 @@ namespace Kernel
static Process* create_kernel(entry_t, void*); static Process* create_kernel(entry_t, void*);
static BAN::ErrorOr<Process*> create_userspace(const Credentials&, BAN::StringView path, BAN::Span<BAN::StringView> arguments); static BAN::ErrorOr<Process*> create_userspace(const Credentials&, BAN::StringView path, BAN::Span<BAN::StringView> arguments);
~Process(); ~Process();
void cleanup_function(Thread*); void cleanup_function();
void register_to_scheduler(); void register_to_scheduler();
void exit(int status, int signal); void exit(int status, int signal);

View File

@ -208,7 +208,7 @@ namespace Kernel
{ {
ASSERT(m_threads.empty()); ASSERT(m_threads.empty());
ASSERT(m_mapped_regions.empty()); ASSERT(m_mapped_regions.empty());
ASSERT(!m_page_table); ASSERT(&PageTable::current() != m_page_table.ptr());
} }
void Process::add_thread(Thread* thread) void Process::add_thread(Thread* thread)
@ -217,7 +217,7 @@ namespace Kernel
MUST(m_threads.push_back(thread)); MUST(m_threads.push_back(thread));
} }
void Process::cleanup_function(Thread* thread) void Process::cleanup_function()
{ {
{ {
SpinLockGuard _(s_process_lock); SpinLockGuard _(s_process_lock);
@ -238,8 +238,6 @@ namespace Kernel
// NOTE: We must unmap ranges while the page table is still alive // NOTE: We must unmap ranges while the page table is still alive
m_mapped_regions.clear(); m_mapped_regions.clear();
thread->give_keep_alive_page_table(BAN::move(m_page_table));
} }
bool Process::on_thread_exit(Thread& thread) bool Process::on_thread_exit(Thread& thread)

View File

@ -242,7 +242,7 @@ namespace Kernel
ASSERT(thread->m_process == process); ASSERT(thread->m_process == process);
process->cleanup_function(thread); process->cleanup_function();
thread->m_delete_process = true; thread->m_delete_process = true;

View File

@ -174,8 +174,6 @@ namespace Kernel
BAN::ErrorOr<void> USBSCSIDevice::write_sectors_impl(uint64_t first_lba, uint64_t sector_count, BAN::ConstByteSpan buffer) BAN::ErrorOr<void> USBSCSIDevice::write_sectors_impl(uint64_t first_lba, uint64_t sector_count, BAN::ConstByteSpan buffer)
{ {
return BAN::Error::from_errno(ENOTSUP);
dprintln_if(DEBUG_USB_MASS_STORAGE, "write_blocks({}, {})", first_lba, sector_count); dprintln_if(DEBUG_USB_MASS_STORAGE, "write_blocks({}, {})", first_lba, sector_count);
const size_t max_blocks_per_write = m_max_packet_size / m_block_size; const size_t max_blocks_per_write = m_max_packet_size / m_block_size;