Compare commits

...

4 Commits

Author SHA1 Message Date
f0e14cf7e9
Update year range in LICENSE :)
All checks were successful
continuous-integration/drone/push Build is passing
2023-01-02 13:08:42 +01:00
5854e5e530
Add newlines at end-of-file 2023-01-02 13:07:29 +01:00
aab3a0a840
Update settings.json 2023-01-02 13:07:13 +01:00
3442970678
Add vscode configuration 2023-01-02 13:00:22 +01:00
92 changed files with 122 additions and 90 deletions

1
.gitignore vendored
View File

@ -1,6 +1,5 @@
Luna.iso Luna.iso
toolchain/ toolchain/
.vscode/
build/ build/
initrd/boot/moon initrd/boot/moon
env-local.sh env-local.sh

13
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,13 @@
{
"configurations": [
{
"name": "Luna",
"compilerPath": "${workspaceFolder}/toolchain/x86-64-luna/bin/x86_64-luna-gcc",
"cStandard": "c17",
"cppStandard": "c++20",
"intelliSenseMode": "gcc-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}

17
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "xaver.clang-format",
"files.exclude": {
"toolchain/build/**": true,
"toolchain/tarballs/**": true,
},
"search.exclude": {
"toolchain/build/**": true,
"toolchain/tarballs/**": true,
},
"editor.tabSize": 4,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"git.inputValidationLength": 72,
"git.inputValidationSubjectLength": 72
}

View File

@ -1,6 +1,6 @@
BSD 2-Clause License BSD 2-Clause License
Copyright (c) 2022, apio. Copyright (c) 2022-2023, apio.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -22,4 +22,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -134,4 +134,4 @@ namespace ELFLoader
return ELFData { segments, elf_header.e_entry }; return ELFData { segments, elf_header.e_entry };
} }
} }

View File

@ -75,4 +75,4 @@ struct ELFData
namespace ELFLoader namespace ELFLoader
{ {
Result<ELFData> load(const TarStream::Entry& elf_entry, const TarStream& stream); Result<ELFData> load(const TarStream::Entry& elf_entry, const TarStream& stream);
}; };

View File

@ -15,4 +15,4 @@ void InitRD::initialize()
.expect_value("Unable to map the initial ramdisk into virtual memory"); .expect_value("Unable to map the initial ramdisk into virtual memory");
g_initrd.initialize((void*)virtual_initrd_address, bootboot.initrd_size); g_initrd.initialize((void*)virtual_initrd_address, bootboot.initrd_size);
} }

View File

@ -6,4 +6,4 @@ extern TarStream g_initrd;
namespace InitRD namespace InitRD
{ {
void initialize(); void initialize();
} }

View File

@ -127,4 +127,4 @@ static bool g_check_already_failed = false;
CPU::print_stack_trace(); CPU::print_stack_trace();
} }
CPU::efficient_halt(); CPU::efficient_halt();
} }

View File

@ -22,4 +22,4 @@ bool log_text_console_enabled();
#define kdbgln(...) log(LogLevel::Debug, __VA_ARGS__) #define kdbgln(...) log(LogLevel::Debug, __VA_ARGS__)
#define kinfoln(...) log(LogLevel::Info, __VA_ARGS__) #define kinfoln(...) log(LogLevel::Info, __VA_ARGS__)
#define kwarnln(...) log(LogLevel::Warn, __VA_ARGS__) #define kwarnln(...) log(LogLevel::Warn, __VA_ARGS__)
#define kerrorln(...) log(LogLevel::Error, __VA_ARGS__) #define kerrorln(...) log(LogLevel::Error, __VA_ARGS__)

View File

@ -27,4 +27,4 @@ namespace CPU
void print_stack_trace_at(Registers* regs); void print_stack_trace_at(Registers* regs);
void pause(); void pause();
} }

View File

@ -34,4 +34,4 @@ namespace MMU
void setup_initial_page_directory(); void setup_initial_page_directory();
PageDirectory* kernel_page_directory(); PageDirectory* kernel_page_directory();
} }

View File

@ -30,4 +30,4 @@ namespace Serial
va_end(ap); va_end(ap);
return rc; return rc;
} }
} }

View File

@ -11,4 +11,4 @@ namespace Serial
void print(const char* str); void print(const char* str);
void println(const char* str); void println(const char* str);
usize printf(const char* str, ...) _format(1, 2); usize printf(const char* str, ...) _format(1, 2);
} }

View File

@ -137,4 +137,4 @@ bool should_invoke_scheduler()
{ {
// FIXME: Modulo is SLOW. We're calling this every tick. // FIXME: Modulo is SLOW. We're calling this every tick.
return (timer_ticks % ARCH_TIMER_FREQ) == 0; return (timer_ticks % ARCH_TIMER_FREQ) == 0;
} }

View File

@ -36,4 +36,4 @@ namespace Timer
void init(); void init();
} }
bool should_invoke_scheduler(); bool should_invoke_scheduler();

View File

@ -284,4 +284,4 @@ namespace CPU
extern "C" void switch_task(Registers* regs) extern "C" void switch_task(Registers* regs)
{ {
Scheduler::switch_task(regs); Scheduler::switch_task(regs);
} }

View File

@ -22,4 +22,4 @@ struct [[gnu::packed]] TSS
static_assert(sizeof(TSS) == 104UL); static_assert(sizeof(TSS) == 104UL);
extern TSS task_state_segment; extern TSS task_state_segment;

View File

@ -37,4 +37,4 @@ namespace IO
{ {
asm volatile("outl %0, %1" : : "a"(value), "Nd"(port)); asm volatile("outl %0, %1" : : "a"(value), "Nd"(port));
} }
} }

View File

@ -10,4 +10,4 @@ namespace IO
void outb(u16 port, u8 value); void outb(u16 port, u8 value);
void outw(u16 port, u16 value); void outw(u16 port, u16 value);
void outl(u16 port, u32 value); void outl(u16 port, u32 value);
} }

View File

@ -274,4 +274,4 @@ namespace MMU
{ {
return g_kernel_directory; return g_kernel_directory;
} }
} }

View File

@ -40,4 +40,4 @@ struct alignas(ARCH_PAGE_SIZE) PageDirectory
}; };
static_assert(sizeof(PageTableEntry) == 8UL); static_assert(sizeof(PageTableEntry) == 8UL);
static_assert(sizeof(PageDirectory) == ARCH_PAGE_SIZE); static_assert(sizeof(PageDirectory) == ARCH_PAGE_SIZE);

View File

@ -12,4 +12,4 @@ void Serial::putchar(u8 c)
{ {
serial_wait(); serial_wait();
IO::outb(COM1, c); IO::outb(COM1, c);
} }

View File

@ -55,4 +55,4 @@ void switch_context(Thread* old_thread, Thread* new_thread, Registers* regs)
if (!old_thread->is_idle()) memcpy(&old_thread->regs, regs, sizeof(Registers)); if (!old_thread->is_idle()) memcpy(&old_thread->regs, regs, sizeof(Registers));
memcpy(regs, &new_thread->regs, sizeof(Registers)); memcpy(regs, &new_thread->regs, sizeof(Registers));
} }

View File

@ -12,4 +12,4 @@ void Timer::arch_init()
IO::outb(PIT_CHANNEL_0, (u8)(divisor & 0xFF)); IO::outb(PIT_CHANNEL_0, (u8)(divisor & 0xFF));
IO::outb(0x80, 0); // short delay IO::outb(0x80, 0); // short delay
IO::outb(PIT_CHANNEL_0, (u8)((divisor & 0xFF00) >> 8)); IO::outb(PIT_CHANNEL_0, (u8)((divisor & 0xFF00) >> 8));
} }

View File

@ -1,4 +1,4 @@
#pragma once #pragma once
#include <luna/Types.h> #include <luna/Types.h>
const usize ARCH_TIMER_FREQ = 5; const usize ARCH_TIMER_FREQ = 5;

View File

@ -91,4 +91,4 @@ void setup_gdt()
setup_tss(); setup_tss();
load_gdt(&gdtr); load_gdt(&gdtr);
load_tr(0x2b); load_tr(0x2b);
} }

View File

@ -115,4 +115,4 @@ void setup_idt()
idtr.limit = 0x0FFF; idtr.limit = 0x0FFF;
idtr.offset = (u64)idt; idtr.offset = (u64)idt;
asm volatile("lidt %0" : : "m"(idtr)); asm volatile("lidt %0" : : "m"(idtr));
} }

View File

@ -50,4 +50,4 @@ void pic_eoi(unsigned char irq)
void pic_eoi(Registers* regs) void pic_eoi(Registers* regs)
{ {
pic_eoi((unsigned char)(regs->error)); // On IRQs, the error code is the IRQ number pic_eoi((unsigned char)(regs->error)); // On IRQs, the error code is the IRQ number
} }

View File

@ -33,4 +33,4 @@ void Init::early_init()
InitRD::initialize(); InitRD::initialize();
MemoryManager::protect_kernel_sections().expect_release_value("We should succeed to protect sections"); MemoryManager::protect_kernel_sections().expect_release_value("We should succeed to protect sections");
} }

View File

@ -4,4 +4,4 @@ namespace Init
{ {
void early_init(); void early_init();
void check_magic(); void check_magic();
} }

View File

@ -90,4 +90,4 @@ extern "C" [[noreturn]] void _start()
auto rc = init(); auto rc = init();
if (rc.has_error()) kerrorln("Runtime error: %s", rc.error_string()); if (rc.has_error()) kerrorln("Runtime error: %s", rc.error_string());
CPU::idle_loop(); CPU::idle_loop();
} }

View File

@ -419,4 +419,4 @@ void operator delete(void* p, usize) noexcept
void operator delete[](void* p, usize) noexcept void operator delete[](void* p, usize) noexcept
{ {
kfree(p); kfree(p);
} }

View File

@ -7,4 +7,4 @@ Result<void*> kcalloc(usize nmemb, usize size);
Result<void*> krealloc(void* ptr, usize size); Result<void*> krealloc(void* ptr, usize size);
Result<void> kfree(void* ptr); Result<void> kfree(void* ptr);
void dump_heap_usage(); void dump_heap_usage();

View File

@ -120,4 +120,4 @@ namespace KernelVM
{ {
return KERNEL_VM_RANGE_SIZE - g_used_vm; return KERNEL_VM_RANGE_SIZE - g_used_vm;
} }
} }

View File

@ -15,4 +15,4 @@ namespace KernelVM
usize free(); usize free();
usize used(); usize used();
} }

View File

@ -357,4 +357,4 @@ namespace MemoryManager
{ {
return free_mem + used_mem + reserved_mem; return free_mem + used_mem + reserved_mem;
} }
} }

View File

@ -35,4 +35,4 @@ namespace MemoryManager
usize used(); usize used();
usize reserved(); usize reserved();
usize total(); usize total();
} }

View File

@ -84,4 +84,4 @@ MemoryMapEntry MemoryMapIterator::highest()
} }
return at(highest_index).value(); return at(highest_index).value();
} }

View File

@ -61,4 +61,4 @@ class MemoryMapIterator
const usize m_mmap_entries; const usize m_mmap_entries;
const MMapEnt* m_base_ent; const MMapEnt* m_base_ent;
usize m_cur_ent; usize m_cur_ent;
}; };

View File

@ -206,4 +206,4 @@ void kernel_sleep(u64 ms)
g_current->state = ThreadState::Dying; g_current->state = ThreadState::Dying;
kernel_yield(); kernel_yield();
unreachable(); unreachable();
} }

View File

@ -25,4 +25,4 @@ namespace Scheduler
extern "C" void kernel_yield(); extern "C" void kernel_yield();
void kernel_sleep(u64 ms); void kernel_sleep(u64 ms);
[[noreturn]] void kernel_exit(); [[noreturn]] void kernel_exit();

View File

@ -25,4 +25,4 @@ void Spinlock::unlock()
{ {
kwarnln("Spinlock::unlock() called on an unlocked lock with value %d", expected); kwarnln("Spinlock::unlock() called on an unlocked lock with value %d", expected);
} }
} }

View File

@ -88,4 +88,4 @@ template <typename T> class LockedValue
private: private:
T m_value; T m_value;
Spinlock m_lock; Spinlock m_lock;
}; };

View File

@ -18,4 +18,4 @@ Result<Thread*> new_thread()
thread->id = g_next_id++; thread->id = g_next_id++;
return thread; return thread;
} }

View File

@ -60,4 +60,4 @@ bool is_in_kernel(Registers* regs);
Result<Thread*> new_thread(); Result<Thread*> new_thread();
extern LinkedList<Thread> g_threads; extern LinkedList<Thread> g_threads;

View File

@ -516,4 +516,4 @@ u8 font[] = { 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, 0x42,
0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42,
0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, 0x00, /* 255 */ 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, 0x00, /* 255 */
0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e,
0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00 /* Special box character, 256 */ }; 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x00, 0x00, 0x00 /* Special box character, 256 */ };

View File

@ -80,4 +80,4 @@ namespace Framebuffer
{ {
return g_fb_scanline; return g_fb_scanline;
} }
} }

View File

@ -15,4 +15,4 @@ namespace Framebuffer
u32 width(); u32 width();
u32 height(); u32 height();
u32 scanline(); u32 scanline();
} }

View File

@ -199,4 +199,4 @@ namespace TextConsole
va_end(ap); va_end(ap);
return rc; return rc;
} }
} }

View File

@ -18,4 +18,4 @@ namespace TextConsole
Result<void> println(const char* str); Result<void> println(const char* str);
void wprintln(const wchar_t* str); void wprintln(const wchar_t* str);
Result<usize> printf(const char* format, ...) _format(1, 2); Result<usize> printf(const char* format, ...) _format(1, 2);
} }

View File

@ -1,6 +1,9 @@
# The miscellaneous library shared between the Luna kernel and userspace, with stuff such as custom types, common routines and data structures. # The miscellaneous library shared between the Luna kernel and userspace, with stuff such as custom types, common routines and data structures.
file(GLOB HEADERS include/luna/*.h)
set(FREESTANDING_SOURCES set(FREESTANDING_SOURCES
${HEADERS}
src/Format.cpp src/Format.cpp
src/NumberParsing.cpp src/NumberParsing.cpp
src/CString.cpp src/CString.cpp

View File

@ -50,4 +50,4 @@ static_assert(get_blocks_from_size(0, 256) == 0);
template <typename T, typename Offset> constexpr T* offset_ptr(T* ptr, Offset offset) template <typename T, typename Offset> constexpr T* offset_ptr(T* ptr, Offset offset)
{ {
return (T*)((char*)ptr + offset); return (T*)((char*)ptr + offset);
} }

View File

@ -44,4 +44,4 @@ template <typename T> void destroy(T* item)
template <typename T> void destroy_array(T* item) template <typename T> void destroy_array(T* item)
{ {
delete[] item; delete[] item;
} }

View File

@ -115,4 +115,4 @@ template <typename T> class Atomic
private: private:
T m_value; T m_value;
}; };

View File

@ -2,4 +2,4 @@
#define _weak __attribute__((weak)) #define _weak __attribute__((weak))
#define _format(n, m) __attribute__((format(printf, n, m))) #define _format(n, m) __attribute__((format(printf, n, m)))
#define _align(x) __attribute__((aligned(x))) #define _align(x) __attribute__((aligned(x)))

View File

@ -9,4 +9,4 @@ template <class T> struct Badge
Badge(Badge<T>&&) = delete; Badge(Badge<T>&&) = delete;
friend T; friend T;
}; };

View File

@ -45,4 +45,4 @@ class Bitmap
u8* m_location = nullptr; u8* m_location = nullptr;
usize m_size_in_bytes = 0; usize m_size_in_bytes = 0;
}; };

View File

@ -16,4 +16,4 @@ extern "C"
// Copies len bytes from src into dest and adds a null terminator. // Copies len bytes from src into dest and adds a null terminator.
void nullcpy(char* dest, const char* src, usize len); void nullcpy(char* dest, const char* src, usize len);
} }

View File

@ -93,4 +93,4 @@ inline constexpr int _toupper(int c)
#define isblank _isblank #define isblank _isblank
#define tolower _tolower #define tolower _tolower
#define toupper _toupper #define toupper _toupper
#endif #endif

View File

@ -4,4 +4,4 @@
extern void debug_log_impl(const char* format, va_list ap); extern void debug_log_impl(const char* format, va_list ap);
void dbgln(const char* format, ...) _format(1, 2); void dbgln(const char* format, ...) _format(1, 2);

View File

@ -16,4 +16,4 @@ usize pure_cstyle_format(const char* format, pure_callback_t callback, void* arg
usize vstring_format(char* buf, usize max, const char* format, va_list ap); usize vstring_format(char* buf, usize max, const char* format, va_list ap);
// Convenience function which outputs into a fixed-size buffer (not unlike snprintf) // Convenience function which outputs into a fixed-size buffer (not unlike snprintf)
usize string_format(char* buf, usize max, const char* format, ...) _format(3, 4); usize string_format(char* buf, usize max, const char* format, ...) _format(3, 4);

View File

@ -220,4 +220,4 @@ template <typename T> class LinkedList
} }
usize m_count = 0; usize m_count = 0;
}; };

View File

@ -3,4 +3,4 @@
template <typename T> inline T&& move(T& lvalue) template <typename T> inline T&& move(T& lvalue)
{ {
return (T &&) lvalue; return (T &&) lvalue;
} }

View File

@ -11,4 +11,4 @@ isize scan_signed_integer(const char** str);
usize parse_unsigned_integer(const char* str, const char** endptr, int base); usize parse_unsigned_integer(const char* str, const char** endptr, int base);
// Parse a signed integer, similar to strtoll(). // Parse a signed integer, similar to strtoll().
isize parse_signed_integer(const char* str, const char** endptr, int base); isize parse_signed_integer(const char* str, const char** endptr, int base);

View File

@ -174,4 +174,4 @@ template <typename T> inline Option<T*> nonnull_or_empty_option(T* ptr)
if (ptr == nullptr) return {}; if (ptr == nullptr) return {};
else else
return ptr; return ptr;
} }

View File

@ -62,4 +62,4 @@ template <typename T> Result<OwnedPtr<T>> adopt_owned_if_nonnull(T* ptr)
if (ptr) return OwnedPtr<T> { ptr }; if (ptr) return OwnedPtr<T> { ptr };
else else
return err(ENOMEM); return err(ENOMEM);
} }

View File

@ -29,4 +29,4 @@ class OwnedStringView
private: private:
char* m_string { nullptr }; char* m_string { nullptr };
usize m_length { 0 }; usize m_length { 0 };
}; };

View File

@ -10,4 +10,4 @@ inline void* operator new[](usize, void* p) noexcept
return p; return p;
} }
inline void operator delete(void*, void*) noexcept {}; inline void operator delete(void*, void*) noexcept {};
inline void operator delete[](void*, void*) noexcept {}; inline void operator delete[](void*, void*) noexcept {};

View File

@ -251,4 +251,4 @@ template <typename T> inline Result<T*> nonnull_or_error(T* ptr, int error)
if (ptr == nullptr) return err(error); if (ptr == nullptr) return err(error);
else else
return ptr; return ptr;
} }

View File

@ -53,4 +53,4 @@ template <typename T> bool mul_will_overflow(T a, T b)
#else #else
return safe_mul(a, b).has_error(); return safe_mul(a, b).has_error();
#endif #endif
} }

View File

@ -25,4 +25,4 @@ template <typename Callback> class ScopeGuard
template <typename Callback> [[nodiscard]] ScopeGuard<Callback> make_scope_guard(const Callback& callback) template <typename Callback> [[nodiscard]] ScopeGuard<Callback> make_scope_guard(const Callback& callback)
{ {
return { callback }; return { callback };
} }

View File

@ -133,4 +133,4 @@ template <typename T> Result<SharedPtr<T>> adopt_shared_from_owned(OwnedPtr<T>&&
guard.deactivate(); guard.deactivate();
return shared_ptr; return shared_ptr;
} }

View File

@ -21,4 +21,4 @@ struct Stack
private: private:
u64 m_base; u64 m_base;
usize m_bytes; usize m_bytes;
}; };

View File

@ -60,4 +60,4 @@
const char* error_string(int error); const char* error_string(int error);
#endif #endif

View File

@ -67,4 +67,4 @@ class TarStream
void* m_pos; void* m_pos;
usize m_size; usize m_size;
usize m_offset = 0; usize m_offset = 0;
}; };

View File

@ -46,4 +46,4 @@ template <class T> struct __remove_ref_impl<T&&>
template <class T> using RemoveReference = __remove_ref_impl<T>::type; template <class T> using RemoveReference = __remove_ref_impl<T>::type;
template <class T> using RemoveCVReference = RemoveCV<RemoveReference<T>>; template <class T> using RemoveCVReference = RemoveCV<RemoveReference<T>>;

View File

@ -22,4 +22,4 @@ static_assert(sizeof(i32) == 4UL);
static_assert(sizeof(i64) == 8UL); static_assert(sizeof(i64) == 8UL);
static_assert(sizeof(usize) == sizeof(void*)); static_assert(sizeof(usize) == sizeof(void*));
static_assert(sizeof(isize) == sizeof(void*)); static_assert(sizeof(isize) == sizeof(void*));

View File

@ -3,4 +3,4 @@
#include <luna/Result.h> #include <luna/Result.h>
usize to_dynamic_unit_cstr(usize value, char* buffer, usize max); usize to_dynamic_unit_cstr(usize value, char* buffer, usize max);
Result<OwnedStringView> to_dynamic_unit(usize value); Result<OwnedStringView> to_dynamic_unit(usize value);

View File

@ -62,4 +62,4 @@ class Utf8Encoder
public: public:
// Does not null-terminate. Returns the number of bytes written. // Does not null-terminate. Returns the number of bytes written.
Result<usize> encode(wchar_t c, char buf[4]); Result<usize> encode(wchar_t c, char buf[4]);
}; };

View File

@ -27,4 +27,4 @@ void raw_free(void* ptr)
void operator delete(void* ptr, usize size, std::align_val_t) noexcept void operator delete(void* ptr, usize size, std::align_val_t) noexcept
{ {
operator delete(ptr, size); operator delete(ptr, size);
} }

View File

@ -85,4 +85,4 @@ void Bitmap::clear_region(usize start, usize bits, bool value)
set(start, value); set(start, value);
start++; start++;
} }
} }

View File

@ -81,4 +81,4 @@ extern "C"
memcpy(dest, src, len); memcpy(dest, src, len);
dest[len] = 0; dest[len] = 0;
} }
} }

View File

@ -3,4 +3,4 @@
_weak [[noreturn]] bool __check_failed(const char*, const char*, const char*, const char*) _weak [[noreturn]] bool __check_failed(const char*, const char*, const char*, const char*)
{ {
__builtin_trap(); __builtin_trap();
} }

View File

@ -6,4 +6,4 @@ void dbgln(const char* format, ...)
va_start(ap, format); va_start(ap, format);
debug_log_impl(format, ap); debug_log_impl(format, ap);
va_end(ap); va_end(ap);
} }

View File

@ -693,4 +693,4 @@ usize string_format(char* buf, usize max, const char* format, ...)
va_end(ap); va_end(ap);
return result; return result;
} }

View File

@ -46,4 +46,4 @@ Result<OwnedStringView> OwnedStringView::from_string_literal(const char* str)
char* dup = strdup(str); char* dup = strdup(str);
if (!dup) return err(ENOMEM); if (!dup) return err(ENOMEM);
return OwnedStringView { dup }; return OwnedStringView { dup };
} }

View File

@ -7,4 +7,4 @@ Stack::Stack(u64 base, usize bytes) : m_base(base), m_bytes(bytes)
u64 Stack::top() u64 Stack::top()
{ {
return (m_base + m_bytes) - sizeof(void*); return (m_base + m_bytes) - sizeof(void*);
} }

View File

@ -59,4 +59,4 @@ const char* error_string(int error)
case EFIXME: return "Functionality not yet implemented"; case EFIXME: return "Functionality not yet implemented";
default: return "Unknown error"; default: return "Unknown error";
} }
} }

View File

@ -106,4 +106,4 @@ Result<OwnedStringView> TarStream::read_contents_as_string(const Entry& entry, u
buf[nread] = 0; buf[nread] = 0;
return OwnedStringView { buf }; return OwnedStringView { buf };
} }

View File

@ -25,4 +25,4 @@ Result<OwnedStringView> to_dynamic_unit(usize value)
to_dynamic_unit_cstr(value, buf, 64); to_dynamic_unit_cstr(value, buf, 64);
return OwnedStringView { buf }; return OwnedStringView { buf };
} }

View File

@ -241,4 +241,4 @@ Result<usize> Utf8Encoder::encode(wchar_t c, char buf[4])
TRY(encode_wide_char_as_utf8(c, buf, len)); TRY(encode_wide_char_as_utf8(c, buf, len));
return len; return len;
} }