Commit Graph

511 Commits

Author SHA1 Message Date
Andreas Kling
f3fed411d4 Kernel: Rename Processor::smp_queue_message() => smp_enqueue_message() 2021-08-09 11:46:30 +02:00
Andreas Kling
46215a8183 Kernel: Add Processor::pause() and use it to give the CPU a rest
On x86, the "pause" instruction is a "spin loop hint".
2021-08-09 11:46:30 +02:00
Andreas Kling
208147c77c Kernel: Rename Process::space() => Process::address_space()
We commonly talk about "a process's address space" so let's nudge the
code towards matching how we talk about it. :^)
2021-08-06 14:05:58 +02:00
Andreas Kling
93d98d4976 Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
Andreas Kling
a1d7ebf85a Kernel: Rename Kernel/VM/ to Kernel/Memory/
This directory isn't just about virtual memory, it's about all kinds
of memory management.
2021-08-06 14:05:58 +02:00
Andreas Kling
33adc3a42d Kernel: Store coredump metadata properties as KStrings
This patch also replaces the HashMap previously used to store coredump
properties with a plain AK::Array.
2021-08-06 00:37:47 +02:00
Brian Gianforcaro
0fc853f5ba Kernel: Remove ThreadTracer.h include from Process.h / Thread.h
This isn't needed for Process / Thread as they only reference it
by pointer and it's already part of Kernel/Forward.h. So just include
it where the implementation needs to call it.
2021-08-01 08:10:16 +02:00
Brian Gianforcaro
ed996fcced Kernel: Remove unused header includes 2021-08-01 08:10:16 +02:00
Gunnar Beutner
3a4d3b15e3 Kernel: Fix CPU initialization for SMP
This was broken by the KASLR changes.
2021-07-27 19:45:38 +02:00
Andreas Kling
84d3428ab3 Kernel: Remove a handful of unused member functions in Processor 2021-07-27 14:38:04 +02:00
Andreas Kling
1e43292c3b Kernel: Introduce ProcessorSpecific<T> for per-CPU data structures
To add a new per-CPU data structure, add an ID for it to the
ProcessorSpecificDataID enum.

Then call ProcessorSpecific<T>::initialize() when you are ready to
construct the per-CPU data structure on the current CPU. It can then
be accessed via ProcessorSpecific<T>::get().

This patch replaces the existing hard-coded mechanisms for Scheduler
and MemoryManager per-CPU data structure.
2021-07-27 14:32:30 +02:00
Gunnar Beutner
57417a3d6e Kernel: Support loading the kernel at almost arbitrary virtual addresses
This enables further work on implementing KASLR by adding relocation
support to the pre-kernel and updating the kernel to be less dependent
on specific virtual memory layouts.
2021-07-27 13:15:16 +02:00
Ali Mohammad Pur
5dc6270b57 Kernel: Remove invalid '#' format modifier for printing a faulting addr
This was mistakenly added in 306d898ee5.
2021-07-26 14:12:09 +04:30
Ali Mohammad Pur
306d898ee5 Kernel: Show the unmapped-after-init symbol being accessed
This makes it a lot easier to figure out what unmapped function is being
accessed, and a lot easier to reason about _why_ it is being accessed.
2021-07-26 11:33:14 +02:00
Ali Mohammad Pur
54c54dabdd Kernel: PANIC() instead of manually halting the processor in abort() 2021-07-26 02:29:25 +04:30
Andreas Kling
deff554096 Kernel+LibSystem: Add a 4th syscall argument
Let's allow passing 4 function arguments to a syscall. The 4th argument
goes into ESI or RSI.
2021-07-25 14:08:50 +02:00
Gunnar Beutner
54fb5637e7 Kernel: Add missing .globl definitions
This ensures that we can properly take the address of these symbols in
other code.
2021-07-23 22:13:43 +02:00
Gunnar Beutner
a6c4a4d2fc Kernel: Make some of the assembly code position-independent on x86_64 2021-07-23 19:06:51 +02:00
Gunnar Beutner
f2be1f9326 Kernel: Fix the variable declaration for some linker script symbols
Despite what the declaration would have us believe these are not "u8*".
If they were we wouldn't have to use the & operator to get the address
of them and then cast them to "u8*"/FlatPtr afterwards.
2021-07-22 22:27:11 +02:00
Gunnar Beutner
31f30e732a Everywhere: Prefix hexadecimal numbers with 0x
Depending on the values it might be difficult to figure out whether a
value is decimal or hexadecimal. So let's make this more obvious. Also
this allows copying and pasting those numbers into GNOME calculator and
probably also other apps which auto-detect the base.
2021-07-22 08:57:01 +02:00
Brian Gianforcaro
85e95105c6 Kernel: Mark read only RegisterState function parameters as const 2021-07-20 03:21:14 +02:00
Brian Gianforcaro
308396bca1 Kernel: No lock validate_user_stack variant, switch to Space as argument
The entire process is not needed, just require the user to pass in the
Space. Also provide no_lock variant to use when you already have the
VM/Space lock acquired, to avoid unnecessary recursive spinlock
acquisitions.
2021-07-20 03:21:14 +02:00
Gunnar Beutner
675de847f7 Kernel: Remove obsolete code 2021-07-19 11:29:09 +02:00
Brian Gianforcaro
1cffecbe8d Kernel: Push ARCH specific ifdef's down into RegisterState functions
The non CPU specific code of the kernel shouldn't need to deal with
architecture specific registers, and should instead deal with an
abstract view of the machine. This allows us to remove a variety of
architecture specific ifdefs and helps keep the code slightly more
portable.

We do this by exposing the abstract representation of instruction
pointer, stack pointer, base pointer, return register, etc on the
RegisterState struct.
2021-07-19 08:46:55 +02:00
Tom
a635ff4e60 Everywhere: Make tracking cpu usage independent from system ticks
This switches tracking CPU usage to more accurately measure time in
user and kernel land using either the TSC or another time source.
This will also come in handy when implementing a tickless kernel mode.
2021-07-18 22:08:26 +02:00
Gunnar Beutner
7e94b090fe Kernel: Introduce basic pre-kernel environment
This implements a simple bootloader that is capable of loading ELF64
kernel images. It does this by using QEMU/GRUB to load the kernel image
from disk and pass it to our bootloader as a Multiboot module.

The bootloader then parses the ELF image and sets it up appropriately.
The kernel's entry point is a C++ function with architecture-native
code.

Co-authored-by: Liav A <liavalb@gmail.com>
2021-07-18 17:31:13 +02:00
Gunnar Beutner
b708b23b13 Kernel: Add support for kernel addresses other than 3-4GB 2021-07-18 17:31:13 +02:00
Gunnar Beutner
741ca5477c Kernel: Fix {read,write}_gs_ptr() for 64-bit addresses 2021-07-18 17:31:13 +02:00
Andreas Kling
2da0581fd2 Kernel: Replace "folder" => "directory" everywhere
Folders are a GUI concept. File systems have directories.
2021-07-17 23:50:00 +02:00
Hediadyoin1
432a34a496 Kernel: Make PAGE_MASK architecture independent 2021-07-17 01:12:15 +02:00
Gunnar Beutner
a17c25e45e Kernel: Make resizing the page tables for the kernel image easier
By using the KERNEL_PD_OFFSET constant we can avoid some of the
hard-coded values in the boot code.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
cbdb488578 Kernel: Move end_of_kernel_image after the .ksyms section
Without this we won't be able to detect whether .ksyms overlaps the end
of the page table we set up for the kernel image.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
acf8f2a2a3 Kernel: Support specifying a 64-bit KERNEL_BASE address
The kernel doesn't currently boot when using an address other than
0xc0000000 because the page tables aren't set up properly for that
but this at least lets us build the kernel.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
9b431cbe42 Kernel: Avoid unnecessary jump in the boot code
The 32-bit boot code jumps to 0xc0000000 + entry address once page
tables are set up. This is unnecessary for 64-bit mode because we'll
do another far jump just moments later.
2021-07-16 18:50:59 +02:00
Gunnar Beutner
eb1935b62e Kernel: Avoid hard-coding kernel virtual base 2021-07-16 18:50:59 +02:00
Jean-Baptiste Boric
528574d958 Kernel: Detect and display CPUID Hyper-V data 2021-07-14 13:52:34 +02:00
Jean-Baptiste Boric
b22357b17b Kernel: Detect and display CPUID hypervisor signature 2021-07-14 13:52:34 +02:00
Jean-Baptiste Boric
4cc346fb19 Kernel: Add support for hypervisor CPUID feature 2021-07-14 13:52:34 +02:00
Daniel Bertalan
ef40de9c6c Kernel: Don't mix AT&T and Intel ASM syntax in boot.S
The rest of the file is in AT&T syntax, so for the time being, I'll
switch these instructions to AT&T too to make Clang shut up.
2021-07-14 13:12:25 +02:00
Hendiadyoin1
d761c5024b AK: Generalize ByteReader
Also use it instead of CPU.h's possibly_unaligned_data interface
2021-07-14 11:26:34 +04:30
Brian Gianforcaro
da665077ce Kernel: Remove unused header includes in Arch subtree 2021-07-11 21:37:38 +02:00
Andreas Kling
98080497d2 Kernel: Use Forward.h headers more 2021-07-11 14:14:51 +02:00
Andreas Kling
358a7cc448 Kernel: Rename SysFS related classes in BIOS code
Give them names that sound related to SysFS.
2021-07-11 01:38:01 +02:00
Andreas Kling
805319ed30 Kernel: Replace "Folder" => "Directory" everywhere
Folders are a GUI concept, file systems have directories. :^)
2021-07-11 01:33:40 +02:00
Andreas Kling
60a7a9d523 Kernel: Rename SystemExposedFolder => SysFSDirectory
"Folder" is a GUI concept, let's call this "Directory".
Also, "System" is completely generic, so let's be more specific and
call this "SysFS..."
2021-07-11 01:07:27 +02:00
Andreas Kling
517170a986 Kernel: Rename SystemExposedComponent => SysFSComponent 2021-07-11 01:06:27 +02:00
Andreas Kling
27244eb0ee Kernel: Rename SystemRegistrar => SysFSComponentRegistry 2021-07-11 01:05:26 +02:00
Luke
c94b0e80e7 Kernel: Stop booting and print if PAE is not supported by the processor
We currently require PAE and not having it causes us to crash.
This turns that crash into an error message.
2021-07-09 01:29:52 +02:00
Tom
87dc4c3d2c Kernel: Move PhysicalPage classes out of the heap into an array
By moving the PhysicalPage classes out of the kernel heap into a static
array, one for each physical page, we can avoid the added overhead and
easily find them by indexing into an array.

This also wraps the PhysicalPage into a PhysicalPageEntry, which allows
us to re-use each slot with information where to find the next free
page.
2021-07-08 11:43:34 +02:00
Tom
ad5d9d648b Kernel: Use PAE to allow accessing all physical memory beyond 4GB
We already use PAE for the NX bit, but this changes the PhysicalAddress
structure to be able to hold 64 bit physical addresses. This allows us
to use all the available physical memory.
2021-07-08 11:43:34 +02:00
Liav A
cc98871383 Kernel: Print if image has become too large again
Instead of just disabling interrupts and halting when entering the C++
section, just halt with a printed message indicating the error.
2021-07-07 22:18:36 +02:00
Liav A
8e8a5680d5 Kernel/x86_64: Print if machine doesn't support x86_64 mode
We drop to real mode and use two BIOS calls to do this.
2021-07-06 19:01:27 +02:00
Gunnar Beutner
8aafbd917a Kernel: Fix incorrect indentation
Looks like a tab and some other things snuck in. :)
2021-07-05 17:12:56 +02:00
Hendiadyoin1
9b7e48c6bd Kernel: Replace raw asm functions with naked ones 2021-07-05 16:40:00 +02:00
Gunnar Beutner
8c14488106 Kernel: Get rid of of some of the duplicate kernel base address macros 2021-07-05 12:28:45 +02:00
Gunnar Beutner
040fe0054b Kernel: Merge the x86 and x86_64 boot code into a single file
They're mostly the same apart from some x86_64-specific parts.
2021-07-05 12:28:45 +02:00
Tom
dce18958b6 Kernel: Fix safe_memset not setting the last few bytes in some cases
Because the remainder variable will always be 0 unless a fault happened
we should not use it to decide if we have nothing left to memset when
finishing the fast path. This caused not all bytes to be zeroed
if the size was not an exact multiple of sizeof(size_t).

Fixes #8352
2021-07-04 18:54:16 +02:00
Gunnar Beutner
c51b49a8cb Kernel: Implement TLS support for x86_64 2021-07-04 01:07:28 +02:00
Gunnar Beutner
04a912f68f Kernel: Hide the implementation detail that MSRs use two registers
When retrieving and setting x86 MSRs two registers are required. The
existing setter and getter for the MSR class made this implementation
detail visible to the caller. This changes the setter and getter to
use u64 instead.
2021-07-04 01:07:28 +02:00
Gunnar Beutner
5ca95b3957 Kernel: Replace some hard-coded memory addresses with macros 2021-07-04 01:07:28 +02:00
Liav A
458ac9bbba Kernel/x86_64: Halt if we happen to boot on non-x86_64 machine 2021-07-03 18:40:37 +02:00
Gunnar Beutner
52f9aaa823 Kernel: Use the GS segment for the per-CPU struct
Right now we're using the FS segment for our per-CPU struct. On x86_64
there's an instruction to switch between a kernel and usermode GS
segment (swapgs) which we could use.

This patch doesn't update the rest of the code to use swapgs but it
prepares for that by using the GS segment instead of the FS segment.
2021-07-02 23:33:17 +02:00
Daniel Bertalan
45a82b2a5b Kernel: Fix struct forward declared as class 2021-07-03 01:56:31 +04:30
Gunnar Beutner
5666809889 Kernel: Fix building the kernel with LTO
Fixes #8383.
2021-07-02 17:51:26 +02:00
Gunnar Beutner
db334b50d0 Kernel: Don't byteswap the ISR number on interrupt entry
Let's just add the padding before we jump to interrupt_common_asm_entry.
2021-07-01 23:36:17 +02:00
Hendiadyoin1
5f6c513610 Kernel: Add support for 64-bit unaligned Mem-ops
Also let the compiler enforce the size and type restrictions
2021-07-01 17:32:34 +02:00
Hendiadyoin1
6b9cf8376e Kernel: Remove not needed comment in Processor.h 2021-07-01 17:32:34 +02:00
Hendiadyoin1
90cd11fa8c Kernel: Support starting up secondary processors on x86_64 2021-07-01 10:50:00 +02:00
Gunnar Beutner
e37576440d Kernel: Fix stack alignment on x86_64
These were already properly aligned (as far as I can tell).
2021-06-30 15:13:30 +02:00
Gunnar Beutner
50839bd1f1 Kernel: Properly initialize r8-r15 for new threads on x86_64 2021-06-30 15:13:30 +02:00
Liav A
92c0dab5ab Kernel: Introduce the new SysFS
The intention is to add dynamic mechanism for notifying the userspace
about hotplug events. Currently, the DMI (SMBIOS) blobs and ACPI tables
are exposed in the new filesystem.
2021-06-29 20:53:59 +02:00
Gunnar Beutner
0b82c583e0 Kernel: Implement capturing stack traces on x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner
36ce2a2b76 Kernel: Fix struct layout for interrupt entries on x86_64 2021-06-29 20:03:36 +02:00
Gunnar Beutner
df9e73de25 Kernel: Add x86_64 support for fork() 2021-06-29 20:03:36 +02:00
Gunnar Beutner
732dc72c58 Kernel: Fix the limit for the IDT table 2021-06-28 22:29:28 +02:00
Gunnar Beutner
e979a88af4 Kernel: Implement do_assume_context for execve() on x86_64 2021-06-28 22:29:28 +02:00
Gunnar Beutner
a8587fbfb9 Kernel: Use FlatPtr for register-sized values 2021-06-28 22:29:28 +02:00
Gunnar Beutner
b5aad1c81d Kernel: Fix GDT and segment selectors to make userland work on x86_64
Userland faulted on the very first instruction before because the
PML4T/PDPT/etc. weren't marked as user-accessible. For some reason
x86 doesn't care about that.

Also, we need to provide an appropriate userspace stack segment
selector to iretq.
2021-06-28 22:29:28 +02:00
rileylyman
640db93bdd Kernel: Fix small typo in inline comment 2021-06-28 16:39:25 +02:00
Gunnar Beutner
e56a0d6af7 Kernel: Fix memset() on x86_64
Previously memset() only set half of the bytes to the requested value.
2021-06-28 15:55:00 +02:00
Gunnar Beutner
32840dfa17 Kernel: Implement more x86_64 context switching functionality 2021-06-28 15:55:00 +02:00
Gunnar Beutner
076692b1ef Kernel: Implement entry code for x86_64 interrupts
With this fixed we can now properly handle interrupts (e.g. timer
interrupts) on x86_64.
2021-06-28 15:55:00 +02:00
Gunnar Beutner
328d44e227 Kernel: Fix stack for new threads on x86_64
Unlike on x86 iretq always pops rsp and ss.
2021-06-28 15:55:00 +02:00
Gunnar Beutner
9ed051fe25 Kernel: Implement initializing threads on x86_64 2021-06-27 15:46:42 +02:00
Gunnar Beutner
f285241cb8 Kernel: Rename Thread::tss to Thread::regs and add x86_64 support
We're using software context switches so calling this struct tss is
somewhat misleading.
2021-06-27 15:46:42 +02:00
Gunnar Beutner
eba33f82b8 Kernel: Reorder code a bit to clarify which #if block it belongs to 2021-06-27 15:46:42 +02:00
Gunnar Beutner
df530941cc Kernel: Implement safe_* memory access functions for x86_64 2021-06-27 15:46:42 +02:00
Gunnar Beutner
79ab9cce18 Kernel: Clear segment registers on x86_64
They're supposedly unused but iretq doesn't like ss being non-zero.
2021-06-27 15:46:42 +02:00
Gunnar Beutner
9d9f20391d Kernel: Use macros for GDT indices instead of hardcoding the values 2021-06-27 15:46:42 +02:00
Gunnar Beutner
065c6c307d Kernel: Add support for interrupts on x86_64 2021-06-27 15:46:42 +02:00
Gunnar Beutner
233ef26e4d Kernel+Userland: Add x86_64 registers to RegisterState/PtraceRegisters 2021-06-27 15:46:42 +02:00
Gunnar Beutner
10ca7f18a7 Kernel: Fix declaration for struct TrapFrame
This is declared as a struct elsewhere.
2021-06-27 15:46:42 +02:00
Gunnar Beutner
324f72d02b Kernel: Fix incorrect flags for the GDT entries
The Sz (protected mode) bit should not be set for 64-bit GDT entries.
2021-06-27 15:46:42 +02:00
Gunnar Beutner
389bf82889 Kernel: Add CPUID flag for long mode
This isn't particularly useful because by the time we've entered
init() the CPU had better support x86_64 anyway. However this shows the
CPU flag in System Monitor - even in 32-bit mode.
2021-06-26 11:08:52 +02:00
Gunnar Beutner
9077c64d37 Kernel: Correct spelling mistake 2021-06-26 11:08:52 +02:00
Gunnar Beutner
e52051903b Kernel: Fix off-by-one error in Processor::write_raw_gdt_entry 2021-06-26 11:08:52 +02:00
Gunnar Beutner
f630299d49 Kernel: Add support for setting up a x86_64 GDT once in C++ land 2021-06-26 11:08:52 +02:00
Gunnar Beutner
29d9666e02 Kernel: Fix GDT limits
The GDT limits are inclusive, so for correctness we should subtract
one from the structs' size.
2021-06-26 11:08:52 +02:00
Gunnar Beutner
4c555684b7 Kernel: Set an appropriate GDT for 64-bit mode 2021-06-25 15:19:09 +02:00
Gunnar Beutner
d84abe51f5 Kernel: Use PML4T for 64-bit mode 2021-06-25 15:19:09 +02:00
Gunnar Beutner
13e4093da4 Kernel: Move Multiboot header into a separate file 2021-06-25 15:19:09 +02:00
Gunnar Beutner
19c0498ccc Kernel: Update the x86_64 boot code to match i386's code 2021-06-25 15:19:09 +02:00
Daniel Bertalan
74535628a8 Kernel: Use proper Atomic<T> types in CPU
This is needed because Clang's intrinsic atomic functions behave weirdly
if only one of their pointer arguments is volatile.
2021-06-24 17:35:49 +04:30
Gunnar Beutner
38fca26f54 Kernel: Add stubs for missing x86_64 functionality
This adds just enough stubs to make the kernel compile on x86_64. Obviously
it won't do anything useful - in fact it won't even attempt to boot because
Multiboot doesn't support ELF64 binaries - but it gets those compiler errors
out of the way so more progress can be made getting all the missing
functionality in place.
2021-06-24 09:27:13 +02:00
Hendiadyoin1
62f9377656 Kernel: Move special sections into Sections.h
This also removes a lot of CPU.h includes infavor for Sections.h
2021-06-24 00:38:23 +02:00
Hendiadyoin1
553ea3036d Kernel: Remove PAGE_SIZE from CPU.h
We have that information in LibC, lets use that instead
2021-06-24 00:38:23 +02:00
Hendiadyoin1
7ca3d413f7 Kernel: Pull apart CPU.h
This does not add any functional changes
2021-06-24 00:38:23 +02:00
Gunnar Beutner
c980a51776 Kernel: Make sure the kernel's ELF PHDRs don't use rwx
This doesn't really matter in terms of writability for the kernel text
because we set up proper page mappings anyway which prohibit writing
to the text segment. However, this makes the profiler happy which
previously died when validating the kernel's ELF program headers.
2021-06-19 12:54:33 +02:00
Jean-Baptiste Boric
8cd96f031d Kernel: Fix CPUID usage inside cpu_detect()
Since no features inside the 0x80000001 leaf are required for
SerenityOS to work, don't assert if it's unavailable.
2021-06-18 01:02:25 +02:00
Jean-Baptiste Boric
fb3447f7ec Kernel: Use FXSR feature only if supported by CPU
If FXSR is not present, fall back to fnsave and frstor instructions.
These instructions aren't available on the canonical i686 CPU which is
the Pentium Pro processor.
2021-06-18 01:02:25 +02:00
Jean-Baptiste Boric
fea23d0ec1 Kernel: Detect support for CPUID FXSR
The fxsave and fxrstor instructions are available only if the FXSR
feature is present.
2021-06-18 01:02:25 +02:00
Gunnar Beutner
da24228348 Kernel: Print stack traces for crashes in release builds
Previously we'd just reset the CPU and reboot.
2021-06-11 11:32:01 +02:00
Gunnar Beutner
bcf6da8cde Kernel: Enable VERIFY() checks even if the DEBUG macro is not defined
Fixes #7910.
2021-06-11 11:32:01 +02:00
Gunnar Beutner
4fca9ee060 Kernel: Allow building the kernel with -O0
Unfortunately the kernel doesn't run with -O0 but at least it can be
successfully built with this change.
2021-05-28 19:52:22 +01:00
Liav A
b8f0a9c974 Kernel/CPU: Fix awkward printing early on boot
This usage of the word "installing" seemed for me for a long time as
a wrong thing, so let's make it better now.
2021-05-21 22:38:26 +01:00
Gunnar Beutner
8495d6aeca Kernel: Use the Function class for smp_broadcast()/smp_unicast()
This avoids allocations for smp_broadcast() and smp_unicast() by
using the Function class.
2021-05-20 09:09:10 +02:00
Gunnar Beutner
cac7a8ced9 Kernel: Use the Function class for deferred_call_queue()
This avoids allocations for deferred_call_queue().
2021-05-20 09:09:10 +02:00
Brian Gianforcaro
7540f4268b Kernel: Remove s_processor_lock by making s_processors statically sized
Currently in SMP mode we hard code support for up to only 8 processors.
There is no reason for this to be a dynamic allocation that needs to be
guarded by a spinlock. Instead use a Array<T* with inline storage of 8,
allowing each processor to initialize it self in place, avoiding all
the need for locks.
2021-05-20 08:10:07 +02:00
Brian Gianforcaro
83fc591cea Kernel: Generate page fault events from the kernel profiler
Hook the kernel page fault handler and capture page fault events when
the fault has a current thread attached in TLS. We capture the eip and
ebp so we can unwind the stack and locate which pieces of code are
generating the most page faults.

Co-authored-by: Gunnar Beutner <gbeutner@serenityos.org>
2021-05-19 22:51:42 +02:00
Liav A
20743e8aed Kernel/Graphics + SystemServer: Support text mode properly
As we removed the support of VBE modesetting that was done by GRUB early
on boot, we need to determine if we can modeset the resolution with our
drivers, and if not, we should enable text mode and ensure that
SystemServer knows about it too.

Also, SystemServer should first check if there's a framebuffer device
node, which is an indication that text mode was not even if it was
requested. Then, if it doesn't find it, it should check what boot_mode
argument the user specified (in case it's self-test). This way if we
try to use bochs-display device (which is not VGA compatible) and
request a text mode, it will not honor the request and will continue
with graphical mode.

Also try to print critical messages with mininum memory allocations
possible.

In LibVT, We make the implementation flexible for kernel-specific
methods that are implemented in ConsoleImpl class.
2021-05-16 19:58:33 +02:00
Liav A
dac129e10b Kernel: Expand the kernel memory slot from 16 MiB to 32 MiB
Like in 8cd5477e54, we need to expand the
kernel slot again to be able to boot again.
2021-05-16 19:58:33 +02:00
Liav A
2cd1f928e1 Kernel: Drop support of GRUB VBE modesetting
We used GRUB to modeset the resolution for a long time, but for good
reasons I see no point with keeping it supported in our kernel. We
support bochs-display device on QEMU (both the VGA compatible and
non-VGA compatible variants), so for QEMU we can still boot the system
in graphical mode even without GRUB help.

Also, we now have a native driver for Intel graphics and although it
doesn't support most Intel graphics cards out there yet, it's a good
starting point to support more cards. If a user wants to boot on
bare-metal in graphical mode, all he needs to do is to add the removed
flag back again, as the kernel still supports pre-set framebuffers.
2021-05-16 19:58:33 +02:00
Nicholas Baron
aa4d41fe2c
AK+Kernel+LibELF: Remove the need for IteratorDecision::Continue
By constraining two implementations, the compiler will select the best
fitting one. All this will require is duplicating the implementation and
simplifying for the `void` case.

This constraining also informs both the caller and compiler by passing
the callback parameter types as part of the constraint
(e.g.: `IterationFunction<int>`).

Some `for_each` functions in LibELF only take functions which return
`void`. This is a minimal correctness check, as it removes one way for a
function to incompletely do something.

There seems to be a possible idiom where inside a lambda, a `return;` is
the same as `continue;` in a for-loop.
2021-05-16 10:36:52 +01:00
Brian Gianforcaro
db78331741 Kernel: Don't crash in page_fault_handler if current_thread is null
If we are attempting to emit debugging information about an unhandleable
page fault, don't crash trying to kill threads or dump processes if the
current_thread isn't set in TLS. Attempt to keep proceeding in order to
dump as much useful information as possible.

Related: #6948
2021-05-15 09:00:29 +02:00
Brian Gianforcaro
64b4e3f34b
Kernel: Add Processor::is_bootstrap_processor() function, and use it. (#6871)
The variety of checks for Processor::id() == 0 could use some assistance
in the readability department. This change adds a new function to
represent this check, and replaces the comparison everywhere it's used.
2021-05-05 18:48:26 +02:00
Tom
ec27cbbb2a Kernel: Store whether a thread is the idle thread in Thread directly
This solves a problem where checking whether a thread is an idle
thread may require iterating all processors if it is not the idle
thread of the current processor.
2021-05-04 16:44:02 +02:00
Gunnar Beutner
6cf59b6ae9 Everywhere: Turn #if *_DEBUG into dbgln_if/if constexpr 2021-05-01 21:25:06 +02:00
Gunnar Beutner
55ae52fdf8 Kernel: Enable building the kernel with -flto
GCC with -flto is more aggressive when it comes to inlining and
discarding functions which is why we must mark some of the functions
as NEVER_INLINE (because they contain asm labels which would be
duplicated in the object files if the compiler decides to inline
the function elsewhere) and __attribute__((used)) for others so
that GCC doesn't discard them.
2021-04-29 20:26:36 +02:00
Linus Groh
dbe72fd962 Everywhere: Remove empty line after function body opening curly brace 2021-04-25 20:20:00 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
FalseHonesty
3123ffb19d Kernel: Add ptrace commands for reading/writing the debug registers
This adds PT_PEEKDEBUG and PT_POKEDEBUG to allow for reading/writing
the debug registers, and updates the Kernel's debug handler to read the
new information from the debug status register.
2021-04-18 17:02:40 +02:00
FalseHonesty
97a4c627cb Kernel: Add debug register handling
This patch adds functions to read/write from the debug registers,
and implements storing/loading them across context switches.
2021-04-18 17:02:40 +02:00
Gunnar Beutner
f033416893 Kernel+LibC: Clean up how assertions work in the kernel and LibC
This also brings LibC's abort() function closer to the spec.
2021-04-18 11:11:15 +02:00
Linus Groh
2b0c361d04 Everywhere: Fix a bunch of typos 2021-04-18 10:30:03 +02:00
Liav A
210754a93a Kernel/PCI + CPU: Allow to access unaligned data 2021-04-06 22:25:28 +02:00
Andreas Kling
0b8226811f Kernel+CrashReporter: Add metadata about page faults to crash reports
Crash reports for page faults now tell you what kind of memory access
failed and where. :^)
2021-04-04 20:13:55 +02:00
Hendiadyoin1
ce4f43a192 Kernel::x86_64: Re-copy boot.S and add longmode in
Now we should have the posibility to run in longmode, after enabling it
in the gdt
2021-03-21 09:35:23 +01:00
Hendiadyoin1
61240aaad3 Kernel: Make IDT Entries their one struct
This is to make them a bit more transparent, and with a bit of Compiler
magic we get the 64-bit implementation in the same package
2021-03-21 09:35:23 +01:00
Hendiadyoin1
0d934fc991 Kernel::CPU: Move headers into common directory
Alot of code is shared between i386/i686/x86 and x86_64
and a lot probably will be used for compatability modes.
So we start by moving the headers into one Directory.
We will probalby be able to move some cpp files aswell.
2021-03-21 09:35:23 +01:00
Hendiadyoin1
5a8cc07485 Kernel: Add TSS64 and Desciptor for 64-bit 2021-03-21 09:35:23 +01:00
Emanuele Torre
1f81bc6879 Everywhere: Remove unnecessary whitespace at the end of some lines. 2021-03-08 09:20:53 +01:00
Luke
368f78d03c Kernel: Manually reset the XCR0 register
According to the Intel manual: "After reset, all bits (except bit 0) in
XCR0 are cleared to zero; XCR0[0] is set to 1."
Sadly we can't trust this, for example VirtualBox starts with
bits 0-4 set, so let's do it ourselves.

Fixes #5653
2021-03-08 08:56:38 +01:00
Jean-Baptiste Boric
32e1354b9b Kernel: Fix unaligned read inside map_ebda() 2021-03-07 14:05:17 +01:00
Andreas Kling
adb2e6be5f Kernel: Make the kernel compile & link for x86_64
It's now possible to build the whole kernel with an x86_64 toolchain.
There's no bootstrap code so it doesn't work yet (obviously.)
2021-03-04 18:25:01 +01:00
Nick Johnson
74881ac649
Kernel: Make InstructionFetch PageFault flags match up (#5608)
Previously, the instruction fetch flag of the page fault handler
did not have the currect binary representation, and would always
return false. This aligns these flags.
2021-03-03 11:04:51 +01:00
Ashleigh Newman-Jones
f0912027ff Kernel: Enable AVX flags if supported by cpu
This enables AVX and its dependency CR4.OSXSAVE when both are available on the cpu.
2021-03-02 16:35:06 +01:00
Tom
cbc450c24e Kernel: Fix KUBSAN warnings due to unaligned APIC variables 2021-02-28 15:27:53 +01:00
Tom
32d9534c67 Kernel: Fix GenericInterruptHandler problems with virtual functions
Because registering and unregistering interrupt handlers triggers
calls to virtual functions, we can't do this in the constructor
and destructor.

Fixes #5539
2021-02-28 15:27:53 +01:00
Andreas Kling
8eeb8db2ed Kernel: Don't disable interrupts while dealing with a process crash
This was necessary in the past when crash handling would modify
various global things, but all that stuff is long gone so we can
simplify crashes by leaving the interrupt flag alone.
2021-02-25 19:36:36 +01:00
Andreas Kling
8129f3da52 Kernel: Move SMAP disabler RAII helper to its own file
Added this in a new directory called Kernel/Arch/x86/ where stuff
that applies to both i386 and x86_64 can live.
2021-02-25 17:25:34 +01:00
Andreas Kling
8f70528f30 Kernel: Take some baby steps towards x86_64
Make more of the kernel compile in 64-bit mode, and make some things
pointer-size-agnostic (by using FlatPtr.)

There's a lot of work to do here before the kernel will even compile.
2021-02-25 16:27:12 +01:00
Andreas Kling
53c6c29158 Kernel: Tighten some typing in Arch/i386/CPU.h
Use more appropriate types for some things.
2021-02-25 11:32:27 +01:00
Andreas Kling
8706ccfadd Kernel: Remove unused Processor::set_thread_specific() 2021-02-25 09:57:32 +01:00
Andreas Kling
a0f4e50bef Kernel: Remove some unused cruft in Arch/i386/CPU.h 2021-02-25 09:16:46 +01:00
Andreas Kling
692bfc6ba2 Kernel: Fix some number typos in Arch/i386/boot.S 2021-02-24 11:40:31 +01:00
Andreas Kling
8cd5477e54 Kernel: Expand the kernel memory slot from 8 MiB to 16 MiB
We were only 448 KiB away from filling up the old slot size we reserve
for the kernel above the 3 GiB mark. This expands the slot to 16 MiB,
which allows us to continue booting the kernel until somebody takes
the time to improve our loader.
2021-02-23 21:50:18 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Andreas Kling
5100dabb96 Kernel: Copy the kernel command line to a good location at boot
When building the kernel with -O2, we somehow ended up with the kernel
command line outside of the lower 8MB of physical memory. Since we don't
map that area in our initial page table setup, we would triple fault
when trying to parse the command line.

This patch sidesteps the issue by copying the (first 4KB of) the kernel
command line to a buffer in a known safe location at boot.
2021-02-23 19:43:44 +01:00
Brian Gianforcaro
26bba8e100 Kernel: Populate ELF::AuxilaryValue::Platform from Processor object.
Move this to the processor object so it can easily be implemented
when Serenity is compiled for a different architecture.
2021-02-21 17:06:24 +01:00
Andreas Kling
1bc859fb68 Kernel: Make UNMAP_AFTER_INIT imply NEVER_INLINE as well
We want to make sure these functions actually do get unmapped. If they
were inlined somewhere, the inlined version(s) would remain mapped.

Thanks to "thislooksfun" for the suggestion! :^)
2021-02-21 00:43:29 +01:00
Andreas Kling
cc0f5917d3 Kernel: Slap a handful more things with UNMAP_AFTER_INIT 2021-02-20 00:00:19 +01:00
Andreas Kling
2b2828ae52 Kernel: Slap UNMAP_AFTER_INIT on a bunch more functions
We're now able to unmap 100 KiB of kernel text after init. :^)
2021-02-19 21:42:18 +01:00
Andreas Kling
fdf03852c9 Kernel: Slap UNMAP_AFTER_INIT on a whole bunch of functions
There's no real system here, I just added it to various functions
that I don't believe we ever want to call after initialization
has finished.

With these changes, we're able to unmap 60 KiB of kernel text
after init. :^)
2021-02-19 20:23:05 +01:00
Andreas Kling
32e93c8808 Kernel: Mark write_cr0() and write_cr4() as UNMAP_AFTER_INIT
This removes a very useful tool for attackers trying to disable
SMAP/SMEP/etc. :^)
2021-02-19 20:23:05 +01:00
Andreas Kling
6136faa4eb Kernel: Add .unmap_after_init section for code we don't need after init
You can now declare functions with UNMAP_AFTER_INIT and they'll get
segregated into a separate kernel section that gets completely
unmapped at the end of initialization.

This can be used for anything we don't need to call once we've booted
into userspace.

There are two nice things about this mechanism:

- It allows us to free up entire pages of memory for other use.
  (Note that this patch does not actually make use of the freed
  pages yet, but in the future we totally could!)

- It allows us to get rid of obviously dangerous gadgets like
  write-to-CR0 and write-to-CR4 which are very useful for an attacker
  trying to disable SMAP/SMEP/etc.

I've also made sure to include a helpful panic message in case you
hit a kernel crash because of this protection. :^)
2021-02-19 20:23:05 +01:00
Andreas Kling
da100f12a6 Kernel: Add helpers for manipulating x86 control registers
Use read_cr{0,2,3,4} and write_cr{0,3,4} helpers instead of inline asm.
2021-02-19 20:23:05 +01:00
Andreas Kling
5f610417d0 Kernel: Remove kprintf()
There are no remaining users of this API.
2021-02-17 16:33:43 +01:00
Andreas Kling
8ee42e47df Kernel: Mark a handful of things in CPU.cpp as READONLY_AFTER_INIT 2021-02-14 18:12:00 +01:00
Andreas Kling
f0a1d9bfa5 Kernel: Mark the x86 IDT as READONLY_AFTER_INIT
We never need to modify the interrupt descriptor table after finishing
initialization, so let's make it an error to do so.
2021-02-14 18:12:00 +01:00
Andreas Kling
a10accd48c Kernel: Print a helpful panic message for READONLY_AFTER_INIT crashes 2021-02-14 18:12:00 +01:00
Andreas Kling
d8013c60bb Kernel: Add mechanism to make some memory read-only after init finishes
You can now use the READONLY_AFTER_INIT macro when declaring a variable
and we will put it in a special ".ro_after_init" section in the kernel.

Data in that section remains writable during the boot and init process,
and is then marked read-only just before launching the SystemServer.

This is based on an idea from the Linux kernel. :^)
2021-02-14 18:11:32 +01:00
Andreas Kling
0e92a80434 Kernel: Add some bits of randomness to kernel stack pointers
Since kernel stacks are much smaller (64 KiB) than userspace stacks,
we only add a small bit of randomness here (0-256 bytes, 16b aligned.)

This makes the location of the task context switch buffer not be
100% predictable. Note that we still also add extra randomness upon
syscall entry, so this patch primarily affects context switching.
2021-02-14 12:30:07 +01:00
Andreas Kling
10b7f6b77e Kernel: Mark handle_crash() as [[noreturn]] 2021-02-14 11:47:14 +01:00
Andreas Kling
09b1b09c19 Kernel: Assert if rounding-up-to-page-size would wrap around to 0
If we try to align a number above 0xfffff000 to the next multiple of
the page size (4 KiB), it would wrap around to 0. This is most likely
never what we want, so let's assert if that happens.
2021-02-14 10:01:50 +01:00
Andreas Kling
b712345c92 Kernel: Use PANIC() in a bunch of places :^) 2021-02-14 09:36:58 +01:00
Andreas Kling
34a83aba71 Kernel: Convert klog() => dbgln()/dmesgln() in Arch/i386/CPU.cpp 2021-02-13 21:51:16 +01:00
Tom
b445f15131 Kernel: Avoid flushing the tlb if there's only one thread
If we're flushing user space pointers and the process only has one
thread, we do not need to broadcast this to other processors as
they will all discard that request anyway.
2021-02-13 19:46:45 +01:00
Andreas Kling
1f277f0bd9 Kernel: Convert all *Builder::appendf() => appendff() 2021-02-09 19:18:13 +01:00
Andreas Kling
f39c2b653e Kernel: Reorganize ptrace implementation a bit
The generic parts of ptrace now live in Kernel/Syscalls/ptrace.cpp
and the i386 specific parts are moved to Arch/i386/CPU.cpp
2021-02-08 19:34:41 +01:00
AnotherTest
09a43969ba Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`
2021-02-08 18:08:55 +01:00
AnotherTest
1f8a633cc7 Kernel: Make Arch/i386/CPU.cpp safe to run through clang-format
This file was far too messy, and touching it was a major pain.
Also enable clang-format linting on it.
2021-02-08 18:08:55 +01:00
Andreas Kling
b0b51c3955 Kernel: Limit the size of stack traces
Let's not allow infinitely long stack traces. Cap it at 4096 frames.
2021-02-02 18:58:26 +01:00
Tom
c531084873 Kernel: Track processor idle state and wake processors when waking threads
Attempt to wake idle processors to get threads to be scheduled more quickly.
We don't want to wait until the next timer tick if we have processors that
aren't doing anything.
2021-01-27 22:48:41 +01:00
Tom
e2f9e557d3 Kernel: Make Processor::id a static function
This eliminates the window between calling Processor::current and
the member function where a thread could be moved to another
processor. This is generally not as big of a concern as with
Processor::current_thread, but also slightly more light weight.
2021-01-27 21:12:24 +01:00
Tom
21d288a10e Kernel: Make Thread::current smp-safe
Change Thread::current to be a static function and read using the fs
register, which eliminates a window between Processor::current()
returning and calling a function on it, which can trigger preemption
and a move to a different processor, which then causes operating
on the wrong object.
2021-01-27 21:12:24 +01:00
Tom
f88a8b16d7 Kernel: Make entering and leaving critical sections atomic
We also need to store m_in_critical in the Thread upon switching,
and we need to restore it. This solves a problem where threads
moving between different processors could end up with an unexpected
value.
2021-01-27 21:12:24 +01:00
Tom
0bd558081e Kernel: Track previous mode when entering/exiting traps
This allows us to determine what the previous mode (user or kernel)
was, e.g. in the timer interrupt. This is used e.g. to determine
whether a signal handler should be set up.

Fixes #5096
2021-01-27 21:12:24 +01:00
asynts
7cf0c7cc0d Meta: Split debug defines into multiple headers.
The following script was used to make these changes:

    #!/bin/bash
    set -e

    tmp=$(mktemp -d)

    echo "tmp=$tmp"

    find Kernel \( -name '*.cpp' -o -name '*.h' \) | sort > $tmp/Kernel.files
    find . \( -path ./Toolchain -prune -o -path ./Build -prune -o -path ./Kernel -prune \) -o \( -name '*.cpp' -o -name '*.h' \) -print | sort > $tmp/EverythingExceptKernel.files

    cat $tmp/Kernel.files | xargs grep -Eho '[A-Z0-9_]+_DEBUG' | sort | uniq > $tmp/Kernel.macros
    cat $tmp/EverythingExceptKernel.files | xargs grep -Eho '[A-Z0-9_]+_DEBUG' | sort | uniq > $tmp/EverythingExceptKernel.macros

    comm -23 $tmp/Kernel.macros $tmp/EverythingExceptKernel.macros > $tmp/Kernel.unique
    comm -1 $tmp/Kernel.macros $tmp/EverythingExceptKernel.macros > $tmp/EverythingExceptKernel.unique

    cat $tmp/Kernel.unique | awk '{ print "#cmakedefine01 "$1 }' > $tmp/Kernel.header
    cat $tmp/EverythingExceptKernel.unique | awk '{ print "#cmakedefine01 "$1 }' > $tmp/EverythingExceptKernel.header

    for macro in $(cat $tmp/Kernel.unique)
    do
        cat $tmp/Kernel.files | xargs grep -l $macro >> $tmp/Kernel.new-includes ||:
    done
    cat $tmp/Kernel.new-includes | sort > $tmp/Kernel.new-includes.sorted

    for macro in $(cat $tmp/EverythingExceptKernel.unique)
    do
        cat $tmp/Kernel.files | xargs grep -l $macro >> $tmp/Kernel.old-includes ||:
    done
    cat $tmp/Kernel.old-includes | sort > $tmp/Kernel.old-includes.sorted

    comm -23 $tmp/Kernel.new-includes.sorted $tmp/Kernel.old-includes.sorted > $tmp/Kernel.includes.new
    comm -13 $tmp/Kernel.new-includes.sorted $tmp/Kernel.old-includes.sorted > $tmp/Kernel.includes.old
    comm -12 $tmp/Kernel.new-includes.sorted $tmp/Kernel.old-includes.sorted > $tmp/Kernel.includes.mixed

    for file in $(cat $tmp/Kernel.includes.new)
    do
        sed -i -E 's/#include <AK\/Debug\.h>/#include <Kernel\/Debug\.h>/' $file
    done

    for file in $(cat $tmp/Kernel.includes.mixed)
    do
        echo "mixed include in $file, requires manual editing."
    done
2021-01-26 21:20:00 +01:00
Tom
b580c005f1 Kernel: Fix possible context switch within first context switch of a thread
We were enabling interrupts too early, before the first context switch to
a thread was complete. This could then trigger another context switch
within the context switch, which lead to a crash.
2021-01-25 23:22:12 +01:00
asynts
8465683dcf Everywhere: Debug macros instead of constexpr.
This was done with the following script:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
2021-01-25 09:47:36 +01:00
asynts
1a3a0836c0 Everywhere: Use CMake to generate AK/Debug.h.
This was done with the help of several scripts, I dump them here to
easily find them later:

    awk '/#ifdef/ { print "#cmakedefine01 "$2 }' AK/Debug.h.in

    for debug_macro in $(awk '/#ifdef/ { print $2 }' AK/Debug.h.in)
    do
        find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/#ifdef '$debug_macro'/#if '$debug_macro'/' {} \;
    done

    # Remember to remove WRAPPER_GERNERATOR_DEBUG from the list.
    awk '/#cmake/ { print "set("$2" ON)" }' AK/Debug.h.in
2021-01-25 09:47:36 +01:00
Jean-Baptiste Boric
7eaefa5aa6 Kernel: Make use of interrupts as an entropy source
Booting old computers without RDRAND/RDSEED and without a disk makes
the system severely starved for entropy. Uses interrupts as a source
to side-step that issue.

Also warn whenever the system is starved of entropy, because that's
a non-obvious failure mode.
2021-01-24 22:16:18 +01:00
asynts
9d588cc9cc Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.
2021-01-22 22:14:30 +01:00
Andreas Kling
928ee2c791 Kernel: Don't let signals unblock threads while handling a page fault
It was possible to signal a process while it was paging in an inode
backed VM object. This would cause the inode read to EINTR, and the
page fault handler would assert.

Solve this by simply not unblocking threads due to signals if they are
currently busy handling a page fault. This is probably not the best way
to solve this issue, so I've added a FIXME to that effect.
2021-01-21 00:14:56 +01:00
Jean-Baptiste Boric
6677ab1ccd Boot: Fix undefined Multiboot behaviors
Both ESP and GDTR are left undefined by the Multiboot specification and
OS images must not rely on these values to be valid. Fix the undefined
behaviors so that booting with PXELINUX does not triple-fault the CPU.
2021-01-19 09:03:37 +01:00
Tom
b17a889320 Kernel: Add safe atomic functions
This allows us to perform atomic operations on potentially unsafe
user space pointers.
2021-01-17 20:30:31 +01:00
asynts
872f2a3b90 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.Everything:
2021-01-11 11:55:47 +01:00
asynts
11d651d447 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.Everything:
2021-01-11 11:55:47 +01:00
asynts
938e5c7719 Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it
easier to find potentially introduced bugs with git bisect.Everything:

The modifications in this commit were automatically made using the
following command:

    find . -name '*.cpp' -exec sed -i -E 's/dbg\(\) << ("[^"{]*");/dbgln\(\1\);/' {} \;
2021-01-09 21:11:09 +01:00
Tom
0d44ee6f2b Kernel: Ignore TLB flush requests for user addresses of other processes
If a TLB flush request is broadcast to other processors and the addresses
to flush are user mode addresses, we can ignore such a request on the
target processor if the page directory currently in use doesn't match
the addresses to be flushed. We still need to broadcast to all processors
in that case because the other processors may switch to that same page
directory at any time.
2021-01-02 20:56:35 +01:00