Commit graph

7532 commits

Author SHA1 Message Date
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