Commit Graph

233 Commits

Author SHA1 Message Date
Bananymous 3fc1edede0 Kernel/LibC: Implement super basic select
This does not really even block but it works... :D
2024-02-12 17:26:33 +02:00
Bananymous 6fb69a1dc2 LibC: Implement inet_ntop for IPv4 addresses 2024-02-08 11:59:11 +02:00
Bananymous 454bee3f02 LibC: Fix sockaddr_un implementation 2024-02-07 15:57:45 +02:00
Bananymous 41cad88d6e Kernel/LibC: Implement dummy syscalls for accept, connect, listen 2024-02-07 15:57:45 +02:00
Bananymous f804e87f7d Kernel: Implement basic gateway for network interfaces 2024-02-05 18:18:56 +02:00
Bananymous c35ed6570b LibC: Implement endiannes and ip address functions 2024-02-05 18:18:56 +02:00
Bananymous 692cec8458 Kernel/Userspace/LibC: Implement basic dprintln for userspace 2024-02-05 01:24:09 +02:00
Bananymous e1ffbb710b Kernel/LibC: Implement basic ioctl for network addresses 2024-02-03 01:50:10 +02:00
Bananymous bc1441a5eb LibC: add stropts.h 2024-02-02 14:29:20 +02:00
Bananymous 0f154c3173 Kernel: Implement basic recvfrom 2024-02-02 13:50:00 +02:00
Bananymous ec2f21bb9f Kernel/LibC: Implement SYS_SENDTO 2024-02-02 03:16:01 +02:00
Bananymous ab150b458a Kernel/LibC: Implement basic socket binding 2024-02-02 01:31:58 +02:00
Bananymous cf28ecd5a6 Kernel/LibC: Add SYS_SOCKET 2024-02-01 23:39:09 +02:00
Bananymous dfe5a2d665 All: Cleanup all files
Add newline to end of files and remove whitespace from end of lines
2024-01-24 15:53:38 +02:00
Bananymous e544e6a62d LibC: Implement floating point parsing to *scanf functions 2024-01-24 11:54:12 +02:00
Bananymous 606a7cb313 LibC: Implement almost POSIX compliant *scanf functions
Only wchar strings and floating point values are not parsed
2024-01-24 10:33:12 +02:00
Bananymous 2c471a89d0 LibC: Add compile option to libc to stop optimizing string.h 2024-01-17 19:44:29 +01:00
Bananymous 51214ea1bf Kernel: Add load_keymap syscall and load Finnish keymap in init 2024-01-10 14:46:29 +02:00
Bananymous db0650cf10 LibC: Implement basic atexit. This allows clean exit from doom (soon) 2024-01-03 00:30:37 +02:00
Bananymous 668c4c8976 LibC: Implement getgrnam and getgrgid 2024-01-03 00:14:49 +02:00
Bananymous 96d831c31a Kernel/LibC/Userspace: Implement chown and set tty owner on login 2024-01-02 22:19:38 +02:00
Bananymous 4307968182 All: Start work again on sse support 2023-12-28 19:14:42 +02:00
Bananymous 3352640d09 LibC: strlen had to be marked not optimized... 2023-12-19 21:42:59 +02:00
Bananymous 637397dd2f LibC: Make memcpy and memset not optimized
GCC does some weird optimizations and breaks these functions
2023-12-19 21:42:59 +02:00
Bananymous 5edbb1d5c4 LibC: make execvp fail if no executable found 2023-12-19 21:42:59 +02:00
Bananymous 1cd5b3c20c LibC: Fix stpncpy
I had misunderstood and tought that the string is always
null terminated
2023-12-15 00:33:37 +02:00
Bananymous c773e2ed07 LibC: Optimize malloc even further
aoc2023/day12 now runs in 3.5 seconds on my machine. This is way
better than the old almost hour.
2023-12-14 23:49:25 +02:00
Bananymous c4186bd5f0 LibC: Compile with -O2 optimizations
I have no idea why libc had no optimizations enabled.

Weird thing is that memcpy optimized to infinite loop if I kept the
__restrict__ attributes in pointers. I don't think there was any ub.
2023-12-14 23:40:08 +02:00
Bananymous 5f640da166 LibC: Optimize malloc by a lot
I now cache first free node in malloc_pool and whether the node is
last or not. There allow doing less full iterations over the whole
malloc pool.

Malloc is still unbearably slow and I will have to write a proper
fast malloc at some point. With this patch running aoc2023/day12 is
atleast possible. Probabaly will take closer to an hour...
2023-12-14 15:31:00 +02:00
Bananymous 7320104fd0 LibC: Mark __assert_fail as noreturn 2023-12-14 15:13:54 +02:00
Bananymous 600bd7ee0f LibC: Implement rmdir in unistd.h 2023-12-14 11:02:56 +02:00
Bananymous adf1e54605 LibC: Implement more functions to string.h 2023-12-14 11:02:30 +02:00
Bananymous a3de64f5fa LibC: Implement basic version of system() this assumes Shell exists 2023-12-14 11:00:40 +02:00
Bananymous 8216d09e06 LibC: Implement non-locale specific functions from strings.h 2023-12-14 10:59:39 +02:00
Bananymous 694cda6e40 LibC: Implement remove for stdio 2023-12-14 10:58:50 +02:00
Bananymous 00d57d783e LibC+userspace: Make everything compile with -Wall -Wextra -Werror
I added -Wall -Wextra -Werror as public compile flags to libc. Now
everything in userspace in compiled using these flags. I made all
necessary changes to allow compilation to work.

Only exception is execvp which has a large stack usage. Maybe it
should use malloc for the buffer but posix allows ENOMEM only when
kernel is out of memory... This can be fixed when fexecve is
implemented and there is no need for absolute path.
2023-12-10 19:20:14 +02:00
Bananymous 9d8c9baa3f LibC: Remove unnecessary RWX mask definition 2023-12-09 19:43:49 +02:00
Bananymous 0dc168a8c0 LibC: Implement basic execvp 2023-12-06 18:14:00 +02:00
Bananymous 76049b2e13 LibC: Implement and fix some string.h functions 2023-12-06 18:13:34 +02:00
Bananymous 976ae64f88 LibC: make sleep() set errno if sleep woke up early 2023-12-06 13:13:43 +02:00
Bananymous 1c78671078 Kernel: Rework all signal code
Signal handling code was way too complex. Now everything is
simplified and there is no need for ThreadBlockers.

Only complication that this patch includes is that blocking syscalls
have to manually be made interruptable by signal. There might be some
clever solution to combat this is make this happen automatically.
2023-12-06 13:02:17 +02:00
Bananymous cdcc36efde Kernel: Remove unnecessary raise syscall 2023-12-06 13:00:45 +02:00
Bananymous 894065a67e LibC: cleanup and fix fgets
My quick fix for fgets wrote non-nullterminated newline if size was
one.

POSIX doesn't specify what happens if size == 0, so I do the same as
glibc and return NULL without setting errno.
2023-12-05 10:00:43 +02:00
Bananymous 95fc894303 LibC: fix fgets when reading empty line 2023-12-05 07:46:14 +02:00
Bananymous 327b330338 Kernel: Make internal framebuffer bpp constexpr defined in libc 2023-11-29 20:07:33 +02:00
Bananymous d86ecf4f61 Kernel: Reading from negative offset in fb dev gives out info 2023-11-28 23:50:11 +02:00
Bananymous 09b7cb2f33 Kernel/LibC: Implement pread() 2023-11-28 23:47:30 +02:00
Bananymous 60e755210c Kernel/LibC: Implement very basic msync 2023-11-22 22:44:06 +02:00
Bananymous c084ce8b01 Kernel/LibC: Implement readlink and readlinkat 2023-11-11 23:16:52 +02:00
Bananymous f6c312a6b3 BuildSystem: using sysroot doesn't need root privileges anymore!
Sysroot is now created with fakeroot. This allows root access to be
only needed for disk image creation, since it uses loopback devices.
2023-11-04 17:50:43 +02:00