Commit graph

24416 commits

Author SHA1 Message Date
Andreas Kling 4d2473b7fa Kernel: Remove confused comment in KBufferBuilder::appendff()
KBufferBuilder exists for code that wants to build a KBuffer instead
of a String. KBuffer is backed by anonymous VM, while String is backed
by a kernel heap allocation.
2021-07-20 18:05:05 +02:00
Alexander d528c9c2ee LibWeb: Don't print JavaScript syntax error hints
This uses the new flag in print_errors to not print hints. This
decreases the load time of JavaScript heavy webpages with many errors
significantly.
2021-07-20 16:20:59 +02:00
Alexander e3fa32b2ad LibJS: Optimize source_location_hint and add flag in print_errors
This optimizes the algorithm used in source_location_hint and adds a
flag to not print hints in print_errors.
2021-07-20 16:20:59 +02:00
Peter Elliott 2ce8cca7b5 LibC: Implement flock(2) using fcntl's F_SETLK
While flock is not a posix interface, it exists on linux and all BSDs as
far as I am aware.
2021-07-20 17:44:30 +04:30
Peter Elliott 3fa2816642 Kernel+LibC: Implement fcntl(2) advisory locks
Advisory locks don't actually prevent other processes from writing to
the file, but they do prevent other processes looking to acquire and
advisory lock on the file.

This implementation currently only adds non-blocking locks, which are
all I need for now.
2021-07-20 17:44:30 +04:30
Gunnar Beutner fbc56461da Profiler: Make profiler not truncate 64-bit addresses 2021-07-20 15:12:19 +02:00
Gunnar Beutner 60b52cfb02 Userland: Hardcode the x86_64 kernel base address for now 2021-07-20 15:12:19 +02:00
Gunnar Beutner 4fdee56ba3 Prekernel: Make sure to reload CR3 after modifying the page tables 2021-07-20 15:12:19 +02:00
Gunnar Beutner 05fc75f994 Prekernel: Don't wrap around the PTE index improperly
The boot_pd0_pts variable contains more than 512 PTEs so we shouldn't
wrap the index here.
2021-07-20 15:12:19 +02:00
Gunnar Beutner d29981e4a1 Prekernel: Properly initialize variables 2021-07-20 15:12:19 +02:00
Gunnar Beutner 9031ed0b84 Meta: Add a new qextlinux target for the run.sh script
This allows testing the extlinux image with QEMU.
2021-07-20 15:12:19 +02:00
Gunnar Beutner 696e15fcd8 Meta: Update extlinux config for the recent prekernel changes 2021-07-20 15:12:19 +02:00
Gunnar Beutner 6a45ebe282 Meta: Fix syslinux detection on Arch Linux 2021-07-20 15:12:19 +02:00
Gunnar Beutner ac1455d3ba Kernel: Specify protection flags for ELF load headers
These are currently unused by the prekernel and ld used the same flags
by default - except for the .ksyms section which was marked as
read-write.
2021-07-20 15:12:19 +02:00
Gunnar Beutner 2019cf3289 Kernel: Use the C preprocessor to avoid two copies of the linker script 2021-07-20 15:12:19 +02:00
Gunnar Beutner 56f952a5f2 Prekernel: Don't assume that PT_LOAD headers are ordered by address
These headers are ordered by virtual address - at least with GCC - but
that might not always be the case.
2021-07-20 15:12:19 +02:00
Gunnar Beutner 5188185374 Kernel: Rename .boot_bss to .super_pages to better reflect what it is
This also removes the section attribute for kernel_base which had no
effect because the section wasn't included in the linker script.
2021-07-20 15:12:19 +02:00
Gunnar Beutner be795d5812 Prekernel: Use physical addresses for some of the BootInfo parameters
The kernel would just turn those virtual addresses into physical
addresses later on, so let's just use physical addresses right from the
start.
2021-07-20 15:12:19 +02:00
Gunnar Beutner dd42093b93 Kernel: Move boot info declarations to a header file
Instead of manually redeclaring those variables in various files this
now adds a header file for them.
2021-07-20 15:12:19 +02:00
Gunnar Beutner b4600f2996 Kernel: Initialize serial debug after setting kernel command-line 2021-07-20 11:38:45 +01:00
Ali Mohammad Pur 3184086679 LibLine: Avoid excessive write() syscalls when refreshing the display
Previously, we were generating the display update one character at a
time, and writing them one at a time to stderr, which is not buffered,
doing so caused one syscall per character printed which is s l o w (TM)
This commit makes LibLine write the update contents into a buffer, and
flush it after all the update is generated :^)
2021-07-20 11:55:42 +04:30
Ali Mohammad Pur 0f6654fef2 LibLine: Reset the suggestion page offset when finding the max length
Otherwise, something like shift+tab->tab->tab will mess up the page
contents (assuming that the max lengths in the pages are different).
2021-07-20 11:55:42 +04:30
Ariel Don 54bf6a7884 LibGUI: Add Ctrl-U to insert mode
While under insert mode, Ctrl-U deletes all characters between the first
non-blank character of the line and the cursor.

Implement delete_from_line_start_to_cursor() in TextEditor. Then, call
the method in VimEditingEngine via its pointer to an instance of
TextEditor.
2021-07-20 03:22:28 +02:00
Ariel Don 8230bf8944 LibGUI: Add Ctrl-H to insert mode
In Vim, Ctrl-H is effectively equivalent to backspace in insert mode, as
it deletes the previous character.

This commit implements method delete_previous_char() to TextEditor.
delete_char() already exists in EditingEngine, but it deletes the
next character rather than the previous. delete_previous_char() is then
called from within VimEditingEngine.
2021-07-20 03:22:28 +02:00
Ariel Don 808e5e813f LibGUI: Add Ctrl-W to insert mode
In Vim's insert mode, Ctrl-W deletes the word before the cursor, like
Ctrl-Backspace. Unlike Ctrl-Backspace, if only whitespace exists between
the end of the word and the cursor, the word will be deleted with the
whitespace.

To do so, this commit introduces two methods: delete_previous_word() for
TextEditor and first_word_before() for TextDocument, where the former
depends on the latter. delete_previous_word() is then called in
VimEditingEngine.
2021-07-20 03:22:28 +02:00
Brian Gianforcaro 8f01a8b741 Kernel: Disable big process lock for sys$yield() 2021-07-20 03:21:14 +02:00
Brian Gianforcaro 5c10fb4007 Kernel: Disable big process lock for sys$gettid()
This syscall reads a read only value from the current thread, and hence
has no need for the big process lock.
2021-07-20 03:21:14 +02:00
Brian Gianforcaro 638598b15d Kernel: Disable big process lock for sys$getpid() 2021-07-20 03:21:14 +02:00
Brian Gianforcaro bfd4635274 Kernel: Disable big process lock for sys$uname() 2021-07-20 03:21:14 +02:00
Brian Gianforcaro 10ce896d4f Kernel: Disable big process lock in sys$gethostname() sys$sethostname() 2021-07-20 03:21:14 +02:00
Brian Gianforcaro 9201a06027 Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED
Before we start disabling acquisition of the big process lock for
specific syscalls, make sure to document and assert that all the
lock is held during all syscalls.
2021-07-20 03:21:14 +02:00
Brian Gianforcaro 120b9bc05b Kernel: Conditionally acquire the big lock based on syscall metadata 2021-07-20 03:21:14 +02:00
Brian Gianforcaro bb1fa019de Kernel: Allow MutexLocker to be conditionally initialized
There are cases where we want to conditionally take a lock, but still
would like to use an RAII type to make sure we don't leak the lock.

This was previously impossible to do with `MutexLocker` due to it's
design. This commit tweaks the design to allow the object to be
initialized to an "empty" state without a lock associated, so it does
nothing, and then later a lock can be "attached" to the locker.

I realized that the get_lock() API's where also unused, and would no
longer make sense for empty locks, so they were removed.
2021-07-20 03:21:14 +02:00
Brian Gianforcaro 354e18a5a0 Kernel: Move validate_syscall_preconditions outside of the big lock
Now that we hold the space lock for the duration of the validation
it should be safe to move the validation outside the big lock.
2021-07-20 03:21:14 +02:00
Brian Gianforcaro 85e95105c6 Kernel: Mark read only RegisterState function parameters as const 2021-07-20 03:21:14 +02:00
Brian Gianforcaro 27e1120dff Kernel: Move syscall precondition validates to MM
Move these to MM to simplify the flow of the syscall handler.

While here, also make sure we hold the process space lock for
the duration of the validation to avoid potential issues where
another thread attempts to modify the process space during the
validation. This will allow us to move the validation out of the
big process lock scope in a future change.

Additionally utilize the new no_lock variants of functions to avoid
unnecessary recursive process space spinlock acquisitions.
2021-07-20 03:21:14 +02:00
Brian Gianforcaro af543328ea Kernel: Instrument syscalls with their process big lock requirements
Currently all syscalls run under the Process:m_big_lock, which is an
obvious bottleneck. Long term we would like to remove the big lock and
replace it with the required fine grained locking.

To facilitate this goal we need a way of gradually decomposing the big
lock into the all of the required fine grained locks. This commit
introduces instrumentation to the syscall table, allowing the big lock
requirement to be toggled on/off per syscall.

Eventually when we are finished, no syscall will required the big lock,
and we'll be able to remove all of this instrumentation.
2021-07-20 03:21:14 +02:00
Brian Gianforcaro 308396bca1 Kernel: No lock validate_user_stack variant, switch to Space as argument
The entire process is not needed, just require the user to pass in the
Space. Also provide no_lock variant to use when you already have the
VM/Space lock acquired, to avoid unnecessary recursive spinlock
acquisitions.
2021-07-20 03:21:14 +02:00
Andreas Kling 59b6169b51 Taskbar: Update the start button width when system fonts change 2021-07-20 02:48:29 +02:00
Andreas Kling f5e914fb9f LibTTF+LibGfx: Make Gfx::Font::bold_variant() work for TTF fonts
There's no need for this to be a virtual, it's just a font database
lookup and can be done in the Font base class.
2021-07-20 02:48:29 +02:00
Andreas Kling 9f601fcbcf LibTTF+LibGfx: Improve vertical alignment of glyphs
Before this patch, some glyphs had a weird off-by-1 vertical position
which looked really jarring at small font sizes.

This was caused by glyph bitmaps having different heights from each
other. (Each glyph bitmap was minimally sized to fit only the glyph
itself, and then vertically positioned during the paint phase.
Since this vertical positioning was integer based, subpixel precision
was lost and things ended up looking wonky.)

Fix this by making all glyph bitmaps be the same height so we can blit
them at the same integer y position. We use the typographic ascent from
the OS/2 table to transform the glyph coordinates.

The end result is a huge improvement visually. :^)
2021-07-20 02:48:29 +02:00
Andreas Kling e984200206 LibTTF: Parse OS/2 tables
The OS/2 table contains nice typographic ascent/descent information.
2021-07-20 02:48:29 +02:00
Andreas Kling 3b1e05f714 LibTTF: Don't choke on fonts with CompositeGlyfFlags::UseMyMetrics
This was preventing us from loading JetBrains Mono Regular with LibTTF.
2021-07-20 02:48:29 +02:00
Andreas Kling 808f1f63ff LibTTF: Minor const correctness fix in TTF rasterizer 2021-07-20 02:48:29 +02:00
Andreas Kling d8f435fa50 LibTTF: Propagate glyph bitmap allocation failure in rasterizer 2021-07-20 02:48:28 +02:00
Andreas Kling 7b3a4f8281 LibTTF: Rename "raster" => "rasterize" 2021-07-20 02:48:28 +02:00
Andreas Kling 8070bbd442 LibTTF: Convert code to east-const style 2021-07-20 02:48:28 +02:00
Linus Groh 84efed502a Ports: Add a launcher for Python
We're even downloading an additional older icon from the git repo
instead of using their current ones for accurate look and feel :^)
2021-07-20 00:58:26 +01:00
Linus Groh b8cd6ae02e Ports: Use "launcher_run_in_terminal=true" instead of "Terminal -e ..." 2021-07-20 00:58:26 +01:00
Linus Groh 6b9e0d98d9 Ports: Add launcher_run_in_terminal package.sh variable
This is being used to generate the RunInTerminal entry in launcher app
files.
2021-07-20 00:58:26 +01:00