Age | Commit message (Collapse) | Author | |
---|---|---|---|
2020-07-12 | UserspaceEmulator: Implement the XCHG instruction | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Implement some more MOV variants | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Implement MOVSB/MOVSW/MOVSD | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Implement the CMPXCHG instruction | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Fix broken MOV_RM8_reg8 | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Implement JMP_NEAR_imm | Andreas Kling | |
This is a full-width relative jump, when the 8-bit immediate variant isn't large enough. | |||
2020-07-12 | UserspaceEmulator: Implement the CMOVcc instruction | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Implement the SBB family of instructions | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Add basic TLS (thread-local storage) support | Andreas Kling | |
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 | UserspaceEmulator: Implement the NEG instruction | Andreas Kling | |
Per the Intel manuals, NEG is equivalent to subtracting a value from 0. | |||
2020-07-12 | UserspaceEmulator: Implement SETcc_RM8 | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Implement the DEC family of instructions | Andreas Kling | |
2020-07-12 | UserspaceEmulator: Make sure ELF data segments are zero-initialized | Andreas Kling | |
(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-11 | UserspaceEmulator: Put memory read/write logging behind MEMORY_DEBUG | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement the SHL family of instructions | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement RET_imm16 | Andreas Kling | |
This is just like RET, but it also pops N bytes off the stack. | |||
2020-07-11 | UserspaceEmulator: Simplify op_foo templates | Andreas Kling | |
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 | UserspaceEmulator: The generic_RM*_imm8 functions need to sign extend | Andreas Kling | |
We are supposed to sign-extend the 8-bit immediate here, "cmp eax, 0xff" is actually "cmp eax, 0xffffffff" | |||
2020-07-11 | UserspaceEmulator: Implement MOV_EAX_moff32 | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement CALL_RM32 | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement the SHR family of instructions | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement SHR_RM32_imm8 | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement the OR family of instructions | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement PUSH_imm8 | Andreas Kling | |
Curiously, the 8-bit immediate is sign-extended. | |||
2020-07-11 | UserspaceEmulator: Fix broken MOV_RM32_imm32 | Andreas Kling | |
Oops, this was incorrectly moving into a GPR rather than the R/M. | |||
2020-07-11 | UserspaceEmulator: Implement the 32-bit LEAVE instruction | Andreas Kling | |
The 16-bit variant is a bit weird. Let's wait until someone needs it. | |||
2020-07-11 | UserspaceEmulator: Implement JMP_imm16 and JMP_imm32 | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement the MOVZX instruction | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement STOSB/STOSW/STOSD | Andreas Kling | |
...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 | UserspaceEmulator: Implement some of the IMUL instruction family | Andreas Kling | |
The single-operand forms of IMUL are a little weird. We can deal with them when they actually show up. | |||
2020-07-11 | UserspaceEmulator+LibX86: Implement the LEA instruction | Andreas Kling | |
This piggybacks nicely on Instruction's ModR/M resolution code. :^) | |||
2020-07-11 | UserspaceEmulator: Improve the initial program stack a tiny bit | Andreas Kling | |
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 | UserspaceEmulator: Both ADD and SUB modify the carry flag | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement the AND and TEST instructions | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement the RET instruction | Andreas Kling | |
We can now return from a CALL! :^) | |||
2020-07-11 | UserspaceEmulator: Symbolicate disassembly output :^) | Andreas Kling | |
Since we have the ELF executable handy, we can actually symbolicate the disassembly trace output really easily. Very cool! :^) | |||
2020-07-11 | UserspaceEmulator: Don't exit the emulation loop on "RET" :^) | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement PUSH_imm32 and PUSH_RM32 | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement short-range jump instructions | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Implement the CALL_imm32 instruction | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Fix broken inline assembly for asymmetric op_foos | Andreas Kling | |
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 | UserspaceEmulator: Print out the current EIP as we execute instructions | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Load the target executable ELF semi-properly :^) | Andreas Kling | |
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 | UserspaceEmulator: Set up a very basic program entry stack | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Convert the XOR instruction to inline assembly | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Convert the SUB instruction to inline assembly | Andreas Kling | |
2020-07-11 | UserspaceEmulator: Tweak INC and SAR helpers to not be SoftCPU members | Andreas Kling | |
It's quite nice having these as compartmentalized free functions. | |||
2020-07-11 | UserspaceEmulator: Add the INC and ADD instructions | Andreas Kling | |
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 | UserspaceEmulator: Give SoftCPU an API for evaluating jump conditions | Andreas Kling | |
There are 16 conditions and they're all based on a combination of the CPU flags. | |||
2020-07-11 | UserspaceEmulator: Split SAR inline assembly into 8/16/32 bit variants | Andreas Kling | |