Andreas Kling
2dfdaafb23
Kernel: Use "new (nothrow)" for SharedInodeVMObject
2021-07-11 21:56:26 +02:00
Brian Gianforcaro
425195e93f
Kernel: Standardize the header include style to 'include <Kernel/...>'
...
This is the overwhelming standard in the project, but there were some
cases in the kernel which were not following it, lets fix those cases!
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
6f408e7f0d
Kernel: Remove unused header includes in root kernel tree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
28cf9ffe90
Kernel: Remove unused header includes in Bus subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
187a8f6896
Kernel: Remove unused header includes in ACPI subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
661809408e
Kernel: Remove unused header includes in Heap subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
abe72ede7a
Kernel: Remove unused header includes in Graphics subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
9814082b5e
Kernel: Remove unused header includes in Interrupts subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
8211aee4b5
Kernel: Remove unused header includes in TTY subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
e18be7f5c7
Kernel: Remove unused header includes in Storage subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
da665077ce
Kernel: Remove unused header includes in Arch subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
1c43836990
Kernel: Remove unused header includes in FileSystem subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
5743561d32
Kernel: Remove unused header includes in Net subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
ea238e7ac3
Kernel: Remove unused header includes in Devices subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
b1740e410b
Kernel: Remove unused header includes in Time subtree
2021-07-11 21:37:38 +02:00
Brian Gianforcaro
9044e21ed4
Kernel: Remove unused header includes in VM subtree
2021-07-11 21:37:38 +02:00
Liav A
a8c35b6a93
Kernel: Fix condition on whether to initialize a display adapter or not
2021-07-11 21:16:33 +02:00
Liav A
b882e5ff6b
Kernel/Graphics: Move Intel graphics related code to a separate folder
2021-07-11 21:16:33 +02:00
Andrew Kaster
da0095855e
Kernel: Print end-inclusive ranges in MemoryManager initialization
...
This brings the physical and virtual addresses printed to dmesg more in
line with inclusive ranges printed elsewhere in the project.
2021-07-11 19:42:00 +02:00
Andrew Kaster
3f0dcd63dc
Kernel: Fix TmpFS resize behavior around INT32_MAX for 32-bit systems
...
We need some overflow checks due to the implementation of TmpFS.
When size_t is 32 bits and off_t is 64 bits, we might overflow our
KBuffer max size and confuse the KBuffer set_size code, causing a VERIFY
failure. Make sure that resulting offset + size will fit in a size_t.
Another constraint, we make sure that the resulting offset + size will
be less than half of the maximum value of a size_t, because we double
the KBuffer size each time we resize it.
2021-07-11 19:42:00 +02:00
Andrew Kaster
578d45b480
Kernel: Create and use USER_RANGE_CEILING
...
We had an inconsistency in valid user addresses. is_user_range() was
checking against the kernel base address, but previous changes caused
the maximum valid user addressable range to be 32 MiB below that.
This patch stops mmap(MAP_FIXED) of a range between these two bounds
from panic-ing the kernel in RangeAllocator::allocate_specific.
2021-07-11 19:42:00 +02:00
Andrew Kaster
ab196b484a
Kernel: Add formatter for Kernel::Range
...
This is very useful when debugging memory allocation in the kernel
2021-07-11 19:42:00 +02:00
Andreas Kling
f244a25f71
Kernel: Rename VMObject::clone() => try_clone()
...
And fix an unsafe dereference in SharedInodeVMObject::try_clone()
to make it OOM-safe.
2021-07-11 19:09:02 +02:00
Andreas Kling
d85bce57b3
Kernel: Rename Region::create_kernel_only() => try_create_kernel_only()
2021-07-11 18:59:41 +02:00
Andreas Kling
cd7a49b90d
Kernel: Make Region splitting OOM-safe
...
Region allocation failures during splitting are now propagated all the
way out to where we can return ENOMEM for them.
2021-07-11 18:52:27 +02:00
Andreas Kling
cac557eee0
Kernel: Make Region::try_create_user_accessible() OOM-safe
...
Previously we would simply assume that Region allocation always
succeeded. There is still one such assumption when splitting user
regions inside a Space. That will be dealt with in a separate commit.
2021-07-11 18:11:31 +02:00
Andreas Kling
241bbce264
Kernel: LoopbackAdapter::create() => try_create()
...
Allow this to fail (although we VERIFY that it succeeds during boot
for now, since we don't want to boot without a loopback adapter.)
2021-07-11 18:00:31 +02:00
Andreas Kling
e4dfb0fdf3
Kernel: Make NetworkAdapter::class_name() return a StringView
2021-07-11 17:59:38 +02:00
Andreas Kling
68f2250768
Kernel: Make VMObject::class_name() return a StringView
2021-07-11 17:57:52 +02:00
Andreas Kling
88d490566f
Kernel: Rename various *VMObject::create*() => try_create()
...
try_*() implies that it can fail (and they all return RefPtr with
nullptr signalling failure.)
2021-07-11 17:55:29 +02:00
Andreas Kling
af8c74a328
Kernel: Make SharedInodeVMObject allocation OOM-safe
2021-07-11 17:52:07 +02:00
Andreas Kling
59049ae4b7
Kernel: Store VMObject physical pages in a FixedArray
...
Let's enforce the invariant that VMObjects don't shrink or grow by
storing the pages in a FixedArray.
2021-07-11 17:42:31 +02:00
Andreas Kling
7d096a1287
Kernel: Make VMObject vend physical page range as a span
...
Stop exposing the internal data structure used for storing the physical
pages and return a Span<RefPtr<PhysicalPage>> instead.
2021-07-11 17:42:31 +02:00
Andreas Kling
846685fca2
Kernel: Remove bogus VMObject resizing in VirtIOGPU
...
It is not legal to resize a VMObject after it has been created.
As far as I can tell, this code would never actually run since the
object was already populated with physical pages due to using
AllocationStrategy::AllocateNow.
2021-07-11 17:42:31 +02:00
Andreas Kling
055726ecf5
Kernel: Remove unused MemoryManager::find_region_from_vaddr()
2021-07-11 17:42:31 +02:00
Andreas Kling
112c7f9a5b
Kernel: Remove unused MemoryManager::m_physical_page_entries_free
2021-07-11 15:15:57 +02:00
Andreas Kling
0afccb560b
Kernel: Remove some duplicate forward declarations
2021-07-11 15:15:57 +02:00
Andreas Kling
b2cd9b2c88
Kernel: Remove pointless ref-counting from PhysicalRegion
...
These are not multiple-owner objects and have no use for ref-counting.
Make them simple value types instead (not eternal heap-allocated.)
2021-07-11 15:15:57 +02:00
Max Wipfli
29d53cbee2
Kernel: Return correct error numbers for the mkdir syscall
...
Previously, VirtualFileSystem::mkdir() would always return ENOENT if
no parent custody was returned by resolve_path(). This is incorrect when
e.g. the user has no search permission in a component of the path
prefix (=> EACCES), or if on component of the path prefix is a file (=>
ENOTDIR). This patch fixes that behavior.
2021-07-11 14:59:57 +02:00
Andreas Kling
25e850ebb1
Kernel: Remove krealloc()
...
This was only used by a single class (AK::ByteBuffer) in the kernel
and not in an OOM-safe way.
Now that ByteBuffer no longer uses it, there's no need for the kernel
heap to burden itself with supporting this.
2021-07-11 14:14:51 +02:00
Andreas Kling
0718bd264c
Kernel: Remove some no-longer-needed C library functions
...
Now that we no longer demangle symbols in the kernel, we don't need to
provide stuff like malloc(), memchr(), free(), etc to the demangler.
2021-07-11 14:14:51 +02:00
Andreas Kling
f684742f15
Kernel: VERIFY_NOT_REACHED in un-sized operator delete
...
All deletes in kernel code should now be of known size. :^)
2021-07-11 14:14:51 +02:00
Andreas Kling
43d7a7f274
Kernel: Use kfree_sized() in KString
2021-07-11 14:14:51 +02:00
Andreas Kling
d38b4e4665
Kernel: Add kfree_sized(), kfree() with a known allocation size
...
C++14 gave us sized operator delete, but we haven't been taking
advantage of it. Let's get to a point where it can help us by
adding kfree_sized(void*, size_t).
2021-07-11 14:14:51 +02:00
Andreas Kling
98080497d2
Kernel: Use Forward.h headers more
2021-07-11 14:14:51 +02:00
Max Wipfli
9ab528ff5c
Kernel: Make KLexicalPath::basename() more compliant
...
This removes some assertions from KLexicalPath::basename() by supporting
paths with trailing slashes, empty paths, paths consisting of only
slashes and paths with ending "." and ".." segments.
2021-07-11 14:10:58 +02:00
Andreas Kling
c9f6786e8b
Kernel: Make various T::class_name() and similar return StringView
...
Instead of returning char const*, we can also give you a StringView.
2021-07-11 01:46:59 +02:00
Andreas Kling
fa9111ac46
Kernel: Rename ProcFSComponentsRegistrar => ProcFSComponentRegistry
...
This matches the formatting used in SysFS.
2021-07-11 01:40:26 +02:00
Andreas Kling
c1143e1bae
Kernel: Remove friend classes from ProcFSComponentsRegistrar
2021-07-11 01:39:51 +02:00
Andreas Kling
358a7cc448
Kernel: Rename SysFS related classes in BIOS code
...
Give them names that sound related to SysFS.
2021-07-11 01:38:01 +02:00