Commit graph

8421 commits

Author SHA1 Message Date
AnotherTest 6b513ca97e LibLine: Avoid crashing if given empty suggestions 2020-04-15 16:38:25 +02:00
Liav A 223a863c6d LibBareMetal: Accept a u16 type pointer in the appropriate IO functions 2020-04-15 12:35:10 +02:00
Liav A f5090ab810 Kernel: Restore ATA PIO functionality
First, before this change, specifying 'force_pio' in the kernel
commandline was meaningless because we nevertheless set the DMA flag to
be enabled.

Also, we had a problem in which we used IO::repeated_out16() in PIO
write method. This might work on buggy emulators, but I suspect that on
real hardware this code will fail.

The most difficult problem was to restore the PIO read operation.
Apparently, it seems that we can't use IO::repeated_in16() here because
it will read zeroed data. Currently we rely on a simple loop that
invokes IO::in16() to a buffer. Also, the interrupt handling stage in
the PIO read method is moved to be handled inside the loop of reading
the requested sectors.
2020-04-15 12:35:10 +02:00
Andreas Kling 3f698db85d LibWeb: Limit the maximum size of <canvas> bitmap buffers
We will no longer create bitmap buffers for canvases that exceed a
total area of (16384 * 16384) pixels. This matches what some other
browser do.

Thanks to @itamar8910 for finding this! :^)
2020-04-15 12:29:21 +02:00
Andreas Kling 228ace854c LibGfx: Don't allow creating bitmaps whose sizes would overflow
If the area or size_in_bytes calculation for a Gfx::Bitmap would
overflow, we now refuse to create such a bitmap and return nullptr.

Thanks to @itamar8910 for finding this! :^)
2020-04-15 12:28:49 +02:00
Linus Groh a8406aa117 LibJS: Check length property of Array.prototype.join in its test
I assume this was copied from the Array.prototype.push() test :^)
2020-04-15 12:20:08 +02:00
Andreas Kling 64f5185bae js: Tweak colorization of printed values a bit 2020-04-15 10:11:48 +02:00
Andreas Kling ad2aac5fde LibJS: Add Array.prototype.join()
And share the code with Array.prototype.toString() :^)
2020-04-15 10:06:01 +02:00
Andreas Kling fa30355194 LibJS: Adding two values should convert them to primitives first 2020-04-15 09:48:25 +02:00
Andreas Kling 63499c2c9f LibJS: Pass the Interpreter& to binary/logical/unary helpers 2020-04-15 09:28:41 +02:00
Kesse Jones 994f1a79ad
LibJS: Add String.prototype.{trim, trimStart, trimEnd} (#1792) 2020-04-15 08:47:40 +02:00
AnotherTest 32276cba7a LibLine: Properly handle multiline suggestions 2020-04-15 08:46:42 +02:00
Noah Rosamilia d09bea5beb
Ports: sl (#1802) 2020-04-15 08:46:11 +02:00
Nick Tiberi e639c5bc25 Browser: Default page title to URL if no title is provided 2020-04-15 08:39:11 +02:00
Andreas Kling aab022b77b Base: Add a little test web page for canvas drawImage() :^) 2020-04-14 20:42:14 +02:00
Andreas Kling 067ea5a2e0 LibWeb: Add CanvasRenderingContext2D.drawImage(image, x, y)
This function allows you to draw a loaded <img> element into a canvas.
2020-04-14 20:38:44 +02:00
Andreas Kling 370befbf52 LibWeb: Add a JavaScript wrapper for HTMLImageElement :^) 2020-04-14 20:37:01 +02:00
Andreas Kling 22de1e47ec LibWeb: Add is<HTMLImageElement>() 2020-04-14 20:35:49 +02:00
Andreas Kling 1813e083ff LibWeb: Dispatch a "load" event on HTMLImageElement 2020-04-14 20:10:48 +02:00
Andreas Kling 57464be8f1 LibGUI: Scroll AbstractView to top on model change 2020-04-14 19:12:10 +02:00
Sergey Bugaev 1d9a7b5143 Ports: Unhardcode Python configuration
This ensures that ./configure results are actually used by the build.
This way, Python picks up the new sizeof(time_t) (which is 8), and
the build succeeds.
2020-04-14 18:40:24 +02:00
Sergey Bugaev f18d6610d3 Kernel: Don't include null terminator in sys$readlink() result
POSIX says, "Conforming applications should not assume that the returned
contents of the symbolic link are null-terminated."

If we do include the null terminator into the returning string, Python
believes it to actually be a part of the returned name, and gets unhappy
about that later. This suggests other systems Python runs in don't include
it, so let's do that too.

Also, make our userspace support non-null-terminated realpath().
2020-04-14 18:40:24 +02:00
Linus Groh 1dee4d0049 LibJS: Redirect stderr to /dev/null when running js in run-tests
This "mutes" output from dbg() calls - which is not an issue inside
serenity itself but if the script is run on the host machine and stdout
and stderr are displayed in the same terminal window.
2020-04-14 18:38:55 +02:00
Linus Groh 823fb9d9aa LibJS: Add missing load("test-common.js") to comments-basic.js
This fixes the test which is currently failing with
"ReferenceError: 'assert' not known".
2020-04-14 17:26:57 +02:00
Andreas Kling b237ba57ea AK: Add a little test for String::split()
Just to verify that the parts are all null-terminated.
2020-04-14 15:36:25 +02:00
Andreas Kling 236dcf7702 LibBareMetal: Add more assertions in copy_{to,from}_user()
Assert that the source/destination address is in kernel space when
appropriate. This is mostly to give ourselves an error if we're doing
something we were not expecting to be doing.
2020-04-14 15:30:25 +02:00
Andreas Kling 815b73bdcc Kernel: Simplify sys$setgroups(0, ...)
If we're dropping all groups, just clear the extra_gids and return.
2020-04-14 15:30:25 +02:00
Linus Groh f7df521073 LibJS: Add Array.prototype.map() 2020-04-14 13:40:04 +02:00
Linus Groh f03d005bc4 LibJS: Add Array.prototype.filter() 2020-04-14 13:40:04 +02:00
Linus Groh 866172a721 LibJS: Add Array.prototype.forEach() 2020-04-14 13:40:04 +02:00
Linus Groh 29253bf932 LibJS: Add Array.prototype.unshift() 2020-04-14 13:40:04 +02:00
Linus Groh 5da1a40ccf LibJS: Support multiple arguments in Array.prototype.push() 2020-04-14 13:40:04 +02:00
Linus Groh 9fab52a390 LibJS: Remove shift, pop, push functions from Array object
This abstraction isn't really that useful, as we can access the
underlying Vector<Value> using elements() and operate on it directly.
2020-04-14 13:40:04 +02:00
Brian Gianforcaro d74ad81402 js/LibJS: Move test functions to pure javascript.
The addition of assert functions to Userland/js
was done before we had load(..) implemented. Now
that it exists, it seems like the right move the
test helper functions to pure javascript instead
of poluting js with random global functions.
2020-04-14 12:55:31 +02:00
Stephan Unverwerth 9477efe970 LibJS: Handle HTML-style comments 2020-04-14 12:54:09 +02:00
Andreas Kling 9962db5bf8 Kernel: Remove SmapDisablers in {peek,poke}_user_data() 2020-04-14 09:52:49 +02:00
Andreas Kling 0f760797a7 Kernel: Remove SmapDisablers in sys$ptrace() implementation
Instead, use copy_from_user() or copy_to_user() which does additional
verification and will panic the kernel on attempted kernel access.
2020-04-14 09:50:14 +02:00
Andreas Kling 0440f4f257 Kernel: Fix little mistakes in ptrace(PT_PEEK)
Output address validation should be done for the tracer's address space
and not the tracee's.

Also use copy_to_user() instead of copy_from_user(). The two are really
identical at the moment, but maybe we can add some assertions to make
sure we're doing what we think we're doing.

Thanks to Sergey for spotting these!
2020-04-14 09:45:04 +02:00
Stephan Unverwerth f0fd85dc1b Shell: Suggest local executables and directories
...when no matching executable could be found in $PATH
2020-04-13 23:21:28 +02:00
Itamar 109c24ae97 Debugger: Repeat previous command when an empty command is entered 2020-04-13 23:20:59 +02:00
Itamar 312559b131 Debugger: Add single step command
Also, this commit does some refactoring to the debugging loop logic.
2020-04-13 23:20:59 +02:00
Itamar c3faaeb9b9 Debugger: Breakpoints now persist after being tripped
Previously, a breakpoint was removed after it was tripped.

After a breakpoint trips, we have to undo the 'int3' patch
from the instruction in order to continue the exceution.

To make a breakpoint persist, we switch to "single step" mode,
which stops the execution after a single instruction, and then we
insert the breakpoint at the previous instruction.

There is also some code that deals with an edge case where there are
breakpoints in two consecutive instructions.
2020-04-13 23:20:59 +02:00
Itamar d04409b444 CPU: Handle Debug exception
We currently only care about debug exceptions that are triggered
by the single-step execution mode.

The debug exception is translated to a SIGTRAP, which can be caught
and handled by the tracing thread.
2020-04-13 23:20:59 +02:00
Itamar 1191ab9500 Debugger: Print where we're stopped at
For some reaason, some magic is required to convince gcc to give us
the implementation for "__cxa_demangle"
Thanks @predmond for finding this simpler form of magic :)
2020-04-13 23:20:59 +02:00
Itamar e207de8449 LibELF: Add find_demangled_function
Also, added AK::String::index_of and fixed a bug in ELF::Loader::symbol_ptr
2020-04-13 23:20:59 +02:00
Brian Gianforcaro 34f0d98e67 Meta: Add Lagom CMake dir to .gitignore
Meta/Lagom/build seems to be the expected cmake output directory.
(It's hardcoded in Libraries/LibJS/Tests/run-tests.)

Add it to the project .gitignore
2020-04-13 23:15:05 +02:00
Jean-Baptiste Boric 0c25826138 Build: Use c++ as default HOST_CXX 2020-04-13 23:14:48 +02:00
Linus Groh 8e08d111da js: Output text using printf() and return undefined in help() 2020-04-13 23:12:17 +02:00
Andreas Kling c8edcf1d71 Kernel: Don't ignore validation result in ptrace(PT_PEEK)
Also mark all of the address validation functions [[nodiscard]] to turn
this kind of bug into a compile error in the future.
2020-04-13 22:40:38 +02:00
Andreas Kling e432a27676 Kernel: Use copy_from_user() in ptrace(PT_PEEK) 2020-04-13 22:39:07 +02:00