Ghost Kernel

A proper memory allocator 2024/09/18, 17:55:40

For a very long time now the memory allocator that was in place on kernel level was pretty crappy. When implementing this first it was one of the "I'll do that properly later" pieces of code that then are never touched again since they work well enough. Well, it actually didn't and caused a lot of issues both performance and stability wise.

The allocator is now replaced by a new one that features a mix of bucket and chunk allocation which vastly improves performance for the huge amount of tiny allocations that the kernel likes to make.

Aside from that I've updated the build script to respect library dependency (currently by just defining it there) which should avoid issues when setting the project up initially.

Release will follow soon.

0 comments

Docker toolchain 2023/09/12, 22:59:13

There's now a Docker image available which simplifies the process of setting up your local development system if you want to modify Ghost. Just clone the repositories, create a container and get started.

Check the documentation for more details!

0 comments

Ghost 0.12.0 and a lot of refactoring 2022/10/09, 00:10:09

After being inactive for a pretty long time (sorry :) I've recently refactored quite some parts of the system.

The wait handling has been extensively reworked so that sleeping an waiting for file I/O is way more efficient now. The scheduler was slightly improved with this change as well. I also added support for the legacy PIC again since all the code was there, so it works without the IO/APIC activated.

Many dumb performance bugs in the window server have been fixed. Here's something for the eye:

0 comments

C++ runtime & thread-local storage support 2020/01/28, 23:44:12

With the latest commits, C++ runtime features (most notably exceptions) and thread-local storage are now supported in executables and shared libraries.

The toolchain build was modified so that the shared version of libgcc libgcc_s.so.1 is now built. Using -shared-libgcc as a linker flag will now cause libgcc to be linked dynamically and therefore allow exception handling over multiple shared objects.

I've adapted the test suite to now call a runtime test program that performs multiple tests for global constructors, exception handling and TLS.

With those additions, shared library support should now be sufficient to continue work on other parts, most notably inter-process messaging will next be implemented in the new kernel implementation.

0 comments

Shared library support added 2020/01/19, 01:05:33

I've finally implemented basic support for shared library objects in the kernel's elf32 loader. This can be found in the branch dynamic-linking.

The main motivation for this was improving the size of executables and as a preparation for future performance improvements. The current implementation always binds all symbols early (so it behaves as if LD_BIND_NOW was set), so lazy-linking is not yet in use.

With this change, the build processes of libc, libghostapi and libuser where also adapted so they additionally emit .so files. By default the system libraries libc and libghostapi will therefore now be linked shared. The "cocorun" demo program is used to test out various features now.

The next steps are getting support for thread-local storage when such a variable is provided or accessed by a shared library. In the existing implementation, the TLS segment of the main object is loaded and a copy of that TLS master is assigned to each thread. There is some work left to do when working with shared libraries now, because each loaded ELF object can have a TLS segment and TLS relocations which must be fulfilled. For this the process structure must be adapted so that all of this information can be stored and evaluated later on.

Anyway, not much to see but have a look at this nice little shared library call :-)

0 comments