summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2020-04-23Applications: Remove ChanViewer appAndreas Kling
The HTTP JSON API this relied on is no longer available via HTTP and I would rather make the website work in Browser anyway. :^)
2020-04-22Kernel: Make Process and Thread non-copyable and non-movableAndreas Kling
2020-04-20Build: Use the GCC port if building on "SerenityOS" :^)Andreas Kling
2020-04-20LibELF: Make ELF::Loader RefCountedItamar
2020-04-19Kernel: rmdir("/") should fail instead of assertingAndreas Kling
We can't assume there's always a parent custody -- when we open "/" there isn't gonna be one! Fixes #1858.
2020-04-19Demos: Add Screensaver demoBrendan Coles
2020-04-18Build: Make sure to create a /home/anon/Desktop directoryAndreas Kling
2020-04-18Kernel: Remove CommandLine::get() in favor of lookup()Andreas Kling
lookup() returns an Optional<String> which allows us to implement easy default values using lookup(key).value_or(default_value);
2020-04-18Kernel: Use shared locking mode in some placesSergey Bugaev
The notable piece of code that remains to be converted is Ext2FS.
2020-04-18Kernel: Introduce shared locking modeSergey Bugaev
A Lock can now be held either in shared or exclusive mode. Multiple threads can hold the same lock in shared mode at one time, but if any thread holds the lock in exclusive mode, no other thread can hold it at the same time in either mode.
2020-04-18Kernel: Compactify FileDescrptionSergey Bugaev
The next commit is going to make it bigger again by increasing the size of Lock, so make use of bitfields to make sure FileDescription still fits into 64 bytes, and so can still be allocated with the SlabAllocator.
2020-04-18Demos: Add 3D Cube DemoStephan Unverwerth
This renders a spinning 3D cube and demonstrates the 3D math classes from LibGfx.
2020-04-16Kernel: Fix dumb logic typo in HardwareTimer::handle_irq()Andreas Kling
2020-04-16Kernel: Rename HardwareTimer::change_function() => set_callback()Andreas Kling
Also make it non-virtual since nothing needs to override it.
2020-04-16Kernel: Remove "stale callback" concept from time managementAndreas Kling
If a hardware timer doesn't have a callback registered, it's now simply represented by a null m_callback.
2020-04-16Kernel: Rename HardwareTimer::m_function_to_call => m_callbackAndreas Kling
2020-04-16Kernel: Remove an unnecessary indirection between timer and schedulerAndreas Kling
We don't need a wrapper Function object that just forwards the timer callback to the scheduler tick function. It already has the same signature, so we can just plug it in directly. :^) Same with the clock updating function.
2020-04-16Kernel: Simplify the way we pass HardwareTimers around a bitAndreas Kling
Instead of passing around indices into the m_hardware_timers vector, just pass around a HardwareTimer* instead.
2020-04-15Kernel: Refuse to set overflowy resolution values in BXVGADeviceAndreas Kling
2020-04-15Kernel: Ensure that we receive IRQs in PIO mode when IOAPIC is enabledLiav A
The IOAPIC manual states that "Interrupt Mask-R/W. When this bit is 1, the interrupt signal is masked. Edge-sensitive interrupts signaled on a masked interrupt pin are ignored." - Therefore we have to ensure that we disable interrupts globally with cli(), but also to ensure that we invoke enable_irq() before sending the hardware command that generates an IRQ almost immediately.
2020-04-15Kernel: Restore ATA PIO functionalityLiav A
First, before this change, specifying 'force_pio' in the kernel commandline was meaningless because we nevertheless set the DMA flag to be enabled. Also, we had a problem in which we used IO::repeated_out16() in PIO write method. This might work on buggy emulators, but I suspect that on real hardware this code will fail. The most difficult problem was to restore the PIO read operation. Apparently, it seems that we can't use IO::repeated_in16() here because it will read zeroed data. Currently we rely on a simple loop that invokes IO::in16() to a buffer. Also, the interrupt handling stage in the PIO read method is moved to be handled inside the loop of reading the requested sectors.
2020-04-14Kernel: Don't include null terminator in sys$readlink() resultSergey Bugaev
POSIX says, "Conforming applications should not assume that the returned contents of the symbolic link are null-terminated." If we do include the null terminator into the returning string, Python believes it to actually be a part of the returned name, and gets unhappy about that later. This suggests other systems Python runs in don't include it, so let's do that too. Also, make our userspace support non-null-terminated realpath().
2020-04-14Kernel: Simplify sys$setgroups(0, ...)Andreas Kling
If we're dropping all groups, just clear the extra_gids and return.
2020-04-14Kernel: Remove SmapDisablers in {peek,poke}_user_data()Andreas Kling
2020-04-14Kernel: Remove SmapDisablers in sys$ptrace() implementationAndreas Kling
Instead, use copy_from_user() or copy_to_user() which does additional verification and will panic the kernel on attempted kernel access.
2020-04-14Kernel: Fix little mistakes in ptrace(PT_PEEK)Andreas Kling
Output address validation should be done for the tracer's address space and not the tracee's. Also use copy_to_user() instead of copy_from_user(). The two are really identical at the moment, but maybe we can add some assertions to make sure we're doing what we think we're doing. Thanks to Sergey for spotting these!
2020-04-13CPU: Handle Debug exceptionItamar
We currently only care about debug exceptions that are triggered by the single-step execution mode. The debug exception is translated to a SIGTRAP, which can be caught and handled by the tracing thread.
2020-04-13Kernel: Don't ignore validation result in ptrace(PT_PEEK)Andreas Kling
Also mark all of the address validation functions [[nodiscard]] to turn this kind of bug into a compile error in the future.
2020-04-13Kernel: Use copy_from_user() in ptrace(PT_PEEK)Andreas Kling
2020-04-13Kernel: Switch the first-8MB-of-upper-3GB pseudo mappings to 4KB pagesAndreas Kling
This memory range was set up using 2MB pages by the code in boot.S. Because of that, the kernel image protection code didn't work, since it assumed 4KB pages. We now switch to 4KB pages during MemoryManager initialization. This makes the kernel image protection code work correctly again. :^)
2020-04-13Debugger: Add DebugSessionItamar
The DebugSession class wraps the usage of Ptrace. It is intended to be used by cli & gui debugger programs. Also, call objdump for disassemly
2020-04-13ptrace: Report error in PT_PEEK via errnoItamar
The syscall wrapper for ptrace needs to return the peeked value when using PT_PEEK. Because of this, the user has to check errno to detect an error in PT_PEEK. This commit changes the actual syscall's interface (only for PT_PEEK) to allow the syscall wrapper to detect an error and change errno.
2020-04-13Process: Fix siginfo for code CLD_STOPPEDItamar
si_code, si_status where swapped
2020-04-13ptrace: Add PT_SETREGSItamar
PT_SETTREGS sets the regsiters of the traced thread. It can only be used when the tracee is stopped. Also, refactor ptrace. The implementation was getting long and cluttered the alraedy large Process.cpp file. This commit moves the bulk of the implementation to Kernel/Ptrace.cpp, and factors out peek & poke to separate methods of the Process class.
2020-04-13ptrace: Stop a traced thread when it exists from execveItamar
This was a missing feature in the PT_TRACEME command. This feature allows the tracer to interact with the tracee before the tracee has started executing its program. It will be useful for automatically inserting a breakpoint at a debugged program's entry point.
2020-04-13Thread: Set m_blocker to null in Thread::unblock()Itamar
Before this commit, m_blocker was only set to null in Thread::block, after the thread has been unblocked. Starting with this commit, m_blocker is also set to null in Thread::unblock. This change will allow us to implement a missing feature of the PT_TRACE command of the ptrace syscall - stopping the traced thread when it exits the execve syscall. That feature will be implemented by sending a blocking SIGSTOP to the traced thread after it has executed the execve logic and before it starts executing the new program in userspace. However, since Process::exec arranges the tss to return to userspace (the so-called "yield-teleport"), the code in Thread::block that should be run after the thread unblocks, and sets m_blocker to null, never actually runs. Setting m_blocker to null in Thread::unblock allows us to avoid an incorrect state where the thread is in a Running state but conatins a pointer to a Blocker.
2020-04-13ptrace: Add PT_POKEItamar
PT_POKE writes a single word to the tracee's address space. Some caveats: - If the user requests to write to an address in a read-only region, we temporarily change the page's protections to allow it. - If the user requests to write to a region that's backed by a SharedInodeVMObject, we replace the vmobject with a PrivateIndoeVMObject.
2020-04-13ptrace: Add PT_PEEKItamar
PT_PEEK reads a single word from the tracee's address space and returns it to the tracer.
2020-04-13CPU: Handle breakpoint trapItamar
Also, start working on the debugger app.
2020-04-12Kernel+LibC: Add minherit() and MAP_INHERIT_ZEROAndreas Kling
This patch adds the minherit() syscall originally invented by OpenBSD. Only the MAP_INHERIT_ZERO mode is supported for now. If set on an mmap region, that region will be zeroed out on fork().
2020-04-12Kernel: Bump the max stack frame count in sample profiles to 50Andreas Kling
Maybe this should be configurable, who knows. For now, 50 works a bit better for highly nested scenarios like LibJS.
2020-04-11Kernel: Store previous thread state upon all transitions to Stopped (#1753)Peter Nelson
We now store the previous thread state in m_stop_state for all transitions to the Stopped state via Thread::set_state. Fixes #1752 whereupon resuming a thread that was stopped with SIGTSTP, the previous state of the thread is not remembered correctly, resulting in m_stop_state == State::Invalid and the associated assertion fails.
2020-04-11LibELF: Move validation methods to their own fileAndrew Kaster
These validate_elf_* methods really had no business being static methods of ELF::Image. Now that the ELF namespace exists, it makes sense to just move them to be free functions in the namespace.
2020-04-11LibELF: Move ELF classes into namespace ELFAndrew Kaster
This is for consistency with other namespace changes that were made a while back to the other libraries :)
2020-04-11Kernel: Include the current instruction pointer in profile samplesAndreas Kling
We were missing the innermost instruction pointer when sampling. This makes the instruction-level profile info a lot cooler! :^)
2020-04-11Kernel: Add $SERENITY_KERNEL_CUSTOM_{CXXFLAGS/LDFLAGS} for build customizationBrian Gianforcaro
I normally want to build with debug symbols for the kernel so I can use a debugger. Add a hook to allow me to do so, but to impact no-one else.
2020-04-11MenuApplets: Rename CPUGraph to ResourceGraphLinus Groh
The plan is to extend what currently is known as "CPUGraph" and let the SystemServer spawn multiple instances of it - which then can show memory or network usages as well :^) Simply renaming the applet is the first step.
2020-04-11Kernel: Instantiate network adapters in their own detect() methodsLiav A
This commit is one step forward for pluggable driver modules. Instead of creating instances of network adapter classes, we let their detect() methods to figure out if there are existing devices to initialize.
2020-04-11Kernel: Keep records of PCI::Address & PCI::ID pairs for enumerationLiav A
2020-04-11Kernel: Simplify a message in PATAChannel::create()Liav A