summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2021-07-05Kernel: Get rid of of some of the duplicate kernel base address macrosGunnar Beutner
2021-07-05Kernel: Merge the x86 and x86_64 boot code into a single fileGunnar Beutner
They're mostly the same apart from some x86_64-specific parts.
2021-07-05KeyboardSettings+Kernel: Setting to enable Num Lock on loginForLoveOfCats
2021-07-04Kernel: Implement buffer flipping for VirtIOGPU framebuffersTom
This solves tearing issues and improves performance when updating the VirtIOGPU framebuffers.
2021-07-04WindowServer: Query driver for framebuffer offsetTom
Depending on the driver, the second buffer may not be located right after the first, e.g. it may be page aligned. This removes this assumption and queries the driver for the appropriate offset.
2021-07-04WindowServer: Implement support for combined buffer flipping + flushingTom
Some devices may require DMA transfers to flush the updated buffer areas prior to flipping. For those devices we track the areas that require flushing prior to the next flip. For devices that do not support flipping, but require flushing, we'll simply flush after updating the front buffer. This also adds a small optimization that skips these steps entirely for a screen that doesn't have any updates that need to be rendered.
2021-07-04Everywhere: Fix incorrect usages of AK::CheckedIdan Horowitz
Specifically, explicitly specify the checked type, use the resulting value instead of doing the same calculation twice, and break down calculations to discrete operations to ensure no intermediary overflows are missed.
2021-07-04Kernel: Fix safe_memset not setting the last few bytes in some casesTom
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-04Kernel: Implement TLS support for x86_64Gunnar Beutner
2021-07-04Kernel: Hide the implementation detail that MSRs use two registersGunnar Beutner
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-04Kernel: Don't allow allocate_tls() if the process has multiple threadsGunnar Beutner
We can't safely update the other threads' FS selector. This shouldn't be a problem in practice because allocate_tls() is only used by the loader.
2021-07-04Kernel: Replace some hard-coded memory addresses with macrosGunnar Beutner
2021-07-03Kernel/x86_64: Halt if we happen to boot on non-x86_64 machineLiav A
2021-07-03Kernel/Graphics: Unblank the screen when initializing bochs displayLiav A
2021-07-03Kernel: Clarify and make it easy to not use raw numbersLiav A
Let's put the PCI IDs as enums in the PCI namespace so they're free to pollute that namespace, but it's also more easier to use them.
2021-07-03Kernel/Graphics: Assert if trying to initialize with the wrong driverLiav A
2021-07-03Kernel: Simplify graphics initialization somewhatLiav A
We use a switch-case statements to ensure we try to find the best suitable driver for a specific graphics card. In case we don't find such, we use the default statement to initialize the graphics card as a generic VGA adapter, if the adapter is VGA compatible. If we couldn't initialize the driver, we don't touch this adapter anymore. Also, GraphicsDevice should not be tied to a PCI::Address member, as it can be theortically be used with other buses (e.g. ISA cards).
2021-07-03Userland: Respect red-zone for signal handlersHediadyoin1
We were building with red-zone before, but were not accounting for it on signal handler entries. This should fix that. Also shorten the stack alignment calculations for this.
2021-07-02Kernel: Use the GS segment for the per-CPU structGunnar Beutner
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-03Kernel: Fix miscellaneous warnings when building with ClangDaniel Bertalan
These small changes fix the remaining warnings that come up during kernel compilation with Clang. These specific fixes were for benign things: unused lambda captures and braces around scalar initializers.
2021-07-03Kernel: Fix always-true comparison warningsDaniel Bertalan
2021-07-03Everywhere: Fix some alignment issuesDaniel Bertalan
When creating uninitialized storage for variables, we need to make sure that the alignment is correct. Fixes a KUBSAN failure when running kernels compiled with Clang. In `Syscalls/socket.cpp`, we can simply use local variables, as `sockaddr_un` is a POD type. Along with moving the `alignas` specifier to the correct member, `AK::Optional`'s internal buffer has been made non-zeroed by default. GCC emitted bogus uninitialized memory access warnings, so we now use `__builtin_launder` to tell the compiler that we know what we are doing. This might disable some optimizations, but judging by how GCC failed to notice that the memory's initialization is dependent on `m_has_value`, I'm not sure that's a bad thing.
2021-07-03Kernel: Fix struct forward declared as classDaniel Bertalan
2021-07-03Kernel: Add missing override specifiersDaniel Bertalan
The `#pragma GCC diagnostic` part is needed because the class has virtual methods with the same name but different arguments, and Clang tries to warn us that we are not actually overriding anything with these. Weirdly enough, GCC does not seem to care.
2021-07-02Kernel: Fix building the kernel with LTOGunnar Beutner
Fixes #8383.
2021-07-02Kernel/ProcFS: Lazily allocate all sub components of a PID folderLiav A
2021-07-02Kernel/ACPI: Don't ask from TypedMapping to map 2 pages if unnecessaryLiav A
2021-07-02Kernel/TypedMapping: Round up length with offset_in_pageLiav A
Fixes #6948.
2021-07-02Kernel/ProcFS: Clean dead processes properlyLiav A
Now we use WeakPtrs to break Ref-counting cycle. Also, we call the prepare_for_deletion method to ensure deleted objects are ready for deletion. This is necessary to ensure we don't keep dead processes, which would become zombies. In addition to that, add some debug prints to aid debug in the future.
2021-07-02Kernel/USB: Move the USB components as a subfolder to the Bus directoryLiav A
2021-07-02Kernel/PCI: Move the PCI components as a subfolder to the Bus directoryLiav A
2021-07-01Kernel: Don't byteswap the ISR number on interrupt entryGunnar Beutner
Let's just add the padding before we jump to interrupt_common_asm_entry.
2021-07-01Kernel: Handle OOM when allocating Thread FPUStateBrian Gianforcaro
Move FPUState allocation to Thread::try_create so that allocation failure can be observed properly by the caller.
2021-07-01Kernel: Only deallocate memory when alloc succeedsHendiadyoin1
Also make AllocationHeader acquisition from pointers more verbose
2021-07-01Kernel: Add support for 64-bit unaligned Mem-opsHendiadyoin1
Also let the compiler enforce the size and type restrictions
2021-07-01Kernel: Remove not needed comment in Processor.hHendiadyoin1
2021-07-01Kernel+LibPthread: Add support for usermode threads on x86_64Gunnar Beutner
2021-07-01Kernel+LibPthread: Remove m_ prefix for public membersGunnar Beutner
2021-07-01Kernel: Support starting up secondary processors on x86_64Hendiadyoin1
2021-06-30Kernel: Disable __thread and TLS on x86_64 for nowGunnar Beutner
They're not yet properly supported.
2021-06-30Kernel: Fix stack alignment on x86_64Gunnar Beutner
These were already properly aligned (as far as I can tell).
2021-06-30Kernel: Properly initialize r8-r15 for new threads on x86_64Gunnar Beutner
2021-06-30Kernel: Don't start usermode threads on x86_64 for nowGunnar Beutner
Starting usermode threads doesn't currently work on x86_64. With this stubbed out we can get text mode to boot though.
2021-06-30Kernel: Don't compile JsonValue & friends into the kernelAndreas Kling
2021-06-30AK+Everywhere: Use mostly StringView in LexicalPathMax Wipfli
This changes the m_parts, m_dirname, m_basename, m_title and m_extension member variables to StringViews onto the m_string String. It also removes the m_is_absolute member in favour of computing if a path is absolute in the is_absolute() getter. Due to this, the canonicalize() method has been completely rewritten. The parts() getter still returns a Vector<String>, although it is no longer a const reference as m_parts is no longer a Vector<String>. Rather, it is constructed from the StringViews in m_parts upon request. The parts_view() getter has been added, which returns Vector<StringView> const&. Most previous users of parts() have been changed to use parts_view(), except where Strings are required. Due to this change, it's is now no longer allow to create temporary LexicalPath objects to call the dirname, basename, title, or extension getters on them because the returned StringViews will point to possible freed memory.
2021-06-30AK+Everywhere: Add and use static APIs for LexicalPathMax Wipfli
The LexicalPath instance methods dirname(), basename(), title() and extension() will be changed to return StringView const& in a further commit. Due to this, users creating temporary LexicalPath objects just to call one of those getters will recieve a StringView const& pointing to a possible freed buffer. To avoid this, static methods for those APIs have been added, which will return a String by value to avoid those problems. All cases where temporary LexicalPath objects have been used as described above haven been changed to use the static APIs.
2021-06-30Kernel/PCI: Keep track of the currently mapped bus in MMIO modeLuke
There is a check in map_bus_region to make sure we don't pointlessly remap the bus region if the previous mapping was for the same bus. This is tracked with `m_mapped_bus`. However, nothing was actually updating `m_mapped_bus`, and it is initialised to 0. This means that if we start with a device on bus 0, the read in data will be valid. If we map say bus 1 then bus 0 again, the map for bus 0 will now be ignored and invalid data will be read in. Fixed by updating `m_mapped_bus` with the currently mapped bus.
2021-06-30Kernel/PCI: Don't unmap determine_memory_mapped_bus_region after initLuke
This can be accessed after init via lspci.
2021-06-30Kernel: Give Devices without a custody a less fake absoulte_pathAndrew Kaster
This hack allows self-test mode run-tests-and-shutdown.sh to give TestProcFs a stat(2)-able /proc/self/fd/0. For some reason, when stdin is a SerialDevice, /proc/self/fd/0 will be a symlink to the device as expected, but, calling realpath or stat on /proc/self/fd/0 will error out. realpath will give the string from Device::absolute_path() which would be something like "device:4,64 (SerialDevice)". When VFS is trying to resolve_path so that we can stat the file, it would bail out on this fake-y path. Change the fake path (that doesn't show up when you ls a device, nor when checking the devices tab in SystemMonitor) from the major/minor device number and class_name() to /dev/device_name(). There's probably a very hairy yak standing behind this issue that was only discovered due to the ProcFS rework.
2021-06-29Kernel: ProcFS and SysFS component indices should be InodeIndexAndreas Kling
This fixes the x86_64 kernel build. :^)