Commit graph

6189 commits

Author SHA1 Message Date
Daniel Bertalan 9b90f1fed5 Kernel: Do not do integer to pointer conversion in constexpr functions
Creating pointers from arbitrary values is not a valid thing to do in
constexpr functions. Furthermore, this functions is always called with
runtime values anyways, so there's no use in having it be constexpr.
Instead, make it ALWAYS_INLINE.
2021-12-04 11:59:59 -08:00
Daniel Bertalan 8e2d0c8d5c Kernel: Do not return a null ref in Processor::current on aarch64
Clang rejects binding a reference to a null pointer at compile-time.
Let's just crash explicitly, instead of waiting for a null dereference
to mess things up.
2021-12-04 11:59:59 -08:00
Idan Horowitz 711a7104f3 Kernel: Handle invalid stack pointer during signal dispatch
Instead of crashing the kernel, we simply terminate the process.
2021-12-01 21:44:11 +02:00
Idan Horowitz 40f64d7379 Kernel: Dispatch handle-able signals instead of crashing if possible
This matches the behaviour of the other *nixs and allows processes to
try and recover from such signals in userland.
2021-12-01 21:44:11 +02:00
Idan Horowitz f415218afe Kernel+LibC: Implement sigaltstack()
This is required for compiling wine for serenity
2021-12-01 21:44:11 +02:00
Idan Horowitz d5d0eb45bf Kernel: Clear up some comments in the sys$mprotect implementation 2021-12-01 21:44:11 +02:00
Idan Horowitz f27bbec7b2 Kernel: Move incorrect early return in sys$mprotect
Since we're iterating over multiple regions that interesect with the
requested range, just one of them having the requested access flags
is not enough to finish the syscall early.
2021-12-01 21:44:11 +02:00
Idan Horowitz a9e436c4a3 Kernel: Replace usages of SIGSTKFLT with SIGSEGV
SIGSTKFLT is a signal that signifies a stack fault in a x87 coprocessor,
this signal is not POSIX and also unused by Linux and the BSDs, so let's
use SIGSEGV so programs that setup signal handlers for the common
signals could still handle them in serenity.
2021-12-01 21:44:11 +02:00
Idan Horowitz 4ca39c7110 Kernel: Move the expand_range_to_page_boundaries helper to MemoryManager
This helper can (and will) be used in more parts of the kernel besides
the mmap-family of syscalls.
2021-12-01 21:44:11 +02:00
Idan Horowitz ff6b43734c Kernel: Add Region::clear_to_zero
This helper method can be used to quickly and efficiently zero out a
region.
2021-12-01 21:44:11 +02:00
Idan Horowitz 5f95a1a7b7 LibC: Define the MADV_DONTNEED madvise advice macro
This isn't actually implemented at the moment, but it is required for
wine to compile
2021-12-01 21:44:11 +02:00
Idan Horowitz fc13d0782f LibC: Make the madvise advice field a value instead of a bitfield
The advices are almost always exclusive of one another, and while POSIX
does not define madvise, most other unix-like and *BSD systems also only
accept a singular value per call.
2021-12-01 21:44:11 +02:00
Idan Horowitz 48f92f6482 LibC: Add the SIGFPE si_code macros 2021-12-01 21:44:11 +02:00
James Mintram 224b865fda Kernel: Add an x86 include check+error in x86/TSS.h 2021-12-01 11:22:04 -08:00
James Mintram b08eb37b11 Kernel: Add an x86 include check+error in x86/TrapFrame.h 2021-12-01 11:22:04 -08:00
James Mintram 80cdfee10a Kernel: Add an x86 include check+error in x86/Spinlock.h 2021-12-01 11:22:04 -08:00
James Mintram 34b341e35d Kernel: Add an x86 include check+error in x86/RegisterState.h 2021-12-01 11:22:04 -08:00
James Mintram 1dc1412dee Kernel: Add an x86 include check+error in x86/ProcessorInfo.h 2021-12-01 11:22:04 -08:00
James Mintram e20884dc0c Kernel: Add an x86 include check+error in x86/Processor.h 2021-12-01 11:22:04 -08:00
James Mintram eb33df0c30 Kernel: Add an x86 include check+error in x86/PageFault.h 2021-12-01 11:22:04 -08:00
James Mintram 17fb2adf61 Kernel: Add an x86 include check+error in x86/PageDirectory.h 2021-12-01 11:22:04 -08:00
James Mintram 70a18a2271 Kernel: Add an x86 include check+error in x86/MSR.h 2021-12-01 11:22:04 -08:00
James Mintram bffc3da9d7 Kernel: Add an x86 include check+error in x86/ISRStubs.h 2021-12-01 11:22:04 -08:00
James Mintram 1e5b82f0c6 Kernel: Add an x86 include check+error in x86/IO.h 2021-12-01 11:22:04 -08:00
James Mintram b9ae6daa02 Kernel: Add an x86 include check+error in x86/Inerrupts.h 2021-12-01 11:22:04 -08:00
James Mintram ed2aa96511 Kernel: Add an x86 include check+error in x86/InerruptDisabler.h 2021-12-01 11:22:04 -08:00
James Mintram 62d86afee9 Kernel: Add an x86 include check+error in x86/DescriptorTable.h 2021-12-01 11:22:04 -08:00
James Mintram db1fbdabf9 Kernel: Add an x86 include check+error in x86/CPUID.h 2021-12-01 11:22:04 -08:00
James Mintram 8350b44ebd Kernel: Add an x86 include check+error in x86/CPU.h 2021-12-01 11:22:04 -08:00
James Mintram 3e3c632969 Kernel: Add an x86 include check+error in x86/ASM_Wrapper.h 2021-12-01 11:22:04 -08:00
James Mintram 1c86b7043b Kernel: Remove ASM_Wrapper include from platform independent processor.h 2021-12-01 11:22:04 -08:00
Hendiadyoin1 c7b90fa7d3 Kernel: Don't rewrite the whole file on sys$msync 2021-12-01 09:47:46 +01:00
Hendiadyoin1 259f78545a Kernel: Allow flushing of partial regions in sys$msync 2021-12-01 09:47:46 +01:00
Hendiadyoin1 49d6ad6633 Kernel: Handle more error cases in sys$msync 2021-12-01 09:47:46 +01:00
Brian Gianforcaro d7568b28b4 Kernel: Surface errors when generating a process core dump :^) 2021-11-30 11:16:35 +01:00
Brian Gianforcaro fa517b213a Kernel: Handle string format errors in FileSystem APIs :^) 2021-11-30 11:16:35 +01:00
Brian Gianforcaro e626d7098d Kernel: Handle string format errors in Device::pseudo_path(..) :^) 2021-11-30 11:16:35 +01:00
Brian Gianforcaro 1f65728d8b Kernel: Handle string format errors in PCIDeviceAttributeSysFSComponent 2021-11-30 11:16:35 +01:00
Brian Gianforcaro 74ee491b84 Kernel: Handle string format errors in SlabAllocator stats :^)
Switch to KString::formatted and fix API so we can propagate errors.
2021-11-30 11:16:35 +01:00
Brian Gianforcaro a0e59099fc Kernel: Handle string format errors in KCOVInstance :^) 2021-11-30 11:16:35 +01:00
Brian Gianforcaro a5cec06135 Kernel: Handle string format error in page_fault_handler(..) :^)
Utilize the new KString::formatted to provide a fallback
if formatting fails because of OOM or whatever reason.
2021-11-30 11:16:35 +01:00
Brian Gianforcaro 4cc41ea186 Kernel: Add an error propagating KString::format(..) API :^)
In the continuous effort of better handling OOM in the kernel,
we want to move away from all AK::String usage. One of the final
pieces left to accomplish this goal is replacing all of the usages
of `String::formatted` with something that can actually propagate
failure.

The StringBuilder API was enhanced in the recent past to propagate
failure and thus a slightly modified version of what exists in
`AK::format` will work well for implementing failable format with
`KString`.
2021-11-30 11:16:35 +01:00
Jelle Raaijmakers e187207610 Kernel: Register Virtio console ports with device management
Previously, Virtio console ports would not show up in `/sys/dev/char/`.
Also adds support to `SystemServer` to create more than one console
port device in `/dev/` in the multiport case.
2021-11-30 10:53:41 +01:00
James Mintram f7c0cdcc19 Kernel: Use peripheral addresses returned from MMIO to map prekernel mem 2021-11-28 22:01:21 -08:00
James Mintram 4e9777243e Kernel: Refactor prekernel MMU to use a bump allocator 2021-11-28 22:01:21 -08:00
James Mintram 4a4a3193f8 Kernel: Rename Aarch64Asm -> ASM_wrapper and add Aarch64::Asm namespace 2021-11-28 22:01:21 -08:00
James Mintram 34709c8d39 Kernel: Rename Aarch64Registers -> Registers and add Aarch64 namespace 2021-11-28 22:01:21 -08:00
James Mintram 271b9b8da3 Kernel: Set up and activate the MMU in the aarch64 perkernel 2021-11-28 22:01:21 -08:00
James Mintram c2d7e200eb Kernel: Move common aarch64 asm functions into kernel folder and NS 2021-11-28 22:01:21 -08:00
James Mintram 68b5d00f42 Kernel: Split prekernel exception level code into its own file 2021-11-28 22:01:21 -08:00