Commit Graph

150 Commits

Author SHA1 Message Date
Bananymous faf14b880e LibC: Rewrite all the headers.
We now have more or less posix issue 2018 conforming libc headers.

This was a really time consuming and boring operation but it had to
be done.

Now we get to actually start implementing libc :)
2023-05-26 22:31:21 +03:00
Bananymous faa7bc6043 BAN: libban is now build into library dir 2023-05-26 22:31:21 +03:00
Bananymous 03c64b950b BAN: Errors.h can be included from userspace 2023-05-26 22:31:21 +03:00
Bananymous 591d03de95 BAN: add is_arithmetic and is_signed to Traits.h 2023-05-15 20:26:29 +03:00
Bananymous 0d9422ead8 BAN: add pow, log2, log10, log in math
These are implemented using x86 floating point assembly
2023-05-10 19:03:33 +03:00
Bananymous 05046d6e93 BAN: Error uses 64 bit error codes 2023-05-07 02:09:52 +03:00
Bananymous 9cf09165b5 BAN: Add is_power_of_two to Math functions 2023-04-28 14:42:49 +03:00
Bananymous 3ca623349a BAN: Add {TRY,MUST}_REF for references
It is annoying that we have to have separate macros for these but
I can't find a way to cleanly return lvalue reference from statement
expression. Currently we cast the reference to pointer and return
unreference the pointer outside of the expression.

This feature will probably not be used any time soon, but atleas
it is implemented if I need it one day
2023-04-19 00:31:15 +03:00
Bananymous 121f4bc1dd BAN: TRY and MUST macros use rvalue references 2023-04-19 00:11:15 +03:00
Bananymous 8e31ef9905 BAN: Add specialization for ErrorOr<LValueReference>
ErrorOr can now return a reference :)
2023-04-18 22:02:47 +03:00
Bananymous 2c52e0aad8 BAN: Variant with reference now supports copy/assign 2023-04-18 20:21:23 +03:00
Bananymous 06916f56be BAN: Variant now works with references
References can be assigned with the set() method. Construction nor
assigment operators cannot be used with references to avoid ambiguity
with what assignment to reference does.

You can set the underlying reference with the set() method and access
it with the get() method.

The references are stored as pointers to the object under the hood
which means that size of a reference is sizeof pointer.
2023-04-18 19:53:34 +03:00
Bananymous c3df0bd15e BAN: Variant::set now copy/move assigns when possible 2023-04-18 19:10:22 +03:00
Bananymous b41a8e2829 BAN: Variant now has variadic template types 2023-04-18 18:29:48 +03:00
Bananymous fdb4eb6042 Kernel: Move kmalloc and MMU to Memory directory 2023-04-18 10:18:15 +03:00
Bananymous c35e7368f2 BAN: Variant now aligns its data properly 2023-04-12 00:17:45 +03:00
Bananymous aa2aee684b Kernel: remove message from BAN::Error
We don't store the error message anymore in BAN::Error.
Instead we store a error code that can be mapped into a string.
This allows BAN::Error to only take 4 bytes instead of 128.

We should also make some kernel initialization just panic instead
of returning errors since they are required for succesfull boot
anyway.
2023-04-11 23:25:21 +03:00
Bananymous cfa025acae BAN: Move RefPtr to its own file and create New.h
New.h contains definitions for placement new operators and
BAN::allocator and BAN::dealloctor
2023-04-10 21:07:25 +03:00
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