1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:08:11 +00:00
Commit graph

11365 commits

Author SHA1 Message Date
Andreas Kling
1579cbdc9d UserspaceEmulator: Implement CALL_RM32 2020-07-11 23:57:14 +02:00
Andreas Kling
a6719ede0b UserspaceEmulator: Implement the SHR family of instructions 2020-07-11 23:57:14 +02:00
Andreas Kling
2ee451afed UserspaceEmulator: Implement SHR_RM32_imm8 2020-07-11 23:57:14 +02:00
Andreas Kling
d79f15e219 UserspaceEmulator: Implement the OR family of instructions 2020-07-11 23:57:14 +02:00
Andreas Kling
cb2e36dde7 UserspaceEmulator: Implement PUSH_imm8
Curiously, the 8-bit immediate is sign-extended.
2020-07-11 23:57:14 +02:00
Andreas Kling
ab9c7ef63b UserspaceEmulator: Fix broken MOV_RM32_imm32
Oops, this was incorrectly moving into a GPR rather than the R/M.
2020-07-11 23:57:14 +02:00
Andreas Kling
6c7ae794ce UserspaceEmulator: Implement the 32-bit LEAVE instruction
The 16-bit variant is a bit weird. Let's wait until someone needs it.
2020-07-11 23:57:14 +02:00
Andreas Kling
321ee72fe7 UserspaceEmulator: Implement JMP_imm16 and JMP_imm32 2020-07-11 23:57:14 +02:00
Andreas Kling
12566b9df0 UserspaceEmulator: Implement the MOVZX instruction 2020-07-11 23:57:14 +02:00
Andreas Kling
0af485dfff UserspaceEmulator: Implement STOSB/STOSW/STOSD
...and add a template to handle REP* instruction prefixes. This can be
further generalized, but let's go one step at a time.
2020-07-11 23:57:14 +02:00
Andreas Kling
6688ce41b2 UserspaceEmulator: Implement some of the IMUL instruction family
The single-operand forms of IMUL are a little weird. We can deal with
them when they actually show up.
2020-07-11 23:57:14 +02:00
Andreas Kling
97f4cebc8d UserspaceEmulator+LibX86: Implement the LEA instruction
This piggybacks nicely on Instruction's ModR/M resolution code. :^)
2020-07-11 23:57:14 +02:00
Andreas Kling
9257657340 LibC: Some s/int/size_t/ in the malloc code 2020-07-11 23:57:14 +02:00
Andreas Kling
463afa69a7 UserspaceEmulator: Improve the initial program stack a tiny bit
Instead of starting with argv=nullptr, envp=nullptr, programs now
start with both pointing to a null terminated array (that immediately
terminates.) :^)
2020-07-11 23:57:14 +02:00
Linus Groh
fa98dcc05d Ports: Use "ini" in neofetch to read theme name 2020-07-11 23:56:33 +02:00
Linus Groh
8afbf89380 Userland: Add "ini" command to read and write .ini config files 2020-07-11 23:56:33 +02:00
Linus Groh
8716d1fe99 Ports: Disable /proc/cpuinfo parsing in neofetch, for now
We don't really have a good way of parsing and processing JSON in the
shell yet, and the solution used for /proc/memstat (read) is very
limited and doesn't work for the more complex /proc/cpuinfo array. Let's
disable cpu detection in neofetch for now until we can come up with a
good solution.
2020-07-11 23:16:16 +02:00
Linus Groh
858f6dc1d1 SystemMonitor: Parse /proc/cpuinfo as JSON 2020-07-11 23:16:16 +02:00
Linus Groh
fc0ec60d82 ProcFS: JSONify /proc/cpuinfo
To be more in line with other parts of Serenity's procfs, the
"key: value" format of /proc/cpuinfo was replaced with JSON, namely
an array of objects (one for each core).

The available keys remain the same, though "features" has been changed
from a space-separated string to an array of strings.
2020-07-11 23:16:16 +02:00
Matthew Olsson
43d955014d LibJS: Implement Symbol.toStringTag 2020-07-11 23:13:29 +02:00
Matthew Olsson
5ecd504f4e LibJS: Implement spec-compliant Object.prototype.toString 2020-07-11 23:13:29 +02:00
Linus Groh
caa11503b1 DisplaySettings: Fix a typo 2020-07-11 20:24:02 +02:00
Andreas Kling
b094e5279c UserspaceEmulator: Both ADD and SUB modify the carry flag 2020-07-11 20:10:30 +02:00
Andreas Kling
f23c258290 UserspaceEmulator: Implement the AND and TEST instructions 2020-07-11 20:10:30 +02:00
Matthew Olsson
531fdb2e82 LibJS: Prefer "define_property" over "put" 2020-07-11 18:54:13 +02:00
Matthew Olsson
c485c86015 LibJS: Use macros to enumerate well-known symbols
Not only is this a much nicer api (can't pass a typo'd string into the
get_well_known_symbol function), it is also a bit more performant since
there are no hashmap lookups.
2020-07-11 18:54:13 +02:00
Matthew Olsson
2ea85355fe LibJS: Start implementing iterable framework, add ArrayIterator
With the addition of symbol keys, work can now be done on starting to
implement the well-known symbol functionality. The most important of
these well-known symbols is by far Symbol.iterator.

This patch adds IteratorPrototype, as well as ArrayIterator and
ArrayIteratorPrototype. In the future, sometime after StringIterator has
also been added, this will allow us to use Symbol.iterator directly in
for..of loops, enabling the use of custom iterator objects. Also makes
adding iterator support to native objects much easier (as will have to
be done for Map and Set, when they get added).
2020-07-11 18:54:13 +02:00
Matthew Olsson
51bfc6c6b3 LibJS: Renamed Object::GetOwnPropertyReturnMode to Object::PropertyKind
This enum will be used by iterators, so it makes sense to use a more
general name.
2020-07-11 18:54:13 +02:00
Peter Elliott
e650be98a1 Piano: Fix cliping of bottom notes when scrolling in RollWidget
fixes #2577
2020-07-11 18:51:41 +02:00
Peter Elliott
b8cf07166f Piano: Handle octave slider jumps of greater than 1
The previous slider handler relied on the new value being 1 different
than the previous.

fixes #1163.
2020-07-11 18:51:41 +02:00
Peter Elliott
0fd31ef598 LibGUI: Ignore KeyUp events by default
fixed #2576
2020-07-11 18:51:41 +02:00
Linus Groh
7241b9ca0c LibJS: Remove a few superfluous exception checks
We don't need to check for exceptions when defining properties on an
array we literally created ourselves a few lines earlier.
2020-07-11 18:38:51 +02:00
Andreas Kling
7596ae4596 UserspaceEmulator: Implement the RET instruction
We can now return from a CALL! :^)
2020-07-11 17:22:38 +02:00
Andreas Kling
0f63d8c9b4 UserspaceEmulator: Symbolicate disassembly output :^)
Since we have the ELF executable handy, we can actually symbolicate the
disassembly trace output really easily. Very cool! :^)
2020-07-11 17:18:07 +02:00
Andreas Kling
dc66d70369 UserspaceEmulator: Don't exit the emulation loop on "RET" :^) 2020-07-11 17:13:15 +02:00
Andreas Kling
4d366b8b24 UserspaceEmulator: Implement PUSH_imm32 and PUSH_RM32 2020-07-11 17:12:44 +02:00
Andreas Kling
55d2bd9eec UserspaceEmulator: Implement short-range jump instructions 2020-07-11 17:12:21 +02:00
Andreas Kling
42787ae309 UserspaceEmulator: Implement the CALL_imm32 instruction 2020-07-11 17:05:04 +02:00
Andreas Kling
0a448ee960 UserspaceEmulator: Fix broken inline assembly for asymmetric op_foos
When the Destination and Source of an op_foo were types of different
sizes, the generated assembly was not filling up the "source" register
fully in some cases. This led to incorrect results.
2020-07-11 17:03:42 +02:00
Andreas Kling
c4ec38ddb5 UserspaceEmulator: Print out the current EIP as we execute instructions 2020-07-11 16:48:27 +02:00
Andreas Kling
ae1d14bc7a UserspaceEmulator: Load the target executable ELF semi-properly :^)
This patch adds a basic ELF program loader to the UserspaceEmulator and
creates MMU regions for each PT_LOAD header. (Note that we don't yet
respect the R/W/X flags etc.)

We also turn the SoftCPU into an X86::InstructionStream and give it an
EIP register so we can actually execute code by fetching memory through
our MMU abstraction.
2020-07-11 16:45:48 +02:00
Andreas Kling
0eab5659f8 UserspaceEmulator: Set up a very basic program entry stack 2020-07-11 16:30:17 +02:00
Andreas Kling
76b9fb258d UserspaceEmulator: Convert the XOR instruction to inline assembly 2020-07-11 16:02:25 +02:00
Andreas Kling
9db588daf1 UserspaceEmulator: Convert the SUB instruction to inline assembly 2020-07-11 15:52:53 +02:00
Andreas Kling
7d41b95071 UserspaceEmulator: Tweak INC and SAR helpers to not be SoftCPU members
It's quite nice having these as compartmentalized free functions.
2020-07-11 15:47:53 +02:00
Andreas Kling
e852768ba6 UserspaceEmulator: Add the INC and ADD instructions
More inline assembly. I'm still figuring out how to combine templates
and inline assembly, but it's turning out pretty cool. :^)
2020-07-11 14:20:08 +02:00
Andreas Kling
12ab46def9 UserspaceEmulator: Give SoftCPU an API for evaluating jump conditions
There are 16 conditions and they're all based on a combination of the
CPU flags.
2020-07-11 13:45:39 +02:00
Andreas Kling
133803b8a7 UserspaceEmulator: Split SAR inline assembly into 8/16/32 bit variants 2020-07-11 13:43:27 +02:00
Andreas Kling
743d4ccb8f UserspaceEmulator: Support MOV_RM32_reg32 with memory destination 2020-07-11 13:29:05 +02:00
Andreas Kling
e5afe6a579 UserspaceEmulator: Implement the CMP family of instructions
These are identical to SUB, except they don't store the result (they
only upate the arithmetic flags.)
2020-07-11 13:27:40 +02:00