Commit Graph

7766 Commits

Author SHA1 Message Date
Liav A
3f98a67d75 Interrupts: Remove unused methods 2020-03-24 16:15:33 +01:00
Liav A
8b38be3072 Kernel: Simplify disable_irq() and enable_irq() methods in IRQHandler
Setting the m_enabled variable to true or false can help
with monitoring the IRQHandler object(s) later, and there's no good
reason to have an if-else statement in those methods anyway.
2020-03-24 16:15:33 +01:00
Liav A
cb676f1211 Interrupts: Do a specific EOI when using the PIC
Before this change, we did a non-specific EOI, which could lead to
problems with other IRQs that are handled in the PIC. Since the original
8259A datasheet permits such functionality and we are not losing any
functionality, this change is acceptable even though we don't experience
problems with the EOI currently.
2020-03-24 16:15:33 +01:00
Liav A
06e7fc9dee Kernel: Limit IRQ rate within E1000 network adapter
This is not a complete fix, since spurious IRQs under heavy loads can
still occur. However, this fix limits the amount of spurious IRQs.

It is encouraged to provide a better fix in the future, probably
something that takes into account handling of PCI level-triggered
interrupts.
2020-03-24 16:15:33 +01:00
Liav A
dbc536e917 Interrupts: Assert if trying to install an handler on syscall vector
Installing an interrupt handler on the syscall IDT vector can lead to
fatal results, so we must assert if that happens.
2020-03-24 16:15:33 +01:00
Liav A
f86be46c98 Kernel: Abstract IRQ controller handling from Interrupt handlers
Now we don't send raw numbers, but we let the IRQController object to
figure out the correct IRQ number.
This helps in a situation when we have 2 or more IOAPICs, so if IOAPIC
1 is assigned for IRQs 0-23 and IOAPIC 2 is assigned for IRQs 24-47,
if an IRQHandler of IRQ 25 invokes disable() for example, it will call
his responsible IRQController (IOAPIC 2), and the IRQController will
subtract the IRQ number with his assigned offset, and the result is that
the second redirection entry in IOAPIC 2 will be masked.
2020-03-24 16:15:33 +01:00
Liav A
666990fbcb Kernel: Correct Spurious Interrupt handlers' controller model() method
We don't return blindly the IRQ controller's model(), if the Spurious
IRQ handler is installed in IOAPIC environment, it's misleading to
return "IOAPIC" string since IOAPIC doesn't really handle Spurious
IRQs, therefore we return a "" string.
2020-03-24 16:15:33 +01:00
Liav A
4cc96a7aa9 Kernel: Create an interface for conversion between IRQs and interrupts 2020-03-24 16:15:33 +01:00
Liav A
c2c0e9fb04 Kernel: Ensure that we don't use a hard-disabled IRQController 2020-03-24 16:15:33 +01:00
Liav A
893d4a41c2 Kernel: Enable IRQs before sending commands to the E1000 adapter
This change prevents a race condition, in which case we send a command
and we are losing an interrupt.
2020-03-24 16:15:33 +01:00
Liav A
7c859efa85 Kernel: Change the Spurious Interrupt Handler offset in the APIC
The Spurious Interrupt Handler number that is written to
APIC_REG_SIV is correct now.
2020-03-24 16:15:33 +01:00
Liav A
f7b207c7ae CPU: Move EOI call to the end of handle_interrupt() 2020-03-24 16:15:33 +01:00
Liav A
1bc7ba8df8 Kernel: Run QEMU machine with two virtual processors 2020-03-24 16:15:33 +01:00
Liav A
c55d5eeef9 Kernel: Change noacpi GRUB entry to use the right boot argument 2020-03-24 16:15:33 +01:00
Andreas Kling
7dc78b5e38 LibJS: Use correct |this| value when getting/setting native properties 2020-03-24 16:14:10 +01:00
Andreas Kling
8705c5ffeb js: Make the -l command-line argument actually work 2020-03-24 16:14:10 +01:00
Andreas Kling
343e224aa8 LibJS: Implement basic exception throwing
You can now throw exceptions by calling Interpreter::throw_exception().
Anyone who calls ASTNode::execute() needs to check afterwards if the
Interpreter now has an exception(), and if so, stop what they're doing
and simply return.

When catching an exception, we'll first execute the CatchClause node
if present. After that, we'll execute the finalizer block if present.

This is unlikely to be completely correct, but it's a start! :^)
2020-03-24 16:14:10 +01:00
Andreas Kling
c33d4aefc3 LibJS: Parse "try", "catch" and "finally"
This is the first step towards support exceptions. :^)
2020-03-24 16:14:10 +01:00
Andreas Kling
404de10a15 AK: Add FlyString::is_null() 2020-03-24 16:14:10 +01:00
myphs
f42f300ba3 LibWeb: CSS: Add "position: absolute" with top and left
This momentarily handles the CSS property "position: absolute;" in
combination with the properties "top" and "left", so that elements can
be placed anywhere on the page independently from their parents.

Statically positioned elements ignore absolute positioned elements when
calculating their position as they don't take up space.
2020-03-23 20:17:29 +01:00
Andreas Kling
494df52961 LibJS: Actually leave the current function scope on "return"
We now unwind until the nearest function-level scope on the scope stack
when executing a return statement.
2020-03-23 19:22:24 +01:00
Andreas Kling
df524203b2 LibJS: Consume semicolon at the end of a statement
A bunch of code was relying on this not happenind, in particular the
parsing of "for" statements. Reorganized things so they work again.
2020-03-23 19:10:18 +01:00
Andreas Kling
fbb9e1b715 LibJS: Implement "else" parsing
We can now handle scripts with if/else in LibJS. Most of the changes
are about fixing IfStatement to store the consequent and alternate node
as Statements.

Interpreter now also runs Statements, rather than running ScopeNodes.
2020-03-23 16:52:58 +01:00
Andreas Kling
b2f005125d LibJS: Always collect all garbage when destroying Heap
When the Heap is going down, it's our last chance to run destructors,
so add a separate collector mode where we simply skip over the marking
phase and go directly to sweeping. This causes everything to get swept
and all live cells get destroyed.

This way, valgrind reports 0 leaks on exit. :^)
2020-03-23 14:11:19 +01:00
Andreas Kling
6dc4b23e2f LibJS: Teach the lexer to recognize ">=" and "<=" :^) 2020-03-23 14:10:23 +01:00
Andreas Kling
7d862dd5fc AK: Reduce header dependency graph of String.h
String.h no longer pulls in StringView.h. We do this by moving a bunch
of String functions out-of-line.
2020-03-23 13:48:44 +01:00
Andreas Kling
1dd71bd68f LibJS: Put some more Heap debug logging behind HEAP_DEBUG 2020-03-23 13:45:01 +01:00
Andreas Kling
e31dac3ba4 Lagom: Build LibJS + "js" test program
You can now get a full Linux build of the "js" test program by simply
building in Meta/Lagom :^)
2020-03-23 13:15:32 +01:00
Andreas Kling
79e065f0a2 LibJS: Port garbage collector to Linux
Well that was easy. LibJS can now run on Linux :^)
2020-03-23 13:14:57 +01:00
Andreas Kling
538537dfd0 LibJS: Use rand() for Math.random() on other systems
I bet we could be smarter here and use arc4random() on systems where
it is present. I'm not sure how to detect it though.
2020-03-23 13:14:04 +01:00
Andreas Kling
290ea11739 LibCore: Tweak DateTime.cpp so it compiles on Linux + drive-by bug fix 2020-03-23 13:13:36 +01:00
Shannon Booth
c47ef61ed8 Toolchain/Ports: Update gcc to 9.3.0
Ever closer to C++20! Also fix up some of those pesky "'s
2020-03-23 08:22:41 +01:00
Nick Tiberi
ca067e71a3
Taskbar: Remove FIXME re: tooltip rendering since it's now working (#1502) 2020-03-23 08:21:34 +01:00
Andreas Kling
6f235ad93f LibWeb: Implement cancelAnimationFrame()
These functions (rAF and cAF) should eventually stop using raw ID's
from GUI::DisplayLink as their identifiers. That's a FIXME for now. :^)
2020-03-22 21:20:40 +01:00
Andreas Kling
39045bfde8 LibWeb: Add basic support for requestAnimationFrame()
We now support rAF, driven by GUI::DisplayLink callbacks. It's a bit
strange how we keep registering new callbacks over and over.
That's something we can definitely optimize.

This allows you to update animations/whatever without doing it more
often than the browser can display.
2020-03-22 21:18:03 +01:00
Andreas Kling
424a3f5ac3 WindowServer+LibGUI: Add a way to get notified at display refresh rate
This patch adds GUI::DisplayLink, a mechanism for registering callbacks
that will fire at the display refresh rate.

Note that we don't actually know the screen refresh rate, but this is
instead completely driven by WindowServer's compositing timer. For all
current intents and purposes it does the job well enough. :^)
2020-03-22 21:13:23 +01:00
Chris
bb70d0692b WindowServer: Improve the close button shape 2020-03-22 19:57:58 +01:00
Andreas Kling
beba585f37 LibWeb: Use FlyString for DOM event names 2020-03-22 19:53:22 +01:00
Andreas Kling
7309642ca8 LibWeb: Use FlyString for Element tag names
This makes selector matching a lot more efficient, and also reduces the
number of strings on the heap.
2020-03-22 19:12:10 +01:00
Andreas Kling
c4a6d6ae9f AK: Add FlyString::to_lowercase() and LogStream operator<<(FlyString) 2020-03-22 19:07:02 +01:00
Andreas Kling
7f8dc347b5 LibGUI: Allow constructing Variant from FlyString 2020-03-22 19:06:31 +01:00
Andreas Kling
7f83f77377 LibWeb: Use FlyString for element attribute names
Attribute names occur again and again.
2020-03-22 13:10:04 +01:00
Andreas Kling
26bc3d4ea0 AK: Add FlyString::equals_ignoring_case(StringView)
And share the code with String by moving the logic to StringUtils. :^)
2020-03-22 13:07:45 +01:00
Andreas Kling
0efa47b7ef AK: Run clang-format on StringUtils.{cpp,h} 2020-03-22 13:04:04 +01:00
Andreas Kling
cccbe43056 LibJS: Use FlyString for identifiers
This makes variable and property lookups a lot faster since comparing
two FlyStrings is O(1).
2020-03-22 13:03:43 +01:00
Andreas Kling
4f72f6b886 AK: Add FlyString, a simple flyweight string class
FlyString is a flyweight string class that wraps a RefPtr<StringImpl>
known to be unique among the set of FlyStrings. The class is very
unoptimized at the moment.

When to use FlyString:

- When you want O(1) string comparison
- When you want to deduplicate a lot of identical strings

When not to use FlyString:

- For strings that don't need either of the above features
- For strings that are likely to be unique
2020-03-22 13:03:43 +01:00
Andreas Kling
0395b25e3f LibWeb: Put selection-related debug spam behind an #ifdef 2020-03-22 13:03:43 +01:00
Shannon Booth
d7133ea326 Kernel: Fix compilation error with ACPI_DEBUG enabled 2020-03-22 08:51:40 +01:00
Shannon Booth
83425b1ac0 LibCore: Wrap commented out debug messages in a preprocessor define
We can also remove an outdated FIXME as dbg() does now support unsigned
longs :^)
2020-03-22 08:51:40 +01:00
Shannon Booth
757c14650f Kernel: Simplify process assertion checking if region is in range
Let's use the helper function for this :)
2020-03-22 08:51:40 +01:00