Idan Horowitz
03b7352286
Kernel: Specify inline capacity of return type in capture_stack_trace
...
Since the inline capacity of the Vector return type was not specified
explicitly, the vector was automatically copied to a 0-length inline
capacity one, essentially eliminating the optimization.
2022-01-16 01:01:08 +02:00
Idan Horowitz
809870d519
Kernel: Convert ProcessorInfo to KString
2022-01-12 16:09:09 +02:00
Idan Horowitz
b4ce1e2e62
Kernel: Remove unused ProcessorInfo::m_processor field
2022-01-12 16:09:09 +02:00
Idan Horowitz
f9528f1882
Kernel: Rename ProcessorInfo::{m_brandstr => m_brand}
...
There's no need to specify the type of the member in it's name,
especially not in shorthand format.
2022-01-12 16:09:09 +02:00
Brian Gianforcaro
faf1fa0a84
Kernel: Convert Processor::features_string() API to KString
2022-01-12 13:03:44 +01:00
Andreas Kling
e53571ef59
Kernel: Dump memory regions when crashing in ring 0
2022-01-08 16:31:14 +01:00
mjz19910
10ec98dd38
Everywhere: Fix spelling mistakes
2022-01-07 15:44:42 +01:00
Idan Horowitz
4f551f54c4
Kernel: Align GDT to the size of a Descriptor
...
This is not actually required by the specification, but it means we
will take the aligned fast-path in QEMU.
2022-01-04 19:08:07 +02:00
Idan Horowitz
f0b82c4b17
Kernel: Replace incorrect loop condition in write_raw_gdt_entry
...
Contradictory to the comment above it, this while loop was actually
clearing the selectors above or equal to the edited one (instead of
the selectors that were skipped when the gdt was extended), this wasn't
really an issue so far, as all calls to this function did extend the
GDT, which meant this condition was always false, but future calls to
this function that will try to edit an existing entry would fail.
2022-01-04 19:08:07 +02:00
Idan Horowitz
e424e3b88c
Kernel: Use enum instead of magic numbers for GDT descriptor types
...
Some of the enum members were also renamed to reflect the fact that the
segment sizes are not necessarily 32bit (64bit on x86_64).
2022-01-04 19:08:07 +02:00
Daniel Bertalan
8e2efe78f7
Kernel: Tighten String-related includes
2021-12-30 14:16:03 +01:00
Owen Smith
3f2b70382e
Kernel: Fix incorrect SFMASK MSR value clobbering reserved bits
...
Also improve the comments around that initialisation code.
2021-12-30 14:12:26 +01:00
Daniel Bertalan
fcdd202741
Kernel: Return the actual number of CPU cores that we have
...
... instead of returning the maximum number of Processor objects that we
can allocate.
Some ports (e.g. gdb) rely on this information to determine the number
of worker threads to spawn. When gdb spawned 64 threads, the kernel
could not cope with generating backtraces for it, which prevented us
from debugging it properly.
This commit also removes the confusingly named
`Processor::processor_count` function so that this mistake can't happen
again.
2021-12-29 03:17:41 -08:00
Owen Smith
e6df1c9988
Kernel: Implement and use the syscall/sysret instruction pair on x86_64
2021-12-28 23:15:38 +01:00
Owen Smith
d36c84c331
Kernel: Reorder the 64-bit GDT a bit
...
Add a kernel data segment and make the user code segment come after
the data segment. We need the GDT to be in a certain order to support
the syscall and sysret instruction pair.
2021-12-28 23:15:38 +01:00
Andreas Kling
3399b6c57f
Kernel: Remove old SlabAllocator :^)
...
This is no longer useful since kmalloc() does automatic slab allocation
without any of the limitations of the old SlabAllocator. :^)
2021-12-26 21:22:59 +01:00
Nick Johnson
08e4a1a4dc
AK+Everywhere: Replace __builtin bit functions
...
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount},
this commit removes all calls to these functions and replaces them with
the equivalent functions in AK/BuiltinWrappers.h.
2021-12-21 22:13:51 +01:00
Andreas Kling
e0521cfb9d
Kernel: Stop ProcFS stack walk on bogus userspace->kernel traversal
...
Unsurprisingly, the /proc/PID/stacks/TID stack walk had the same
arbitrary memory read problem as the perf event stack walk.
It would be nice if the kernel had a single stack walk implementation,
but that's outside the scope of this commit.
2021-12-19 18:18:38 +01:00
Hendiadyoin1
7a206868f8
Kernel: Move architecture dependent includes to the top in Processor.h
...
With the declaration order dependency resolved in the last two commits
we can now do this, which looks a lot nicer.
2021-12-11 13:23:27 -08:00
Hendiadyoin1
3f434506f5
Kernel: Extract ProcessorSpecificDataID from from Arch/Processor.h
2021-12-11 13:23:27 -08:00
Hendiadyoin1
556b516182
Kernel: Extract DeferredCallEntry from Arch/Processor.h
2021-12-11 13:23:27 -08:00
Hendiadyoin1
e34eb3e36d
Kernel: Remove unused String.h includes
...
This makes searching for not yet OOM safe interfaces a bit easier.
2021-12-11 13:15:26 -08:00
Idan Horowitz
39ecb832e4
Kernel: Don't try to dispatch urgent signals for kernel crashes
...
If we crashed in the kernel there's no point to sending a signal to the
active process, we're going to panic soon anyway.
2021-12-06 19:36:42 +01: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
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
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
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
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
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
5a75bd31b0
Kernel: Replace inline asm with typesafe static member functions
2021-11-28 22:01:21 -08:00