Commit Graph

23654 Commits

Author SHA1 Message Date
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
x-yl
642aa65310 Meta: Only try to use SDL when there are multiple displays
SDL brings with it an annoying issue whereby trying to resize the window
before Serenity starts up prevents it from automatically resizing to fit
the screen.

This patch makes the previous behavior (i.e using the GTK backend) the
default unless SERENITY_SCREENS is greater than 1.
2021-07-11 21:16:56 +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
Karol Kosek
9d36369c58 SoundPlayer: Show the context menu right under the cursor
The context menu used the mouse position by window,
which resulted in a pop-up menu in the upper left corner of the screen.
2021-07-11 21:15:56 +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
2ca1193d9a Userland+Tests: Convert test_io to be LibTest based
Add a few extra tests as well, to make sure we don't have any future
TmpFs regressions.
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
4cc75501d7 Utilities+Tests: Convert test_efault to be LibTest based
This test exposed a kernel panic in is_user_range calculations, so let's
convert it to be a LibTest test so we can prevent regressions in mmap,
the page allocator, and the memory manager.
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
373b8d7cfa AK: Add FixedArray::span() 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
88c8451973 AK: Bring back FixedArray<T>
Let's bring this class back, but without the confusing resize() API.
A FixedArray<T> is simply a fixed-size array of T.

The size is provided at run-time, unlike Array<T> where the size is
provided at compile-time.
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
Hendiadyoin1
a8d86cc533 DynamicLoader+LibC: Make _start a naked function 2021-07-11 17:07:20 +02:00
Andreas Kling
112c7f9a5b Kernel: Remove unused MemoryManager::m_physical_page_entries_free 2021-07-11 15:15:57 +02:00
Andreas Kling
5087b2b32f AK: Don't forget to kfree_sized() in ByteBuffer 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
966880eb45 AK: Don't use realloc() in AK::ByteBuffer
This class is the only reason we have to support krealloc() in the
kernel heap, something which adds a lot of complexity.

Let's move towards a simpler path and do malloc+memset in the
ByteBuffer code (where we know the sizes anyway.)
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
c1e902acd9 AK: Use kfree_sized() in AK::Vector 2021-07-11 14:14:51 +02:00
Andreas Kling
c68c3fa69c AK: Use kfree_sized() in AK::StringImpl 2021-07-11 14:14:51 +02:00
Andreas Kling
3aabace9f5 AK: Use kfree_sized() in AK::HashTable 2021-07-11 14:14:51 +02:00