1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:38:10 +00:00
Commit graph

11365 commits

Author SHA1 Message Date
Andreas Kling
80d3306840 UserspaceEmulator: Fix wrong ESI/EDI step sizes in MOVSW and MOVSD 2020-07-13 13:50:22 +02:00
Andreas Kling
e0580e2975 UserspaceEmulator: Add some more syscalls
We can now unmap mapped memory, among other things. This is all very
ad-hoc as I'm trying to run UserspaceEmulator inside itself. :^)
2020-07-13 13:50:22 +02:00
Andreas Kling
9b6464010f UserspaceEmulator: Add basic support for memory-mapped files
MmapRegion now supports using an mmap'ed file descriptor as backing.
2020-07-13 13:50:22 +02:00
Andreas Kling
63d3f5d19b UserspaceEmulator: Implement the PUSHFD instruction 2020-07-13 13:50:22 +02:00
Andreas Kling
f6ad5edab0 UserspaceEmulator: Make mmap'ed memory track read/write protection
Here's the first time we get a taste of better information than the
real hardware can give us: unlike x86 CPUs, we can actually support
write-only memory, so now we do!

While this isn't immediately useful, it's still pretty cool. :^)
2020-07-13 13:50:22 +02:00
Andreas Kling
27c1690504 UserspaceEmulator: Pass arguments through to emulated process
Ultimately we'll want to support passing some options to the emulator
as well, but for now just pass all arguments (except argv[0] of course)
through to the emulated process.

This is still not perfect, but slightly better than what we had before.
2020-07-13 13:50:22 +02:00
Andreas Kling
3d42b85969 UserspaceEmulator: Move SimpleRegion to its own files 2020-07-13 13:50:22 +02:00
Andreas Kling
4d3787ae33 UserspaceEmulator: Support the fstat() and get_process_name() syscalls
For now, we just pretend that the process name is "EMULATED". We can
probably do better though. :^)
2020-07-13 13:50:22 +02:00
Nico Weber
20378b8640 Default Fonts: Tweak 'F' and 'W'
In all default fonts, make the lower bar of the F one pixel shorter to
match the middle bare of the E.

Make the W in CsillaThin a bit shorter on the sides and make it
go less high in the middle. This makes it look more like the W in
CsillaBold, makes the middle high spot in W match the height of
the same spot in X Y E F H. Making it shorter on the side makes
the letter look better when its next ot other full-width letters,
e.g. in "WWW".

Make the w in Katica10 match new new W in CsillaThin. The bold
letters already match, and in general it looks like Csilla is
a monospace version of Katica.
2020-07-13 10:19:32 +02:00
Stefano Cristiano
a1e1aa96fb Toolchain: Allow building using CMake on macOS 2020-07-13 08:46:44 +02:00
Andreas Kling
617655db0d UserspaceEmulator: Move exit() syscall logging to debug output
We want the emulated program to appear without noise in the terminal.
2020-07-12 21:37:54 +02:00
Andreas Kling
1d32c66dde UserspaceEmulator: Put some syscall logging behind DEBUG_SPAM 2020-07-12 21:37:54 +02:00
Andreas Kling
95a42efc62 UserspaceEmulator: Implement enough syscalls to get /bin/id running :^) 2020-07-12 21:37:54 +02:00
Andreas Kling
1b196df4c4 UserspaceEmulator: Implement/stub out various syscalls
Moving forward on getting /bin/id to run inside the emulator. :^)
2020-07-12 21:37:54 +02:00
Andreas Kling
56d3a949e6 UserspaceEmulator: Disable per-instruction trace dumps for now
With tracing turned on, it's just too slow when doing big operations
like initializing malloc freelists.
2020-07-12 21:37:54 +02:00
Andreas Kling
079021a607 UserspaceEmulator: Put the executable name in argv[0] :^)
The emulated program can now find its own name in argv[0]. Very cool!
2020-07-12 21:37:54 +02:00
Andreas Kling
ddf7b817df UserspaceEmulator: Add Emulator::dump_backtrace()
This gives you a nice, symbolicated backtrace at the current EIP. :^)
2020-07-12 21:37:54 +02:00
Andreas Kling
584923445c UserspaceEmulator: "Add" a couple of syscalls
This patch adds gettid() and stubs out pledge() and unveil() for now.
2020-07-12 21:37:54 +02:00
Peter Elliott
f87cf701a4 Ports: Build ncurses with sigwinch enabled 2020-07-12 21:03:16 +02:00
Linus Groh
85e7bfc047 Ports: Use "jq" in neofetch for /proc/{cpuinfo,memstat}
Now that a "jq" port is available we can re-enable CPU name detection in
neofetch and don't need to use "read" for extracting values from
/proc/memstat anymore :^)
2020-07-12 17:45:38 +02:00
AnotherTest
8d71eb9a6c Shell: Recursively resolve aliases 2020-07-12 17:45:18 +02:00
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