This is the final part of the major mm subsystem
refactor (for now). The new and improved slab
allocator can do *proper* poisoning, with pretty
accurate out-of-bounds and use-after-free
detection.
vm_page_t has also been restructured; its flags
and order are now combined into one atomic field.
This is part 3 of the mm subsystem overhaul.
The allocator doesn't rely on mutexes anymore and
uses individual per-order spinlocks instead.
Also, it is aware of multiple memory zones (normal
and DMA) as well as emergency reserves.
Page bitmaps take up 50 % less overhead now.
Another one of those larger endeavours that take
multiple commits. This first one introduces the
basic vm_page data structure, as well as the x86
bootstrap code for initializing it.
As of now, everything except the code imported
from FreeBSD is proprietary. Of course, it won't
be like this for long, only until we have decided
which license we like to use. The rationale is
that releasing everything under a copyleft license
later is always easier than doing so immediately
and then changing it afterwards.
Naturally, any changes made before this commit are
still subject to the terms of the CNPL.
This has been brewing for quite some time now, and
it still is nowhere near finished, but at least it
compiles now. A lot has changed, and it's still
quite messy (i386 is almost certainly broken now,
i haven't even checked)
This seems like a huge commit but it's really just
renaming a bunch of symbols. The entire mm
subsystem is probably gonna have to go through
some major changes in the near future, so it's
best to start off with something that is not too
chaotic i guess.
That's it, nothing major is gonna happen anymore
until i get amd64 support working and deprecate
the entire i386 branch. 32-bit just adds so many
extra complications to memory management that i
don't want to waste any more energy on this
platform which is obsolete anyway.
kqueues are going to form the basis for anything
related to I/O and IPC. They are a lock-free,
atomic FIFO queue and support multiple emitters
and consumers.
Up to now, the page frame allocator's
initialization routine relied on the fact that
map_page() never needs to get new pages on i386 if
the mapped page is a hugepage. This is not at all
true on other architectures, however.
This also includes a minor refactor of everything,
as well as some optimizations. The bitmap
operations have been moved into a separate file
because they are probably gonna come in handy in
other parts of the system as well.
This is a huge commit, but it mainly just moves
some files around and doesn't change their
contents much.
A lot of stuff works the same on amd64 as it does
on i386, so i'm moving the parts that are specific
to the latter into separate subdirectories while
the rest can be shared with the amd64 codebase.
This is part of a series of commits where i
completely rewrite kmalloc() because it needs to
be able to return physically contiguous memory for
DMA operations.
Yes, i know the build isn't working right now.
Oh my fucking god this was by far the most awful
and boring and tedious day in my entire life.
Also, dear FreeBSD people: please don't sue me.
I tried really hard to comply with all the
copyright stuff, but it is absolutely possible i
made a mistake. Just DM me and i'll do everything
in my power to fix it, even if that means
releasing entire portions of GayBSD under the BSD
license. I don't care, i just want stuff to work.
(i'm including this message to use it as possible
evidence in case i get sued to show my good will)
So this was painful. kprintf() supports most of
the format specifiers from BSD now, except for the
$ sequence. It has gotten a general overhaul and
is significantly more sophisticated, bloated and
slower now. There is also some minor stuff i
forgot about, like the 't' length modifier, but
that isn't so important right now and will be
fixed later(TM).
This commit also fixes the fun little size bug in
segment.S where i subtracted the end from the
start address of the GDT instead of the other way
round which resulted in a gigantic overflow :)
Now that memory allocation finally kind of works,
we can finally start focusing on the core system
architecture. This commit also fixes some bugs in
get_page() and friends, as well as performance
improvements because the page map is addressed as
unsigned longs rather than individual bytes.