Commit Graph

29 Commits

Author SHA1 Message Date
Andreas Kling
1c692e87a6 Kernel: Move kmalloc() into a Kernel/Heap/ directory 2019-09-16 09:01:44 +02:00
Sergey Bugaev
2396b2ed70 Kernel: Add strncmp() 2019-08-11 16:30:43 +02:00
Andreas Kling
57c29491a3 Kernel+AK: Remove AK/StdLibExtras.cpp, moving kernel stuff to Kernel/.
We had some kernel-specific gizmos in AK that should really just be in the
Kernel subdirectory instead. The only thing remaining after moving those
was mmx_memcpy() which I moved to the ARCH(i386)-specific section of
LibC/string.cpp.
2019-07-29 11:58:44 +02:00
Andreas Kling
27f699ef0c AK: Rename the common integer typedefs to make it obvious what they are.
These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
2019-07-03 21:20:13 +02:00
Andreas Kling
5bce004d84 Kernel: The kernel will never call mmx_memcpy() so prune it. 2019-06-07 19:32:12 +02:00
Andreas Kling
891d4c4834 Kernel: Qualify a bunch of #include statements. 2019-06-07 19:29:34 +02:00
Andreas Kling
bc951ca565 Kernel: Run clang-format on everything. 2019-06-07 11:43:58 +02:00
Andreas Kling
6693cfb26a Kernel: Don't use MMX memcpy() in the kernel.
I just discovered the hard way that clobbering FPU/MMX/SSE registers in the
kernel makes things very confusing for userspace (and other kernel threads.)

Let's banish all of those things from the kernel to keep things simple.
2019-04-22 17:13:18 +02:00
Andreas Kling
a58d7fd8bb Kernel: Get rid of Kernel/types.h, separate LinearAddress/PhysicalAddress. 2019-04-06 14:29:29 +02:00
Andreas Kling
bcc00857a4 AK: Revert Eternal<T> for now since it doesn't work as intended. 2019-04-05 05:14:20 +02:00
Andreas Kling
c02c9880b6 AK: Add Eternal<T> and use it in various places.
This is useful for static locals that never need to be destroyed:

Thing& Thing::the()
{
    static Eternal<Thing> the;
    return the;
}

The object will be allocated in data segment memory and will never have
its destructor invoked.
2019-04-03 16:52:25 +02:00
Andreas Kling
60d25f0f4a Kernel: Introduce threads, and refactor everything in support of it.
The scheduler now operates on threads, rather than on processes.
Each process has a main thread, and can have any number of additional
threads. The process exits when the main thread exits.

This patch doesn't actually spawn any additional threads, it merely
does all the plumbing needed to make it possible. :^)
2019-03-23 22:03:17 +01:00
Andreas Kling
6788dcdb58 Start fixing things up to build with a proper cross-compiler. 2019-02-22 10:23:28 +01:00
Andreas Kling
022f7790db Use modern C++ attributes instead of __attribute__ voodoo.
This is quite nice, although I wish [[gnu::always_inline]] implied inline.
Also "gnu::" is kind of a wart, but whatcha gonna do.
2019-02-15 12:30:48 +01:00
Andreas Kling
2e663eda36 Kernel: Don't disable interrupts to access the system hostname. 2019-02-07 10:29:26 +01:00
Andreas Kling
1f159eaab0 Add a fast memcpy() using MMX when we're moving >= 1KB.
This is a nice speedup for WindowServer. I'll eventually have to do this
with SSE but the kernel doesn't support SSE yet so this is it for now.
2019-02-07 08:46:52 +01:00
Andreas Kling
5e9ba2ac84 Kernel: Rewrite ProcFS.
Now the filesystem is generated on-the-fly instead of manually adding and
removing inodes as processes spawn and die.

The code is convoluted and bloated as I wrote it while sleepless. However,
it's still vastly better than the old ProcFS, so I'm committing it.

I also added /proc/PID/fd/N symlinks for each of a process's open fd's.
2019-02-03 12:33:11 +01:00
Andreas Kling
14712ad9c5 Let's do dword-at-a-time memcpy() and memset() in userspace as well.
Also fix a dumb bug that showed up when I was memsetting something other
than zeroes.
2019-01-15 08:14:44 +01:00
Andreas Kling
c43903eebd Don't use dword-by-dword memset/memcpy if the addresses are unaligned.
Also don't enable the large kmalloc catcher by default.
2019-01-12 23:36:08 +01:00
Andreas Kling
24b2cadb82 Make the kernel's memcpy() and memset() go fast with dword copies.
Also I learned that the ABI allows us to assume DF=0 on function entry.
2019-01-12 18:14:40 +01:00
Andreas Kling
fa6029eed0 Make the kernel's memset do a "rep stosb" because. 2019-01-12 02:23:09 +01:00
Andreas Kling
9d05f6b7a7 Make bash-2.05b build with minimal changes.
This is really neat. :^)
2018-11-17 00:14:07 +01:00
Andreas Kling
ebf308d413 Make kernel build with clang.
It's a bit faster than g++ and seems to generate perfectly fine code.
The kernel is also roughly 10% smaller(!)
2018-11-09 12:22:31 +01:00
Andreas Kling
47b7eeda44 Fix all current build warnings in the kernel. 2018-11-09 10:03:21 +01:00
Andreas Kling
d980ddc745 Fix busted display of tty names in /proc/summary. 2018-10-31 22:43:49 +01:00
Andreas Kling
0f20be05a6 Implement sys$getcwd properly.
Also fixed broken strcpy that didn't copy the null terminator.
2018-10-30 00:06:31 +01:00
Andreas Kling
39fa1eb2c2 Print the contents of motd.txt on boot. 2018-10-17 12:07:39 +02:00
Andreas Kling
9171521752 Integrate ext2 from VFS into Kernel. 2018-10-17 10:57:23 +02:00
Andreas Kling
9396108034 Import the "gerbert" kernel I worked on earlier this year.
It's a lot crappier than I remembered it. It's gonna need a lot of work.
2018-10-16 11:02:00 +02:00