Commit graph

11844 commits

Author SHA1 Message Date
Andreas Kling
e461e3c8b0 UserspaceEmulator: Fix missing sign extension in PUSH_imm8 2020-07-12 17:44:14 +02:00
Andreas Kling
94f07660e9 UserspaceEmulator: Add some convenient SoftMMU APIs for copying data
We'll soon want to copy data in and out of the SoftMMU memory space.
2020-07-12 17:42:57 +02:00
Andreas Kling
274ac3c628 UserspaceEmulator: Implement the XADD instruction 2020-07-12 15:35:01 +02:00
Andreas Kling
04695957e2 UserspaceEmulator: Implement the MOVSX instruction 2020-07-12 15:33:29 +02:00
Andreas Kling
8940916232 UserspaceEmulator: Implement JMP_RM32 2020-07-12 14:54:30 +02:00
Andreas Kling
a424208399 UserspaceEmulator: Implement DIV_RM32
Not using inline assembly for this one since flags are undefined after
a DIV instruction anyway.
2020-07-12 14:53:19 +02:00
Andreas Kling
062e2f8614 UserspaceEmulator: Implement the XCHG instruction 2020-07-12 14:45:46 +02:00
Andreas Kling
536ca0f8c9 UserspaceEmulator: Implement some more MOV variants 2020-07-12 14:45:35 +02:00
Andreas Kling
2d44f4526a UserspaceEmulator: Implement MOVSB/MOVSW/MOVSD 2020-07-12 14:45:02 +02:00
Andreas Kling
ed57efff4f UserspaceEmulator: Implement the CMPXCHG instruction 2020-07-12 14:43:30 +02:00
Andreas Kling
6ec0a63af1 UserspaceEmulator: Fix broken MOV_RM8_reg8 2020-07-12 14:42:15 +02:00
Andreas Kling
226c0cfb20 LibVT: Don't scroll to bottom when pressing the right shift key 2020-07-12 14:32:39 +02:00
Andreas Kling
bdf72a7c7a UserspaceEmulator: Implement JMP_NEAR_imm
This is a full-width relative jump, when the 8-bit immediate variant
isn't large enough.
2020-07-12 01:36:45 +02:00
Andreas Kling
938a00ecf9 UserspaceEmulator: Implement the CMOVcc instruction 2020-07-12 01:36:45 +02:00
Andreas Kling
adf3775955 UserspaceEmulator: Implement the SBB family of instructions 2020-07-12 01:36:45 +02:00
Andreas Kling
734f63d522 UserspaceEmulator: Add basic TLS (thread-local storage) support
The SoftMMU now receives full X86::LogicalAddress values from SoftCPU.
This allows the MMU to reroute TLS accesses to a special memory region.

The ELF executable's PT_TLS header tells us how to allocate the TLS.

Basically, the GS register points to a magical 4-byte area which has
a pointer to the TCB (thread control block). The TCB lives in normal
flat memory space and is accessed through the DS register.
2020-07-12 01:36:45 +02:00
Andreas Kling
df95e25eaa UserspaceEmulator: Implement the NEG instruction
Per the Intel manuals, NEG is equivalent to subtracting a value from 0.
2020-07-12 01:36:45 +02:00
Andreas Kling
aa13183615 UserspaceEmulator: Implement SETcc_RM8 2020-07-12 01:36:45 +02:00
Andreas Kling
b524bc123d UserspaceEmulator: Implement the DEC family of instructions 2020-07-12 01:36:45 +02:00
Andreas Kling
ce51cf90c6 UserspaceEmulator: Make sure ELF data segments are zero-initialized
(And all other memory, too.) This will mutate later when we add shadow
memory etc, but for now just zero-initialize it since that's expected
by the emulated program.
2020-07-12 01:36:45 +02:00
Andreas Kling
7f394435da Debugger: Add some pledges required by LibLine
These are a bit unfortunate. We should reorganize LibLine so it sets
up the RPC server earlier, then we can drop these pledges later on.
2020-07-12 01:36:45 +02:00
AnotherTest
dc719f3b61 Ports: Add jq :^) 2020-07-12 01:19:48 +02:00
AnotherTest
9054811ace LibM: Add 'isnormal' 2020-07-12 01:19:48 +02:00
Andreas Kling
8a94622e54 UserspaceEmulator: Put memory read/write logging behind MEMORY_DEBUG 2020-07-11 23:57:14 +02:00
Andreas Kling
775bc158ba UserspaceEmulator: Implement the SHL family of instructions 2020-07-11 23:57:14 +02:00
Andreas Kling
bfacb9583a UserspaceEmulator: Implement RET_imm16
This is just like RET, but it also pops N bytes off the stack.
2020-07-11 23:57:14 +02:00
Andreas Kling
eb86264d3b UserspaceEmulator: Simplify op_foo templates
Instead of templatizing both the destination and source types, simply
templatize the operand type and sign-extend narrower source values at
the call sites instead.
2020-07-11 23:57:14 +02:00
Andreas Kling
6febad1ef3 UserspaceEmulator: The generic_RM*_imm8 functions need to sign extend
We are supposed to sign-extend the 8-bit immediate here,
"cmp eax, 0xff" is actually "cmp eax, 0xffffffff"
2020-07-11 23:57:14 +02:00
Andreas Kling
21837544bb UserspaceEmulator: Implement MOV_EAX_moff32 2020-07-11 23:57:14 +02:00
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