summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2020-09-02Kernel: Prevent recursive expansion or removing memory while expanding itTom
The process of expanding memory requires allocations and deallocations on the heap itself. So, while we're trying to expand the heap, don't remove memory just because we might briefly not need it. Also prevent recursive expansion attempts.
2020-09-01Kernel: Fix memory purge clobbering mapped page directory in ensure_pteTom
If allocating a page table triggers purging memory, we need to call quickmap_pd again to make sure the underlying physical page is remapped to the correct one. This is needed because purging itself may trigger calls to ensure_pte as well. Fixes #3370
2020-09-01Kernel: Remove assertion from Region::commitTom
We should be able to gracefully fail a commit in low-memory situations.
2020-09-01Kernel: Only remap regions if memory was purged from themTom
2020-09-01Kernel: Preserve internal state in cloned PurgeableVMObjectsAndreas Kling
When cloning a purgeable memory region (which happens on fork), we need to preserve the "was purged" and "volatile" state of the original region, or they will always appear as non-volatile and unpurged regions in the child process. Fixes #3374.
2020-09-01Build: Add some -Wno-unknown-warning-option flags to CXXFLAGSAndreas Kling
Patch from Anonymous.
2020-08-31Kernel: Fix Processor::features_string() stopping too early and detect more ↵Luke
features The exit condition for the loop was sizeof(m_features) * 8, which was 32. Presumably this was supposed to mean 32 bits, but it actually made it stop as soon as it reached the 6th bit. Also add detection for more SIMD CPU features.
2020-08-31Kernel: Add more detailed debug output for E1000 {in,out}{8,16,32}Luke
Also adds FIXME for VirtualBox.
2020-08-30Kernel+LibC+UE: Implement sleep() via sys$clock_nanosleep()Andreas Kling
This doesn't need to be its own syscall either. :^)
2020-08-30Kernel: Remove unused variable PhysicalRegion::m_lastAndreas Kling
2020-08-30Kernel: Make Heap implementation reusable, and make kmalloc expandableTom
Add an ExpandableHeap and switch kmalloc to use it, which allows for the kmalloc heap to grow as needed. In order to make heap expansion to work, we keep around a 1 MiB backup memory region, because creating a region would require space in the same heap. This means, the heap will grow as soon as the reported utilization is less than 1 MiB. It will also return memory if an entire subheap is no longer needed, although that is rarely possible.
2020-08-30Kernel+LibC+UE: Implement usleep() via sys$clock_nanosleep()Andreas Kling
This doesn't need to be its own syscall. Thanks @BenWiederhake for the idea. :^)
2020-08-30Kernel: Add shutdown commands for other virtualizersLuke
Source: https://wiki.osdev.org/Shutdown
2020-08-30Kernel: Explain correctness of reference to local lambdaBen Wiederhake
2020-08-30Kernel: Unbreak building with extra debug macros, part 2Ben Wiederhake
2020-08-30Kernel: Unbreak building with extra debug macros, part 1Ben Wiederhake
2020-08-29FileSystem: Convert file types to DT_* types at a later stageItamar
A change introduced in 5e01234 made it the resposibility of each filesystem to have the file types returned from 'traverse_as_directory' match up with the DT_* types. However, this caused corruption of the Ext2FS file format because the Ext2FS uses 'traverse_as_directory' internally when manipulating the file system. The result was a mixture between EXT2_FT_* and DT_* file types in the internal Ext2FS structures. Starting with this commit, the conversion from internal filesystem file types to the user facing DT_* types happens at a later stage, in the 'FileDescription::get_dir_entries' function which is directly used by sys$get_dir_entries.
2020-08-28Ext2FS: Make reported file_type values match up with those in direntItamar
This fixes an issue we had in the git port where git would not recognize untracked files (for example in 'git status'). When git used readdir, the 'd_type' field in the dirent struct contained bad values (Specifically, it contained the values defiend in Kernel/FileSystem/ext2_fs.h instead of the ones in LibC/dirent.h). After this fix, we can create a new git repository with 'git init', and then stage and commit files as usual.
2020-08-28Kernel: Release page tables when no longer neededTom
When unmapping regions, check if page tables can be freed. This is a follow-up change for #3254.
2020-08-28Kernel: Remove the enabled concept of IRQ handlersLiav A
An IRQ handler should always be ready to respond to any IRQ. We must remember that hardware can generate IRQs without any interaction from our code at all. Ignoring IRQs in such cases is obviously not the right thing to do.
2020-08-28Kernel: Add and remove explicit keyword where neededLiav A
2020-08-26Kernel: Minor tweak to now() computationNico Weber
Make sure the expression is evaluated as time_t so that it does the right thing after 2037, and factor things so that the constants look less magical.
2020-08-26AK+LibCore+Kernel: Have fewer implementations of day_of_yearNico Weber
The JS tests pointed out that the implementation in DateTime had an off-by-one in the month when doing the leap year check, so this change fixes that bug.
2020-08-26AK+LibC+Kernel: Have fewer implementations of year_to_days_in_epochNico Weber
I believe the implementation in RTC.cpp had an off-by-one in the year passed to is_leap_year(). If that's true, then this fixes that too.
2020-08-26AK+LibC+LibCore+Kernel: Have fewer implementations of is_leap_yearNico Weber
2020-08-26Kernel: Fix losing PTEsTom
We can't use a HashMap with a small key that doesn't guarantee collisions. Change it to a HashTable instead. Fixes #3254
2020-08-26Kernel: Protect looping over VMObject regionsTom
We need to hold the memory manager lock so nobody else can modify these lists while we're iterating them.
2020-08-25AK: Add Endian.h header to replace NetworkOrdered.h.asynts
2020-08-25Kernel: Optimize SlabAllocator to be lock-freeTom
2020-08-25Kernel: Copy command line to a safe placeTom
This avoids kmalloc overwriting it because it may be within the kmalloc or eternal pool.
2020-08-25Kernel: Switch singletons to use new Singleton classTom
MemoryManager cannot use the Singleton class because MemoryManager::initialize is called before the global constructors are run. That caused the Singleton to be re-initialized, causing it to create another MemoryManager instance. Fixes #3226
2020-08-25Kernel: Fix kmalloc memory corruptionTom
Rather than hardcoding where the kmalloc pool should be, place it at the end of the kernel image instead. This avoids corrupting global variables or other parts of the kernel as it grows. Fixes #3257
2020-08-25Kernel: Make PhysicalPage not movable and use atomic ref countingTom
We should not be moving ref-counted objects.
2020-08-25Kernel: Scroll wheel amount on Intellimouse is 4 bits instead of 8Luke
When trying to scroll up on virtualizers that don't use the VMware backdoor and instead use PS2MouseDevice, it would actually scroll down rapidly. Looking into it, the mouse delta for scrolling down was 1 and 15 for scrolling up. 15 is suspiciously -1 for a nibble. According to https://isdaman.com/alsos/hardware/mouse/ps2interface.htm the Z is actually 4 bits for Intellimouse. This fixes scrolling up on virtualizers such as VirtualBox.
2020-08-24Kernel: Remove strcpy()Ben Wiederhake
These are not called in the kernel or by libstdc++ anyway. Remove the tempting function, and prevent future overflows.
2020-08-23Kernel: Avoid some allocations in command line parsing (#3213)Muhammad Zahalqa
1. Preallocate args hashmap to prevent rehashing. 2. Use move to prevent string copies.
2020-08-23Ext2FS: Fix build with EXT2_DEBUGAndreas Kling
2020-08-22Kernel: Stop supporting sprintfBen Wiederhake
The kernel no longer needs sprintf (which might, in theory, overflow), so we can hide the C++ declaration and make the function uncallable from within the kernel. However, libstdc++ still links against it, as libstdc++ uses it for demangling, from AK::demangle().
2020-08-22Kernel: Prefer snprintf over sprintfBen Wiederhake
2020-08-22AK+Kernel: Support snprintfBen Wiederhake
In contrast to sprintf, which might overflow the given buffer. I feel bad about the code duplication, but that is a pre-existing issue.
2020-08-22Revert "Kernel: Switch singletons to use new Singleton class"Andreas Kling
This reverts commit f48feae0b2a300992479abf0b2ded85e45ac6045.
2020-08-22Kernel: Make Process::dump_regions() sort the regions before dumpingAndreas Kling
2020-08-22Kernel: Prevent confusing silent misuse of PCI::AddressBen Wiederhake
2020-08-22Revert "Kernel: Move Singleton class to AK"Andreas Kling
This reverts commit f0906250a181c831508a45434b9f645ff98f33e4.
2020-08-22Revert "Kernel: Fix regression where MemoryManager is initialized twice"Andreas Kling
This reverts commit 8a75e0b892ab8e1c4765ac4e2f7289b258f1bf5a.
2020-08-22Revert "AK: Get rid of make_singleton function"Andreas Kling
This reverts commit 5a98e329d157a2db8379e0c97c6bdc1328027843.
2020-08-22Revert "Kernel: Copy command line to a safe place"Andreas Kling
This reverts commit 41c005cb140c8a9ae94e6b68456d8d6f1d925a8f.
2020-08-22Revert "Kernel: Make PhysicalPage not movable and use atomic ref counting"Andreas Kling
This reverts commit a89ccd842becdfbc951436da5384d8819374e0f4.
2020-08-22Revert "Kernel: Fix kmalloc memory corruption"Andreas Kling
This reverts commit b306f240a4a3ef4a8f5797734457572e0026cc0c.
2020-08-22Kernel: Fix kmalloc memory corruptionTom
Rather than hardcoding where the kmalloc pool should be, place it at the end of the kernel image instead. This avoids corrupting global variables or other parts of the kernel as it grows. Fixes #3257