Commit graph

59964 commits

Author SHA1 Message Date
Sönke Holz ec5cfc031e Kernel/riscv64: Add Linux boot header
This allows us to boot via U-Boot's booti command.
2024-03-25 14:30:39 -06:00
Dan Klishch d99d66e358 JSSpecCompiler: Pave a way for representing compile-time objects 2024-03-25 14:28:52 -06:00
Dan Klishch 3077e516a2 JSSpecCompiler: Parse properties list clause title 2024-03-25 14:28:52 -06:00
Dan Klishch ec16556fea JSSpecCompiler: Add option to silence all diagnostics and use in tests
In the future, we will probably want to test regressions in diagnostics
too but let's not do that for now.
2024-03-25 14:28:52 -06:00
Dan Klishch 0e7c33b1be JSSpecCompiler: Let FunctionDeclaration know its name and category
This is achieved by moving ClauseHeader::{AbstractOperation,Accessor,
Method} to Function.h itself and storing them in FunctionDeclaration.

This commit also introduces QualifiedName class that is used to store
function's name split by '.' (just like it appear in the spec).
2024-03-25 14:28:52 -06:00
Hendiadyoin1 70cfa60f56 LibCrypto: Remove now unused temporary BigInt buffers
Plus 1 drive-by division->shift optimization
2024-03-25 14:26:29 -06:00
Hendiadyoin1 c96d44e9cf LibCrypto: Use a right shift for division in NumberTheory::Power 2024-03-25 14:26:29 -06:00
Hendiadyoin1 4339868296 LibCrypto: Use Knuths algorithm D for BigInt division 2024-03-25 14:26:29 -06:00
Hendiadyoin1 877cfe1890 AK: Move generalized internals of UFixedBigIntDivision to BigIntBase
We will reuse this in LibCrypto

Co-Authored-By: Dan Klishch <danilklishch@gmail.com>
2024-03-25 14:26:29 -06:00
Hendiadyoin1 1af9fa1968 LibCrypto: Implement arbitrarily sized right shifts
Previously we could only shift by words at a time
2024-03-25 14:26:29 -06:00
Hendiadyoin1 9045840e33 AK: Use correct wide integer type for qhat check in UFixedBigIntDivision
Previously, we were assuming that were always on a 64-bit platform,
which is not 100% correct
2024-03-25 14:26:29 -06:00
Hendiadyoin1 f95abe8c0e AK: Make BigIntBase more agnostic to non native word sizes
This will allow us to use it in Crypto::UnsignedBigInteger, which always
uses 32 bit words
2024-03-25 14:26:29 -06:00
Sönke Holz 1a312f4265 Kernel/riscv64: Only enable interrupts in trap handler if they were on
Always enabling interrupts is in hindsight obviously a bug, as trapping
code that has interrupts disabled very likely expects that they stay
disabled.
2024-03-25 14:21:41 -06:00
Sönke Holz 6a223c6210 Kernel/riscv64: Set g_total_processors to a hard-coded value of 1
This value is used by the NVMe driver to determine the number of queues
to create.
2024-03-25 14:20:39 -06:00
Sönke Holz 58a2e6412c Kernel/riscv64: Implement Processor::pause 2024-03-25 14:20:39 -06:00
Sönke Holz 040e0fe88c Kernel/riscv64: Implement microseconds_delay
This simple delay loop uses the time CSR to wait for the given amount
of time. The tick frequency of the CSR is read from the
/cpus/timebase-frequency devicetree property.
2024-03-25 14:20:39 -06:00
RGBCube 720feaa658 nix: Clean up files, use good practices 2024-03-25 14:19:34 -06:00
Sönke Holz 6654021655 Kernel/riscv64: Don't hard-code the page fault reason on RISC-V
Instead, rewrite the region page fault handling code to not use
PageFault::type() on RISC-V.

I split Region::handle_fault into having a RISC-V-specific
implementation, as I am not sure if I cover all page fault handling edge
cases by solely relying on MM's own region metadata.
We should probably also take the processor-provided page fault reason
into account, if we decide to merge these two implementations in the
future.
2024-03-25 14:18:38 -06:00
Sönke Holz 496a7541a2 Kernel/riscv64: Implement the signal trampoline 2024-03-25 14:17:32 -06:00
Sönke Holz 66f8d0f031 Kernel/riscv64: Add support for handling traps from userspace
This commit also removes the unnecessary user_sp RegisterState member.
We never use the kernel stack pointer on entry, so we can simply always
store the stack pointer of the previous privilege mode in sp.

Also remove the sp member from mcontext, as RISC-V doesn't have a
dedicated stack pointer register.
sp is defined to be x2 (x[1] in our case) by the ABI.

I probably accidentally included sp while copying the struct from
aarch64.
2024-03-25 14:14:43 -06:00
Sönke Holz afe9a12412 Kernel/riscv64: Handle syscalls
sepc has to be incremented before the call to syscall_handler,
as we otherwise would return to the ecall instruction, resulting in an
infinite trap loop.
We can't increment it after syscall_handler, as sepc might get changed
while handling the syscall.
2024-03-25 14:11:43 -06:00
Sönke Holz 04ca9f393f Kernel/riscv64: Implement create_thread 2024-03-25 14:10:05 -06:00
Sönke Holz 65724efac3 Kernel/riscv64: Implement fork 2024-03-25 14:10:05 -06:00
Sönke Holz faede8c93a Kernel/riscv64: Implement execve 2024-03-25 14:10:05 -06:00
ronak69 22586c9cc6 AnalogClock: Add feature to change and show time zone
The said time zone is local to each instance of the AnalogClock and is
separate from the system time zone.

This allows user to have clocks that use different time zones
simultaneously.
2024-03-25 14:09:23 -06:00
Sönke Holz 6daa0da3c6 Kernel/NVMe: Fix calculation of "Maximum Queue Entries Supported" field
The value of this field is incremented by one, as a value of 0 for this
field means 1 entry supported.

A value of 0xffff for CAP.MQES would incorrectly by truncated to 0x0000,
if we don't increase the bit width of the return type.
2024-03-25 14:08:28 -06:00
LekKit 760b9186a5 LibC: Fix pthread_cond_broadcast() waking only one thread 2024-03-25 14:06:32 -06:00
stelar7 0359e8848a LibCrypto: Add roundtrip test for parsing RSA private keys 2024-03-25 14:06:19 -06:00
stelar7 1be411cc73 LibCrypto: Adjust DER length encoding to follow the spec
It says to always use the smallest possible length representation
2024-03-25 14:06:19 -06:00
Nico Weber 2e142105c9 Fuzzers: Add JPEG2000 fuzzer 2024-03-25 20:35:00 +01:00
Nico Weber 9ec5a1591d Tests/JPEG2000: Add a simple JPEG2000 test
We can't decode any actual image data yet, but it shows that we can
read the basics of the container format. (...as long as there's an
Annex I container around the data, not just an Annex A codestream.
All files I've found so far have the container.)

I drew the thes input in Acorn.app and used "Save as..." to save it as
JPEG2000.  It's an RGBA image.
2024-03-25 20:35:00 +01:00
Nico Weber a92d887ee3 LibGfx/JPEG2000: Read file structure
This is enough for `file` to print the dimensions of .jp2 / .jpx files,
and for `icc` to print color profile information embedded in the
'colr' box.
2024-03-25 20:35:00 +01:00
Nico Weber 1ab28276f6 LibGfx: Add the start of a JPEG2000 loader
JPEG2000 is the last image format used in PDF filters that we
don't have a loader for. Let's change that.

This adds all the scaffolding, but no actual implementation yet.
2024-03-25 20:35:00 +01:00
Nico Weber 1e95c08db5 LibGfx/ISOBMFF: Add JPEG2000ChannelDefinitionBox 2024-03-25 20:35:00 +01:00
Nico Weber f080836127 LibGfx/ISOBMFF: Add JPEG2000URLBox 2024-03-25 20:35:00 +01:00
Nico Weber c58996f4fc LibGfx/ISOBMFF: Add JPEG2000ContiguousCodestreamBox 2024-03-25 20:35:00 +01:00
Nico Weber f372a9b346 LibGfx/ISOBMFF: Add JPEG2000UUIDListBox 2024-03-25 20:35:00 +01:00
Nico Weber 4a95e55fb3 LibGfx/ISOBMFF: Add JPEG2000CaptureResolutionBox 2024-03-25 20:35:00 +01:00
Nico Weber b386d5bb14 LibGfx/ISOBMFF: Add JPEG2000ResolutionBox 2024-03-25 20:35:00 +01:00
Nico Weber 7d137dc480 LibGfx/ISOBMFF: Add JPEG2000UUIDInfoBox 2024-03-25 20:35:00 +01:00
Nico Weber 214ff799ce LibGfx/ISOBMFF: Add JPEG2000ColorSpecificationBox 2024-03-25 20:35:00 +01:00
Nico Weber 59bd378db8 LibGfx/ISOBMFF: Add JPEG2000ImageHeaderBox 2024-03-25 20:35:00 +01:00
Nico Weber 78deac3dca LibGfx/ISOBMFF: Give Reader::read_entire_file() a factory callback
This will allow creating different child boxes in different containers.
2024-03-25 20:35:00 +01:00
Nico Weber b7a120c47e LibGfx/ISOBMFF: Remove Box::read_from_stream()
This doesn't have to be a virtual method: it's called from
various create_from_stream() methods that have a static type
that's created. There's no point in the virtual call here,
and it makes it harder to add additional parameters to
read_from_stream() in some subclasses.
2024-03-25 20:35:00 +01:00
Nico Weber c84487ed2d LibGfx/ISOBMFF: Give JPEG2000HeaderBox its own type
...and make SuperBox a pure superclass that's not usable by itself.
2024-03-25 20:35:00 +01:00
Nico Weber 65bd090815 LibGfx/ISOBMFF: Start creating JPEG2000 box types
`isobmff` can now dump the id in a JPEG2000SignatureBox.
Creates JPEG2000Boxes.{h,cpp} to house JPEG2000 box types.
2024-03-25 20:35:00 +01:00
Nico Weber a073b2d047 LibGfx/ISOBMFF: Read JPEG2000HeaderBox 2024-03-25 20:35:00 +01:00
Nico Weber 15ba0a7e18 LibGfx/ISOBMFF: Make BoxStream MaybeOwn its stream
...and make Reader always have a BoxStream.
2024-03-25 20:35:00 +01:00
Nico Weber 07750774cf AK: Allow creating a MaybeOwned<Superclass> from a MaybeOwned<Subclass> 2024-03-25 20:35:00 +01:00
Nico Weber a72770cdf6 LibGfx/ISOBMFF: Add JPEG2000 box types
I prefixed the types that are labeled as "JPEG2000" on
https://mp4ra.org/registered-types/boxes with "JPEG2000".
2024-03-25 20:35:00 +01:00