e9e1bef89c
OwnedPtr, SharedPtr: Add operator bool
continuous-integration/drone/pr Build is passing
2023-02-25 16:27:36 +01:00
ae22321648
Option, Result: Make try_move_value() non-const since it modifies the Option
continuous-integration/drone/pr Build is passing
2023-02-25 16:22:11 +01:00
37bbc04719
Heap: Fix GPF caused when making many small allocations
...
continuous-integration/drone/pr Build is passing
Apparently space was too tight to split(), but we did it anyways, corrupting the next block.
This patch fixes this behavior.
2023-02-17 22:47:15 +01:00
4697a16206
Heap: Avoid accessing a block after it's potentially deleted
continuous-integration/drone/pr Build is passing
2023-02-14 20:17:31 +01:00
08d5d727ee
luna: Skip UBSAN.cpp in CMakeLists as that's not implemented yet
continuous-integration/drone/pr Build is passing
2023-02-14 20:10:02 +01:00
38bd3d3eef
luna: Use spinlocks in the heap implementation
continuous-integration/drone/pr Build is failing
2023-02-14 20:07:30 +01:00
4e88a7482c
kernel, luna: Move Spinlock.h to luna
2023-02-14 20:05:00 +01:00
6eff41e7af
Option: Use __builtin_launder to ensure that the compiler doesn't label this as UB
2023-02-14 20:03:29 +01:00
79078ff21e
SharedPtr: Implement make_shared using adopt_shared
continuous-integration/drone/pr Build is passing
2023-02-14 19:59:44 +01:00
51024f879d
SharedPtr: Delete ptr on failure in all adopt_shared* functions
2023-02-03 22:20:00 +01:00
e9a009478f
SharedPtr: Fixes and support for casting to other SharedPtr types
continuous-integration/drone/push Build is passing
2023-01-31 19:59:06 +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
8cb9c14b1e
luna/Format: Make output_(pure_)integer_data take a const reference to vstate
continuous-integration/drone/push Build is passing
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
continuous-integration/drone/push Build is passing
2023-01-22 15:00:20 +01:00
a7a38d3433
Bitmap: Add a fallible variant of match_region() that does not crash if arguments are out of range
...
continuous-integration/drone/push Build is passing
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
continuous-integration/drone/push Build is passing
2023-01-22 12:51:30 +01:00
34a9b35037
Option, Result: Propagate caller locations when erroring out
continuous-integration/drone/push Build is passing
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
continuous-integration/drone/push Build is failing
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
...
continuous-integration/drone/push Build is passing
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_
continuous-integration/drone/push Build is passing
2023-01-21 22:44:16 +01:00
a3d0fa7d0a
UserVM: Validate the entire range when freeing multiple VM pages
continuous-integration/drone/push Build is passing
2023-01-16 21:16:38 +01:00
1d92784608
luna, kernel: Replace some uses of char by truly 1-byte wide types
continuous-integration/drone/push Build is passing
2023-01-16 19:52:34 +01:00
329e8ab182
luna/Heap: Scrub reallocations properly
2023-01-16 19:50:35 +01:00
d0600f5714
luna: Make Utf8StringEncoder short-circuit instead of failing when hitting the length limit
continuous-integration/drone/push Build is passing
2023-01-14 12:07: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
continuous-integration/drone/push Build is passing
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!!
continuous-integration/drone/push Build is passing
2023-01-13 22:28:03 +01:00
2d2db300b0
libc: Add malloc(), calloc(), realloc() and free()
continuous-integration/drone/push Build is passing
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
09dc8bd522
Bitmap: Add find_region() and find_and_toggle_region()
2023-01-13 18:55:31 +01:00
59db656f25
size_t -> usize
2023-01-13 18:55:05 +01:00
16a62552db
SharedPtr: Add a nullptr constructor
2023-01-13 18:54:39 +01:00
445aeed80d
OwnedPtr: Implement assignment operators
2023-01-13 18:54:25 +01:00
586ca19b62
Add a VERY BASIC and hacky way of allocating memory from userspace
...
continuous-integration/drone/push Build is passing
Only supports one-page allocations and doesn't have libc wrappers, which means it has to be invoked using syscall().
2023-01-11 23:02:42 +01:00
0e1e15e85a
Result: Construct a Result from an Option using from_option()
2023-01-11 23:02:42 +01:00
d150c55143
TarStream: Support mode
continuous-integration/drone/push Build is passing
2023-01-11 18:42:50 +01:00
82b555cf5c
TarStream: Refactor the API to get rid of that awful method in Result
...
continuous-integration/drone/push Build is passing
That method being try_set_value_with_specific_error()
2023-01-11 17:30:53 +01:00
6cf042e65e
Result: Remove m_has_value, rely on Option::has_value()
continuous-integration/drone/push Build is passing
2023-01-11 17:09:32 +01:00
67ebb00bd3
Option, Result: Introduce try_move_value(), which is the release_value() equivalent of try_set_value()
2023-01-11 17:06:17 +01:00
84c82a4e75
luna, kernel: More constness
continuous-integration/drone/push Build is passing
2023-01-10 19:31:41 +01:00
5aa667c776
luna: Make OwnedStringView::clone() just call from_string_literal()
continuous-integration/drone/push Build is passing
2023-01-10 19:03:00 +01:00
3ac3d54788
luna: Make check() and expect() output errors in userspace
2023-01-10 19:02:16 +01:00
c82ed5df01
Enable -Os on all targets
2023-01-10 18:13:21 +01:00
c83f6c03b5
Bitmap: Add a 'find_and_toggle' method
...
continuous-integration/drone/push Build is passing
Just like find(), but toggles the value when finding it.
Avoids doing this manually in MemoryManager and KernelVM.
2023-01-09 18:08:50 +01:00
4287ec6cb0
Bitmap: Introduce a new method 'find' and use it in MM and KernelVM
...
continuous-integration/drone/push Build is passing
This method looks for the first bit with a value, optionally from a starting index, and returns its index.
This should be (haven't benchmarked) way faster than the manual way,
AKA what MM and KernelVM were doing.
This is due to this method using bit and byte manipulation tricks instead of just calling get() until getting the desired result :)
2023-01-09 17:59:52 +01:00