116 Commits (main)
 

Author SHA1 Message Date
anna f5db4e4a25
mm/slab: add object caches
This was the last major obstacle in being able to
manage virtual memory maps.  Object caches are
custom allocators that allow for more fine-grained
allocation policies, including being able to use
memory from the DMAP region.
2 years ago
anna 3910c85cac
x86/mm: fix __boot_clear_page 2 years ago
anna 30df044cec
mm/page: yet another overhaul
This is primarily for the slab allocator update
that's about to come, but to be completely tbh
not even i myself am sure what i should include
here because i made a longer break and there are
like 40 modified files that are all interlinked.
2 years ago
anna b4ed811920
mm: refactor page allocator
This is hopefully the last time in a while that
something in the mm subsystem needs a refactor
this large.  There are two main changes:
- The page frame allocator returns a vm_page_t
  rather than a virtual address.
- Data for the slab allocator is now stored in
  struct vm_page, which means there is no overhead
  in the slab itself so the space is used in a
  more efficient manner.
2 years ago
anna f8a85a1541
happy new year 2022 uwu
May it be slightly less exhausting than 2021.
2 years ago
anna b2c6b5e193
mm/page: remove the stupid (again) 2 years ago
anna 56767c59ed
x86/ktrace: improve traceability 2 years ago
anna 79033fbc8b
x86/mm: disable page caching in direct map 2 years ago
anna bd23d2cbc8
lib/x86: add fast memset family of functions 2 years ago
anna baf03e97a4
cmake: add cflags utility macros 2 years ago
anna 205326bccd
x86: add GDT generator tool 2 years ago
anna 21798e1396
mm/page: remove the stupid 2 years ago
anna c6c92ac39f
x86/trap: fix trap frame layout 2 years ago
anna 2e32e299d2
mm: rewrite slab allocator
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.
2 years ago
anna 36d53093d4
ktrace: don't unwind past ISR entry points 2 years ago
anna 7f92690f84
panic: print stack trace when panicking 2 years ago
anna 385af1b7ef
mm: refactor page frame allocator
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.
2 years ago
anna 825a981d67
clist: make debugging better 2 years ago
anna c620f2ae34
x86: make -march configurable 2 years ago
anna d19e665d47
mm: generalize boot allocator
The boot page frame allocator is now architecture
independent.
This is part 2 of the mm subsystem refactor.
2 years ago
anna 7285c2e076
mm: refactor entire mm subsystem, part 1
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.
2 years ago
anna 2ace3d3505
port inttypes.h from FreeBSD 2 years ago
anna 5a5135f416
update license terms
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.
2 years ago
anna 52ac282ac8
x86: move common setup checks to shared file
This should also kind of fix the build.
I don't know whether that's actually the case
because i haven't tried tho lmao.
2 years ago
anna 24ae60225f
amd64: add base 64-bit support files
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)
2 years ago
anna eba1c83c2f
x86: add inline CPUID instruction 2 years ago
anna 637ac5ce92
x86/page: add page flagging functions 2 years ago
anna ec889c08b9
types: add BSD style typedefs for unsigned types 2 years ago
anna fb8bef86d5
kprintf: explicitly disable wchar support
This might get implemented later, even though
there is no real reason why we would need wchar
support in the kernel as it is UTF-8 native
2 years ago
anna 14630c86bf
x86: remove unnecessary standalone port functions 2 years ago
anna a3941b6dc4
mm: minor page management refactor
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.
2 years ago
anna 03f31df67f
x86: better separation for i386 specific code
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.
2 years ago
anna 36985f51e2
add kqueue API
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.
3 years ago
anna 5877697e64
page: use new ptr align macros 3 years ago
anna ebce7b8e83
mutex: fix lock race conditions 3 years ago
anna b6385aea0a
panic: move to separate file, add KASSERT macro 3 years ago
anna 24c6e9504d
add kernel panic utility
This also includes some minor rearrangements in
terms of which header files define what.
3 years ago
anna abd9bb5d43
amd64/atom: fix typo 3 years ago
anna 38d9a9586d
smp: add base for SMP awareness 3 years ago
anna 6d0950501c
page: ensure early page mapping doesn't fail
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.
3 years ago
anna eb0091403e
mutex: add semaphores 3 years ago
anna c36b03d97c
mutex: avoid wait queue lock if possible
This also tidies up the atomic operations a little
and adds a new atom_cmp_xchg() as well as the same
APIs for longs and pointers.
3 years ago
anna c66b05216d
clist: add better debugging facilities 3 years ago
anna 2b3eaf4ff7
mm: add basic slab allocator
This still needs some work and integration into
kmalloc() but hey i've tested it and it doesn't
immediately fall apart so why not commit it
3 years ago
anna e561adbb6f
bits: remove unnecessary xor 3 years ago
anna 16a229c936
mm: protect cache pools with mutex 3 years ago
anna 743424d15f
mm: fix page frame allocator bugs
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.
3 years ago
anna 96378f019c
kmalloc: add shiny new buddy page frame allocator
This is still kind of a work in progress because
it will be the backend to a slab allocator, which
in turn is managed by kmalloc().
3 years ago
anna f0706b802b
boot: ignore unaddressable RAM areas on i386
We don't support PAE or any other fancy hack to
get past the 4 GB limit on 32-bit, so we have to
clip areas that would fall outside that range
3 years ago
anna f59229ba39
types: fix typo in u64 typedef
This would have been a fun one to debug if i
hadn't caught it right now
3 years ago