Commit Graph

20 Commits

Author SHA1 Message Date
8d46c9bbe2 Kernel, libc: Fix a big bug in printf()
Every time printf flushes the buffer to us in sprintf() or snprintf(), we call strncat to append the data.

But we want to start from the beginning in the first flush. What if there was data already there?
Well, we just append to the old data. Which is not good, and breaks snprintf()'s maximum size policy.

This fix sets the first byte of str to NULL, to avoid this.
2022-10-30 09:53:23 +01:00
437f51add7 Kernel: move over the mem* functions from libc 2022-10-22 19:04:35 +02:00
8c0a57f0c2 Kernel: Copy strrchr, dirname and basename over from libc 2022-10-16 14:36:25 +02:00
aca1367158 Kernel: Switch to strlcpy() as well
Surprisingly, most uses of strncpy() are in places where strncpy() is actually a better choice.
For example, copying to a fixed-length char array in a structure.
2022-10-15 17:30:34 +02:00
bcbf43e55c Kernel/std: Add strdup() 2022-10-12 18:03:54 +02:00
3ee1f34bc4 Forgot to add break :)
And that, is why you test before pushing and commiting >.<
2022-10-08 18:08:50 +02:00
c67079dd74 Kernel, libc: Implement %p in *printf()
So we can avoid writing (unsigned long)ptr or (uint64_t)ptr everywhere when wanting to print a pointer.
2022-10-08 18:07:33 +02:00
b7ee746da3 Kernel: Enable even more warnings 2022-10-07 18:10:20 +02:00
1ee5deb0f0 Remove unnecessary include 2022-10-06 19:51:16 +02:00
594d79143e Kernel: enable -Wconversion 2022-10-06 17:13:34 +02:00
0e46ea8ada Finally, a text renderer that actually works. We can now see the kernel messages without a serial port :) 2022-10-01 14:27:45 +02:00
49ddb47ad4 Reorganize structure 2022-09-21 17:56:53 +02:00
1c12cf016e Add a Scheduler.
Finally.

Just Round Robin with sleeping, but it's still awesome. I think this can finish v0.3, with a few adjustments.
2022-09-20 19:58:04 +02:00
18140a55ec Make strstr take a const char* as a needle instead of a char* 2022-09-15 18:42:18 +02:00
e3e2952661 Consistent naming 2022-09-10 18:06:46 +02:00
9de9eacb1d add strstr 2022-09-08 17:02:16 +02:00
aa6c578a3c Fix bug in internal_printf 2022-09-07 15:02:38 +02:00
bd0a24097f Add a KernelMemoryManager namespace to wrap PMM + VMM 2022-09-06 18:08:15 +02:00
1367e88d88 Finally implement %l and %z format modifiers
Finally, we can use %zx with a 64-bit number instead of %x%x with 2 32-bit values split from a 64-bit number!
2022-09-05 16:59:45 +02:00
1b727a66ea Ready. Set. Go! 2022-09-05 16:13:51 +02:00