Commit graph

50 commits

Author SHA1 Message Date
fef
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.
2022-04-01 17:09:03 +02:00
fef
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.
2022-04-01 16:56:08 +02:00
fef
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.
2022-01-02 05:44:46 +01:00
fef
f8a85a1541
happy new year 2022 uwu
May it be slightly less exhausting than 2021.
2022-01-01 03:49:33 +01:00
fef
b2c6b5e193
mm/page: remove the stupid (again) 2021-12-31 02:20:06 +01:00
fef
21798e1396
mm/page: remove the stupid 2021-11-22 20:05:49 +01:00
fef
c6c92ac39f
x86/trap: fix trap frame layout 2021-11-22 20:01:26 +01:00
fef
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.
2021-11-22 04:23:31 +01:00
fef
7f92690f84
panic: print stack trace when panicking 2021-11-21 06:57:24 +01:00
fef
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.
2021-11-20 22:49:05 +01:00
fef
825a981d67
clist: make debugging better 2021-11-20 22:12:04 +01:00
fef
d19e665d47
mm: generalize boot allocator
The boot page frame allocator is now architecture
independent.
This is part 2 of the mm subsystem refactor.
2021-11-18 02:25:41 +01:00
fef
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.
2021-11-15 19:23:22 +01:00
fef
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
2021-11-09 22:16:35 +01:00
fef
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.
2021-11-09 20:34:35 +01:00
fef
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.
2021-11-04 06:06:31 +01:00
fef
5877697e64
page: use new ptr align macros 2021-11-04 06:01:03 +01:00
fef
ebce7b8e83
mutex: fix lock race conditions 2021-11-04 05:56:40 +01:00
fef
b6385aea0a
panic: move to separate file, add KASSERT macro 2021-11-01 23:54:55 +01:00
fef
24c6e9504d
add kernel panic utility
This also includes some minor rearrangements in
terms of which header files define what.
2021-10-31 02:00:10 +02:00
fef
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.
2021-10-29 00:23:30 +02:00
fef
eb0091403e
mutex: add semaphores 2021-10-28 17:08:46 +02:00
fef
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.
2021-10-28 17:01:13 +02:00
fef
c66b05216d
clist: add better debugging facilities 2021-10-24 21:55:54 +02:00
fef
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
2021-10-24 05:36:46 +02:00
fef
e561adbb6f
bits: remove unnecessary xor 2021-10-23 22:16:51 +02:00
fef
16a229c936
mm: protect cache pools with mutex 2021-10-23 02:50:04 +02:00
fef
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.
2021-10-23 00:56:49 +02:00
fef
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().
2021-10-22 06:22:38 +02:00
fef
c911ff9009
x86/mm: add huge page support
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.
2021-10-17 01:09:51 +02:00
fef
7af90dc798
clist: you got to be fucking kidding me
This was my actual intention behind the previous
commit.  I should really go to bed.
2021-10-16 04:30:37 +02:00
fef
9ba75c564a
clist: remove the stupid there, too 2021-10-16 04:26:00 +02:00
fef
721ba69276
mtx: remove the stupid 2021-10-16 04:23:05 +02:00
fef
ad422894f2
mtx: add basic synchronization primitives 2021-10-16 04:00:22 +02:00
fef
b2fccf1ecd
sched: add base for scheduling and task switching 2021-10-15 00:01:47 +02:00
fef
904584ccc0
libc: refactor a couple of string routines
This is just a minor overhaul of several utility
functions, in part because it kept bothering me
and in part because i was bored.
2021-10-12 23:24:17 +02:00
fef
4679b7cee5
x86: add irq support 2021-10-07 19:16:21 +02:00
fef
16b6924beb
kmalloc: fix comments affected by auto rename
Just VS Code things
2021-10-04 05:56:11 +02:00
fef
3e43ec5491
kprintf: minor refactor, fix stupid offset bugs 2021-10-03 18:59:06 +02:00
fef
d475429639
kprintf: implement "full" format sequence support
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).
2021-10-03 04:31:28 +02:00
fef
347bb5cc9c
kmalloc: bugfixes and performance improvements 2021-09-30 00:32:07 +02:00
fef
5c0fa715a4
kmalloc: add actual memory allocator
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.
2021-09-29 01:10:41 +02:00
fef
7c4819e5fd
clist: corrupt removed entry pointers if DEBUG 2021-09-28 01:25:19 +02:00
fef
8129518640
mm: replace GRUB's GDT with our own 2021-09-28 00:48:19 +02:00
fef
d436d9b203
mm: add page frame allocator 2021-09-21 18:25:54 +02:00
fef
2a0ed8121a
util: refactor misc utility stuff 2021-09-21 17:34:27 +02:00
fef
8fb2f7987c
kprintf: fix vararg bug
Turns out you can't pass a va_list to subroutines
as per the C standard, even though it worked
perfectly fine on ARM.  Well then, the entire
kprintf thing needs to be refactored anyway at
some point in the future, so that more formatting
options are supported.
2021-09-20 18:02:13 +02:00
fef
89e7a4eb47
clist: add circular list api 2021-09-20 02:03:01 +02:00
fef
6ac206051a
kernel: add main 2021-09-19 04:58:48 +02:00
fef
2af5fad52f
kernel: add kprintf() api 2021-09-19 04:50:24 +02:00