summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2020-05-08Kernel+Userland: Add "settime" pledge promise for setting system timeAndreas Kling
We now require the "settime" promise from pledged processes who want to change the system time.
2020-05-08Kernel: Only allow superuser to call sys$clock_settime()Andreas Kling
2020-05-08Kernel: Remove SmapDisabler in sys$clock_settime()Andreas Kling
2020-05-08Kernel: Assert on startup if we don't find any physical pagesAndreas Kling
Instead of checking this on every page allocation, just check it once on startup. :^)
2020-05-08Kernel: Add for_each_vmobject_of_type<T>Andreas Kling
This makes iterating over a specific type of VMObjects a bit nicer.
2020-05-08Services: Move Taskbar and SystemMenu from Applications to ServicesAndreas Kling
2020-05-08Services: Renamed from ServersAndreas Kling
It didn't feel right to have a "DHCPClient" in a "Servers" directory. Rename this to Services to better reflect the type of programs we'll be putting in there.
2020-05-08Kernel: Propagate failure to commit VM regions in more placesAndreas Kling
Ultimately we should not panic just because we can't fully commit a VM region (by populating it with physical pages.) This patch handles some of the situations where commit() can fail.
2020-05-08Kernel: Use NonnullRefPtrVector for HardwareTimer and HPETComparatorAndreas Kling
2020-05-08Kernel: Remove ref-counting from interrupt override metadataAndreas Kling
I don't see a reason for these to be reference-counted, and removing it simplifies a bunch of surrounding data structures.
2020-05-08Kernel: Use NonnullRefPtrVector<T> instead of Vector<RefPtr<T>> someAndreas Kling
2020-05-07Build: Support building in DockerYonatan Goldschmidt
Add missing installations to instructions, and use genext2fs instead of mounting.
2020-05-07Kernel: Memory purging was incorrectly "purging" the shared zero pageAndreas Kling
This caused us to report one purged page per occurrence of the shared zero page in a purgeable memory region, despite it being a no-op. Thanks to Sergey for spotting the bad assertion removal that led to this being found!
2020-05-06Kernel: Crash the current process on OOM (instead of panicking kernel)Andreas Kling
This patch adds PageFaultResponse::OutOfMemory which informs the fault handler that we were unable to allocate a necessary physical page and cannot continue. In response to this, the kernel will crash the current process. Because we are OOM, we can't symbolicate the crash like we normally would (since the ELF symbolication code needs to allocate), so we also communicate to Process::crash() that we're out of memory. Now we can survive "allocate 300 MB" (only the allocate process dies.) This is definitely not perfect and can easily end up killing a random innocent other process who happened to allocate one page at the wrong time, but it's a *lot* better than panicking on OOM. :^)
2020-05-06Kernel: Assert on OOM in Region::commit()Andreas Kling
This function has a lot of callers that don't bother checking if it returns successfully or not. We'll need to handle failure in a bunch of places and then we can remove this assertion.
2020-05-06Kernel: Don't assert on OOM in allocate_user_physical_page()Andreas Kling
We now give callers a chance to react to OOM situations.
2020-05-05LibCore: Add a standard downloads directory (~/Downloads)Andreas Kling
2020-05-04Kernel: Use Multiboot macros instead of magic constants (#2090)Nathan Lanza
MUTLIBOOT_FRAMEBUFFER_TYPE_{RGB,EGA_TEXT} are defined in the Multiboot.h header. Use those definitions instead of hard-coding 1 and 2.
2020-05-03Kernel: Don't crash on invalid fcntlBen Wiederhake
2020-05-03Kernel: Fix pledge syscall applying new pledges when it fails (#2076)Michael Lelli
If the exec promises fail to apply, then the normal promises should not apply either. Add a test for this fixed functionality.
2020-05-02Demos: Add a little "Mouse" demo for showing mouse button statesAndreas Kling
This was very helpful when adding support for 5-button mice! :^)
2020-05-02Kernel: Detect 5-button PS/2 mouse if present :^)Andreas Kling
The detection works very similarly to how we detect a mouse wheel, just another magical sequence of "set sample rate" requests to the mouse followed by an ID check.
2020-04-30AK: Add ALWAYS_INLINE, NEVER_INLINE and FLATTEN macrosAndreas Kling
It's tedious to write (and look at) [[gnu::always_inline]] etc. :^)
2020-04-29DisplaySettings: Rename from DisplayPropertiesAndreas Kling
2020-04-29Kernel: Fix integer overflow in framebuffer resolution handlingAndreas Kling
This made it possible to map the E1000 MMIO range into userspace and mess with the registers. Thanks to @grigoritchy for finding this! Fixes #2015.
2020-04-28Kernel: Be a little more defensive when indexing E1000 Rx/Tx buffersAndreas Kling
2020-04-28Kernel: Leave VMObject alone on OOM during CoW faultAndreas Kling
If we OOM during a CoW fault and fail to allocate a new page for the writing process, just leave the original VMObject alone so everyone else can keep using it.
2020-04-28Kernel: Add Region helpers for accessing underlying physical pagesAndreas Kling
Since a Region is basically a view into a potentially larger VMObject, it was always necessary to include the Region starting offset when accessing its underlying physical pages. Until now, you had to do that manually, but this patch adds a simple Region::physical_page() for read-only access and a physical_page_slot() when you want a mutable reference to the RefPtr<PhysicalPage> itself. A lot of code is simplified by making use of this.
2020-04-27Kernel: Update TimerQueue next due timer only when necessaryBrian Gianforcaro
Previously we blindly just called update_next_timer_due() when ever we modified the timer list. Since we know the list is sorted this is a bit wasteful, and we can do better. This change refactors the code so we only update the next due time when necessary. In places where it was possible the code was modified to directly modify the next due time, instead of having to go to the front of the list to fetch it.
2020-04-27Kernel: Expose timers via a TimerId typeBrian Gianforcaro
The public consumers of the timer API shouldn't need to know the how timer id's are tracked internally. Expose a typedef instead to allow the internal implementation to be protected from potential churn in the future. It's also just good API design.
2020-04-26Kernel: Enable timeout support for sys$futex(FUTEX_WAIT)Brian Gianforcaro
Utilize the new Thread::wait_on timeout parameter to implement timeout support for FUTEX_WAIT. As we compute the relative time from the user specified absolute time, we try to delay that computation as long as possible before we call into Thread::wait_on(..). To enable this a small bit of refactoring was done pull futex_queue fetching out and timeout fetch and calculation separation.
2020-04-26Kernel: Add timeout support to Thread::wait_onBrian Gianforcaro
This change plumbs a new optional timeout option to wait_on. The timeout is enabled by enqueing a timer on the timer queue while we are waiting. We can then see if we were woken up or timed out by checking if we are still on the wait queue or not.
2020-04-26Kernel: Refactor TimeQueue::add_timer to use timevalBrian Gianforcaro
The current API of add_timer makes it hard to use as you are forced to do a bunch of time arithmetic at the caller. Ideally we would have overloads for common time types like timespec or timeval to keep the API as straight forward as possible. This change moves us in that direction. While I'm here, we should really also use the machines actual ticks per second, instead of the OPTIMAL_TICKS_PER_SECOND_RATE.
2020-04-26Kernel: Make sys$sethostname() superuser-onlyAndreas Kling
Also take the hostname string lock exclusively.
2020-04-26Kernel: Added the ability to set the hostname via new syscallLuke Payne
Userland/hostname: Now takes parameter to set the hostname LibC/unistd: Added sethostname function
2020-04-26Kernel: Support signaling all processes with pid == -1Brian Gianforcaro
This is a special case that was previously not implemented. The idea is that you can dispatch a signal to all other processes the calling process has access to. There was some minor refactoring to make the self signal logic into a function so it could easily be easily re-used from do_killall.
2020-04-26Kernel: Implement FUTEX_WAKE of arbitrary count.Brian Gianforcaro
Previously we just woke all waiters no matter how many were requested. Fix this by implementing WaitQueue::wake_n(..).
2020-04-25LibPthread: implicitly call pthread_exit on return from start routine.Drew Stratford
Previously, when returning from a pthread's start_routine, we would segfault. Now we instead implicitly call pthread_exit as specified in the standard. pthread_create now creates a thread running the new pthread_create_helper, which properly manages the calling and exiting of the start_routine supplied to pthread_create. To accomplish this, the thread's stack initialization has been moved out of sys$create_thread and into the userspace function create_thread.
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.