diff --git a/InstructionSets/x86/Implementation/PerformImplementation.hpp b/InstructionSets/x86/Implementation/PerformImplementation.hpp index 1d671bf1c..6f7405845 100644 --- a/InstructionSets/x86/Implementation/PerformImplementation.hpp +++ b/InstructionSets/x86/Implementation/PerformImplementation.hpp @@ -746,7 +746,7 @@ requires is_context void perform( const Instruction &instruction, ContextT &context, - uint32_t source_ip + const ip_size_t source_ip ) { if constexpr (uses_8086_exceptions(ContextT::model)) { InstructionSet::x86::perform( @@ -843,7 +843,7 @@ requires is_context void fault( const Exception exception, ContextT &context, - const uint32_t source_ip + const ip_size_t source_ip ) { if constexpr (uses_8086_exceptions(ContextT::model)) { InstructionSet::x86::interrupt( diff --git a/InstructionSets/x86/Perform.hpp b/InstructionSets/x86/Perform.hpp index 18d24ec01..aaedb7933 100644 --- a/InstructionSets/x86/Perform.hpp +++ b/InstructionSets/x86/Perform.hpp @@ -250,6 +250,10 @@ concept is_context = is_context_real && (!has_protected_mode || is_context_protected); +/// Gives the instruction pointer size for a given context. +template +using ip_size_t = std::conditional_t, uint32_t, uint16_t>; + /// Performs @c instruction querying @c registers and/or @c memory as required, using @c io for port input/output, /// and providing any flow control effects to @c flow_controller. /// @@ -259,7 +263,7 @@ template < typename ContextT > requires is_context -void perform(const Instruction &, ContextT &, uint32_t source_ip); +void perform(const Instruction &, ContextT &, ip_size_t source_ip); /// Performs an Exception, which includes those generated by external sources. /// @c source_ip is unused if the exception is an instance of `Exception::interrupt` but is required for other internal faults. @@ -267,7 +271,7 @@ template < typename ContextT > requires is_context -void fault(Exception, ContextT &, const uint32_t source_ip = 0); +void fault(Exception, ContextT &, const ip_size_t source_ip = 0); }