diff --git a/verification/gen/templates/cflow_iterate_inl_gen.h.erb b/verification/gen/templates/cflow_iterate_inl_gen.h.erb index 77e078d1df0357fd96facff028ec4f160fe35184..de18f57c14197f8be901930f338941085a20043b 100644 --- a/verification/gen/templates/cflow_iterate_inl_gen.h.erb +++ b/verification/gen/templates/cflow_iterate_inl_gen.h.erb @@ -221,16 +221,20 @@ CflowStatus IterateOverInstructions(const uint8_t* pc, const uint8_t* from, cons status = <%= key_status%> goto COMMON_BODY; % } - +% dt_max_opcode = 255 COMMON_BODY: { if (status) { return *status; } if (!handler.IsPrimaryOpcodeValid()) { LOG(DEBUG, VERIFIER) << "Opcode value is out of range. " << "Current value is: " << static_cast(handler.GetPrimaryOpcode()) - << ". Allowed value is in the interval: [0, <%= Panda::dispatch_table.invalid_non_prefixed_interval.min - 1 %>] U " - << "[<%= Panda::dispatch_table.invalid_non_prefixed_interval.max + 1 %>, <%= Panda::dispatch_table.invalid_prefixes_interval.min + 1 %>] U " - << "[<%= Panda::dispatch_table.invalid_prefixes_interval.max + 1 %>, 255]"; + << ". Allowed value is in the interval: [0, <%= Panda::dispatch_table.invalid_non_prefixed_interval.min - 1%>] U " +% if Panda::dispatch_table.invalid_prefixes_interval.max + 1 < dt_max_opcode + << "[<%= Panda::dispatch_table.invalid_non_prefixed_interval.max + 1 %>, <%= Panda::dispatch_table.invalid_prefixes_interval.min - 1%>] U" + << "[<%= Panda::dispatch_table.invalid_prefixes_interval.max + 1 %>, <%= dt_max_opcode.to_s %>]"; +% else + << "[<%= Panda::dispatch_table.invalid_non_prefixed_interval.max + 1 %>, <%= Panda::dispatch_table.invalid_prefixes_interval.min - 1%>]"; +% end return CflowStatus::ERROR; } goto* dispatch_table[handler.GetPrimaryOpcode()]; @@ -238,9 +242,13 @@ COMMON_BODY: HANDLE_INVALID: LOG(DEBUG, VERIFIER) << "Opcode value is out of range. " << "Current value is: " << static_cast(handler.GetPrimaryOpcode()) - << ". Allowed value is in the interval: [0, <%= Panda::dispatch_table.invalid_non_prefixed_interval.min - 1 %>] U " - << "[<%= Panda::dispatch_table.invalid_non_prefixed_interval.max + 1 %>, <%= Panda::dispatch_table.invalid_prefixes_interval.min + 1 %>] U " - << "[<%= Panda::dispatch_table.invalid_prefixes_interval.max + 1 %>, 255]"; + << ". Allowed value is in the interval: [0, <%= Panda::dispatch_table.invalid_non_prefixed_interval.min - 1%>] U " +% if Panda::dispatch_table.invalid_prefixes_interval.max + 1 < dt_max_opcode + << "[<%= Panda::dispatch_table.invalid_non_prefixed_interval.max + 1 %>, <%= Panda::dispatch_table.invalid_prefixes_interval.min - 1%>] U" + << "[<%= Panda::dispatch_table.invalid_prefixes_interval.max + 1 %>, <%= dt_max_opcode.to_s %>]"; +% else + << "[<%= Panda::dispatch_table.invalid_non_prefixed_interval.max + 1 %>, <%= Panda::dispatch_table.invalid_prefixes_interval.min - 1%>]"; +% end return CflowStatus::ERROR; % Panda::prefixes.each do |p| HANDLE_<%= p.handler_name %>: diff --git a/verification/gen/templates/job_fill_gen.h.erb b/verification/gen/templates/job_fill_gen.h.erb index 7a8f90425ed99275e4ff3580bafd8a113df53282..2edbc351ffc9d13206bf7ea738cf2e1470077283 100644 --- a/verification/gen/templates/job_fill_gen.h.erb +++ b/verification/gen/templates/job_fill_gen.h.erb @@ -55,11 +55,6 @@ bool Job::ResolveIdentifiers(LibCache &cache) { return false; } goto* dispatch_table[inst.GetPrimaryOpcode()]; - -% dt_non_prefixed_min_minus = (Panda::dispatch_table.invalid_non_prefixed_interval.min - 1).to_s -% dt_non_prefixed_max_plus = (Panda::dispatch_table.invalid_non_prefixed_interval.max + 1).to_s -% dt_prefixed_min_plus = (Panda::dispatch_table.invalid_prefixes_interval.min + 1).to_s -% dt_prefixed_max_plus = (Panda::dispatch_table.invalid_prefixes_interval.max + 1).to_s % % dispatch_table_hash = Hash.new() % Panda::instructions.each do |i| @@ -102,6 +97,18 @@ bool Job::ResolveIdentifiers(LibCache &cache) { % end % dispatch_table_hash[combination_flags].push(value_dispatch) % end +% dt_max_opcode = 255 +% depend_on_opcode_string = "" +% if Panda::dispatch_table.invalid_prefixes_interval.max + 1 < dt_max_opcode +% depend_on_opcode_string = %( +% << "[) + (Panda::dispatch_table.invalid_non_prefixed_interval.max + 1).to_s + %(, ) + (Panda::dispatch_table.invalid_prefixes_interval.min - 1).to_s + %(] U " +% << "[) + (Panda::dispatch_table.invalid_prefixes_interval.max + 1).to_s + %(, ) + dt_max_opcode.to_s + %(]"; +% ) +% else +% depend_on_opcode_string = %( +% << "[) + (Panda::dispatch_table.invalid_non_prefixed_interval.max + 1).to_s + %(, ) + (Panda::dispatch_table.invalid_prefixes_interval.min - 1).to_s + %(]"; +% ) +% end % body_gen_parts = Hash.new() % body_gen_parts = { % "Prop_" => %( @@ -221,15 +228,13 @@ bool Job::ResolveIdentifiers(LibCache &cache) { % "GetNext_" => %( % if (inst.IsLast()) { % return true; -% } -% +% } % auto next_inst = inst.GetNext(); % if (!inst.IsPrimaryOpcodeValid()) { % LOG(DEBUG, VERIFIER) << "Opcode value is out of range. " % << "Current value is: " << static_cast(inst.GetPrimaryOpcode()) -% << ". Allowed value is in the interval: [0, ) + dt_non_prefixed_min_minus + %(] U " -% << "[) + dt_non_prefixed_max_plus + %(, ) + dt_prefixed_min_plus + %(] U " -% << "[) + dt_prefixed_max_plus + %(, 255]"; +% << ". Allowed value is in the interval: [0, ) + (Panda::dispatch_table.invalid_non_prefixed_interval.min - 1).to_s + %(] U ") + +% depend_on_opcode_string + %( % return false; % } % if (!next_inst.IsValid()) {