Commit graph

46705 commits

Author SHA1 Message Date
Tim Schumacher
a6bcad551d LibCrypto: Use AK::Stream for pretty printing DER 2023-02-08 18:50:53 +00:00
Tim Schumacher
f5fb1396e8 LibCrypto: Use ErrorOr error handling for parsing DER
This replaces a mixture of `Result`, `Optional`, and a custom error enum
with our usual `ErrorOr`-based error handling.
2023-02-08 18:50:53 +00:00
Tim Schumacher
e80eb09fe5 LibGfx: Use AK::Stream to serialize and deserialize bitmaps 2023-02-08 18:50:43 +00:00
Tim Schumacher
6ea3c1659a LibGfx: Propagate errors from serializing bitmaps
We essentially just end up moving `release_value_but_fixme_...` one
layer down, but it makes adding more fallible operations in the
serialization function more comfortable.
2023-02-08 18:50:43 +00:00
Tim Schumacher
81863eaf57 Kernel: Use AK::Stream to write packed binary data 2023-02-08 18:50:31 +00:00
Tim Schumacher
23e10a30ad Kernel: Modernize Error handling when serializing directory entries 2023-02-08 18:50:31 +00:00
Undefine
ccc871e608 LibCore: Propagate errors in SecretString 2023-02-08 19:49:48 +01:00
Xexxa
b4f47935a5 Base: Add more emoji
💪 - U+1F4AA FLEXED BICEPS
🐕‍🦺 - U+1F415 U+200D U+1F9BA SERVICE DOG
🧈 - U+1F9C8 BUTTER
🚚 - U+1F69A DELIVERY TRUCK
🕰️ - U+1F570 MANTELPIECE CLOCK
🏸 - U+1F3F8 BADMINTON
🥻 - U+1F97B SARI
2023-02-08 19:48:49 +01:00
Rodrigo Tobar
e4a7606b81 LibPDF: Construct accented characters with Type1 seac command
The seac command provides the base and accented character that are
needed to create an accented character glyph. Storing these values is
all that was left to properly support these composed glyphs.
2023-02-08 19:47:15 +01:00
Rodrigo Tobar
3eaa27f53a LibPDF: Add infrastructure for accented character glyphs
Type1 accented character glyphs are composed of two other glyphs in the
same font: a base glyph and an accent glyph, given as char codes in the
standard encoding. These two glyphs are then composed together to form
the accented character.

This commit adds the data structures to hold the information for
accented characters, and also the routine that composes the final glyph
path out of the two individual components. All glyphs must have been
loaded by the time this composition takes place, and thus a new
protected consolidate_glyphs() routine has been added to perform this
calculation.
2023-02-08 19:47:15 +01:00
Rodrigo Tobar
11a9bfd4b6 LibPDF: Turn Glyph into a class
Glyph was a simple structure, but even now it's become more complex that
it was initially. Turning it into a class hides some of that complexity,
and make sit easier to understand to external eyes.

While doing this I also decided to remove the float + bool combo for
keeping track of the glyph's width, and replaced it with an Optional
instead.
2023-02-08 19:47:15 +01:00
Rodrigo Tobar
c084943457 LibPDF: Index Type1 glyphs by name, not char code
Storing glyphs indexed by char code in a Type1 Font Program binds a Font
Program instance to the particular Encoding that was used at Font
Program construction time. This makes it difficult to reuse Font Program
instances against different Encodings, which would be otherwise
possible.

This commit changes how we store the glyphs on Type1 Font Programs.
Instead of storing them on a map indexed by char code, the map is now
indexed by glyph name. In turn, when rendering a glyph we use the
Encoding object to turn the char code into a glyph name, which in turn
is used to index into the map of glyphs.

This is the first step towards reusability of Type1 Font Programs. It
also unlocks the ability to render glyphs that are described via the
"seac" command (standard encoding accented character), which requires
accessing the base and accent glyphs by name.
2023-02-08 19:47:15 +01:00
Rodrigo Tobar
f99c9dc11a LibGfx: Add the ability to append a Path into another
This is useful in general (I'd imagine), but in particular having this
will allow us to implement accented PDF Type1 Font glyphs, which consist
of two separate glyphs that are composed into a single one.
2023-02-08 19:47:15 +01:00
Rodrigo Tobar
596119cf3e LibPDF: Add placeholders for *flex Type2 commands
These should be implemented properly in the future, but for now we are
adding the as placeholders to avoid crashes.
2023-02-08 19:47:15 +01:00
Rodrigo Tobar
64bbe431b5 LibPDF: Add char_code -> name mapping function
We already keep both mappings internally, now it's time to actually use
it.
2023-02-08 19:47:15 +01:00
Rodrigo Tobar
82bd854d6f LibPDF: Account for other endings of PS1 Encoding array 2023-02-08 19:47:15 +01:00
Rodrigo Tobar
a533ea7ae6 LibPDF: Improve stream parsing
When parsing streams we rely on a /Length item being defined in the
stream's dictionary to know how much data comprises the stream. Its
value is usually a direct value, but it can be indirect. There was
however a contradiction in the code: the condition that allowed it to
read and use the /Length value required it to be a direct value, but the
actual code using the value would have worked with indirect ones. This
meant that indirect /Length values triggered the fallback, "manual"
stream parsing code.

On the other hand, this latter code was also buggy, because it relied on
the "endstream" keyword to appear on a separate line, which isn't always
the case.

This commit both fixes the bug in the manual stream parsing scenario,
while also allowing for indirect /Length values to be used to parse
streams more directly and avoid the manual approach. The main caveat to
this second change is that for a brief period of time the Document is
not able to resolve references (i.e., before the xref table itself is
not parsed). Any parsing happening before that (e..g, the linearization
dictionary) must therefore use the manual stream parsing approach.
2023-02-08 19:47:15 +01:00
Timothy Flynn
8670526f2a LibJS+LibLocale: Propagate OOM from CLDR RelativeTime Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
340434ce09 LibLocale: Propagate OOM from CLDR DateTime Vector and String operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
89da8de4ca LibJS+LibLocale: Propagate OOM from CLDR NumberFormat Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
858126d236 LibJS: Propagate OOM from remaining Intl Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
9af525bbb0 LibJS: Propagate OOM from Intl.RelativeTimeFormat Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
cb8b2209c1 LibJS: Propagate OOM from Intl.ListFormat Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
c1c54fad96 LibJS: Propagate OOM from Intl.DurationFormat Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
fb8fd757e6 LibJS: Propagate OOM from Intl.DateTimeFormat Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
822ee35f7a LibJS: Propagate OOM from Intl.NumberFormat Vector operations 2023-02-08 18:32:37 +00:00
Timothy Flynn
ea13f3e285 LibJS: Propagate OOM from PatternPartitionWithSource factory 2023-02-08 18:32:37 +00:00
Timothy Flynn
e86eafe65e LibJS: Replace remaining uses of StringBuilder in the Intl namespace 2023-02-08 18:32:37 +00:00
Itamar
951a8269f0 Debugger: Support attaching to a running process 2023-02-08 19:23:07 +01:00
Itamar
26250fe14a LibDebug: Add static attach() function
This function is similar to exec_and_attach(), but instead of spawning
a new process and debugging it, it attaches to an existing process.
2023-02-08 19:23:07 +01:00
Itamar
ddec9cb1f0 Kernel: Update stored registers in a thread's tracer on SIGSTOP
This is needed so we can retrieve the registers of a traced
thread that was attached to while it was running.

Attaching with ptrace to a running thread sends SIGSTOP to it.
2023-02-08 19:23:07 +01:00
Itamar
7544b35694 Kernel: Update registers in tracer when attaching to a stopped thread 2023-02-08 19:23:07 +01:00
Timon Kruiper
0f3e1668bb Kernel/aarch64: Execute first userspace process
This adds the necessary code to init.cpp to be able to execute the first
userspace process. To do this, first the filesystem code is initialized,
which will use the ramdisk embedded into the kernel image. Then the
first userspace process, /bin/SystemServer is executed. :^)

The ramdisk code is used as it is useful for the bring-up of the aarch64
port, however once the kernel has support for better ram-based
filesystems, the ramdisk code will be removed again.
2023-02-08 18:19:48 +00:00
Timon Kruiper
3b65fd64fc Kernel/aarch64: Embed disk image into kernel binary
This allows us to actually boot to userspace in the next commit! :^)
2023-02-08 18:19:48 +00:00
Timon Kruiper
da89cd948f Kernel/aarch64: Do not dump register state on every page fault
This became very spammy, and is not needed anymore since we now
correctly handle page faults.
2023-02-08 18:19:48 +00:00
Timon Kruiper
3106a72a72 Kernel/aarch64: Make register dump output a bit nicer 2023-02-08 18:19:48 +00:00
Timon Kruiper
a9f7267cbd Meta: Allow creating disk image without installing kernel into it
This change allows for creating smaller disk images, which is useful for
creating a disk image that will be put into ram.
2023-02-08 18:19:48 +00:00
Timon Kruiper
cf5b02e3a4 Kernel/aarch64: Dump ESR_EL1 in dump_registers and remove backtracing 2023-02-08 18:19:48 +00:00
Timon Kruiper
3295137224 Kernel: Add optional userspace backtrace to Process::crash
This is very useful for debugging the initial userspace applications, as
the CrashReporter is not yet running.
2023-02-08 18:19:48 +00:00
Timon Kruiper
3611427ce2 Kernel/aarch64: Return correct values from RegisterState accessors 2023-02-08 18:19:48 +00:00
Timon Kruiper
5aba83e6ba Kernel/aarch64: Add TimeManagement fallback entropy source to Random.cpp
The emulated aarch64 CPU does not contain the RNG cpu feature, so the
random number generator was not seeded. This commit adds a fallback to
use TimeManagement as a entropy source, such that get_good_random_bytes
works, which is needed for running the first userspace application on
aarch64.
2023-02-08 18:19:48 +00:00
Timon Kruiper
5781d58fe8 Kernel/aarch64: Implement set_exec_state in ThreadRegisters
This sets up the correct ThreadRegisters state when a process is
exec'ed, which happens when the first userspace application is executed.
Also changes Processor.cpp to get the stack pointer from the
ThreadRegisters.
2023-02-08 18:19:48 +00:00
Timon Kruiper
8960662e57 Kernel/aarch64: Set exception origin mode to SP_EL0 for userspace thread 2023-02-08 18:19:48 +00:00
Timon Kruiper
3f05748c0c Kernel/aarch64: Store Saved Program Status Register in ThreadRegisters
This allows us to set the Mode field of the Saved Program Status
Register (EL1) to EL0t when a userspace process is created.
2023-02-08 18:19:48 +00:00
Timon Kruiper
816076f71a Kernel: Share CrashHandler.cpp between aarch64 and x86_64
This file contains no architecture specific code, so can be moved to the
Kernel/ directory, and thus shared between aarch64 and x86_64.
2023-02-08 18:19:48 +00:00
Timon Kruiper
7ba9bc6338 Kernel/aarch64: Remove static from dump_registers
This allows the function to be called from other translation units, in
particular this allows the CrashHandler.cpp file to be shared between
aarch64 and x86_64.
2023-02-08 18:19:48 +00:00
Timon Kruiper
5cb37038a3 Kernel/aarch64: Set kernel_load_base and correctly calculate symbol addr
Setting the kernel_load_base variable caused backtracking to regress, so
to have proper backtracing the calculation of the symbol address in
KSyms.cpp needs to keep into account that the aarch64 kernel is linked
at a high virtual memory address.
2023-02-08 18:19:48 +00:00
Timon Kruiper
c7802cef25 Kernel/aarch64: Handle exceptions from lower exception level (EL)
When we execute in userspace, the exception level is EL0, so to handle
exceptions, such as interrupts, and syscalls, we need to add handlers to
vector_table.S. For now we only support running userspace applications
in AArch64 mode, so this commit only adds the handlers for that mode.
2023-02-08 18:19:48 +00:00
Timon Kruiper
7be7324287 Kernel/aarch64: Set correct ExecutionMode of PageFault
Adds a helper to aarch64/Registers.h to factor out the exception class
encoding.
2023-02-08 18:19:48 +00:00
Timon Kruiper
ecf45e191e Kernel/aarch64: Handle instruction aborts
To detect instruction aborts, a helper to Registers.h is added, and used
in Interrupts.cpp. Additionally, the PageFault class gets a setter to
set the PageFaults m_is_instruction_fetch bool, and is also used in
Interrupts.cpp.
2023-02-08 18:19:48 +00:00