Commit Graph

16209 Commits

Author SHA1 Message Date
Andreas Kling
ab14b0ac64 Kernel: Hoist VM range allocation up to sys$mmap() itself
Instead of letting each File subclass do range allocation in their
mmap() override, do it up front in sys$mmap().

This makes us honor alignment requests for file-backed memory mappings
and simplifies the code somwhat.
2021-01-25 18:57:06 +01:00
Andreas Kling
adcc1c1eff LibELF: Cache the DynamicObject in DynamicLoader
This avoids reparsing the same dynamic library file multiple times.
2021-01-25 18:57:06 +01:00
Andreas Kling
41d8734288 LibELF: Use Optional<SymbolLookupResult> as a return type
Instead of storing a "found" state inside the result object.
2021-01-25 18:57:06 +01:00
Andreas Kling
a5de46684b LibELF: Convert String::format() to String::formatted() 2021-01-25 18:57:06 +01:00
Andreas Kling
eb354b7ce8 DynamicLoader: Remove some unnecessary #includes 2021-01-25 18:57:06 +01:00
Andreas Kling
c5e52be5d4 LibELF: Convert dbgprintf() in DynamicObject class to dbgln() 2021-01-25 18:57:06 +01:00
Andreas Kling
98e4e2aae3 LibELF: Convert dbgprintf() in DynamicLinker class to dbgln() 2021-01-25 18:57:06 +01:00
Andreas Kling
e9fd81b964 LibELF: Convert dbgprintf() in DynamicLoader class to dbgln() 2021-01-25 18:57:06 +01:00
Andreas Kling
9a0762b203 DynamicLoader: Remove unused debugging macros 2021-01-25 18:57:06 +01:00
Nico Weber
75b7880f54 LibGfx: Remove unreachable branch in Painter::draw_scaled_bitmap
This is in the else block of a `(source.has_alpha_channel() || opacity != 1.0f)`
conditional, so it's guaranteed that !source.has_alpha_channel() in
here, which means source.format() can't be RGBA32.

No behavior change.
2021-01-25 18:56:54 +01:00
Nico Weber
ea8baaa1ab LibGfx: Fix opacity handling in Painter::draw_scaled_bitmap
If the source image had no alpha channel we'd ignore opacity < 1.0 and
blit the image as if it was fully opaque.

With this fix, adjusting the opacity of windows with mousewheel while
holding super works in hidpi mode.
2021-01-25 18:39:27 +01:00
Nico Weber
dfb12e2a73 LibGfx: Minor style tweaks in Painter
No behavior change.
2021-01-25 18:39:27 +01:00
asynts
8571209560 Kernel: Fix crash when booting with ACPI. 2021-01-25 13:00:49 +01:00
asynts
eea72b9b5c Everywhere: Hook up remaining debug macros to Debug.h. 2021-01-25 09:47:36 +01:00
asynts
da69de1f1b Meta: Make check-debug-flags.sh work with the new changes. 2021-01-25 09:47:36 +01:00
asynts
8465683dcf Everywhere: Debug macros instead of constexpr.
This was done with the following script:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
2021-01-25 09:47:36 +01:00
asynts
bb483f7ef4 Everywhere: Name debug macros more consistently.
Personally, I prefer the naming convention DEBUG_FOO over FOO_DEBUG, but
the majority of the debug macros are already named in the latter naming
convention, so I just enforce consistency here.

This was done with the following script:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/DEBUG_PATH/PATH_DEBUG/' {} \;
2021-01-25 09:47:36 +01:00
asynts
acdcf59a33 Everywhere: Remove unnecessary debug comments.
It would be tempting to uncomment these statements, but that won't work
with the new changes.

This was done with the following commands:

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/#define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/#define/ { toggle = 1 }' {} \;

    find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec awk -i inplace '$0 !~ /\/\/ #define/ { if (!toggle) { print; } else { toggle = !toggle } } ; $0 ~/\/\/ #define/ { toggle = 1 }' {} \;
2021-01-25 09:47:36 +01:00
asynts
1a3a0836c0 Everywhere: Use CMake to generate AK/Debug.h.
This was done with the help of several scripts, I dump them here to
easily find them later:

    awk '/#ifdef/ { print "#cmakedefine01 "$2 }' AK/Debug.h.in

    for debug_macro in $(awk '/#ifdef/ { print $2 }' AK/Debug.h.in)
    do
        find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/#ifdef '$debug_macro'/#if '$debug_macro'/' {} \;
    done

    # Remember to remove WRAPPER_GERNERATOR_DEBUG from the list.
    awk '/#cmake/ { print "set("$2" ON)" }' AK/Debug.h.in
2021-01-25 09:47:36 +01:00
Nico Weber
76f2918416 LibGfx:: Implement scale support for blit_with_opacity()
Now we no longer crash on mousewheel over Terminal while holding the
super key. The terminal window doesn't yet correctly become transparent
in hidpi mode (needs more investigation), but it works in LibGfxScaleDemo,
so maybe that's a problem elsewhere.

Also add a FIXME for a pre-existing bug.
2021-01-25 09:41:34 +01:00
Andrew Kaster
258a3b27ac Userland: Implement grep -v (invert-match)
This will make grep output every line that doesn't have
any matches of the given regular expression
2021-01-25 09:41:19 +01:00
Andrew Kaster
036828ff43 Userland: Use getline instead of Core::File::standard_input in grep
Core::IODevice (which Core::File inherits from) does not have a
reasonable way to block for a line. grep was spinning on
IODevice::read_line, passing endless empty strings to the matcher
lambda. Use getline instead, which will at least block in the Kernel for
characters to be available on stdin and only return full lines (or eof)
2021-01-25 09:41:19 +01:00
Andreas Kling
f5d916a881 Kernel: Make sys$anon_create() fail if size == 0
An empty anonymous file is useless since it cannot be resized anyway,
so let's not support creating it.
2021-01-25 09:36:42 +01:00
Linus Groh
02cca92763 LibJS: Set length of TypedArray constructors to 3
https://tc39.es/ecma262/#sec-typedarray-constructors

    Each TypedArray constructor [...] has a "length" property whose
    value is 3.
2021-01-24 22:24:10 +01:00
Jean-Baptiste Boric
76e12a4840 SystemServer: Do not crash if device files are not present 2021-01-24 22:16:18 +01:00
Jean-Baptiste Boric
491a67ddc4 WindowServer: Don't crash if unable to open input peripherals
Seems a bit extreme, other operating systems don't have their graphical
environment crash if there is no keyboard or no mouse.
2021-01-24 22:16:18 +01:00
Jean-Baptiste Boric
4d755725bf Kernel: Allow disabling of IDE controllers with disable_ide
The kernel doesn't like the IDE controllers on an Asus A7N8X-E Deluxe
motherboard, so add an option to disable them.
2021-01-24 22:16:18 +01:00
Jean-Baptiste Boric
7eaefa5aa6 Kernel: Make use of interrupts as an entropy source
Booting old computers without RDRAND/RDSEED and without a disk makes
the system severely starved for entropy. Uses interrupts as a source
to side-step that issue.

Also warn whenever the system is starved of entropy, because that's
a non-obvious failure mode.
2021-01-24 22:16:18 +01:00
Nico Weber
cb89d3b780 FontEditor: change order of baseline and mean line row
The mean line is above the baseline, so it makes sense if the UI
elements are in the same order.
2021-01-24 22:02:23 +01:00
Nico Weber
40f6dfeacc FontEditor: change "Mean Line:" label to "Mean line:"
Matches the case used in other labels in the app.
2021-01-24 22:02:23 +01:00
Nico Weber
42a8f99374 FontEditor: Fix typos in code
No behavior change.
2021-01-24 22:02:23 +01:00
Nico Weber
90e09dd7a8 FontEditor: Make left and right UI margins match 2021-01-24 22:02:23 +01:00
Nico Weber
8bb9c667fd FontEditor: Remove "Save" and "Quit" buttons
We have both the normal menu items and keyboard shortcuts for these by
now. No need to have always-visible buttons -- makes the app more
consistent with the other apps, and makes it use up less vertical space.
2021-01-24 22:02:23 +01:00
Zac
330ab52ddb
Vim: More correct word jumping (#5090)
Implemented move_to_beginning_of_next(), move_to_end_of_next(),
move_to_beginning_of_previous() and move_to_end_of_previous() functions
for more correct word jumping than the move_to_xxx_span() methods that
were previously used.
2021-01-24 19:24:56 +01:00
Camisul
0678dab7dc HexEditor: Find
Added search submenu with options to find or find again.
Find allows to search for ASII string or sequence of Hex value.
2021-01-24 19:23:31 +01:00
DragonAlex98
509e39ac00 FileManager: Make DirectoryView open links in their real directory
Previously it was possible to open a link like /home/anon/Desktop/Home,
leading to a folder with the same name. Now it correctly opens its real
path, which is /home/anon

FileManager: Use Core::File::real_path_for to get real path of links
2021-01-24 19:21:54 +01:00
Andreas Kling
f8d643284e pmap: Sort memory regions in output
This makes the program 100% nicer to use. :^)
2021-01-24 19:15:34 +01:00
Andreas Kling
7a71d4b887 LibJS: Add some assertions and tests for TypedArray limitations 2021-01-24 19:08:44 +01:00
Andreas Kling
0e3ee03e2b LibJS: Throw exception on too large TypedArray construction request
We will now throw a RangeError in these cases:

* new TypedArray with >= INT32_MAX entries
* new TypedArray whose ArrayBuffer allocation size computation would
  cause a 32-bit unsigned overflow.
2021-01-24 18:55:06 +01:00
Andreas Kling
ae0be7797f LibWeb: Disable resource cache for file:// URLs
This makes the browser a bit less annoying when testing local files,
since you no longer have to restart it for changes to take effect.

Longer-term we should have a proper way to decide which resources
are cacheable.
2021-01-24 12:11:08 +01:00
Luke
712f76c010 LibHTTP: Always read in the last chunk
This was accidentally put behind a debug flag.

Fixes #5080
2021-01-24 09:25:47 +01:00
Andreas Kling
2112b79986 Revert "Kernel: Make VFS::create() fail with EINVAL on invalid file mode"
This reverts commit ca3489eec7.

Fixes #5087.
2021-01-24 08:32:09 +01:00
Luke
50a2cb38e5 Kernel: Fix two error codes being returned as positive in Process::exec
This made the assertion on line 921 think it was a successful exec, when it wasn't.

Fixes #5084
2021-01-24 01:06:24 +01:00
Luke
1c18d1380f Lagom/Fuzzers: Fix FuzzilliJs build and update patch for new Fuzzilli version
-fsanitize=fuzzer was being added to LINKER_FLAGS from Lagom/CMakeLists,
which we don't want with FuzzilliJs as we want to define the functions
it provides ourselves.
2021-01-24 00:40:49 +01:00
Linus Groh
f37d3f25e6 LibJS: Remove redundant exception check from ClassExpression::execute()
as_object() cannot fail, leftover from ea55453.
2021-01-24 00:40:22 +01:00
Linus Groh
766f30f593 LibJS: Check if class extends value has a valid prototype
If we have a function as class extends value, we still cannot assume
that it has a prototype property and that property has a function or
null as its value - blindly calling to_object() on it may fail.

Fixes #5075.
2021-01-24 00:09:18 +01:00
Luke
397f432aed LibWeb: Add XHREventTarget and ProgressEvent constructors to Window 2021-01-23 22:29:21 +01:00
Luke
0a1226344a LibWeb: Add XHREventTarget and have XHR inherit from it 2021-01-23 22:29:21 +01:00
Luke
4f2e154dbe LibWeb: Flesh out existing XHR methods a bit more
This makes open, send and setRequestHeader a bit more spec compliant and
adds a bunch of FIXMEs for unimplemented parts.
2021-01-23 22:29:21 +01:00
Andreas Kling
c68148efc5 LibWeb: Remove Range constructor/prototype caches from WindowObject
These are constructed on the code generator path now instead.
2021-01-23 19:02:02 +01:00