Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix - callx encoding #491

Merged
merged 1 commit into from
Jul 28, 2023
Merged

Fix - callx encoding #491

merged 1 commit into from
Jul 28, 2023

Conversation

Lichtso
Copy link

@Lichtso Lichtso commented Jul 28, 2023

Currently callx encodes its target register in the imm field, but it should use the src register field instead.

The instruction info in llvm would need to be patched here:
https://github.com/solana-labs/llvm-project/blob/7b8db05b564faffb522434b73b7082662171f94a/llvm/lib/Target/SBF/SBFInstrInfo.td#L526

@Lichtso Lichtso requested a review from alessandrod July 28, 2023 11:07
@codecov-commenter
Copy link

Codecov Report

Merging #491 (bbbe89c) into main (5debf64) will increase coverage by 0.01%.
Report is 1 commits behind head on main.
The diff coverage is 96.00%.

@@            Coverage Diff             @@
##             main     #491      +/-   ##
==========================================
+ Coverage   89.69%   89.70%   +0.01%     
==========================================
  Files          23       23              
  Lines       10109    10123      +14     
==========================================
+ Hits         9067     9081      +14     
  Misses       1042     1042              
Files Changed Coverage Δ
src/disassembler.rs 92.92% <0.00%> (ø)
src/assembler.rs 99.60% <100.00%> (+<0.01%) ⬆️
src/elf.rs 87.34% <100.00%> (+0.02%) ⬆️
src/interpreter.rs 98.23% <100.00%> (+0.01%) ⬆️
src/jit.rs 92.90% <100.00%> (+0.01%) ⬆️
src/verifier.rs 97.50% <100.00%> (+0.04%) ⬆️

... and 1 file with indirect coverage changes

src/elf.rs Outdated
@@ -230,6 +230,11 @@ impl SBPFVersion {
self != &SBPFVersion::V1
}

/// Use src reg instead of imm in callx
pub fn fix_callx_encoding(&self) -> bool {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: call it callx_uses_src_reg or something? "fix" is generic: what was broken?
how was it fixed?

@Lichtso Lichtso merged commit ecde3c0 into main Jul 28, 2023
12 checks passed
@Lichtso Lichtso deleted the fix/callx_encoding branch July 28, 2023 16:51
@Lichtso Lichtso mentioned this pull request Nov 28, 2023
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants