2116 Commits

Author SHA1 Message Date
0985b75057
kernel: Add a guard page to the bootstrap stack so that we can catch more stack overflows 2023-02-25 17:42:32 +01:00
4fd871fdaa
luna: Introduce fail(...), a replacement for expect(false, ...) 2023-02-25 17:41:28 +01:00
8352df5ee8
kernel: Enable UBSAN when building in debug mode 2023-02-25 17:37:50 +01:00
da436b3856
luna: Add UB sanitizer, for both kernel-space and userspace 2023-02-25 17:37:38 +01:00
03ed2c3e12
libc: Make dbgln() also print a newline in userspace
Previously, dbgln() only printed a newline in kernel-space.
2023-02-25 17:36:03 +01:00
794567327f
kernel, luna: Port non-VFS changes over from pull request
OwnedPtr, SharedPtr: Add operator bool
Option, Result: Make try_move_value() non-const since it modifies the Option
kernel: Switch to a stack we control for the main task as soon as we leave early boot
Heap: Fix GPF caused when making many small allocations
Heap: Avoid accessing a block after it's potentially deleted
luna: Skip UBSAN.cpp in CMakeLists as that's not implemented yet
luna: Use spinlocks in the heap implementation
kernel, luna: Move Spinlock.h to luna
Option: Use __builtin_launder to ensure that the compiler doesn't label this as UB
SharedPtr: Implement make_shared using adopt_shared
SharedPtr: Delete ptr on failure in all adopt_shared* functions
2023-02-25 17:09:03 +01:00
89958fbc74
kernel: Show a more technical message on failure to remap kernel data sections 2023-02-02 21:26:07 +01:00
c05a87c7ff
kernel: Reenable the text console on panic 2023-02-01 22:58:31 +01:00
e9a009478f
SharedPtr: Fixes and support for casting to other SharedPtr types 2023-01-31 19:59:06 +01:00
3a84e4998c
kernel/Thread: Add FIXME 2023-01-31 17:02:49 +01:00
35501407c1
kernel: Stop shouting when creating threads 2023-01-25 21:25:34 +01:00
fd0e29ede5
kernel: Add FIXME in copy_to_user()/copy_from_user() 2023-01-25 21:22:14 +01:00
8098ff0616
tools: Avoid rebuilding libc and friends every single time
We do this by preserving timestamps when copying headers so CMake doesn't think they have changed.
2023-01-25 21:16:20 +01:00
635437a4a4
luna: Add a new idiomatic way to mark unused parameters as used while keeping their names
Just call ignore(...)
2023-01-25 21:14:44 +01:00
39042cbbd4
kernel: PCI constness updates 2023-01-25 21:01:45 +01:00
fa29d6e9b9
kernel: Rename PCI::callback_t to PCI::Callback 2023-01-25 20:58:59 +01:00
15c89a3592
kernel: Implement filtered PCI scans 2023-01-23 21:24:05 +01:00
3a4ca73df7
kernel: Sync log output 2023-01-23 20:42:34 +01:00
6677c643a5
kernel: Start scanning the PCI bus for devices 2023-01-23 20:07:17 +01:00
de04c094e7
x86_64: Skip enabling WP for now until I find how to check for its availability 2023-01-23 20:06:45 +01:00
8cb9c14b1e
luna/Format: Make output_(pure_)integer_data take a const reference to vstate 2023-01-22 17:36:02 +01:00
7f8a8cdcaf
kernel, libc: Add an usleep() system call and use that to implement usleep() and sleep() in libc 2023-01-22 15:00:20 +01:00
d5b1d72396
x86_64/MMU: Map the kernel page directory to virtual memory
This avoids depending on the kernel address space to create a new userspace one,
since there is no physical memory access.

This was fine for a single process, since its address space was created from the kernel one
and no more address spaces were created,
but for two or more, this started to become problematic, since we would create one address space
while being in another process's address space, which has no direct mapping of physical memory.
2023-01-22 14:46:03 +01:00
a7a38d3433
Bitmap: Add a fallible variant of match_region() that does not crash if arguments are out of range
This lets us call deallocate_memory() with any address and it will not crash.
2023-01-22 14:25:51 +01:00
cb59a4e0e3
libc: Add assert.h 2023-01-22 12:51:30 +01:00
34a9b35037
Option, Result: Propagate caller locations when erroring out 2023-01-22 12:00:52 +01:00
0126a8fb6e
luna: Add a new SourceLocation class and use that in check() and expect() 2023-01-22 11:43:48 +01:00
129297a0b0
CString: Fix compilation in strnlen() 2023-01-22 11:43:10 +01:00
cf8d3c6ff9
OwnedStringView: Add a method to extract a substring 2023-01-22 11:27:54 +01:00
12d2039f68
CString: Add strnlen() and strndup() 2023-01-22 11:27:37 +01:00
944d32de36
Bitmap: Introduce new malloc-aware initialization functions
Lets us call resize(new_size) instead of initialize(realloc(location, new_size), new_size)
2023-01-21 23:16:50 +01:00
0e607c2fef
Bitmap: Declare more variables as const
I miss Rust's immutability-by-default...
2023-01-21 23:04:21 +01:00
a6974b605e
tools+CMake: Prefix all environment variables with LUNA_ 2023-01-21 22:44:16 +01:00
a3d0fa7d0a
UserVM: Validate the entire range when freeing multiple VM pages 2023-01-16 21:16:38 +01:00
631cdd0204
x86_64/CPU: Skip null instruction pointers on stack trace generation 2023-01-16 20:44:45 +01:00
c374c25523
Convert some FIXMEs into NOTES 2023-01-16 20:30:35 +01:00
1d92784608
luna, kernel: Replace some uses of char by truly 1-byte wide types 2023-01-16 19:52:34 +01:00
329e8ab182
luna/Heap: Scrub reallocations properly 2023-01-16 19:50:35 +01:00
1b807a4e06
arch/Timer: Make sure ARCH_TIMER_FREQ is a power of two
(avoid division and modulo, division is slow)
Fortunately, GCC will optimize divisions by powers of two to simple bitwise shifts :)
2023-01-16 19:43:05 +01:00
d0600f5714
luna: Make Utf8StringEncoder short-circuit instead of failing when hitting the length limit 2023-01-14 12:07:08 +01:00
e3ef29e80d
libc: Implement wcstombs() 2023-01-14 11:59:08 +01:00
00ee8314b3
luna: Make Utf8String{De,En}coders return the number of bytes written
This means we can avoid a call to code_points() in mbstowcs(),
which would parse a string twice.
2023-01-14 11:55:19 +01:00
da805eec83
Describe what check() and expect() are 2023-01-14 10:59:30 +01:00
eb35abfa52
Vector: Assigment, copy&move constructors, and destructor 2023-01-14 10:50:28 +01:00
3b4b750cbf
luna: Vector is here!! 2023-01-13 22:28:03 +01:00
28bde216c4
libc: Implement perror() 2023-01-13 21:08:10 +01:00
e676fb8299
libc: Add a wide range of time manipulation functions, including reentrant variants 2023-01-13 21:06:27 +01:00
2d2db300b0
libc: Add malloc(), calloc(), realloc() and free() 2023-01-13 20:00:20 +01:00
5fb2ff09c7
kernel, luna, libc: Move the heap code to a common zone, to be used by both kernel and userspace 2023-01-13 19:27:53 +01:00
d864bda751
libc: Add (de)allocate_memory wrappers located in sys/mman.h 2023-01-13 19:08:02 +01:00