Commit Graph

2426 Commits

Author SHA1 Message Date
Robin Burchell
5babcac289 Build: Install most headers to Root (and libcore.a/libgui.a)
This makes out-of-tree linking possible. And at the same time, add a
CMakeToolchain.txt file that can be used to build arbitrary cmake-using
applications on Serenity by pointing to the CMAKE_TOOLCHAIN_FILE when
running cmake:

    -DCMAKE_TOOLCHAIN_FILE=~/code/serenity/Toolchain/CMakeToolchain.txt
2019-05-17 21:59:48 +02:00
Andreas Kling
2d98f4e28f Kernel: Make the times() syscall return something other than 0.
Based on the description I read, this syscall doesn't seem completely
reasonable, but let's at least return a number that is likely to change
between invocations in case somebody depends on that happening.
2019-05-17 20:19:29 +02:00
Andreas Kling
f015798af9 LibC: Implement clock() and add CLOCKS_PER_SEC define. 2019-05-17 20:19:03 +02:00
Andreas Kling
a182ea8c60 Kernel: After creating our GDT, make sure CS refers to the right descriptor.
This will allow us to boot from e.g GRUB which will have a different looking
GDT in effect before we start moving things around.
2019-05-17 18:52:29 +02:00
Andreas Kling
64b0b81b2a sync.sh: Use mkdir -p for everything. 2019-05-17 18:26:54 +02:00
Andreas Kling
e8ae2c952e Kernel: Put GDT and IDT in BSS rather than runtime-allocating them. 2019-05-17 18:25:50 +02:00
Andreas Kling
e0ff07bb57 Kernel: Make sure we load DS/ES/FS/GS/SS immediately after making the GDT. 2019-05-17 18:23:08 +02:00
Andreas Kling
a15857ea28 Kernel: Clear the X86 direction flag (DF) in the boot loader.
I'm not sure who is responsible for clearing this, but IIUC the C++ ABI
expects it to be clear on function entry, so just to be on the safe side..
2019-05-17 18:20:11 +02:00
Andreas Kling
45230a9544 Run QEMU with the "guest_errors" debug flag, in case we do something wrong. 2019-05-17 18:19:03 +02:00
Andreas Kling
923e587283 Kernel: GDTR and IDTR limits should be table size - 1. 2019-05-17 18:17:53 +02:00
Robin Burchell
0d77aa841a Kernel/Process: Use auto to avoid incompatible types, causing a signedness warning in the ASSERT 2019-05-17 16:06:26 +02:00
Robin Burchell
1cefb4a3b4 Kernel/RTC: Mark some intentional fallthroughs to suppress compiler warnings 2019-05-17 16:06:26 +02:00
Robin Burchell
20e55c0120 GInputBox: Use whichever is greater: the approximate size of the title, or the label's text
Might be an idea to add a minimum size constrain in window server
instead, since it knows the exact dimensions? But this is a simple fix
that seems to do the job.
2019-05-17 15:54:16 +02:00
Robin Burchell
77dfd419e9 LibCore: Move AK/ArgsParser to LibCore/CArgsParser
Also rename the classes to match LibCore naming style.
This means that it's no longer incorrectly linked into LibC and Kernel.
2019-05-17 15:49:37 +02:00
Robin Burchell
190111e21a Userland: Port ln to use ArgsParser 2019-05-17 15:49:37 +02:00
Robin Burchell
bffed9e3cb ArgsParser: Expand to be able to handle multiple single arguments
This is needed for e.g. ln
2019-05-17 15:49:37 +02:00
Robin Burchell
b92fa59832 Userland: Port pape to use ArgsParser, and minor cleanups 2019-05-17 15:49:37 +02:00
Robin Burchell
56aad835ad Userland: Port sysctl to use ArgsParser, and minor cleanups 2019-05-17 15:49:37 +02:00
Robin Burchell
6dd7ee53ea AK/Userland: Add single value to ArgsParser usage, and port tail to use ArgsParser 2019-05-17 15:49:37 +02:00
Robin Burchell
c478503581 ArgsParser: Remove prefix from constructor
It makes sense to keep this consistent between applications, and the
purpose of the string is not immediately obvious from an API perspective.

If we need to make it configurable later, that can come from a setter.
2019-05-17 15:49:37 +02:00
Robin Burchell
729507f2bd ArgsParser: Remove boolean trap on add_arg
Rather than requiring a boolean for whether or not the argument is
required, add some new methods to make the purpose of the bool explicit.
2019-05-17 15:49:37 +02:00
Robin Burchell
5cad215919 ArgsParser: Style fixup
Remove tabs, make whitespace lines a little more in fitting with the rest of the codebase.
2019-05-17 15:49:37 +02:00
Andreas Kling
3ec625067a Terminal: Uh, also change the one caller of beep() to sysbeep().. 2019-05-17 14:34:07 +02:00
Andreas Kling
c081aae9b5 LibC: Rename beep() to sysbeep() to avoid clashing with curses. 2019-05-17 14:32:53 +02:00
Robin Burchell
c8fda23a03 LibCore/Userland: Introduce a simple tail implementation
Also introduce more seek modes on CIODevice, and an out param to find
the current position inside the file -- this means less syscalls (and
less potential races) than requesting it through a separate pos()
accessor or something.
2019-05-17 14:28:13 +02:00
Robin Burchell
805e87a21c WindowServer: Add a more dynamic app list
This contains more stuff, and is easier to add to since it's just a vector :)
2019-05-17 14:20:44 +02:00
Andreas Kling
cc5ee3bff4 Vector: Add insert() overload that takes a const T&. 2019-05-17 04:59:56 +02:00
Andreas Kling
cde47089d2 Kernel: Remove some unnecessary massaging of region base/size pairs.
These will be appropriately rounded by the allocate_range(), so call sites
can stop worrying about it.
2019-05-17 04:47:06 +02:00
Andreas Kling
6957825444 Kernel: Factor out range allocation from Process::allocate_region*().
These functions were doing exactly the same thing for range allocation, so
share that code in an allocate_range() helper.

Region allocation will now also fail if range allocation fails, which means
that mmap() can actually fail without falling apart. Exciting times!
2019-05-17 04:39:22 +02:00
Andreas Kling
87b54a82c7 Kernel: Let Region keep a Range internally. 2019-05-17 04:32:08 +02:00
Andreas Kling
4a6fcfbacf Kernel: Use a RangeAllocator for kernel-only virtual space allocation too. 2019-05-17 04:02:29 +02:00
Andreas Kling
b1bb737704 Kernel: Remove Process::m_next_address.
This isn't needed now that we have RangeAllocator. :^)
2019-05-17 03:47:00 +02:00
Andreas Kling
45ff3a7e6a Kernel: Make Thread::kernel_stack_base() work for kernel processes. 2019-05-17 03:43:51 +02:00
Andreas Kling
c414e65498 Kernel: Implement a simple virtual address range allocator.
This replaces the previous virtual address allocator which was basically
just "m_next_address += size;"

With this in place, virtual addresses can get reused, which cuts down on
the number of page tables created. When we implement ASLR some day, we'll
probably have to do page table deallocation, but for now page tables are
only deallocated once the process dies.
2019-05-17 03:40:15 +02:00
Andreas Kling
c56e3ebee1 Always dump QEMU CPU state on CPU reset. 2019-05-17 00:06:23 +02:00
Andreas Kling
bcb7893156 WindowServer: Don't treat bottom titlebar edge as part of the border.
We were allowing initiation of resize from the bottom titlebar edge
since everything inside the window frame that's not either inside the
title bar, or inside the window content, is considered the border.
2019-05-16 20:29:42 +02:00
Andreas Kling
c597c2332b Userland: Add /bin/whoami 2019-05-16 20:18:17 +02:00
Andreas Kling
f196e2fcda Terminal: Set original window title to "Terminal"
Don't rely on the shell setting the window title using escape sequences.
2019-05-16 20:13:41 +02:00
Andreas Kling
4e7e2950bc WindowServer: Fill unbacked windows with their background color.
This avoids flashing a content-less window frame during client startup.
2019-05-16 20:11:09 +02:00
Andreas Kling
4e88872c8e Kernel: Always dump_backtrace() on process crash. 2019-05-16 19:49:48 +02:00
GuillaumeGas
0ba4ceb2cd Added CProcessStatisticsReader to avoid having to parse /proc/all (#35)
* Added CProcessStatisticsReader to avoid having to parse /proc/all

* Took @awesomekling's feedbacks into account

* Fixed indentation and replaced tabs by spaces
2019-05-16 18:47:47 +02:00
Andreas Kling
174639b7f0 Kernel: Symbolicate userspace backtraces using ELFLoader.
Stash away the ELFLoader used to load an executable in Process so we can use
it for symbolicating userspace addresses later on. This will make debugging
userspace programs a lot nicer. :^)
2019-05-16 17:18:25 +02:00
Andreas Kling
e20aecefba LibC: Don't clobber errno in dbgprintf(). 2019-05-16 16:24:22 +02:00
Robin Burchell
f1f3cd58b0 FileSystem: fix errno on lseek() beyond the bounds of a file
These are all EINVAL. Also remove bogus assert on metadata.size.
2019-05-16 16:05:08 +02:00
Robin Burchell
abb7455163 LibC/Shell: Add unsetenv(), and unset builtin calling it in Shell. 2019-05-16 14:32:09 +02:00
Robin Burchell
b2dd12daac LibC: Change putenv (and getenv) to not copy, but directly return the environ values.
This is in keeping with how putenv should function. It does mean that
the shell's export command now leaks, but that's not a difficult fix.

Contributes to #29.
2019-05-16 14:32:09 +02:00
Andreas Kling
c5434e0cfa Kernel: Simplify ELF loader by removing the allocator indirections. 2019-05-16 14:16:08 +02:00
Andreas Kling
07df2fa7ec GFilePicker: Remove the frame around the little toolbar. 2019-05-16 14:06:55 +02:00
Andreas Kling
ee363faf10 GButton: Only draw focus rect if there is a caption text. 2019-05-16 14:05:28 +02:00
Robin Burchell
6f73a549fa LibC: Add struct timespec to time.h 2019-05-16 14:03:49 +02:00