Commit Graph

182 Commits

Author SHA1 Message Date
Bananymous 781cc78a1f BuildSystem: Fix header copying to sysroot
We used to copy all headers everytime to sysroot which caused
rebuild of the whole os. Now we use the cmake command
'copy_directory_if_different' which seemed to fix this issue :)
2023-04-10 21:07:25 +03:00
Bananymous 8a8793fd2d BuildSystem: you can now build the toolchain with cmake 2023-04-06 00:23:02 +03:00
Bananymous daa35aaf7d BAN: Add data() member function to Array 2023-04-03 17:00:52 +03:00
Bananymous 4c5176f751 BuildSystem: We are now using cmake instead of plain make
I have been annoyed for a while since I had to build everything
when running the os since the buildsystem was really bad.

I wanted to rewrite the whole build system and changed to using cmake

:)
2023-04-02 04:07:27 +03:00
Bananymous 7b7f4eb141 BAN: LinkedList::remove now returns iterator to the element after 2023-03-30 18:46:19 +03:00
Bananymous 5d459130a7 BAN: StringView::split(char, bool) is now thread safe
I had to duplicate some code, but this is better since I would like
to not use BAN::Function for something like this
2023-03-30 16:35:38 +03:00
Bananymous 10e0c90fde BAN: String add front() and back() helpers 2023-03-29 14:10:29 +03:00
Bananymous e5c3486826 BAN: Vector now takes optional argument for default value on resize 2023-03-28 23:10:36 +03:00
Bananymous 8e626b8d1f BAN: Implement basic Circular Queue 2023-03-28 21:44:02 +03:00
Bananymous 6a6717cdd3 BAN: ScopeGuard can now be disabled (it wont call the function) 2023-03-28 01:15:13 +03:00
Bananymous 0cebf248a3 BAN: move placement new declaration to Move.h 2023-03-27 03:38:06 +03:00
Bananymous 666051fd34 Kernel/BAN: move unix time conversion to BAN and add stat to Shell 2023-03-27 00:49:58 +03:00
Bananymous efe73caf1b BAN: char* is now formatted as string and not pointer 2023-03-23 14:29:35 +02:00
Bananymous 3ef72e8a7b BAN: Modify Span constructors to keep constness correctly 2023-03-23 14:26:03 +02:00
Bananymous e9da63ad79 BAN: Add is_const to traits 2023-03-23 13:28:57 +02:00
Bananymous 74949401bd Kernel: Cleanup GPT parsing code 2023-03-23 11:13:14 +02:00
Bananymous a61cf61fd1 BAN: Add wrappers for little/big endian numbers 2023-03-20 19:48:08 +02:00
Bananymous f9ae1f0023 Kernel: Fix PC Screen font parsing
I had misread the format and the parsing code was incorrect. I also
changed fonts to store unicode codepoints as 32 bit integers, so
every character can be represented
2023-03-20 14:52:42 +02:00
Bananymous ce3f268075 BAN: Implement basic Span
This is wrapper over contiguous block of memory e.g. Vector
2023-03-20 13:34:26 +02:00
Bananymous 8edabaea55 BAN: Add iterators to all containers with contiguous memory 2023-03-20 13:26:42 +02:00
Bananymous ec22b86e00 BAN: Add implementation for basic iterator for contiguous memory 2023-03-20 13:15:38 +02:00
Bananymous 1292be71b2 BAN: Add FNV hash for strings 2023-03-16 15:11:22 +02:00
Bananymous 1b7625581d Kernel: Add basic concept of Processes
We now create Shell as a process that has its own threads
2023-03-16 12:17:04 +02:00
Bananymous c012822d49 BAN: Rename StringView suffix from _sv to sv 2023-03-16 12:15:16 +02:00
Bananymous 392da37f9a BAN: Function storage is now aligned as CallableBase and not max_align_t
On 32 bit architecture the alignment of 16 bytes did not seem to work
on stack variables. UBSan detected whole lot of misaligned functions
from Ext2.cpp. This patch should make function alignment be big enough?
2023-03-09 01:42:17 +02:00
Bananymous 371dfe8ef3 BAN: Formatter now uses perfect forwarding on its arguments 2023-03-08 21:31:26 +02:00
Bananymous 3ac99f1bd8 BAN: Add more traits and cleanup code 2023-03-08 21:30:21 +02:00
Bananymous 7458f68c38 BAN: Error can now be constructed from c_string or format string
If the resulting string would overflow, we just truncate it to fit
the error message buffer (128) bytes
2023-03-08 17:05:37 +02:00
Bananymous 23b3028e15 Kernel: Rename RefCounted -> RefPtr and implement RefCounted 2023-03-08 03:26:25 +02:00
Bananymous e480f9c195 BAN: RefCounted<> frees count if object allocation fails 2023-03-06 13:17:04 +02:00
Bananymous e3a71289c0 BAN: fix LinkedList back/front functions 2023-03-06 01:46:52 +02:00
Bananymous 81cb342c12 BAN: Remove #error macros 2023-03-02 22:30:32 +02:00
Bananymous 1c146ba1a5 BAN: remove aligned alloc from ban 2023-03-02 22:12:42 +02:00
Bananymous 52aa98ba25 Kernel+LibC: Add some errno codes
Kernel now returns ENOMEM and other errnos, so we dont have to write
error messages
2023-03-02 21:10:44 +02:00
Bananymous 90a7268e5a BAN: Rewrite RefCounted to return ErrorOr 2023-03-02 12:30:11 +02:00
Bananymous dc1a4614fb BAN: Errors are now moved around with TRY() 2023-02-26 02:54:34 +02:00
Bananymous 9439582154 BAN: Add ASSERT_NOT_REACHED() 2023-02-26 02:53:58 +02:00
Bananymous 6c1f0d1dc8 BAN: Add big_endian_to_host in Math 2023-02-23 15:58:32 +02:00
Bananymous 0e77b4dc4e BAN: You can now transform little endian data to host endian 2023-02-22 21:47:22 +02:00
Bananymous f98f3d851c BAN: HashMap uses LinkedList as bucket, so kmalloc_fixed can be used 2023-02-22 21:46:41 +02:00
Bananymous a845f8696c BAN: Add function to decode utf-8 encoded strings
works for 3 byte unicode characters
2023-02-22 21:45:26 +02:00
Bananymous 4afc4660a4 BAN: Basic containers have shrink_to_fit() method
I also chaged the default memory allocation increase from 1.5 to 2
2023-02-22 02:07:05 +02:00
Bananymous 5d31e89574 Kernel: Update ErrorOr API and add path find to VFS
These two are done on the same commit since Changes to Shell were
annoying to make work with only one change
2023-02-22 01:23:11 +02:00
Bananymous 9aab67fed8 BAN: make all Math functions inline constexpr 2023-02-22 01:17:56 +02:00
Bananymous 10b6d51522 BAN: implement Variant<> for two types 2023-02-22 01:17:21 +02:00
Bananymous afd4b7a184 BAN: HashMap now copies size when copying :D 2023-02-22 01:16:07 +02:00
Bananymous fbc17eb6dd BAN: Implement basic HashMap 2023-02-20 16:00:51 +02:00
Bananymous 247f03c79e BAN: Make ErrorOr<> have attribute [[nodiscard]]
We don't have to specify it everytime we make function return ErrorOr
2023-02-19 20:10:30 +02:00
Bananymous 66a4b69a29 BAN: Math now uses template concepts and add div_round_up 2023-02-19 00:48:56 +02:00
Bananymous 7f12a7050a BAN: Add data() to Vector.
This allows you to access the underlying data in a vector
2023-02-16 20:47:49 +02:00
Bananymous f188fea81c BAN: Implement basic HashSet 2023-02-10 02:59:52 +02:00
Bananymous 7630df84ad BAN: Add basic hashing functionality 2023-02-10 02:59:30 +02:00
Bananymous 4f8fcf0bd7 BAN: Add Formatter specialization for Vector 2023-02-10 02:58:14 +02:00
Bananymous f68ae01d0c BAN: Fix ErrorOr<void> to actually set error byte 2023-02-10 01:06:18 +02:00
Bananymous 7ee4ecd7f4 BAN: Vector's and Queue's underlying type is T* instead of uint8_t*
I have no idea what kind of brainfart I had to make use uint8_t*
that just complicated the code :D
2023-02-10 00:12:23 +02:00
Bananymous e5ffc1686f BAN: Vector::const_iterator now uses const T* as underlying type 2023-02-09 23:06:49 +02:00
Bananymous bfc9a2377c BAN: LinkedList now uses iterators instead of const_iterators on methods 2023-02-09 23:06:16 +02:00
Bananymous 6a133782ed All: Move to c++20 2023-02-09 23:05:26 +02:00
Bananymous 338771c5b0 BAN: Cleanup Vector code
*Applies to last patch also!*

Remove duplicate code in iterators. We used to have separate iterator
and const_iterator but now they are the same class with some enable_if
magic to disable references from const_iterator

This introduces some 'bad things' you can for example call
const_iterator.operator*<false>() to obtain non const reference. I
don't think this matters since you could use const_cast or something
else to work around const if you really tried
2023-02-07 11:08:05 +02:00
Bananymous 08dfb0e1db BAN: Cleanup LinkedList code 2023-02-06 19:01:52 +02:00
Bananymous 2403df50bb BAN: Add getter for Function size 2023-02-02 23:19:18 +02:00
Bananymous 0d2d6e5348 BAN: Fix all emplace functions to actually do perfect forwarding 2023-02-01 21:41:51 +02:00
Bananymous 99cf1c0330 BAN: Add destructor to function if it needs to deallocate something someday 2023-02-01 21:41:18 +02:00
Bananymous 9b8de5025a All: rename every function from UpperCamelCase to snake_case
This was a mess since I didn't know which to use but now I decided
to go with snake_case :)
2023-02-01 21:05:44 +02:00
Bananymous 4faa662a59 BAN: Rewrite Traits and add some more of them 2023-02-01 20:05:34 +02:00
Bananymous 1945b716ad BAN: Implement basic LinkedList 2023-02-01 01:22:41 +02:00
Bananymous 5127da9ecc BAN: Add more traits 2023-02-01 01:22:19 +02:00
Bananymous 56d6b2af3d BAN: TRY() now returns the error itself and not ErrorOr<>
This allows us to use TRY with different ErrorOr<> templates
2023-02-01 01:21:14 +02:00
Bananymous 3a1f068bac BAN: Add needed include to Function 2023-01-31 18:43:24 +02:00
Bananymous f10a57dcec BAN: Add RefCounted<> and Unique<>
We have now maybe functional smart pointers
2023-01-31 18:43:09 +02:00
Bananymous b315fdc27f Kernel: Finally managed to get 64-bit working
I had weird problems with interrupts but everything should work now
2023-01-25 19:19:28 +02:00
Bananymous 7c6d474a3a BAN: Add basic ScopeGuard 2023-01-23 17:41:34 +02:00
Bananymous c9e32b1b5b BAN: Cleanup Queue AddressOf functions 2023-01-18 17:19:57 +02:00
Bananymous 64f0cc0d42 BAN: fix Vector code
one return value was missing and AddressOf functions were kinda ugly
2023-01-18 17:18:54 +02:00
Bananymous dd607ce86f BAN: Add basic lambda support for BAN::Function 2023-01-18 14:39:31 +02:00
Bananymous ef2e8f1a2f BAN: Move RemoveReference and IsLValueReference to their own header
Also implement basic Less, Equal, Greater
2023-01-18 13:39:08 +02:00
Bananymous 59fa4055a6 BAN: Add Queue::Emplace() 2023-01-17 12:02:59 +02:00
Bananymous 1340e26148 BAN: Add Vector::Emplace and EmplaceBack() and fix insert assignment 2023-01-17 11:59:36 +02:00
Bananymous cf63552b2a BAN: Cleanup includes 2023-01-17 11:38:16 +02:00
Bananymous a7a55cd0fb BAN: Rename Forward.h -> ForwardList.h to avoid confusion with BAN::Forward() 2023-01-17 11:21:21 +02:00
Bananymous 53a5ad3cf9 BAN: Function now properly forward arguments 2023-01-17 11:16:46 +02:00
Bananymous 124afbecaa BAN: Add Forward() 2023-01-17 11:15:57 +02:00
Bananymous 5122d27f89 BAN: Add Front() and Back() to StringView 2023-01-16 18:56:51 +02:00
Bananymous 3561257286 BAN: Add basic Function for function pointers and member functions 2023-01-16 15:09:27 +02:00
Bananymous a02d4c59ed BAN: Vector and Queue replace Address() with AddressOf and correct const 2023-01-16 12:10:16 +02:00
Bananymous c62d512d68 BAN: Add Iterator and ConstIterator to Vector 2023-01-13 17:48:19 +02:00
Bananymous 57cbd728db BAN: Rewrite Queue with move semantics 2023-01-13 15:04:06 +02:00
Bananymous 0f4e95acc5 BAN: Rewrite vector with move semantics 2023-01-13 15:04:06 +02:00
Bananymous 065e23d307 BAN: fix include 2023-01-13 15:04:06 +02:00
Bananymous 82a25f9035 BAN: implement placement new 2023-01-13 14:45:27 +02:00
Bananymous 61de71e0d5 BAN: Properly allocate/deallocate elements in Vector/Queue 2023-01-13 01:09:40 +02:00
Bananymous 6ed542d6bf BAN: Queue and Vector now default initialize newly allocated elements 2023-01-13 01:00:50 +02:00
Bananymous c35181a92f BAN: ASSERT now prints the condition 2023-01-13 00:57:47 +02:00
Bananymous 53d1d12c12 BAN: String add operator=(StringView) 2023-01-13 00:57:47 +02:00
Bananymous c33c6c5785 BAN: memcpy only if we already have a buffer 2023-01-13 00:17:19 +02:00
Bananymous 6b73547989 All: edit gcc flags 2023-01-13 00:04:15 +02:00
Bananymous 61bd9da8e0 BAN: Add [[nodiscard]] to BAN functions returning ErrorOr 2023-01-12 23:57:07 +02:00
Bananymous 78da037dda BAN: String, Queue and Vector dont use floating point arithmetic 2023-01-12 17:00:29 +02:00
Bananymous 67308c36ad BAN: ErrorOr<void> does not do an heap allocation anymore 2023-01-12 00:11:54 +02:00
Bananymous d02e3b19c7 BAN: Move operator new/delete to BAN/Memory.cpp
We also now implement alignment new
2023-01-10 21:59:40 +02:00