summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2019-11-08Kernel: Fix the search method of free userspace physical pages (#742)Liav A
Now the userspace page allocator will search through physical regions, and stop the search as it finds an available page. Also remove an "address of" sign since we don't need that when counting size of physical regions
2019-11-08Kernel: Removing hardcoded offsets from Memory Managersupercomputer7
Now the kernel page directory and the page tables are located at a safe address, to prevent from paging data colliding with garbage.
2019-11-08Kernel: Remove debug spam about dump_backtrace() calling itselfAndreas Kling
This was too noisy and important-sounding, when it doesn't really matter that much. It's not the end of the world if symbolication fails for one reason or another.
2019-11-06Kernel: If a process is interrupted during usleep(), return -EINTRAndreas Kling
2019-11-06Kernel: A running process should keep its TTY aliveAndreas Kling
It's not safe to use a raw pointer for Process::m_tty. A pseudoterminal pair will disappear when file descriptors are closed, and we'd end up looking dangly. Just use a RefPtr.
2019-11-06Kernel: Rework Process::Priority into ThreadPriorityAndreas Kling
Scheduling priority is now set at the thread level instead of at the process level. This is a step towards allowing processes to set different priorities for threads. There's no userspace API for that yet, since only the main thread's priority is affected by sched_setparam().
2019-11-06AK: Remove unused AK::not_implemented()Andreas Kling
Whatever this was supposed to be, it was ironically... not implemented.
2019-11-06Kernel: Sort the C++ objects in the MakefileAndreas Kling
2019-11-06LibELF: Move AK/ELF/ into Libraries/LibELF/Andreas Kling
Let's arrange things like this instead. It didn't feel right for all of the ELF handling code to live in AK.
2019-11-06Kernel: Remove unnecessary init_ksyms() functionAndreas Kling
2019-11-06Kernel: Don't instantiate and throw away ProcFS + DevPtsFS on bootAndreas Kling
Oops, we were creating these and then throwing them away. They will get instantiated a bit later, when we bring up the mounts in /etc/fstab from userspace.
2019-11-06Kernel: Simplify kernel entry points slightlyAndreas Kling
It was silly to push the address of the stack pointer when we can also just change the callee argument to be a value type.
2019-11-06Kernel: Link with libgccAndreas Kling
This allows us to get rid of all the custom 64-bit division helpers. I wanted to do this ages ago but couldn't get it working. Turns out it was unstable due to libgcc using the regular ABI and the kernel being built with -mregparm=3. Now that we build the kernel with regular calls, we can just link with libgcc and get this stuff for free. :^)
2019-11-06Kernel: Don't build with -mregparm=3Andreas Kling
It was really confusing to have different calling conventions in kernel and userspace. Also this has prevented us from linking with libgcc.
2019-11-06Kernel: Use KParams::has() instead of !KParams::get().is_null()Andreas Kling
Also rename a local variable to be consistent with what it represents.
2019-11-06Kernel+SystemServer: Get rid of two virtual consolesAndreas Kling
Having four virtual (text) consoles by default seems really overkill for a system that can't even switch to them anyway (yet!)
2019-11-06Kernel: Remove unused SynthFS filesystemAndreas Kling
This used to be the base class of ProcFS and DevPtsFS but not anymore.
2019-11-05Kernel: Implement O_DIRECT open() flag to bypass disk cachesAndreas Kling
Files opened with O_DIRECT will now bypass the disk cache in read/write operations (though metadata operations will still hit the disk cache.) This will allow us to test actual disk performance instead of testing disk *cache* performance, if that's what we want. :^) There's room for improvment here, we're very aggressively flushing any dirty cache entries for the specific block before reading/writing that block. This is done by walking the entire cache, which may be slow.
2019-11-05run: Unbreak the run scriptAndreas Kling
2019-11-05run: Comment out qemu packet captureDan MacDonald
2019-11-04Janitorial: Have sync.sh sudo automagicallyYour Name
Run sudo and keep environment just like in makeall.sh
2019-11-04ProcFS: Fix Clang build (or really, Qt Creator syntax highlighting)Andreas Kling
The Clang parser used by Qt Creator kept getting confused by this code.
2019-11-04Ext2FS: Don't uncache inodes while they are being watchedAndreas Kling
If an inode is observed by watch_file(), we won't uncache it. This allows a program to watch a file without keeping it open.
2019-11-04PATAChannel: Alert user when no PCI device is foundJesse Buhagiar
This helps aid debugging of issues such as #695, where the bridge chip that controls IDE is NOT a PIIX3/4 compatible controller. Instead of just hanging when the DMA registers can't be accessed, the system will inform the user that no valid IDE controller has been found. In this case, the system will not attempt to initialise the DMA registers and instead use PIO mode.
2019-11-04Kernel: Make File's can_read/can_write take a const FileDescription&Andreas Kling
Asking a File if we could possibly read or write it will never mutate the asking FileDescription&, so it should be const.
2019-11-04Kernel: Don't update fd offset on read/write errorAndreas Kling
If something goes wrong with a read or write operation, we don't want to add the error number to the fd's offset. :^)
2019-11-04IPv4: Non-blocking IPv4 sockets should return -EAGAIN in recvfrom()Andreas Kling
...if there are no packets in the receive queue.
2019-11-04run: Only enable KVM if /dev/kvm is r/w for the current userAndreas Kling
2019-11-04Ext2FS: Uncache unused Inodes after flushing contents to diskAndreas Kling
Don't keep Inodes around in memory forever after we've interacted with them once. This is a slight performance pessimization when accessing the same file repeatedly, but closing it for a while in between. Longer term we should find a way to keep a limited number of unused Inodes cached, whichever ones we think are likely to be used again.
2019-11-04Kernel: Reorganize memory layout a bitAndreas Kling
Move the kernel image to the 1 MB physical mark. This prevents it from colliding with stuff like the VGA memory. This was causing us to end up with the BIOS screen contents sneaking into kernel memory sometimes. This patch also bumps the kmalloc heap size from 1 MB to 3 MB. It's not the perfect permanent solution (obviously) but it should get the OOM monkey off our backs for a while.
2019-11-04Kernel: Fix bug in Thread::dispatch_signal().Drew Stratford
dispatch_signal() expected a RegisterDump on the kernel stack. However in certain cases, like just after a clone, this was not the case and dispatch_signal() would instead write to an incorrect user stack pointer. We now use the threads TSS in situations where the RegisterDump may not be valid, fixing the issue.
2019-11-04Thread.cpp: add method get_RegisterDump_from_stack().Drew Stratford
This refactors some the RegisterDump code from dispatch_signal into a stand-alone function, allowing for better reuse.
2019-11-04Kernel: Tweak some outdated kprintfs in RegionAndreas Kling
2019-11-04Kernel: Move page fault handling from MemoryManager to RegionAndreas Kling
After the page fault handler has found the region in which the fault occurred, do the rest of the work in the region itself. This patch also makes all fault types consistently crash the process if a new page is needed but we're all out of pages.
2019-11-04Kernel: Don't expose a region's page directory to the outside worldAndreas Kling
Now that region manages its own mapping/unmapping, there's no need for the outside world to be able to grab at its page directory.
2019-11-04Kernel: Remove Region API's for setting/unsetting the page directoryAndreas Kling
This is done implicitly by mapping or unmapping the region.
2019-11-04Kernel: Fix weird Region constructor that took nullable RefPtr<Inode>Andreas Kling
It's never valid to construct a Region with a null Inode pointer using this constructor, so just take a NonnullRefPtr<Inode> instead.
2019-11-04Kernel: Merge MemoryManager::map_region_at_address() into Region::map()Andreas Kling
2019-11-03Kernel: Fix bad setup of CoW faults for offset regionsAndreas Kling
Regions with an offset into their VMObject were incorrectly adding the page offset when indexing into the CoW bitmap.
2019-11-03Kernel: Set the G (global) bit for kernel page tablesAndreas Kling
Since the kernel page tables are shared between all processes, there's no need to (implicitly) flush the TLB for them on every context switch. Setting the G bit on kernel page tables allows the CPU to keep the translation caches around.
2019-11-03Kernel: Teach Region how to remap itselfAndreas Kling
Now remapping (i.e flushing kernel metadata to the CPU page tables) is done by simply calling Region::remap().
2019-11-03Kernel: Regions should be mapped into a PageDirectory, not a ProcessAndreas Kling
This patch changes the parameter to Region::map() to be a PageDirectory since that matches how we think about the memory model: Regions are views onto VMObjects, and are mapped into PageDirectories. Each Process has a PageDirectory. The kernel also has a PageDirectory.
2019-11-03Kernel: Move region map/unmap operations into the Region classAndreas Kling
The more Region can take care of itself, the better.
2019-11-03ProcFS: Identify virtual filesystems' device in df (#728)Alexander
2019-11-03Kernel: Clean up a bunch of wrong-looking Region/VMObject codeAndreas Kling
Since a Region is merely a "window" onto a VMObject, it can both begin and end at a distance from the VMObject's boundaries. Therefore, we should always be computing indices into a VMObject's physical page array by adding the Region's "first_page_index()". There was a whole bunch of code that forgot to do that. This fixes many wrong behaviors for Regions that start part-way into a VMObject.
2019-11-03Kernel: Move page remapping into Region::remap_page(index)Andreas Kling
Let Region deal with this, instead of everyone calling MemoryManager.
2019-11-03Kernel: Remove nonsense in bootstrap codeAndreas Kling
This code was not doing anything important. Since we're building the kernel with -mregparm=3, the first function argument goes in %eax.
2019-11-03Ext2FS: Lock the filesystem during initialization and during syncAndreas Kling
If we get preempted during initialization, we really don't want to try doing a sync on a partially-initialized filesystem.
2019-11-03Kernel: Prevent kprintf() from asserting in Console::the() (#718)Nicolas Van Bossuyt
This triggered a stack overflow because ubsan can call kprintf() at any time, even before Console is initialized.
2019-11-03Build: Fix more bugs in the POSIX sh-ification of scriptsAndreas Kling