Skip to content

Commit

Permalink
Change jal to call in zkVM entrypoint (risc0#1257)
Browse files Browse the repository at this point in the history
As described in risc0#1243, our use of
the `jal` instruction in our entrypoint breaks when the jump distance
becomes too far. This PR changes the instruction to the `call`
psuedo-instruction to allow the assembler flexibility to solve this
issue and implement a far jump.

Co-authored-by: @weikengchen
Resolves: risc0#1243

---------

Co-authored-by: Frank Laub <[email protected]>
Co-authored-by: Frank Laub <[email protected]>
  • Loading branch information
3 people authored Dec 20, 2023
1 parent 2a6026f commit b4b6ddf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions risc0/build/src/docker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,15 @@ mod test {
build("../../risc0/zkvm/methods/guest/Cargo.toml");
compare_image_id(
"risc0_zkvm_methods_guest/multi_test",
"f95f1a062cc386bcebe950e093c05b2064d0938d63c5522e7762618200204b29",
"1179a5fefa42c0ffd9c9defacb007f0e5c3b91b008726f1c334333e62998b1fd",
);
compare_image_id(
"risc0_zkvm_methods_guest/hello_commit",
"d79504add318b06cb7150c0434b7fafaffe8c93c001271bb3c3d956b7b6a476f",
"4fe8d43b0b9f78d17b011adeba1cb2242cd3ce758772fbe9e43429e4d91d4f10",
);
compare_image_id(
"risc0_zkvm_methods_guest/slice_io",
"0cdb7e93db5ce17d5646c7330fa3ffc86ef4433733a2965422a232e4ee330547",
"fcc440cb194deb4741cc6c919acad75cf95c8b548191b90ebd748fe644bd26fc",
);
}
}
2 changes: 1 addition & 1 deletion risc0/zkvm/platform/src/rust_rt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ mod entrypoint {
.option pop
la sp, {0}
lw sp, 0(sp)
jal ra, __start;
call __start;
"#,
sym STACK_TOP
);
Expand Down
2 changes: 1 addition & 1 deletion risc0/zkvm/src/guest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ _start:
.option pop;
la sp, {0}
lw sp, 0(sp)
jal ra, __start;
call __start;
"#,
sym STACK_TOP
);
Expand Down

0 comments on commit b4b6ddf

Please sign in to comment.