Commit graph

7607 commits

Author SHA1 Message Date
Timon Kruiper fcbb6b79ac Kernel: Don't expose processor information for aarch64 in sysfs
We do not (yet) acquire this information for the aarch64 processors.
2022-10-26 20:01:45 +02:00
Timon Kruiper 32f4c8df6c Kernel: Stub more functions to progress aarch64 build 2022-10-26 20:01:45 +02:00
Timon Kruiper f9ab02429b Kernel: Use generic functions to change interrupt state of Processor
This allows these files to be built for aarch64.
2022-10-26 20:01:45 +02:00
Timon Kruiper acfeffc9ca Kernel/aarch64: Branch to local halt function instead of C++ one
The kernel image grew so much that it wasn't possible to jump to the C++
symbol anymore, since this generated a 'relocation truncated' error when
linking.
2022-10-26 20:01:45 +02:00
Timon Kruiper a47271ebdc Kernel: Move PAGE_MASK define to the shared CPU.h header
These are the same for both x86 and aarch64 for now. Also update some
include paths to use the generic CPU.h header.
2022-10-26 20:01:45 +02:00
Liav A 75f01692b4 Kernel+Userland: Move /sys/firmware/power_state to /sys/kernel directory
Let's put the power_state global node into the /sys/kernel directory,
because that directory represents all global nodes and variables being
related to the Kernel. It's also a mutable node, that is more acceptable
being in the mentioned directory due to the fact that all other files in
the /sys/firmware directory are just firmware blobs and are not mutable
at all.
2022-10-25 15:33:34 -06:00
Liav A dc5b28e26c Kernel/ProcFS: Remove all unnecessary components
Now that all global nodes are located in the /sys/kernel directory, we
can safely drop the global nodes in /proc, which includes both /proc/net
and /proc/sys directories as well.
This in fact leaves the ProcFS to only have subdirectories for processes
and the "self" symbolic link to reflect the current process being run.
2022-10-25 15:33:34 -06:00
Liav A a91589c09b Kernel: Introduce global variables and stats in /sys/kernel directory
The ProcFS is an utter mess currently, so let's start move things that
are not related to processes-info. To ensure it's done in a sane manner,
we start by duplicating all /proc/ global nodes to the /sys/kernel/
directory, then we will move Userland to use the new directory so the
old directory nodes can be removed from the /proc directory.
2022-10-25 15:33:34 -06:00
Liav A 03ae9f94cf Kernel/FileSystem: Remove hardcoded unveil path of /usr/lib/Loader.so
If a program needs to execute a dynamic executable program, then it
should unveil /usr/lib/Loader.so by itself and not rely on the Kernel to
allow using this binary without any sense of respect to unveil promises
being made by the running parent program.
2022-10-24 19:41:32 -06:00
demostanis 3e8b5ac920 AK+Everywhere: Turn bool keep_empty to an enum in split* functions 2022-10-24 23:29:18 +01:00
Gunnar Beutner de6048b7d3 Kernel: Add definitions for SO_SNDLOWAT and SO_RCVLOWAT 2022-10-24 15:49:39 +02:00
Gunnar Beutner 01ffed710c Kernel: Add definition for MSB_EOR
None of the protocols we support at the moment use this, but it makes
boost happy.
2022-10-24 15:49:39 +02:00
Gunnar Beutner ce4b66e908 Kernel: Add support for MSG_NOSIGNAL and properly send SIGPIPE
Previously we didn't send the SIGPIPE signal to processes when
sendto()/sendmsg()/etc. returned EPIPE. And now we do.

This also adds support for MSG_NOSIGNAL to suppress the signal.
2022-10-24 15:49:39 +02:00
Liav A e3de568a45 Kernel/Graphics: Handle correctly unknown ioctls on a DisplayConnector
In such case, we should not assert but instead just return EINVAL.
2022-10-23 14:59:57 +02:00
Liav A fea3cb5ff9 Kernel/FileSystem: Discard safely filesystems when unmounted last time
This commit reached that goal of "safely discarding" a filesystem by
doing the following:
1. Stop using the s_file_system_map HashMap as it was an unsafe measure
to access pointers of FileSystems. Instead, make sure to register all
FileSystems at the VFS layer, with an IntrusiveList, to avoid problems
related to OOM conditions.
2. Make sure to cleanly remove the DiskCache object from a BlockBased
filesystem, so the destructor of such object will not need to do that in
the destruction point.
3. For ext2 filesystems, don't cache the root inode at m_inode_cache
HashMap. The reason for this is that when unmounting an ext2 filesystem,
we lookup at the cache to see if there's a reference to a cached inode
and if that's the case, we fail with EBUSY. If we keep the m_root_inode
also being referenced at the m_inode_cache map, we have 2 references to
that object, which will lead to fail with EBUSY. Also, it's much simpler
to always ask for a root inode and get it immediately from m_root_inode,
instead of looking up the cache for that inode.
2022-10-22 16:57:52 -04:00
Liav A 24977996a6 Kernel: Append root filesystem to the VFS FileBackedFileSystem list 2022-10-22 16:57:52 -04:00
Liav A 0fd7b688af Kernel: Introduce support for using FileSystem object in multiple mounts
The idea is to enable mounting FileSystem objects across multiple mounts
in contrast to what happened until now - each mount has its own unique
FileSystem object being attached to it.

Considering a situation of mounting a block device at 2 different mount
points at in system, there were a couple of critical flaws due to how
the previous "design" worked:
1. BlockBasedFileSystem(s) that pointed to the same actual device had a
separate DiskCache object being attached to them. Because both instances
were not synchronized by any means, corruption of the filesystem is most
likely achieveable by a simple cache flush of either of the instances.
2. For superblock-oriented filesystems (such as the ext2 filesystem),
lack of synchronization between both instances can lead to severe
corruption in the superblock, which could render the entire filesystem
unusable.
3. Flags of a specific filesystem implementation (for example, with xfs
on Linux, one can instruct to mount it with the discard option) must be
honored across multiple mounts, to ensure expected behavior against a
particular filesystem.

This patch put the foundations to start fix the issues mentioned above.
However, there are still major issues to solve, so this is only a start.
2022-10-22 16:57:52 -04:00
Liav A 965afba320 Kernel/FileSystem: Add a few missing includes
In preparation to future commits, we need to ensure that
OpenFileDescription.h doesn't include the VirtualFileSystem.h file to
avoid include loops.
2022-10-22 16:57:52 -04:00
Jesse Buhagiar 2c16532159 Kernel+USB: Move descriptor bookkeeping into seperate structure(s)
We now have a seperately allocated structure for the bookkeeping
information in the QueueHead and TransferDescriptor UHCI strucutres.
This way, we can support 64-bit pointers in UHCI, fixing a problem where
32-bit pointers would truncate the upper 32-bits of the (virtual)
address of the descriptor, causing a crash.

Co-authored-by: b14ckcat <b14ckcat@protonmail.com>
2022-10-22 15:54:55 -04:00
Liav A 07387ec19a Kernel+Base: Introduce MS_NOREGULAR mount flag
This flag doesn't conform to any POSIX standard nor is found in any OS
out there. The idea behind this mount flag is to ensure that only
non-regular files will be placed in a filesystem, which includes device
nodes, symbolic links, directories, FIFOs and sockets. Currently, the
only valid case for using this mount flag is for TmpFS instances, where
we want to mount a TmpFS but disallow any kind of regular file and only
allow other types of files on the filesystem.
2022-10-22 19:18:15 +02:00
Liav A 97f8927da6 Kernel: Remove the DevTmpFS class
Although this code worked quite well, it is considered to be a code
duplication with the TmpFS code which is more tested and works quite
well for a variety of cases. The only valid reason to keep this
filesystem was that it enforces that no regular files will be created at
all in the filesystem. Later on, we will re-introduce this feature in a
sane manner. Therefore, this can be safely removed after SystemServer no
longer uses this filesystem type anymore.
2022-10-22 19:18:15 +02:00
Liav A c2b5c5bac5 Kernel: Add support for device nodes in TmpFS
Later on we will remove the DevTmpFS code, so in order to support
mounting TmpFS instead, we need to be able to create device nodes on
the filesystem.
2022-10-22 19:18:15 +02:00
Timon Kruiper cede752cd1 Kernel/aarch64: Stub enough functions to build Random.cpp
Also update Random.cpp such that it builds for aarch64.
2022-10-20 23:26:32 +02:00
Timon Kruiper a998bba73b Kernel/aarch64: Store a pointer to the current Thread on Processor
And also implemented and update the related functions.
2022-10-20 23:26:32 +02:00
Timon Kruiper 8fe3c50b30 Kernel/aarch64: Force kmalloc to return 16 byte aligned pointers
KUBSAN complained about a misaligned address when trying to construct
the Thread class.
2022-10-20 23:26:32 +02:00
Timon Kruiper 179cb7b2d0 Kernel/aarch64: Stub enough functions to build Process.cpp
ProcessProcFSTraits.cpp is also added the CMakeLists.
2022-10-20 23:26:32 +02:00
Timon Kruiper 84158a18d5 Kernel/aarch64: Stub WaitQueueBlocker::unblock to build WaitQueue.cpp 2022-10-20 23:26:32 +02:00
Timon Kruiper b69a3ad51a Kernel/aarch64: Stub more functions to build Thread.cpp 2022-10-20 23:26:32 +02:00
Liav A e81cf66784 Kernel: Don't assume paths to children PID directories in ProcFS code
Instead of using absolute paths which is considered an abstraction layer
violation between the kernel and userspace, let's not hardcode the path
to children PID directories but instead we can use relative path links
to them.
2022-10-19 16:44:16 -04:00
Timon Kruiper 1a84cb5457 Kernel/aarch64: Stub more functions to be able to build Scheduler.cpp
With all these functions stubbed, Scheduler.cpp is now buidable!
2022-10-18 13:08:25 +02:00
Timon Kruiper 352f980ca2 Kernel: Call Processor::are_interrupts_enabled in Scheduler::idle_loop
This expresses the intent better, and we shouldn't be calling global
functions anyway.
2022-10-18 13:08:25 +02:00
Jesse Buhagiar c962cfdc28 Kernel: Reintroduce ScopedAddressSpaceSwitcher to aarch64 build 2022-10-18 13:08:25 +02:00
Jesse Buhagiar 2db73f2171 Kernel: Reintroduce Mutex.cpp to aarch64 build
A few more stubs have been added to support the building of this file
2022-10-18 13:08:25 +02:00
Jesse Buhagiar 07649bcb02 Kernel: Reintroduce Credentials.cpp to aarch64 build 2022-10-18 13:08:25 +02:00
Jesse Buhagiar fd5671b5d5 Kernel: Add more stubs for the Thread class
Slowly getting there...
2022-10-18 13:08:25 +02:00
Jesse Buhagiar e61d22b5b6 Kernel: Prevent atomic read/write from failing on nullptr
Having this function return `nullptr` explicitly triggers the compiler's
inbuilt checker, as it knows the destination is null. Having this as a
static (scoped) variable for now circumvents this problem.
2022-10-18 13:08:25 +02:00
Jesse Buhagiar 6582e34bbb Kernel: Include KBufferBuilder.cpp in aarch64 build 2022-10-18 13:08:25 +02:00
Gunnar Beutner 056e406a12 Kernel: Add even more AARCH64 stubs 2022-10-18 13:08:25 +02:00
Gunnar Beutner 63a91d6971 Kernel: Add more AARCH64 stubs 2022-10-18 13:08:25 +02:00
b14ckcat bf3c99ef23 Kernel/USB: Refactor USB Pipe
Decompose the current monolithic USBD Pipe interface into several
subclasses, one for each pair of endpoint type & direction. This is to
make it more clear what data and functionality belongs to which Pipe
type, and prevent nonsensical things like trying to execute a control
transfer on a non-control pipe. This is important, because the Pipe
class is the interface by which USB device drivers will interact with
the HCD, so the clearer and more explicit this interface is the better.
2022-10-18 12:58:12 +02:00
b14ckcat 1304575190 Kernel/USB: Adjust USB Pipe buffer
Allocate DMA buffer pages for use within the USBD Pipe class, and allow
for the user to specify the size of this buffer, rounding up to the
next page boundary.
2022-10-18 12:58:12 +02:00
Timon Kruiper c7aa05cdcc Kernel/aarch64: Initialize TimeManagement in init.cpp
Also remove the check for aarch64 in AK/Format.cpp, so now the format
functions will prepend the time since boot!
2022-10-17 20:11:31 +02:00
Timon Kruiper 01a14ac7af Kernel: Implement TimeManagement for aarch64
This sets up the RPi::Timer to trigger an interurpt every 4ms using one
of the comparators. The actual time is calculated by looking at the main
counter of the RPi::Timer using the Timer::update_time function.

A stub for Scheduler::timer_tick is also added, since the TimeManagement
code now calls the function.
2022-10-17 20:11:31 +02:00
Timon Kruiper 83b95c135e Kernel/aarch64: Implement HardwareTimer for RPi::Timer
This makes the RPi::Timer suitable for use in the TimeManagement code.
2022-10-17 20:11:31 +02:00
Timon Kruiper de0bb99893 Kernel: Correctly calculate delta_ticks when 64-bit counter wraps around
We never caught this bug in the HPET, since it takes ages for a 64-bit
counter to wrap around. Also remove an unnecessary if check.
2022-10-17 20:11:31 +02:00
Timon Kruiper 6680241773 Kernel/aarch64: Add implementation for Processor::current_in_irq 2022-10-17 20:11:31 +02:00
Timon Kruiper 1348757dda Kernel/aarch64: Add implementation of Processor::is_bootstrap_processor
This should really go into a generic Processor class, but there is no
such class yet, so a FIXME is added for that.
2022-10-17 20:11:31 +02:00
Timon Kruiper 9827c11d8b Kernel: Move InterruptDisabler out of Arch directory
The code in this file is not architecture specific, so it can be moved
to the base Kernel directory.
2022-10-17 20:11:31 +02:00
Andrew Kaster 3f13959c68 Kernel: Mark Version.h as a dependency of Kernel rather than ALL 2022-10-17 15:55:55 +02:00
Liav A b9dca3300e Kernel: Use more fine-grained content data block granularity in TmpFS
Instead of just having a giant KBuffer that is not resizeable easily, we
use multiple AnonymousVMObjects in one Vector to store them.
The idea is to not have to do giant memcpy or memset each time we need
to allocate or de-allocate memory for TmpFS inodes, but instead, we can
allocate only the desired block range when trying to write to it.
Therefore, it is also possible to have data holes in the inode content
in case of skipping an entire set of one data block or more when writing
to the inode content, thus, making memory usage much more efficient.

To ensure we don't run out of virtual memory range, don't allocate a
Region in advance to each TmpFSInode, but instead try to allocate a
Region on IO operation, and then use that Region to map the VMObjects
in IO loop.
2022-10-16 17:46:40 +02:00
Gunnar Beutner 69efded562 Kernel: Add more stubs needed for Thread.cpp 2022-10-16 17:35:37 +02:00
Gunnar Beutner 1e3edb3b76 Kernel: Don't directly include <Kernel/Arch/x86/TrapFrame.h>
This adds a new arch-independent header which in turn includes the
correct header for the build architecture.
2022-10-16 17:35:37 +02:00
Gunnar Beutner 918fdf9e2c Kernel: Add VALIDATE_IS_AARCH64 guard macro 2022-10-16 17:35:37 +02:00
Gunnar Beutner dfee6f73d2 Kernel: Replace VERIFY_NOT_REACHED with TODO_AARCH64
This makes it easier to differentiate between cases where certain
functionality is not implemented vs. cases where a code location
should really be unreachable.
2022-10-16 17:35:37 +02:00
Liav A 462802ef0c Kernel/SysFS: Expose file size of ACPI tables in /sys/firmware/acpi
It costs us nothing, and some utilities (such as the known file utility)
rely on the exposed file size (after doing lstat on it), to show
anything useful besides saying the file is "empty".
2022-10-16 17:26:35 +02:00
Liav A 11a5f2c508 Kernel: Initialize primitive class member of ACPISysFSComponent to zero 2022-10-16 17:26:35 +02:00
Brian Gianforcaro 2079728a74 Kernel: Add formal Processor::verify_no_spinlocks_held() API
In a few places we check `!Processor::in_critical()` to validate
that the current processor doesn't hold any kernel spinlocks.

Instead lets provide it a first class name for readability.
I'll also be adding more of these, so I would rather add more
usages of a nice API instead of this implicit/assumed logic.
2022-10-16 02:29:14 -06:00
Liav A 40f35558b5 Kernel: Remove unused /proc/devices node
This node is not used anymore, so let's remove it.
2022-10-16 02:24:43 -06:00
Gunnar Beutner afa9060012 Kernel: Fix build error on AARCH64
This currently fails with:

error: #pragma once in main file [-Werror]
2022-10-15 06:01:45 +00:00
Undefine 135ca3fa1b Kernel: Add support for the FAT32 filesystem
This commit adds read-only support for the FAT32 filesystem. It also
includes support for long file names.
2022-10-14 18:36:40 -06:00
Liav A 7520acd4eb Kernel: Move Scheduler current time method to the TimeManagement code 2022-10-14 14:13:51 +02:00
Liav A 3651d9701e Kernel: Abstract platform-specific current time methods from Scheduler
This change ensures that the scheduler doesn't depend on a platform
specific or arch-specific code when it initializes itself, but rather we
ensure that in compile-time we will generate the appropriate code to
find the correct arch-specific current time methods.
2022-10-14 14:13:51 +02:00
kleines Filmröllchen 4c7eef874d Kernel: Read version and git commit hash from baked-in version info
... instead of hard-coding it in the uname syscall.
2022-10-14 13:45:33 +02:00
kleines Filmröllchen 7e11b9a276 Kernel: Move sys$uname to use TypedTransfer
This should equate to roughly the same code but improve typechecking.
2022-10-14 13:45:33 +02:00
kleines Filmröllchen 7c05eed487 Kernel: Bake version information into the Kernel
This is done by generating a Kernel/Version.h header with major version,
minor version, and git hash.
2022-10-14 13:45:33 +02:00
Gunnar Beutner 70f4d943be Kernel+LibC: Add registers for AARCH64 in __mcontext 2022-10-14 13:01:13 +02:00
Gunnar Beutner b7555419f1 Kernel: Remove -nodefaultlibs compiler options
This was necessary until a few months ago because of b0rked toolchain
options.
2022-10-14 13:01:13 +02:00
Gunnar Beutner 5921df75b6 Kernel: Implement userspace support for syscalls on AARCH64
There are no guarantees that the final syscall API will look like this
but at least for now this lets us compile the userland binaries.
2022-10-14 13:01:13 +02:00
Timon Kruiper 50e74de279 Kernel: Add StdLib.cpp and UserOrKernelBuffer.cpp to aarch64 build
Also remove UserOrKernelBuffer::{read, write} and __stack_chk_fail from
Dummy.cpp and init.cpp respectively.
2022-10-13 11:26:46 +02:00
Markus Pfeifenberger 0cfcac7900 Kernel: Only use the TSC when it is invariant 2022-10-12 00:32:23 -06:00
minus cf48200e7b Kernel: Make the ACPI DSDT table accessible
Expose the DSDT table in ACPI::Parser and in
/sys/firmware/acpi as a first little step toward
interpreting the AML bytecode from ACPI.
2022-10-12 00:11:36 -06:00
Andrew Kaster 828441852f Everywhere: Replace uses of __serenity__ with AK_OS_SERENITY
Now that we have OS macros for essentially every supported OS, let's try
to use them everywhere.
2022-10-10 12:23:12 +02:00
Liav A f07e0180d6 Kernel: Don't truncate physical memory space PDE pointers
For some odd reason we used to return PhysicalPtr for a page_table_base
result, but when setting it we accepted only a 32 bit value, so we
truncated valid 64 bit addresses into 32 bit addresses by doing that.
With this commit being applied, now PageDirectories can be located
beyond the 4 GiB barrier.

This was found by sin-ack, therefore he should be credited with this fix
appropriately with Co-authored-by sign.

Co-authored-by: sin-ack <sin-ack@users.noreply.github.com>
2022-10-09 09:58:08 -06:00
Tim Schumacher d72a3b5959 Kernel: Do not mark .ro_after_init as NOLOAD
There is no particular reason why this section should be marked as
`NOBITS` (as it might very well include initialized values), and it
resolves 90% of the mismatches between the input and output sections,
which LLD now warns about when linking.
2022-10-09 10:20:19 +02:00
Nico Weber 2af028132a AK+Everywhere: Add AK_COMPILER_{GCC,CLANG} and use them most places
Doesn't use them in libc headers so that those don't have to pull in
AK/Platform.h.

AK_COMPILER_GCC is set _only_ for gcc, not for clang too. (__GNUC__ is
defined in clang builds as well.) Using AK_COMPILER_GCC simplifies
things some.

AK_COMPILER_CLANG isn't as much of a win, other than that it's
consistent with AK_COMPILER_GCC.
2022-10-04 23:35:07 +01:00
Timothy Flynn 97d15e9b8f Kernel: Do not require 'proc' promise in getsid() and getpgid()
These only require 'stdio' according to:
https://man.openbsd.org/pledge.2
2022-10-03 13:48:03 +02:00
Liav A 4e0f85432a Kernel/Storage: Remove the ramdisk implementation
Nobody uses this because the x86 prekernel environment is corrupting the
ramdisk image prior to running the actual kernel. In the future we can
ensure that the prekernel doesn't corrupt the ramdisk if we want to
bring support back. In addition to that, we could just use a RAM based
filesystem to load whatever is needed like in Linux, without the need of
additional filesystem driver.

For the mentioned corruption problem, look at issue #9893.
2022-10-03 11:12:35 +02:00
Liav A 66bde66f49 Kernel/aarch64: Use adopt_lock_ref to instantiate an InterruptController 2022-10-01 19:36:04 +02:00
Timon Kruiper 779a1d1232 Kernel/aarch64: Get framebuffer data from BootFramebufferConsole
The BootFramebufferConsole class maps the framebuffer using the
MemoryManager, so to be able to draw the logo, we need to get this
mapped framebuffer. This commit adds a unsafe API for that.
2022-10-01 14:09:01 +02:00
Timon Kruiper 15b818cd57 Kernel/aarch64: Remove specific aarch64 code in BootFramebufferConsole
The MemoryManager now works, so we can use the same code as on x86 to
map the framebuffer. Since it uses the MemoryManager, the initialization
of the BootFramebufferConsole has to happen after the MemoryManager is
working.
2022-10-01 14:09:01 +02:00
Timon Kruiper 57b1369475 Kernel/aarch64: Put correct memory size in multiboot_mmap
Also enable the MMU earlier in the boot process.
2022-10-01 14:09:01 +02:00
Timon Kruiper c2e410195a Kernel/aarch64: Set up pointer to kernel page directory
The MemoryManager uses this pointer to adds its newly created page
tables to the kernel page directory.
2022-10-01 14:09:01 +02:00
Timon Kruiper 96f73c9289 Kernel/aarch64: Set up quickmap infrastructure in initial page tables
With this change the quickmap related functions in MemoryManager
actually work. :^)
2022-10-01 14:09:01 +02:00
Timon Kruiper a62732ee2f Kernel/aarch64: Only identity map kernel image, instead of all of RAM
For the initial page tables we only need to identity map the kernel
image, the rest of the memory will be managed by the MemoryManager. The
linker script is updated to get the kernel image start and end
addresses.
2022-10-01 14:09:01 +02:00
Timon Kruiper cdf59c86ac Kernel: Make PageDirectory.h architecture specific
The page table and page directory formats are architecture specific, so
move the headers into the Arch directory. Also move the aarch64 page
table constants from aarch64/MMU.cpp to aarch64/PageDirectory.h.
2022-10-01 14:09:01 +02:00
Timon Kruiper ad5e8bbb4f Kernel: Add ability to dump backtrace from provided frame pointer
When an exception happens it is sometimes hard to figure out where
exactly the exception happened, so use the frame pointer of the trap
frame to print a backtrace.
2022-10-01 14:09:01 +02:00
Timon Kruiper 57901a6f62 Kernel/aarch64: Implement tlb flushing
This initial implementation flushes the complete tlb cache. A FIXME is
added to implement the partial tlb flushing.
2022-10-01 14:09:01 +02:00
Timon Kruiper 424a974e01 Kernel: Don't reserve Low Memory (0-1MB) on non-x86 architectures
This memory is only reserved on x86(-64) and is usable on other
architectures.
2022-10-01 14:09:01 +02:00
Timon Kruiper 1b60126d93 Kernel/aarch64: Stub Inode::{read,write}_bytes
Recent changes caused the build to fail for aarch64, with these
functions stubbed it builds again.
2022-10-01 14:09:01 +02:00
Nico Weber b0c0ebc543 Kernel: Fix a comment typo 2022-09-30 20:09:26 -07:00
Liav A 3cf6ac1b3f Kernel: Fix typo in comment in Ext2FileSystem::read_bytes_locked method 2022-09-26 20:13:13 +01:00
Liav A 0a793a7fa3 Kernel/FileSystem: Remove the locking of a Inode mutex in InodeVMObjects
We no longer require to lock the m_inode_lock in the SharedInodeVMObject
code as the methods write_bytes and read_bytes of the Inode class do
this for us now.
2022-09-26 22:06:10 +03:00
Liav A 60b088b89a Kernel: Send SIGBUS to threads that use after valid Inode mmaped range
According to Dr. POSIX, we should allow to call mmap on inodes even on
ranges that currently don't map to any actual data. Trying to read or
write to those ranges should result in SIGBUS being sent to the thread
that did violating memory access.

To implement this restriction, we simply check if the result of
read_bytes on an Inode returns 0, which means we have nothing valid to
map to the program, hence it should receive a SIGBUS in that case.
2022-09-26 20:00:34 +03:00
Idan Horowitz 04b1d32b70 Kernel: Stop using 'int's for indices in interrupt handling 2022-09-25 16:52:56 +03:00
Idan Horowitz 6f6211c5e6 Kernel: Simplify InterruptManagement::switch_to_pic_mode()
Since switch_to_pic_mode is only called if no IOAPIC is available,
there's no need to try and and find it and disable it.
2022-09-25 16:52:56 +03:00
Idan Horowitz 9abbeff79f Kernel: Store IRQControllers in NonnullRefPtrs instead of RefPtrs
These are always non-null, so there's no point in storing them in a
nullable container.
2022-09-25 16:52:56 +03:00
Idan Horowitz 176989d811 Kernel: Use InterruptManagement::m_interrupt_controllers::append()
There's no need to reinvent the wheel.
2022-09-25 16:52:56 +03:00
Idan Horowitz 746bf12ac4 Kernel: Remove unused InterruptManagement::m_smp_enabled 2022-09-25 16:52:56 +03:00
Liav A d5b97eb41e Kernel+Userland: Provide bytes count for a DisplayConnector framebuffer
This value will be used later on by WindowServer to reject resolutions
that will request a mapping that will overflow the hardware framebuffer
max length.
2022-09-24 15:38:56 +01:00
kleines Filmröllchen 1a7d6508e3 Kernel: By default, don't dump regions when a userspace crash happens
There is the DUMP_REGIONS_ON_CRASH debug macro which re-enables this
(old) behavior.
2022-09-24 14:22:09 +02:00