summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-11 21:36:25 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-11 23:57:14 +0200
commit97f4cebc8d80c55452d4d4ca60469a26fa8b8142 (patch)
treeed6d8c7463d5ae74fc6d828c32ffe369870c5365 /Libraries
parent92576573405f28375b47bc47cd6d5d2c7c23a412 (diff)
downloadserenity-97f4cebc8d80c55452d4d4ca60469a26fa8b8142.zip
UserspaceEmulator+LibX86: Implement the LEA instruction
This piggybacks nicely on Instruction's ModR/M resolution code. :^)
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibX86/Instruction.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Libraries/LibX86/Instruction.h b/Libraries/LibX86/Instruction.h
index 17208a829b..7a7a47eff5 100644
--- a/Libraries/LibX86/Instruction.h
+++ b/Libraries/LibX86/Instruction.h
@@ -218,6 +218,14 @@ public:
template<typename CPU>
u32 read32(CPU&, const Instruction&);
+ template<typename CPU>
+ LogicalAddress resolve(const CPU& cpu, Optional<SegmentRegister> segment_prefix)
+ {
+ if (m_a32)
+ return resolve32(cpu, segment_prefix);
+ return resolve16(cpu, segment_prefix);
+ }
+
private:
MemoryOrRegisterReference() { }
@@ -235,14 +243,6 @@ private:
LogicalAddress resolve32(const CPU&, Optional<SegmentRegister>);
template<typename CPU>
- LogicalAddress resolve(const CPU& cpu, Optional<SegmentRegister> segment_prefix)
- {
- if (m_a32)
- return resolve32(cpu, segment_prefix);
- return resolve16(cpu, segment_prefix);
- }
-
- template<typename CPU>
u32 evaluate_sib(const CPU&, SegmentRegister& default_segment) const;
unsigned m_register_index { 0xffffffff };