summaryrefslogtreecommitdiff
path: root/Kernel
AgeCommit message (Collapse)Author
2019-11-22Kernel: Move Kernel mapping to 0xc0000000Jesse Buhagiar
The kernel is now no longer identity mapped to the bottom 8MiB of memory, and is now mapped at the higher address of `0xc0000000`. The lower ~1MiB of memory (from GRUB's mmap), however is still identity mapped to provide an easy way for the kernel to get physical pages for things such as DMA etc. These could later be mapped to the higher address too, as I'm not too sure how to go about doing this elegantly without a lot of address subtractions.
2019-11-21Ext2FileSystem: set_metadata_dirty(true) during write_directory().Drew Stratford
This adds a call to set_metadata_dirty(true) to Ext2FS::write_directory(). This fixes a bug wherein InodeWatchers weren't alerted on directory updates.
2019-11-21Kernel: Build with -fno-asynchronous-unwind-tablesAndreas Kling
We'll never use exceptions in the kernel, so there's no need for unwind tables and we can save ourselves some space.
2019-11-19Kernel: Don't interrupt short writesSergey Bugaev
Remove explicit checking for pending signals from writing code paths, since this is handled automatically when blocking, and should not happen if the write() call is "short", i.e. doesn't block. All the other syscalls already work like this. Fixes https://github.com/SerenityOS/serenity/issues/797
2019-11-18IPv4: Disconnected non-blocking sockets were not signalling EOFAndreas Kling
After a socket has disconnected, we shouldn't return -EAGAIN. Instead we should allow userspace to read/recvfrom the socket until its packet queue has been exhausted. At that point, we now return 0, signalling EOF. It might be even better to start returning -ENOTCONN after signalling EOF once. I'm not sure how that should work, needs looking into.
2019-11-18Build: Oops, typo in the path to LibHTML code generators in makeall.shAndreas Kling
This worked locally because I already had the built generators lying around, but failed for other people who hadn't built them yet. Oops!
2019-11-18LibHTML: Let's just build host-side tools in makeall.sh insteadAndreas Kling
Instead of trying to build the host-side code generator helpers right before we need them in the LibHTML build process, just build them ahead of time in makeall.sh, like we already do for {IPC,Form}Compiler.
2019-11-18Kernel: When userspaces calls a removed syscall, fail with ENOSYSAndreas Kling
This is a bit gentler than jumping to 0x0, which always crashes the whole process. Also log a debug message about what happened, and let the user know that it's probably time to rebuild the program.
2019-11-18Kernel+LibPthread: pthread_create handles pthread_attr_tAndrew Kaster
Add an initial implementation of pthread attributes for: * detach state (joinable, detached) * schedule params (just priority) * guard page size (as skeleton) (requires kernel support maybe?) * stack size and user-provided stack location (4 or 8 MB only, must be aligned) Add some tests too, to the thread test program. Also, LibC: Move pthread declarations to sys/types.h, where they belong.
2019-11-17Kernel+LibC: Remove the isatty() syscallAndreas Kling
This can be implemented entirely in userspace by calling tcgetattr(). To avoid screwing up the syscall indexes, this patch also adds a mechanism for removing a syscall without shifting the index of other syscalls. Note that ports will still have to be rebuilt after this change, as their LibC code will try to make the isatty() syscall on startup.
2019-11-17Kernel: Let's have sys$uname() report "i686" instead of "i386"Andreas Kling
We wouldn't be able to run on an 80386 without considerable changes, so let's be honest here and call it i686.
2019-11-17Ext2FS: Rename allocate_inode() => find_a_free_inode()Andreas Kling
Since this function doesn't actually mark the inode as allocated, let's tone down the name a little bit.
2019-11-17Ext2FS: Writing to a slow symlink should not treat it like a fast oneAndreas Kling
We would misinterpret short writes to the first 60 bytes of a slow symlink as writes to a fast symlink.
2019-11-17Ext2FS: Remove unnecessary extra cache lookup in get_inode()Andreas Kling
2019-11-17Ext2FS: Add some FIXME's while browsing this codeAndreas Kling
2019-11-17Kernel: Just hang if VFS::mount_root() failsAndreas Kling
2019-11-17Kernel+LibPthread+LibC: Create secondary thread stacks in userspaceAndreas Kling
Have pthread_create() allocate a stack and passing it to the kernel instead of this work happening in the kernel. The more of this we can do in userspace, the better. This patch also unexposes the raw create_thread() and exit_thread() syscalls since they are now only used by LibPthread anyway.
2019-11-17Kernel+SystemMonitor: Show VM region "shared" and "stack" bits in UIAndreas Kling
Expose these two region bits through /proc/PID/vm and show them in the SystemMonitor process memory map view.
2019-11-17Kernel: Implement some basic stack pointer validationAndreas Kling
VM regions can now be marked as stack regions, which is then validated on syscall, and on page fault. If a thread is caught with its stack pointer pointing into anything that's *not* a Region with its stack bit set, we'll crash the whole process with SIGSTKFLT. Userspace must now allocate custom stacks by using mmap() with the new MAP_STACK flag. This mechanism was first introduced in OpenBSD, and now we have it too, yay! :^)
2019-11-16Ext2FS: Minor cleanup, remove an unused functionAndreas Kling
2019-11-16Kernel: Release the big process lock while yielding in sys$yield()Andreas Kling
Otherwise, a thread calling sched_yield() will prevent other threads in that process from entering the kernel.
2019-11-15Kernel: Unbreak SlabAllocator after startup-time constructorsAndreas Kling
Now that the kernel supports startup-time constructors, we were first doing slab_alloc_init(), and then the constructors ran later on, zeroing out the freelist pointers. This meant that all slab allocators thought they were completelty exhausted and forwarded all requests to kmalloc() instead.
2019-11-14Kernel: Move Thread::m_joinee_exit_value into the JoinBlockerAndreas Kling
There's no need for this to be a permanent Thread member. Just use a reference in the JoinBlocker instead.
2019-11-14Kernel+LibPthread: Implement pthread_join()Andreas Kling
It's now possible to block until another thread in the same process has exited. We can also retrieve its exit value, which is whatever value it passed to pthread_exit(). :^)
2019-11-14Kernel: Implement the killpg() syscallSergey Bugaev
2019-11-14Kernel: Unwind kernel stacks before dyingSergey Bugaev
While executing in the kernel, a thread can acquire various resources that need cleanup, such as locks and references to RefCounted objects. This cleanup normally happens on the exit path, such as in destructors for various RAII guards. But we weren't calling those exit paths when killing threads that have been executing in the kernel, such as threads blocked on reading or sleeping, thus causing leaks. This commit changes how killing threads works. Now, instead of killing a thread directly, one is supposed to call thread->set_should_die(), which will unblock it and make it unwind the stack if it is blocked in the kernel. Then, just before returning to the userspace, the thread will automatically die.
2019-11-13run: Unbreak this script when running with a regular Bourne /bin/shAndreas Kling
We can't use bashisms in our scripts anymore, since we're trying to keep them POSIXy (to make them easier to run for our own shell someday)
2019-11-13LibPthread: Start working on a POSIX threading libraryAndreas Kling
This patch adds pthread_create() and pthread_exit(), which currently simply wrap our existing create_thread() and exit_thread() syscalls. LibThread is also ported to using LibPthread.
2019-11-13Kernel: Add a kernel boot parameter to force PIO modesupercomputer7
Also added an option in the run script to force PIO operation mode with the IDE controller. In addition, we're no longer limited to PIIX3 and PIIX4 chipsets for DMA
2019-11-13Kernel: Fix failing in can_read()/can_write()Sergey Bugaev
Now that the SystemMonitor queries which open files can be read and written to, having can_read()/can_write() unconditionally call ASSERT_NOT_REACHED() leads to system crashes when inspecting the WindowServer. Instead, just return true from can_read()/can_write() (indicating that the read()/write() syscalls should not block) and return -EINVAL when trying to actually read from or write to these devices.
2019-11-12Build: Make sure PATH is passed properly (#765)Dominik Madarász
2019-11-11Toolchain: Add QEMU build script and improve documentationEmanuel Sprung
Added a script to build QEMU from source as part of the Toolchain. The script content could be in BuildIt.sh but has been put in a seperate file to make the build optional. Added PATH=$PATH to sudo calls to hand over the Toolchain's PATH setup by UseIt.sh. This enabled the script's to use the QEMU contained in the SerenityOS toolchain. Deleted old documentation in Meta and replaced it by a new documentation in the Toolchain folder.
2019-11-11Launcher: Remove the Launcher app, and all hacks in support of itAndreas Kling
The Launcher's functionality has been replaced by the app shortcuts in the system menu. There were various window management hacks to ensure that the launcher stayed below all other windows while also being movable, etc.
2019-11-11Kernel: open() with a zero-length path should fail with EINVALAndreas Kling
2019-11-10Kernel: Use C++ structured bindings to bind syscall parametersAndreas Kling
Some syscalls have to pass parameters through a struct, since we can only fit 3 parameters with our calling convention. This patch makes use of C++ structured binding to clean up the places where we expand those parameters structs into local variables.
2019-11-10Kernel+LibC: Implement the openat() syscallAndreas Kling
POSIX's openat() is very similar to open(), except you also provide a file descriptor referring to a directory from which relative paths should be resolved. Passing it the magical fd number AT_FDCWD means "resolve from current directory" (which is indeed also what open() normally does.) This fixes libarchive's bsdtar, since it was trying to do something extremely wrong in the absence of openat() support. The issue has recently been fixed upstream in libarchive: https://github.com/libarchive/libarchive/issues/1239 However, we should have openat() support anyway, so I went ahead and implemented it. :^) Fixes #748.
2019-11-10Kernel: Process should release its TTY immediately on exitAndreas Kling
Don't wait for someone to wait() on a dead process before releasing its TTY object. This fixes the child process death detection used by the Terminal application, which relies on getting an EOF on the master PTY in order to know it's time to wait() on the child process. :^)
2019-11-09Kernel: Clear the x86 DF flag when entering the kernelAndreas Kling
The SysV ABI says that the DF flag should be clear on function entry. That means we have to clear it when jumping into the kernel from some random userspace context.
2019-11-09Kernel: Use a lookup table for syscallsAndreas Kling
Instead of the big ugly switch statement, build a lookup table using the syscall enumeration macro. This greatly simplifies the syscall implementation. :^)
2019-11-09Kernel+SystemMonitor: Publish can_read/write state for open filesAndreas Kling
The can_read() and can_write() states for file descriptions are now published in /proc, allowing SystemMonitor to display it.
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