1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-11-01 11:16:16 +00:00

Resolve IP size imbalance.

This commit is contained in:
Thomas Harte
2025-10-29 09:16:30 -04:00
parent 48f983c040
commit 02a29056b7
2 changed files with 8 additions and 4 deletions

View File

@@ -746,7 +746,7 @@ requires is_context<ContextT>
void perform(
const Instruction<type> &instruction,
ContextT &context,
uint32_t source_ip
const ip_size_t<ContextT> source_ip
) {
if constexpr (uses_8086_exceptions(ContextT::model)) {
InstructionSet::x86::perform(
@@ -843,7 +843,7 @@ requires is_context<ContextT>
void fault(
const Exception exception,
ContextT &context,
const uint32_t source_ip
const ip_size_t<ContextT> source_ip
) {
if constexpr (uses_8086_exceptions(ContextT::model)) {
InstructionSet::x86::interrupt(

View File

@@ -250,6 +250,10 @@ concept is_context =
is_context_real<ContextT> &&
(!has_protected_mode<ContextT::model> || is_context_protected<ContextT>);
/// Gives the instruction pointer size for a given context.
template <typename ContextT>
using ip_size_t = std::conditional_t<has_32bit_instructions<ContextT::model>, 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<ContextT>
void perform(const Instruction<type> &, ContextT &, uint32_t source_ip);
void perform(const Instruction<type> &, ContextT &, ip_size_t<ContextT> 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<ContextT>
void fault(Exception, ContextT &, const uint32_t source_ip = 0);
void fault(Exception, ContextT &, const ip_size_t<ContextT> source_ip = 0);
}